diff --git a/src/main/java/fathertoast/specialmobs/common/bestiary/BestiaryInfo.java b/src/main/java/fathertoast/specialmobs/common/bestiary/BestiaryInfo.java index 08b575a..a036d44 100644 --- a/src/main/java/fathertoast/specialmobs/common/bestiary/BestiaryInfo.java +++ b/src/main/java/fathertoast/specialmobs/common/bestiary/BestiaryInfo.java @@ -227,8 +227,12 @@ public class BestiaryInfo { owningSpecies = species; entityTypeBuilder = typeBuilder; - // Special variants should copy many of the vanilla replacement's stats - if( species.specialVariantName != null ) { + if( species.specialVariantName == null ) { + // Fire immunity should be copied from the entity type + if( species.family.replaceableTypes[0].fireImmune() ) isImmuneToFire = true; + } + else { + // Special variants should copy many of the vanilla replacement's stats final BestiaryInfo parent = species.family.vanillaReplacement.bestiaryInfo; baseScale = parent.baseScale; diff --git a/src/main/java/fathertoast/specialmobs/common/bestiary/MobFamily.java b/src/main/java/fathertoast/specialmobs/common/bestiary/MobFamily.java index f34ac3a..1fb398a 100644 --- a/src/main/java/fathertoast/specialmobs/common/bestiary/MobFamily.java +++ b/src/main/java/fathertoast/specialmobs/common/bestiary/MobFamily.java @@ -45,7 +45,7 @@ public class MobFamily { public static final MobFamily ZOMBIE = new MobFamily<>( FamilyConfig::newLessSpecial, "Zombie", "zombies", 0x00AFAF, new EntityType[] { EntityType.ZOMBIE, EntityType.HUSK }, - "Brute", "Fire", /*"Fishing",*/ "Giant", "Hungry", "Husk", "MadScientist", "Plague" + "Brute", "Fire", "Fishing", "Giant", "Hungry", "Husk", "MadScientist", "Plague" );//TODO fishing // TODO Drowned family and zombie transform mechanic // public static final MobFamily DROWNED = new MobFamily<>( FamilyConfig::new, @@ -54,7 +54,7 @@ public class MobFamily { // ); public static final MobFamily ZOMBIFIED_PIGLIN = new MobFamily<>( FamilyConfig::new, "ZombifiedPiglin", "zombified piglins", 0xEA9393, new EntityType[] { EntityType.ZOMBIFIED_PIGLIN }, - "Brute", /*"Fishing",*/ "Giant", "Hungry", "Knight", "Plague", "Vampire"//TODO figure out crossbows + "Brute", "Fishing", "Giant", "Hungry", "Knight", "Plague", "Vampire"//TODO figure out crossbows );//TODO fishing public static final MobFamily SKELETON = new MobFamily<>( SkeletonFamilyConfig::new, @@ -86,7 +86,7 @@ public class MobFamily { public static final MobFamily SILVERFISH = new MobFamily<>( SilverfishFamilyConfig::new, "Silverfish", "silverfish", 0x6E6E6E, new EntityType[] { EntityType.SILVERFISH }, - "Blinding", "Desiccated", /*"Fishing",*/ "Flying", "Poison", /*"Puffer",*/ "Tough" + "Albino", "Blinding", "Desiccated", "Fire", "Fishing", "Flying", "Poison", "Puffer", "Tough" );//TODO fishing, puffer public static final MobFamily ENDERMAN = new MobFamily<>( FamilyConfig::new, diff --git a/src/main/java/fathertoast/specialmobs/common/entity/blaze/_SpecialBlazeEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/blaze/_SpecialBlazeEntity.java index 26fbc74..62444da 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/blaze/_SpecialBlazeEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/blaze/_SpecialBlazeEntity.java @@ -46,7 +46,7 @@ public class _SpecialBlazeEntity extends BlazeEntity implements IRangedAttackMob public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { bestiaryInfo.color( 0xFFF87E ) .vanillaTextureBaseOnly( "textures/entity/blaze.png" ) - .experience( 10 ).fireImmune().waterSensitive() + .experience( 10 ).waterSensitive() .fireballAttack( 1.0, 60, 100, 48.0 ); } diff --git a/src/main/java/fathertoast/specialmobs/common/entity/ghast/_SpecialGhastEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/ghast/_SpecialGhastEntity.java index a7bd033..6445021 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/ghast/_SpecialGhastEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/ghast/_SpecialGhastEntity.java @@ -49,7 +49,7 @@ public class _SpecialGhastEntity extends GhastEntity implements IRangedAttackMob public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { bestiaryInfo.color( 0xBCBCBC ) .vanillaTextureWithAnimation( "textures/entity/ghast/ghast.png", "textures/entity/ghast/ghast_shooting.png" ) - .experience( 5 ).fireImmune() + .experience( 5 ) .fireballAttack( 0.0, 20, 40, 64.0 ); } diff --git a/src/main/java/fathertoast/specialmobs/common/entity/silverfish/AlbinoSilverfishEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/AlbinoSilverfishEntity.java new file mode 100644 index 0000000..0dfa360 --- /dev/null +++ b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/AlbinoSilverfishEntity.java @@ -0,0 +1,76 @@ +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.config.species.SilverfishSpeciesConfig; +import fathertoast.specialmobs.common.config.species.SpeciesConfig; +import fathertoast.specialmobs.common.entity.MobHelper; +import fathertoast.specialmobs.common.util.References; +import fathertoast.specialmobs.datagen.loot.LootTableBuilder; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.attributes.Attributes; +import net.minecraft.item.Items; +import net.minecraft.potion.EffectInstance; +import net.minecraft.potion.Effects; +import net.minecraft.world.World; + +@SpecialMob +public class AlbinoSilverfishEntity extends _SpecialSilverfishEntity { + + //--------------- Static Special Mob Hooks ---------------- + + @SpecialMob.SpeciesReference + public static MobFamily.Species SPECIES; + + @SpecialMob.BestiaryInfoSupplier + public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { + bestiaryInfo.color( 0xFFFFFF ).theme( BestiaryInfo.Theme.ICE ) + .uniqueTextureBaseOnly() + .addExperience( 1 ).effectImmune( Effects.MOVEMENT_SLOWDOWN ) + .addToAttribute( Attributes.ARMOR, 10.0 ); + } + + @SpecialMob.ConfigSupplier + public static SpeciesConfig createConfig( MobFamily.Species species ) { + return new SilverfishSpeciesConfig( species, 1.0 ); + } + + @SpecialMob.LanguageProvider + public static String[] getTranslations( String langKey ) { + return References.translations( langKey, "Albino Silverfish", + "", "", "", "", "", "" );//TODO + } + + @SpecialMob.LootTableProvider + public static void buildLootTable( LootTableBuilder loot ) { + addBaseLoot( loot ); + loot.addCommonDrop( "common", Items.SNOWBALL ); + } + + @SpecialMob.Factory + public static EntityType.IFactory getVariantFactory() { return AlbinoSilverfishEntity::new; } + + /** @return This entity's mob species. */ + @SpecialMob.SpeciesSupplier + @Override + public MobFamily.Species getSpecies() { return SPECIES; } + + + //--------------- Variant-Specific Implementations ---------------- + + public AlbinoSilverfishEntity( EntityType entityType, World world ) { super( entityType, world ); } + + /** Override to apply effects when this entity hits a target with a melee attack. */ + @Override + protected void onVariantAttack( Entity target ) { + if( target instanceof LivingEntity ) { + final LivingEntity livingTarget = (LivingEntity) target; + final int duration = MobHelper.getDebuffDuration( level.getDifficulty() ); + + livingTarget.addEffect( new EffectInstance( Effects.MOVEMENT_SLOWDOWN, duration ) ); + } + } +} \ No newline at end of file diff --git a/src/main/java/fathertoast/specialmobs/common/entity/silverfish/DesiccatedSilverfishEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/DesiccatedSilverfishEntity.java index e4ca6ec..7b663a7 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/silverfish/DesiccatedSilverfishEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/DesiccatedSilverfishEntity.java @@ -87,7 +87,7 @@ public class DesiccatedSilverfishEntity extends _SpecialSilverfishEntity { /** Called each tick to update this entity's movement. */ @Override public void aiStep() { - if( absorbCount > 0 && spongebob() ) spawnAnim(); + if( !level.isClientSide() && absorbCount > 0 && spongebob() ) spawnAnim(); super.aiStep(); } diff --git a/src/main/java/fathertoast/specialmobs/common/entity/silverfish/FireSilverfishEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/FireSilverfishEntity.java new file mode 100644 index 0000000..5e3472b --- /dev/null +++ b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/FireSilverfishEntity.java @@ -0,0 +1,88 @@ +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.References; +import fathertoast.specialmobs.datagen.loot.LootTableBuilder; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.monster.SilverfishEntity; +import net.minecraft.item.Items; +import net.minecraft.potion.EffectInstance; +import net.minecraft.potion.Effects; +import net.minecraft.world.World; + +import java.util.List; + +@SpecialMob +public class FireSilverfishEntity extends _SpecialSilverfishEntity { + + //--------------- Static Special Mob Hooks ---------------- + + @SpecialMob.SpeciesReference + public static MobFamily.Species SPECIES; + + @SpecialMob.BestiaryInfoSupplier + public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { + bestiaryInfo.color( 0xDFA21B ).weight( BestiaryInfo.DefaultWeight.LOW ).theme( BestiaryInfo.Theme.FIRE ) + .uniqueTextureWithEyes() + .addExperience( 2 ).fireImmune(); + } + + @SpecialMob.LanguageProvider + public static String[] getTranslations( String langKey ) { + return References.translations( langKey, "Firebrat", + "", "", "", "", "", "" );//TODO + } + + @SpecialMob.LootTableProvider + public static void buildLootTable( LootTableBuilder loot ) { + addBaseLoot( loot ); + loot.addCommonDrop( "common", Items.FIRE_CHARGE ); + loot.addUncommonDrop( "uncommon", Items.COAL ); + } + + @SpecialMob.Factory + public static EntityType.IFactory getVariantFactory() { return FireSilverfishEntity::new; } + + /** @return This entity's mob species. */ + @SpecialMob.SpeciesSupplier + @Override + public MobFamily.Species getSpecies() { return SPECIES; } + + + //--------------- Variant-Specific Implementations ---------------- + + private byte auraCooldown = 20; + + public FireSilverfishEntity( EntityType entityType, World world ) { super( entityType, world ); } + + /** Override to apply effects when this entity hits a target with a melee attack. */ + @Override + protected void onVariantAttack( Entity target ) { + target.setSecondsOnFire( 5 ); + } + + /** Called each tick to update this entity's movement. */ + @Override + public void aiStep() { + super.aiStep(); + + if( auraCooldown-- <= 0 ) { + auraCooldown = 30; + pulseAura(); + } + } + + /** Applies this entity's aura effect. */ + private void pulseAura() { + final List friends = level.getEntitiesOfClass( SilverfishEntity.class, getBoundingBox().inflate( 7.0 ) ); + for( SilverfishEntity cutie : friends ) { + if( cutie.isAlive() && !cutie.fireImmune() ) { + cutie.addEffect( new EffectInstance( Effects.FIRE_RESISTANCE, 35 + random.nextInt( 16 ), + 0, true, true ) ); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/fathertoast/specialmobs/common/entity/silverfish/FishingSilverfishEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/FishingSilverfishEntity.java index 899c1aa..fe171a7 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/silverfish/FishingSilverfishEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/FishingSilverfishEntity.java @@ -31,7 +31,7 @@ public class FishingSilverfishEntity extends _SpecialSilverfishEntity implements .addExperience( 2 ).drownImmune().fluidPushImmune() .spitAttack( 0.0, 1.0, 40, 40, 10.0 ) .addToAttribute( Attributes.MAX_HEALTH, 4.0 ) - .multiplyAttribute( Attributes.MOVEMENT_SPEED, 0.9 ); + .multiplyAttribute( Attributes.MOVEMENT_SPEED, 0.8 ); } @SpecialMob.ConfigSupplier diff --git a/src/main/java/fathertoast/specialmobs/common/entity/silverfish/PufferSilverfishEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/PufferSilverfishEntity.java new file mode 100644 index 0000000..da4f9e5 --- /dev/null +++ b/src/main/java/fathertoast/specialmobs/common/entity/silverfish/PufferSilverfishEntity.java @@ -0,0 +1,69 @@ +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; +import fathertoast.specialmobs.datagen.loot.LootTableBuilder; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Items; +import net.minecraft.potion.EffectInstance; +import net.minecraft.potion.Effects; +import net.minecraft.world.World; + +@SpecialMob +public class PufferSilverfishEntity extends _SpecialSilverfishEntity { + + //--------------- Static Special Mob Hooks ---------------- + + @SpecialMob.SpeciesReference + public static MobFamily.Species SPECIES; + + @SpecialMob.BestiaryInfoSupplier + public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { + bestiaryInfo.color( 0xE6E861 ).theme( BestiaryInfo.Theme.WATER ) + .uniqueTextureBaseOnly()//TODO Change texture or renderer to fix offset + .addExperience( 1 ).drownImmune().effectImmune( Effects.POISON ); + } + + @SpecialMob.LanguageProvider + public static String[] getTranslations( String langKey ) { + return References.translations( langKey, "\"Pufferfish\"", + "", "", "", "", "", "" );//TODO + } + + @SpecialMob.LootTableProvider + public static void buildLootTable( LootTableBuilder loot ) { + addBaseLoot( loot ); + loot.addUncommonDrop( "uncommon", Items.PUFFERFISH ); + } + + @SpecialMob.Factory + public static EntityType.IFactory getVariantFactory() { return PufferSilverfishEntity::new; } + + /** @return This entity's mob species. */ + @SpecialMob.SpeciesSupplier + @Override + public MobFamily.Species getSpecies() { return SPECIES; } + + + //--------------- Variant-Specific Implementations ---------------- + + public PufferSilverfishEntity( EntityType entityType, World world ) { super( entityType, world ); } + + //TODO swim behavior + + /** Override to apply effects when this entity hits a target with a melee attack. */ + @Override + protected void onVariantAttack( Entity target ) { + if( target instanceof LivingEntity ) { + final LivingEntity livingTarget = (LivingEntity) target; + final int duration = MobHelper.getDebuffDuration( level.getDifficulty() ); + + livingTarget.addEffect( new EffectInstance( Effects.POISON, duration ) ); + } + } +} \ No newline at end of file diff --git a/src/main/java/fathertoast/specialmobs/common/entity/witherskeleton/_SpecialWitherSkeletonEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/witherskeleton/_SpecialWitherSkeletonEntity.java index 2034177..31f23df 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/witherskeleton/_SpecialWitherSkeletonEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/witherskeleton/_SpecialWitherSkeletonEntity.java @@ -55,7 +55,7 @@ public class _SpecialWitherSkeletonEntity extends WitherSkeletonEntity implement bestiaryInfo.color( 0x474D4D ) .vanillaTextureBaseOnly( "textures/entity/skeleton/wither_skeleton.png" ) .familySize( 1.2F ) - .experience( 5 ).undead().fireImmune() + .experience( 5 ).undead() .bowAttack( 2.0, 1.0, 1.0, 20, 15.0 ); } diff --git a/src/main/java/fathertoast/specialmobs/common/entity/zombie/FishingZombieEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/zombie/FishingZombieEntity.java index fee425e..54cc317 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/zombie/FishingZombieEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/zombie/FishingZombieEntity.java @@ -6,6 +6,7 @@ import fathertoast.specialmobs.common.bestiary.SpecialMob; import fathertoast.specialmobs.common.config.Config; import fathertoast.specialmobs.common.config.species.SpeciesConfig; import fathertoast.specialmobs.common.config.species.ZombieSpeciesConfig; +import fathertoast.specialmobs.common.entity.ai.AIHelper; import fathertoast.specialmobs.common.entity.ai.IAngler; import fathertoast.specialmobs.common.util.References; import fathertoast.specialmobs.datagen.loot.LootEntryItemBuilder; @@ -87,6 +88,7 @@ public class FishingZombieEntity extends _SpecialZombieEntity implements IAngler /** Override to change this entity's AI goals. */ @Override protected void registerVariantGoals() { + AIHelper.replaceWaterAvoidingRandomWalking( this, 1.0 ); //TODO add angler AI @ attack priority } diff --git a/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/FishingZombifiedPiglinEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/FishingZombifiedPiglinEntity.java index d7ec4d5..a55d1da 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/FishingZombifiedPiglinEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/FishingZombifiedPiglinEntity.java @@ -6,6 +6,7 @@ import fathertoast.specialmobs.common.bestiary.SpecialMob; import fathertoast.specialmobs.common.config.Config; import fathertoast.specialmobs.common.config.species.SpeciesConfig; import fathertoast.specialmobs.common.config.species.ZombieSpeciesConfig; +import fathertoast.specialmobs.common.entity.ai.AIHelper; import fathertoast.specialmobs.common.entity.ai.IAngler; import fathertoast.specialmobs.common.util.References; import fathertoast.specialmobs.datagen.loot.LootEntryItemBuilder; @@ -87,6 +88,7 @@ public class FishingZombifiedPiglinEntity extends _SpecialZombifiedPiglinEntity /** Override to change this entity's AI goals. */ @Override protected void registerVariantGoals() { + AIHelper.replaceWaterAvoidingRandomWalking( this, 1.0 ); //TODO add angler AI @ attack priority } diff --git a/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/_SpecialZombifiedPiglinEntity.java b/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/_SpecialZombifiedPiglinEntity.java index e9e3a2d..f194289 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/_SpecialZombifiedPiglinEntity.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/zombifiedpiglin/_SpecialZombifiedPiglinEntity.java @@ -54,7 +54,7 @@ public class _SpecialZombifiedPiglinEntity extends ZombifiedPiglinEntity impleme public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { bestiaryInfo.color( 0x4C7129 ) .vanillaTextureBaseOnly( "textures/entity/piglin/zombified_piglin.png" ) - .experience( 5 ).undead().fireImmune() + .experience( 5 ).undead() .bowAttack( 2.0, 1.0, 0.8, 20, 15.0 ); } diff --git a/src/main/resources/assets/specialmobs/textures/entity/silverfish/albino.png b/src/main/resources/assets/specialmobs/textures/entity/silverfish/albino.png new file mode 100644 index 0000000..df1ab28 Binary files /dev/null and b/src/main/resources/assets/specialmobs/textures/entity/silverfish/albino.png differ diff --git a/src/main/resources/assets/specialmobs/textures/entity/silverfish/fire.png b/src/main/resources/assets/specialmobs/textures/entity/silverfish/fire.png new file mode 100644 index 0000000..c574619 Binary files /dev/null and b/src/main/resources/assets/specialmobs/textures/entity/silverfish/fire.png differ diff --git a/src/main/resources/assets/specialmobs/textures/entity/silverfish/fire_eyes.png b/src/main/resources/assets/specialmobs/textures/entity/silverfish/fire_eyes.png new file mode 100644 index 0000000..f890dc7 Binary files /dev/null and b/src/main/resources/assets/specialmobs/textures/entity/silverfish/fire_eyes.png differ