more silverfish

This commit is contained in:
FatherToast 2022-07-24 12:02:21 -05:00
parent 2a221eaddc
commit 361cbf4e6d
16 changed files with 252 additions and 11 deletions

View file

@ -227,8 +227,12 @@ public class BestiaryInfo {
owningSpecies = species; owningSpecies = species;
entityTypeBuilder = typeBuilder; 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; final BestiaryInfo parent = species.family.vanillaReplacement.bestiaryInfo;
baseScale = parent.baseScale; baseScale = parent.baseScale;

View file

@ -45,7 +45,7 @@ public class MobFamily<T extends LivingEntity, V extends FamilyConfig> {
public static final MobFamily<ZombieEntity, FamilyConfig> ZOMBIE = new MobFamily<>( FamilyConfig::newLessSpecial, public static final MobFamily<ZombieEntity, FamilyConfig> ZOMBIE = new MobFamily<>( FamilyConfig::newLessSpecial,
"Zombie", "zombies", 0x00AFAF, new EntityType[] { EntityType.ZOMBIE, EntityType.HUSK }, "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 fishing
// TODO Drowned family and zombie transform mechanic // TODO Drowned family and zombie transform mechanic
// public static final MobFamily<ZombieEntity, FamilyConfig> DROWNED = new MobFamily<>( FamilyConfig::new, // public static final MobFamily<ZombieEntity, FamilyConfig> DROWNED = new MobFamily<>( FamilyConfig::new,
@ -54,7 +54,7 @@ public class MobFamily<T extends LivingEntity, V extends FamilyConfig> {
// ); // );
public static final MobFamily<ZombifiedPiglinEntity, FamilyConfig> ZOMBIFIED_PIGLIN = new MobFamily<>( FamilyConfig::new, public static final MobFamily<ZombifiedPiglinEntity, FamilyConfig> ZOMBIFIED_PIGLIN = new MobFamily<>( FamilyConfig::new,
"ZombifiedPiglin", "zombified piglins", 0xEA9393, new EntityType[] { EntityType.ZOMBIFIED_PIGLIN }, "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 );//TODO fishing
public static final MobFamily<AbstractSkeletonEntity, SkeletonFamilyConfig> SKELETON = new MobFamily<>( SkeletonFamilyConfig::new, public static final MobFamily<AbstractSkeletonEntity, SkeletonFamilyConfig> SKELETON = new MobFamily<>( SkeletonFamilyConfig::new,
@ -86,7 +86,7 @@ public class MobFamily<T extends LivingEntity, V extends FamilyConfig> {
public static final MobFamily<SilverfishEntity, SilverfishFamilyConfig> SILVERFISH = new MobFamily<>( SilverfishFamilyConfig::new, public static final MobFamily<SilverfishEntity, SilverfishFamilyConfig> SILVERFISH = new MobFamily<>( SilverfishFamilyConfig::new,
"Silverfish", "silverfish", 0x6E6E6E, new EntityType[] { EntityType.SILVERFISH }, "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 );//TODO fishing, puffer
public static final MobFamily<EndermanEntity, FamilyConfig> ENDERMAN = new MobFamily<>( FamilyConfig::new, public static final MobFamily<EndermanEntity, FamilyConfig> ENDERMAN = new MobFamily<>( FamilyConfig::new,

View file

@ -46,7 +46,7 @@ public class _SpecialBlazeEntity extends BlazeEntity implements IRangedAttackMob
public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) {
bestiaryInfo.color( 0xFFF87E ) bestiaryInfo.color( 0xFFF87E )
.vanillaTextureBaseOnly( "textures/entity/blaze.png" ) .vanillaTextureBaseOnly( "textures/entity/blaze.png" )
.experience( 10 ).fireImmune().waterSensitive() .experience( 10 ).waterSensitive()
.fireballAttack( 1.0, 60, 100, 48.0 ); .fireballAttack( 1.0, 60, 100, 48.0 );
} }

View file

@ -49,7 +49,7 @@ public class _SpecialGhastEntity extends GhastEntity implements IRangedAttackMob
public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) {
bestiaryInfo.color( 0xBCBCBC ) bestiaryInfo.color( 0xBCBCBC )
.vanillaTextureWithAnimation( "textures/entity/ghast/ghast.png", "textures/entity/ghast/ghast_shooting.png" ) .vanillaTextureWithAnimation( "textures/entity/ghast/ghast.png", "textures/entity/ghast/ghast_shooting.png" )
.experience( 5 ).fireImmune() .experience( 5 )
.fireballAttack( 0.0, 20, 40, 64.0 ); .fireballAttack( 0.0, 20, 40, 64.0 );
} }

View file

@ -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<AlbinoSilverfishEntity> 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<AlbinoSilverfishEntity> getVariantFactory() { return AlbinoSilverfishEntity::new; }
/** @return This entity's mob species. */
@SpecialMob.SpeciesSupplier
@Override
public MobFamily.Species<? extends AlbinoSilverfishEntity> getSpecies() { return SPECIES; }
//--------------- Variant-Specific Implementations ----------------
public AlbinoSilverfishEntity( EntityType<? extends _SpecialSilverfishEntity> 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 ) );
}
}
}

View file

@ -87,7 +87,7 @@ public class DesiccatedSilverfishEntity extends _SpecialSilverfishEntity {
/** Called each tick to update this entity's movement. */ /** Called each tick to update this entity's movement. */
@Override @Override
public void aiStep() { public void aiStep() {
if( absorbCount > 0 && spongebob() ) spawnAnim(); if( !level.isClientSide() && absorbCount > 0 && spongebob() ) spawnAnim();
super.aiStep(); super.aiStep();
} }

View file

@ -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<FireSilverfishEntity> 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<FireSilverfishEntity> getVariantFactory() { return FireSilverfishEntity::new; }
/** @return This entity's mob species. */
@SpecialMob.SpeciesSupplier
@Override
public MobFamily.Species<? extends FireSilverfishEntity> getSpecies() { return SPECIES; }
//--------------- Variant-Specific Implementations ----------------
private byte auraCooldown = 20;
public FireSilverfishEntity( EntityType<? extends _SpecialSilverfishEntity> 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<SilverfishEntity> 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 ) );
}
}
}
}

View file

@ -31,7 +31,7 @@ public class FishingSilverfishEntity extends _SpecialSilverfishEntity implements
.addExperience( 2 ).drownImmune().fluidPushImmune() .addExperience( 2 ).drownImmune().fluidPushImmune()
.spitAttack( 0.0, 1.0, 40, 40, 10.0 ) .spitAttack( 0.0, 1.0, 40, 40, 10.0 )
.addToAttribute( Attributes.MAX_HEALTH, 4.0 ) .addToAttribute( Attributes.MAX_HEALTH, 4.0 )
.multiplyAttribute( Attributes.MOVEMENT_SPEED, 0.9 ); .multiplyAttribute( Attributes.MOVEMENT_SPEED, 0.8 );
} }
@SpecialMob.ConfigSupplier @SpecialMob.ConfigSupplier

View file

@ -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<PufferSilverfishEntity> 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<PufferSilverfishEntity> getVariantFactory() { return PufferSilverfishEntity::new; }
/** @return This entity's mob species. */
@SpecialMob.SpeciesSupplier
@Override
public MobFamily.Species<? extends PufferSilverfishEntity> getSpecies() { return SPECIES; }
//--------------- Variant-Specific Implementations ----------------
public PufferSilverfishEntity( EntityType<? extends _SpecialSilverfishEntity> 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 ) );
}
}
}

View file

@ -55,7 +55,7 @@ public class _SpecialWitherSkeletonEntity extends WitherSkeletonEntity implement
bestiaryInfo.color( 0x474D4D ) bestiaryInfo.color( 0x474D4D )
.vanillaTextureBaseOnly( "textures/entity/skeleton/wither_skeleton.png" ) .vanillaTextureBaseOnly( "textures/entity/skeleton/wither_skeleton.png" )
.familySize( 1.2F ) .familySize( 1.2F )
.experience( 5 ).undead().fireImmune() .experience( 5 ).undead()
.bowAttack( 2.0, 1.0, 1.0, 20, 15.0 ); .bowAttack( 2.0, 1.0, 1.0, 20, 15.0 );
} }

View file

@ -6,6 +6,7 @@ import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.config.Config; import fathertoast.specialmobs.common.config.Config;
import fathertoast.specialmobs.common.config.species.SpeciesConfig; import fathertoast.specialmobs.common.config.species.SpeciesConfig;
import fathertoast.specialmobs.common.config.species.ZombieSpeciesConfig; 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.entity.ai.IAngler;
import fathertoast.specialmobs.common.util.References; import fathertoast.specialmobs.common.util.References;
import fathertoast.specialmobs.datagen.loot.LootEntryItemBuilder; 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 to change this entity's AI goals. */
@Override @Override
protected void registerVariantGoals() { protected void registerVariantGoals() {
AIHelper.replaceWaterAvoidingRandomWalking( this, 1.0 );
//TODO add angler AI @ attack priority //TODO add angler AI @ attack priority
} }

View file

@ -6,6 +6,7 @@ import fathertoast.specialmobs.common.bestiary.SpecialMob;
import fathertoast.specialmobs.common.config.Config; import fathertoast.specialmobs.common.config.Config;
import fathertoast.specialmobs.common.config.species.SpeciesConfig; import fathertoast.specialmobs.common.config.species.SpeciesConfig;
import fathertoast.specialmobs.common.config.species.ZombieSpeciesConfig; 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.entity.ai.IAngler;
import fathertoast.specialmobs.common.util.References; import fathertoast.specialmobs.common.util.References;
import fathertoast.specialmobs.datagen.loot.LootEntryItemBuilder; import fathertoast.specialmobs.datagen.loot.LootEntryItemBuilder;
@ -87,6 +88,7 @@ public class FishingZombifiedPiglinEntity extends _SpecialZombifiedPiglinEntity
/** Override to change this entity's AI goals. */ /** Override to change this entity's AI goals. */
@Override @Override
protected void registerVariantGoals() { protected void registerVariantGoals() {
AIHelper.replaceWaterAvoidingRandomWalking( this, 1.0 );
//TODO add angler AI @ attack priority //TODO add angler AI @ attack priority
} }

View file

@ -54,7 +54,7 @@ public class _SpecialZombifiedPiglinEntity extends ZombifiedPiglinEntity impleme
public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) { public static void getBestiaryInfo( BestiaryInfo.Builder bestiaryInfo ) {
bestiaryInfo.color( 0x4C7129 ) bestiaryInfo.color( 0x4C7129 )
.vanillaTextureBaseOnly( "textures/entity/piglin/zombified_piglin.png" ) .vanillaTextureBaseOnly( "textures/entity/piglin/zombified_piglin.png" )
.experience( 5 ).undead().fireImmune() .experience( 5 ).undead()
.bowAttack( 2.0, 1.0, 0.8, 20, 15.0 ); .bowAttack( 2.0, 1.0, 0.8, 20, 15.0 );
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B