changed @SpecialMob contract

This commit is contained in:
FatherToast 2022-06-27 10:38:10 -05:00
parent b90fcf9506
commit f3003ea09d
89 changed files with 401 additions and 249 deletions

View file

@ -40,22 +40,18 @@ public class ClientRegister {
registerFamilyRenderers( MobFamily.ENDERMAN, SpecialEndermanRenderer::new );
//registerFamilyRenderers( MobFamily.WITCH, SpecialWitchRenderer::new );
// Custom renderers
registerRenderer( NinjaSkeletonEntity.class, NinjaSkeletonRenderer::new );
registerRenderer( NinjaWitherSkeletonEntity.class, NinjaSkeletonRenderer::new );
// Species overrides
registerSpeciesRenderer( NinjaSkeletonEntity.SPECIES, NinjaSkeletonRenderer::new );
registerSpeciesRenderer( NinjaWitherSkeletonEntity.SPECIES, NinjaSkeletonRenderer::new );
}
private static <T extends LivingEntity> void registerFamilyRenderers( MobFamily<T> family, IRenderFactory<? super T> renderFactory ) {
RenderingRegistry.registerEntityRenderingHandler( family.vanillaReplacement.entityType.get(), renderFactory );
for( MobFamily.Species<? extends T> species : family.variants )
RenderingRegistry.registerEntityRenderingHandler( species.entityType.get(), renderFactory );
registerSpeciesRenderer( species, renderFactory );
}
private static <T extends LivingEntity> void registerRenderer( Class<T> entityClass, IRenderFactory<? super T> renderFactory ) {
MobFamily.Species<T> species = MobFamily.findSpecies( entityClass );
if( species == null )
throw new IllegalArgumentException( "Could not register renderer for entity class '" + entityClass.getSimpleName() + "', as no belonging mob species was found." );
private static <T extends LivingEntity> void registerSpeciesRenderer( MobFamily.Species<T> species, IRenderFactory<? super T> renderFactory ) {
RenderingRegistry.registerEntityRenderingHandler( species.entityType.get(), renderFactory );
}
}

View file

@ -2,12 +2,10 @@ package fathertoast.specialmobs.common.bestiary;
import fathertoast.specialmobs.common.core.register.SMEntities;
import fathertoast.specialmobs.common.core.register.SMItems;
import fathertoast.specialmobs.common.entity.ISpecialMob;
import fathertoast.specialmobs.common.util.AnnotationHelper;
import fathertoast.specialmobs.common.util.References;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.monster.*;
@ -132,16 +130,6 @@ public class MobFamily<T extends LivingEntity> {
/** @return A list of all species. */
public static List<Species<?>> getAllSpecies() { return SPECIES_LIST; }
@SuppressWarnings( "unchecked" )
@Nullable
public static <T extends LivingEntity> Species<T> findSpecies( Class<T> entityClass ) {
for( Species<?> species : getAllSpecies() ) {
if( species.entityClass == entityClass )
return (Species<T>) species;
}
return null;
}
/** @return The family of mobs that can replace the passed entity; returns null if the entity is not replaceable. */
@Nullable
public static MobFamily<?> getReplacementFamily( LivingEntity entity ) {
@ -250,9 +238,6 @@ public class MobFamily<T extends LivingEntity> {
/** This species's spawn egg item, wrapped in its registry object. */
public final RegistryObject<ForgeSpawnEggItem> spawnEgg;
/** Whether this species has a custom renderer. */
public final boolean hasCustomRenderer;
/** Constructs a new mob species. For vanilla replacements, the variant name is null. */
private Species( MobFamily<? super T> parentFamily, String packageRoot, @Nullable String variantName ) {
final boolean vanillaReplacement = variantName == null;
@ -272,8 +257,9 @@ public class MobFamily<T extends LivingEntity> {
// Initialize deferred registry objects
entityType = SMEntities.register( name.toLowerCase( Locale.ROOT ), entityTypeBuilder );
spawnEgg = SMItems.registerSpawnEgg( entityType, parentFamily.eggBaseColor, bestiaryInfo.eggSpotsColor );
hasCustomRenderer = AnnotationHelper.hasCustomRenderer( entityClass );
AnnotationHelper.injectEntityTypeHolder( this );
// Register this species with the entity class
AnnotationHelper.injectSpeciesReference( this );
}
/** Finds the entity class based on a standard format. */

View file

@ -16,15 +16,15 @@ import java.lang.annotation.Target;
public @interface SpecialMob {
/**
* OPTIONAL. This is injected with the species's entity type during registration so you may access it later, as needed.
* REQUIRED. This is injected with a reference to the species during registration so you may access it later, as needed.
* <p>
* The annotated field must have a signature that follows the pattern:
* <p>
* public static RegistryObject<EntityType<T>> FIELD_NAME;
* public static MobFamily.Species<T> FIELD_NAME;
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.FIELD )
@interface TypeHolder { }
@interface SpeciesReference { }
/**
* REQUIRED. This is grabbed during registration to be used as a mob 'factory'; the needed constructor will probably
@ -36,13 +36,12 @@ public @interface SpecialMob {
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.CONSTRUCTOR )
@interface Constructor {
boolean hasCustomRenderer() default false;
}
@interface Constructor { }
/**
* REQUIRED. This is called during registration to collect static properties of the mob needed for the bestiary
* and for building the species's entity type.
* This is not 'overridable' because all species must have unique info in the bestiary.
* <p>
* The annotated method must have a signature that follows the pattern:
* <p>
@ -57,7 +56,9 @@ public @interface SpecialMob {
@interface BestiaryInfoSupplier { }
/**
* REQUIRED. This is called during registration to build the base attributes for the species.
* OVERRIDABLE. This is called during registration to build the base attributes for the species.
* 'Overridable' static methods inherit from their superclass if not defined in a subclass, but must be defined somewhere.
* This is 'overridable' because not all species need to have different attributes from their parent vanilla mob.
* <p>
* The annotated method must have a signature that follows the pattern:
* <p>
@ -72,6 +73,7 @@ public @interface SpecialMob {
/**
* REQUIRED. This is called during data generation to build the mod's default lang files.
* This is not 'overridable' because all species must have unique names.
* <p>
* The annotated method must have a signature that follows the pattern:
* <p>
@ -89,6 +91,7 @@ public @interface SpecialMob {
/**
* REQUIRED. This is called during data generation to build the mob's default loot table. Special variants will
* typically start this method by calling their vanilla replacement's implementation of this method.
* This is not 'overridable' because all species must have unique default loot tables.
* <p>
* The annotated method must have a signature that follows the pattern:
* <p>

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.cavespider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -12,7 +13,6 @@ import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.item.Items;
import net.minecraft.world.World;
import net.minecraftforge.fml.RegistryObject;
import javax.annotation.ParametersAreNonnullByDefault;
@ -23,8 +23,8 @@ public class BabyCaveSpiderEntity extends _SpecialCaveSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.TypeHolder
public static RegistryObject<EntityType<BabyCaveSpiderEntity>> ENTITY_TYPE;
@SpecialMob.SpeciesReference
public static MobFamily.Species<BabyCaveSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.cavespider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.SpecialLeapAtTargetGoal;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -24,6 +25,9 @@ public class FlyingCaveSpiderEntity extends _SpecialCaveSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FlyingCaveSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x6388B2 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.cavespider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -12,13 +13,11 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.monster.SlimeEntity;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IServerWorld;
import net.minecraft.world.World;
@ -32,6 +31,9 @@ public class MotherCaveSpiderEntity extends _SpecialCaveSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<MotherCaveSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.9F, 0.6F );
@ -118,7 +120,7 @@ public class MotherCaveSpiderEntity extends _SpecialCaveSpiderEntity {
/** Helper method to simplify spawning babies. */
@Nullable
private ILivingEntityData spawnBaby( float speed, @Nullable ILivingEntityData groupData ) {
final BabyCaveSpiderEntity baby = BabyCaveSpiderEntity.ENTITY_TYPE.get().create( level );
final BabyCaveSpiderEntity baby = BabyCaveSpiderEntity.SPECIES.entityType.get().create( level );
if( baby == null ) return groupData;
baby.copyPosition( this );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.cavespider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -28,6 +29,9 @@ public class WebCaveSpiderEntity extends _SpecialCaveSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<WebCaveSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xE7E7E7, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.cavespider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -26,6 +27,9 @@ public class WitchCaveSpiderEntity extends _SpecialCaveSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<WitchCaveSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xDD0E0E, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.cavespider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -36,6 +37,9 @@ public class _SpecialCaveSpiderEntity extends CaveSpiderEntity implements ISpeci
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialCaveSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xA80E0E );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -10,7 +11,6 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
@ -32,16 +32,14 @@ public class DarkCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<DarkCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xF9FF3A );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialCreeperEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Dark Creeper",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -24,6 +25,9 @@ public class DeathCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<DeathCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.9F, 2.6F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.ExplosionHelper;
@ -28,6 +29,9 @@ public class DirtCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<DirtCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x78553B );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.AreaEffectCloudEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.ResourceLocation;
@ -25,17 +25,15 @@ public class DoomCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<DoomCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x494949 );
//TODO theme - forest
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialCreeperEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Doom Creeper",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.ExplosionHelper;
@ -19,13 +20,11 @@ import net.minecraft.entity.passive.fish.PufferfishEntity;
import net.minecraft.item.Items;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IServerWorld;
import net.minecraft.world.World;
import net.minecraft.world.spawner.WorldEntitySpawner;
import javax.annotation.ParametersAreNonnullByDefault;
@ -36,6 +35,9 @@ public class DrowningCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<DrowningCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x2D41F4, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ai.AIHelper;
@ -44,6 +45,9 @@ public class EnderCreeperEntity extends _SpecialCreeperEntity implements IAngera
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<EnderCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xCC00FA, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -8,7 +9,6 @@ import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@ -22,6 +22,9 @@ public class FireCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FireCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
@ -29,11 +32,6 @@ public class FireCreeperEntity extends _SpecialCreeperEntity {
//TODO theme - fire
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialCreeperEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Fire Creeper",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.item.FallingBlockEntity;
import net.minecraft.item.Items;
import net.minecraft.util.DamageSource;
@ -27,16 +27,14 @@ public class GravelCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GravelCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x908884 );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialCreeperEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Gravel Creeper",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.AIHelper;
import fathertoast.specialmobs.common.entity.ai.SpecialLeapAtTargetGoal;
@ -25,6 +26,9 @@ public class JumpingCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<JumpingCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x7D6097 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -8,7 +9,6 @@ import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@ -23,17 +23,15 @@ public class LightningCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<LightningCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
return new BestiaryInfo( 0x499CAE );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialCreeperEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Lightning Creeper",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -11,7 +12,6 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.world.World;
import net.minecraftforge.fml.RegistryObject;
import javax.annotation.ParametersAreNonnullByDefault;
@ -22,8 +22,8 @@ public class MiniCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.TypeHolder
public static RegistryObject<EntityType<MiniCreeperEntity>> ENTITY_TYPE;
@SpecialMob.SpeciesReference
public static MobFamily.Species<MiniCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.ExplosionHelper;
@ -30,6 +31,9 @@ public class SplittingCreeperEntity extends _SpecialCreeperEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<SplittingCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.7F, 1.99F );
@ -89,7 +93,7 @@ public class SplittingCreeperEntity extends _SpecialCreeperEntity {
/** Helper method to simplify spawning babies. */
@Nullable
private ILivingEntityData spawnBaby( float speed, @Nullable ILivingEntityData groupData ) {
final MiniCreeperEntity baby = MiniCreeperEntity.ENTITY_TYPE.get().create( level );
final MiniCreeperEntity baby = MiniCreeperEntity.SPECIES.entityType.get().create( level );
if( baby == null ) return groupData;
baby.copyPosition( this );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.creeper;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -42,6 +43,9 @@ public class _SpecialCreeperEntity extends CreeperEntity implements ISpecialMob<
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialCreeperEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x000000 );

View file

@ -1,13 +1,13 @@
package fathertoast.specialmobs.common.entity.enderman;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.References;
import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
@ -23,17 +23,15 @@ public class BlindingEndermanEntity extends _SpecialEndermanEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BlindingEndermanEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xFFFFFF );
//TODO theme - forest
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialEndermanEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Blinding Enderman",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.enderman;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.entity.ai.AIHelper;
@ -14,7 +15,6 @@ import net.minecraft.enchantment.FrostWalkerEnchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
@ -41,17 +41,15 @@ public class IcyEndermanEntity extends _SpecialEndermanEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<IcyEndermanEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x72959C );
//TODO theme - ice
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialEndermanEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Icy Enderman",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.enderman;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.effect.LightningBoltEntity;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
@ -25,17 +25,15 @@ public class LightningEndermanEntity extends _SpecialEndermanEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<LightningEndermanEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
return new BestiaryInfo( 0x4BB4B5 );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialEndermanEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Lightning Enderman",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.enderman;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -21,6 +22,9 @@ public class MiniEndermanEntity extends _SpecialEndermanEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<MiniEndermanEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.5F, 0.99F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.enderman;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -16,7 +17,6 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.RegistryObject;
import javax.annotation.ParametersAreNonnullByDefault;
@ -27,8 +27,8 @@ public class MirageEndermanEntity extends _SpecialEndermanEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.TypeHolder
public static RegistryObject<EntityType<MirageEndermanEntity>> ENTITY_TYPE;
@SpecialMob.SpeciesReference
public static MobFamily.Species<MirageEndermanEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
@ -122,7 +122,7 @@ public class MirageEndermanEntity extends _SpecialEndermanEntity {
private void mirage( double xI, double yI, double zI ) {
if( !isFake && getTarget() != null ) {
final MirageEndermanEntity mirage = ENTITY_TYPE.get().create( level );
final MirageEndermanEntity mirage = SPECIES.entityType.get().create( level );
if( mirage == null ) return;
mirage.setFake();

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.enderman;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -28,6 +29,9 @@ public class ThiefEndermanEntity extends _SpecialEndermanEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<ThiefEndermanEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x04FA00, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.enderman;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -34,6 +35,9 @@ public class _SpecialEndermanEntity extends EndermanEntity implements ISpecialMo
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialEndermanEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x000000 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.magmacube;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.entity.ai.AIHelper;
@ -11,7 +12,6 @@ import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Items;
@ -31,6 +31,9 @@ public class BouncingMagmaCubeEntity extends _SpecialMagmaCubeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BouncingMagmaCubeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
@ -38,11 +41,6 @@ public class BouncingMagmaCubeEntity extends _SpecialMagmaCubeEntity {
//TODO theme - mountain
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialMagmaCubeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Bouncing Magma Cube",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.magmacube;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.SpecialLeapAtTargetGoal;
import fathertoast.specialmobs.common.util.References;
@ -10,7 +11,6 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Vector3d;
@ -25,17 +25,15 @@ public class HardenedMagmaCubeEntity extends _SpecialMagmaCubeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<HardenedMagmaCubeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 3.06F, 3.06F );
return new BestiaryInfo( 0xDF7679, BestiaryInfo.BaseWeight.LOW );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialMagmaCubeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Hardened Magma Cube",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.magmacube;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.References;
import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
@ -8,7 +9,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.item.Items;
import net.minecraft.util.DamageSource;
@ -25,16 +25,14 @@ public class StickyMagmaCubeEntity extends _SpecialMagmaCubeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<StickyMagmaCubeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x9D733F );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialMagmaCubeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Sticky Magma Cube",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.magmacube;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.AreaEffectCloudEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.player.PlayerEntity;
@ -37,16 +37,14 @@ public class VolatileMagmaCubeEntity extends _SpecialMagmaCubeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<VolatileMagmaCubeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x331133 );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialMagmaCubeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Volatile Magma Cube",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.magmacube;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -36,6 +37,9 @@ public class _SpecialMagmaCubeEntity extends MagmaCubeEntity implements ISpecial
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialMagmaCubeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xFCFC00 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.silverfish;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
@ -25,17 +25,15 @@ public class BlindingSilverfishEntity extends _SpecialSilverfishEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BlindingSilverfishEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x000000 );
//TODO theme - forest
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSilverfishEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Blinding Silverfish",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.silverfish;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.IAngler;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -26,6 +27,9 @@ public class FishingSilverfishEntity extends _SpecialSilverfishEntity implements
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FishingSilverfishEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.5F, 0.4F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.silverfish;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.SpecialLeapAtTargetGoal;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -24,6 +25,9 @@ public class FlyingSilverfishEntity extends _SpecialSilverfishEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FlyingSilverfishEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x6388B2 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.silverfish;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
@ -25,17 +25,15 @@ public class PoisonSilverfishEntity extends _SpecialSilverfishEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<PoisonSilverfishEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x779C68 );
//TODO theme - forest
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSilverfishEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Venomous Silverfish",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.silverfish;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -23,6 +24,9 @@ public class ToughSilverfishEntity extends _SpecialSilverfishEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<ToughSilverfishEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.6F, 0.45F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.silverfish;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -38,6 +39,9 @@ public class _SpecialSilverfishEntity extends SilverfishEntity implements ISpeci
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialSilverfishEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x303030 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -30,6 +31,9 @@ public class BruteSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BruteSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.7F, 2.4F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.References;
import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
@ -8,7 +9,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
@ -24,6 +24,9 @@ public class FireSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FireSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
@ -31,11 +34,6 @@ public class FireSkeletonEntity extends _SpecialSkeletonEntity {
//TODO theme - fire
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSkeletonEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Fire Skeleton",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -23,6 +24,9 @@ public class GatlingSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GatlingSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xFFFF0B );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -22,6 +23,9 @@ public class GiantSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GiantSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.9F, 2.99F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -25,6 +26,9 @@ public class KnightSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<KnightSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xDDDDDD );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.INinja;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -36,6 +37,9 @@ public class NinjaSkeletonEntity extends _SpecialSkeletonEntity implements INinj
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<NinjaSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x333366 );
@ -61,7 +65,7 @@ public class NinjaSkeletonEntity extends _SpecialSkeletonEntity implements INinj
Blocks.INFESTED_CRACKED_STONE_BRICKS, Blocks.INFESTED_MOSSY_STONE_BRICKS, Blocks.INFESTED_CHISELED_STONE_BRICKS );
}
@SpecialMob.Constructor(hasCustomRenderer = true)
@SpecialMob.Constructor
public NinjaSkeletonEntity( EntityType<? extends _SpecialSkeletonEntity> entityType, World world ) {
super( entityType, world );
xpReward += 2;
@ -120,8 +124,8 @@ public class NinjaSkeletonEntity extends _SpecialSkeletonEntity implements INinj
if( !level.isClientSide() ) {
if( canHide ) {
//EntityAINinja.startHiding( this ); TODO
this.setHiding(true);
this.setDisguiseBlock(Blocks.DIRT.defaultBlockState());
this.setHiding( true );
this.setDisguiseBlock( Blocks.DIRT.defaultBlockState() );
}
else if( onGround && getDisguiseBlock() == null &&
(getTarget() == null || getTarget() instanceof PlayerEntity && ((PlayerEntity) getTarget()).isCreative()) ) {
@ -141,7 +145,7 @@ public class NinjaSkeletonEntity extends _SpecialSkeletonEntity implements INinj
// super.move( type, x, y, z );
// }
// }
/** Returns true if this entity should push and be pushed by other entities when colliding. */
@Override
public boolean isPushable() {

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.ArrowEntity;
import net.minecraft.item.ItemStack;
@ -30,17 +30,15 @@ public class PoisonSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<PoisonSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x779C68 );
//TODO theme - forest
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSkeletonEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Poison Skeleton",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -23,6 +24,9 @@ public class SniperSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<SniperSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x486720 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -24,6 +25,9 @@ public class SpitfireSkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<SpitfireSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.9F, 2.99F ).fireImmune();

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.References;
@ -31,6 +32,9 @@ public class StraySkeletonEntity extends _SpecialSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<StraySkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xDDEAEA, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.skeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -55,6 +56,9 @@ public class _SpecialSkeletonEntity extends AbstractSkeletonEntity implements IS
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x494949 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.AreaEffectCloudEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.player.PlayerEntity;
@ -37,16 +37,14 @@ public class BlackberrySlimeEntity extends _SpecialSlimeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BlackberrySlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x331133 );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSlimeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Blackberry Slime",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.entity.ai.AIHelper;
@ -10,7 +11,6 @@ import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Items;
@ -32,17 +32,15 @@ public class BlueberrySlimeEntity extends _SpecialSlimeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BlueberrySlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x766BBC );
//TODO theme - water
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSlimeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Blueberry Slime",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.References;
import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
@ -8,7 +9,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.item.Items;
import net.minecraft.particles.IParticleData;
@ -28,16 +28,14 @@ public class CaramelSlimeEntity extends _SpecialSlimeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<CaramelSlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x9D733F );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSlimeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Caramel Slime",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.SpecialLeapAtTargetGoal;
import fathertoast.specialmobs.common.util.References;
@ -8,7 +9,6 @@ import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.item.Items;
import net.minecraft.particles.IParticleData;
@ -26,17 +26,15 @@ public class GrapeSlimeEntity extends _SpecialSlimeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GrapeSlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xB333B3 );
//TODO theme - mountain
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSlimeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Grape Slime",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.ExplosionHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.effect.LightningBoltEntity;
import net.minecraft.item.Items;
@ -30,17 +30,15 @@ public class LemonSlimeEntity extends _SpecialSlimeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<LemonSlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
return new BestiaryInfo( 0xE6E861 );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSlimeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Lemon Slime",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.entity.ai.AIHelper;
@ -11,7 +12,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
@ -32,6 +32,9 @@ public class StrawberrySlimeEntity extends _SpecialSlimeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<StrawberrySlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
@ -39,11 +42,6 @@ public class StrawberrySlimeEntity extends _SpecialSlimeEntity {
//TODO theme - fire
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSlimeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Strawberry Slime",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.SpecialLeapAtTargetGoal;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.item.Items;
import net.minecraft.particles.IParticleData;
@ -28,17 +28,15 @@ public class WatermelonSlimeEntity extends _SpecialSlimeEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<WatermelonSlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 3.06F, 3.06F );
return new BestiaryInfo( 0xDF7679, BestiaryInfo.BaseWeight.LOW );
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSlimeEntity.createAttributes(); // Slimes define their attributes elsewhere based on size
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Watermelon Slime",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.slime;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -37,6 +38,9 @@ public class _SpecialSlimeEntity extends SlimeEntity implements ISpecialMob<_Spe
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialSlimeEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x51A03E );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -12,7 +13,6 @@ import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.item.Items;
import net.minecraft.world.World;
import net.minecraftforge.fml.RegistryObject;
import javax.annotation.ParametersAreNonnullByDefault;
@ -23,8 +23,8 @@ public class BabySpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.TypeHolder
public static RegistryObject<EntityType<BabySpiderEntity>> ENTITY_TYPE;
@SpecialMob.SpeciesReference
public static MobFamily.Species<BabySpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -27,6 +28,9 @@ public class DesertSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<DesertSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.95F, 0.7F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.SpecialLeapAtTargetGoal;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -24,6 +25,9 @@ public class FlyingSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FlyingSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x6388B2 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -22,6 +23,9 @@ public class GiantSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GiantSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 1.9F, 1.3F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -34,6 +35,9 @@ public class HungrySpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<HungrySpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 1.9F, 1.3F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -30,6 +31,9 @@ public class MotherSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<MotherSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 1.7F, 1.0F );
@ -116,7 +120,7 @@ public class MotherSpiderEntity extends _SpecialSpiderEntity {
/** Helper method to simplify spawning babies. */
@Nullable
private ILivingEntityData spawnBaby( float speed, @Nullable ILivingEntityData groupData ) {
final BabySpiderEntity baby = BabySpiderEntity.ENTITY_TYPE.get().create( level );
final BabySpiderEntity baby = BabySpiderEntity.SPECIES.entityType.get().create( level );
if( baby == null ) return groupData;
baby.copyPosition( this );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -27,6 +28,9 @@ public class PaleSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<PaleSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xDED4C6 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.References;
@ -9,7 +10,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
@ -25,17 +25,15 @@ public class PoisonSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<PoisonSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x0C424E );
//TODO theme - forest
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialSpiderEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Venomous Spider",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -28,6 +29,9 @@ public class WebSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<WebSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xE7E7E7, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -26,6 +27,9 @@ public class WitchSpiderEntity extends _SpecialSpiderEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<WitchSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xDD0E0E, BestiaryInfo.BaseWeight.LOW );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.spider;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -36,6 +37,9 @@ public class _SpecialSpiderEntity extends SpiderEntity implements ISpecialMob<_S
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialSpiderEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xA80E0E );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witch;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -33,6 +34,9 @@ public class _SpecialWitchEntity extends WitchEntity implements ISpecialMob<_Spe
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialWitchEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xA80E0E );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -30,6 +31,9 @@ public class BruteWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BruteWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.85F, 2.9F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -23,6 +24,9 @@ public class GatlingWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GatlingWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xFFFF0B );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -22,6 +23,9 @@ public class GiantWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GiantWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.95F, 3.6F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -25,6 +26,9 @@ public class KnightWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<KnightWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xDDDDDD );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.INinja;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -36,6 +37,9 @@ public class NinjaWitherSkeletonEntity extends _SpecialWitherSkeletonEntity impl
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<NinjaWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x333366 );
@ -61,7 +65,7 @@ public class NinjaWitherSkeletonEntity extends _SpecialWitherSkeletonEntity impl
Blocks.INFESTED_CRACKED_STONE_BRICKS, Blocks.INFESTED_MOSSY_STONE_BRICKS, Blocks.INFESTED_CHISELED_STONE_BRICKS );
}
@SpecialMob.Constructor(hasCustomRenderer = true)
@SpecialMob.Constructor
public NinjaWitherSkeletonEntity( EntityType<? extends _SpecialWitherSkeletonEntity> entityType, World world ) {
super( entityType, world );
xpReward += 2;

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -23,6 +24,9 @@ public class SniperWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<SniperWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x486720 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -24,6 +25,9 @@ public class SpitfireWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<SpitfireWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.95F, 3.6F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.witherskeleton;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -52,6 +53,9 @@ public class _SpecialWitherSkeletonEntity extends WitherSkeletonEntity implement
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialWitherSkeletonEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x474D4D );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -30,6 +31,9 @@ public class BruteZombieEntity extends _SpecialZombieEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<BruteZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.7F, 2.35F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.References;
import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
@ -8,7 +9,6 @@ import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
@ -27,6 +27,9 @@ public class FireZombieEntity extends _SpecialZombieEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FireZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.fireImmune();
@ -34,11 +37,6 @@ public class FireZombieEntity extends _SpecialZombieEntity {
//TODO theme - fire
}
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialZombieEntity.createAttributes();
}
@SpecialMob.LanguageProvider
public static String[] getTranslations( String langKey ) {
return References.translations( langKey, "Fire Zombie",

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.ai.IAngler;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -34,6 +35,9 @@ public class FishingZombieEntity extends _SpecialZombieEntity implements IAngler
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<FishingZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x2D41F4 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.util.AttributeHelper;
import fathertoast.specialmobs.common.util.References;
@ -22,6 +23,9 @@ public class GiantZombieEntity extends _SpecialZombieEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<GiantZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
entityType.sized( 0.9F, 2.95F );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -31,6 +32,9 @@ public class HungryZombieEntity extends _SpecialZombieEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<HungryZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xAB1518 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.References;
@ -10,6 +11,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.monster.HuskEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.ArrowEntity;
import net.minecraft.item.ItemStack;
@ -30,6 +32,9 @@ public class HuskZombieEntity extends _SpecialZombieEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<HuskZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xE6CC94, BestiaryInfo.BaseWeight.LOW );
@ -38,7 +43,7 @@ public class HuskZombieEntity extends _SpecialZombieEntity {
@SpecialMob.AttributeCreator
public static AttributeModifierMap.MutableAttribute createAttributes() {
return _SpecialZombieEntity.createAttributes();
return HuskEntity.createAttributes();
}
@SpecialMob.LanguageProvider

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.register.SMItems;
import fathertoast.specialmobs.common.entity.MobHelper;
@ -32,6 +33,9 @@ public class MadScientistZombieEntity extends _SpecialZombieEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<MadScientistZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0xDED4C6 ); // TODO - Temp color

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.entity.MobHelper;
import fathertoast.specialmobs.common.util.AttributeHelper;
@ -17,8 +18,6 @@ import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.ArrowEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@ -31,6 +30,9 @@ public class PlagueZombieEntity extends _SpecialZombieEntity {
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<PlagueZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x8AA838 );

View file

@ -1,6 +1,7 @@
package fathertoast.specialmobs.common.entity.zombie;
import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
@ -49,9 +50,12 @@ public class _SpecialZombieEntity extends ZombieEntity implements IRangedAttackM
//--------------- Static Special Mob Hooks ----------------
@SpecialMob.SpeciesReference
public static MobFamily.Species<_SpecialZombieEntity> SPECIES;
@SpecialMob.BestiaryInfoSupplier
public static BestiaryInfo bestiaryInfo( EntityType.Builder<LivingEntity> entityType ) {
return new BestiaryInfo( 0x799C65 );//sized(0.6F, 1.95F)
return new BestiaryInfo( 0x799C65 );
}
@SpecialMob.AttributeCreator

View file

@ -4,11 +4,13 @@ import fathertoast.specialmobs.common.bestiary.BestiaryInfo;
import fathertoast.specialmobs.common.bestiary.MobFamily;
import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.datagen.loot.LootTableBuilder;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.item.Item;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import java.lang.annotation.Annotation;
import java.lang.reflect.*;
@ -16,19 +18,21 @@ import java.lang.reflect.*;
/**
* Provides helper methods to handle annotation processing through reflection.
*/
@SuppressWarnings( "SameParameterValue" )
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public final class AnnotationHelper {
//--------------- PRETTY HELPER METHODS ----------------
/** Creates an entity factory from a special mob species. Throws an exception if anything goes wrong. */
public static void injectEntityTypeHolder( MobFamily.Species<?> species ) {
public static void injectSpeciesReference( MobFamily.Species<?> species ) {
try {
final Field field = getFieldOptional( species.entityClass, SpecialMob.TypeHolder.class );
if( field != null ) field.set( null, species.entityType );
final Field field = getField( species.entityClass, SpecialMob.SpeciesReference.class );
field.set( null, species );
}
catch( IllegalAccessException ex ) {
throw new RuntimeException( "Entity class for " + species.name + " has invalid entity type holder", ex );
catch( IllegalAccessException | NoSuchFieldException ex ) {
throw new RuntimeException( "Entity class for " + species.name + " has invalid species reference holder", ex );
}
}
@ -63,7 +67,7 @@ public final class AnnotationHelper {
/** Creates an attribute modifier map from a special mob species. Throws an exception if anything goes wrong. */
public static AttributeModifierMap createAttributes( MobFamily.Species<?> species ) {
try {
return ((AttributeModifierMap.MutableAttribute) getMethod( species.entityClass, SpecialMob.AttributeCreator.class )
return ((AttributeModifierMap.MutableAttribute) getMethodOrSuper( species.entityClass, SpecialMob.AttributeCreator.class )
.invoke( null )).build();
}
catch( NoSuchMethodException | InvocationTargetException | IllegalAccessException ex ) {
@ -104,31 +108,18 @@ public final class AnnotationHelper {
throw new RuntimeException( "Entity class for " + species.name + " has invalid loot table builder method", ex );
}
}
/**
* Returns the boolean value for custom rendering from the target class' Constructor annotation.
* {@link SpecialMob.Constructor#hasCustomRenderer()}
*/
public static boolean hasCustomRenderer( Class<?> entityClass ) {
if (entityClass.isAnnotationPresent(SpecialMob.Constructor.class)) {
return entityClass.getDeclaredAnnotation(SpecialMob.Constructor.class).hasCustomRenderer();
}
else {
return false;
}
}
//--------------- RAW ANNOTATION METHODS ----------------
/**
* @return Pulls a static field with a specific annotation from a class.
* @throws NoSuchFieldException if the field does not exist.
* @throws NoSuchFieldException if the field does not exist in the class.
*/
private static Field getField( Class<?> type, Class<? extends Annotation> annotation ) throws NoSuchFieldException {
final Field field = getFieldOptional( type, annotation );
if( field == null ) {
throw new NoSuchFieldException( String.format( "Could not find static @%s annotated field in %s",
throw new NoSuchFieldException( String.format( "Could not find required static @%s annotated field in %s",
annotation.getSimpleName(), type.getName() ) );
}
return field;
@ -137,8 +128,9 @@ public final class AnnotationHelper {
/**
* @return Pulls a static field with a specific annotation from a class, or null if the field does not exist.
*/
@Nullable
private static Field getFieldOptional( Class<?> type, Class<? extends Annotation> annotation ) {
for( Field field : type.getFields() ) {
for( Field field : type.getDeclaredFields() ) {
if( Modifier.isStatic( field.getModifiers() ) && field.isAnnotationPresent( annotation ) )
return field;
}
@ -147,26 +139,32 @@ public final class AnnotationHelper {
/**
* @return Pulls a static method with a specific annotation from a class.
* @throws NoSuchMethodException if the method does not exist.
* @throws NoSuchMethodException if the method does not exist in the class.
*/
private static Method getMethod( Class<?> type, Class<? extends Annotation> annotation ) throws NoSuchMethodException {
final Method method = getMethodOptional( type, annotation );
if( method == null ) {
throw new NoSuchMethodException( String.format( "Could not find static @%s annotated method in %s",
annotation.getSimpleName(), type.getName() ) );
}
return method;
}
/**
* @return Pulls a static method with a specific annotation from a class, or null if the method does not exist.
*/
private static Method getMethodOptional( Class<?> type, Class<? extends Annotation> annotation ) {
for( Method method : type.getMethods() ) {
for( Method method : type.getDeclaredMethods() ) {
if( Modifier.isStatic( method.getModifiers() ) && method.isAnnotationPresent( annotation ) )
return method;
}
return null;
throw new NoSuchMethodException( String.format( "Could not find required static @%s annotated method in %s",
annotation.getSimpleName(), type.getName() ) );
}
/**
* @return Pulls a static method with a specific annotation from a class, or its super class(es) if none is defined in the class.
* @throws NoSuchMethodException if the method does not exist in the class or any of its parents.
*/
private static Method getMethodOrSuper( Class<? extends LivingEntity> type, Class<? extends Annotation> annotation ) throws NoSuchMethodException {
Class<?> currentType = type;
while( currentType != LivingEntity.class ) {
for( Method method : currentType.getDeclaredMethods() ) {
if( Modifier.isStatic( method.getModifiers() ) && method.isAnnotationPresent( annotation ) )
return method;
}
currentType = currentType.getSuperclass();
}
throw new NoSuchMethodException( String.format( "Could not find 'overridable' static @%s annotated method in %s or its parents",
annotation.getSimpleName(), type.getName() ) );
}
/**