Spitfire mobs

This commit is contained in:
FatherToast 2022-06-30 12:40:43 -05:00
parent 30df52a0e2
commit 214bd23b92
4 changed files with 61 additions and 7 deletions

View file

@ -55,11 +55,11 @@ public class MobFamily<T extends LivingEntity> {
public static final MobFamily<AbstractSkeletonEntity> SKELETON = new MobFamily<>( public static final MobFamily<AbstractSkeletonEntity> SKELETON = new MobFamily<>(
"Skeleton", "skeletons", 0xC1C1C1, new EntityType[] { EntityType.SKELETON, EntityType.STRAY }, "Skeleton", "skeletons", 0xC1C1C1, new EntityType[] { EntityType.SKELETON, EntityType.STRAY },
"Brute", "Fire", "Gatling", "Giant", "Knight", "Ninja", "Poison", "Sniper", /*"Spitfire",*/ "Stray" "Brute", "Fire", "Gatling", "Giant", "Knight", "Ninja", "Poison", "Sniper", "Spitfire", "Stray"
); );
public static final MobFamily<AbstractSkeletonEntity> WITHER_SKELETON = new MobFamily<>( public static final MobFamily<AbstractSkeletonEntity> WITHER_SKELETON = new MobFamily<>(
"WitherSkeleton", "wither skeletons", 0x141414, new EntityType[] { EntityType.WITHER_SKELETON }, "WitherSkeleton", "wither skeletons", 0x141414, new EntityType[] { EntityType.WITHER_SKELETON },
"Brute", "Gatling", "Giant", "Knight", "Ninja", "Sniper"//, "Spitfire" "Brute", "Gatling", "Giant", "Knight", "Ninja", "Sniper", "Spitfire"
); );
public static final MobFamily<SlimeEntity> SLIME = new MobFamily<>( public static final MobFamily<SlimeEntity> SLIME = new MobFamily<>(

View file

@ -12,8 +12,10 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap; import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes; import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.projectile.SmallFireballEntity;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
@ -73,9 +75,12 @@ public class SpitfireSkeletonEntity extends _SpecialSkeletonEntity {
@Override @Override
protected void registerVariantGoals() { protected void registerVariantGoals() {
getSpecialData().rangedAttackDamage += 2.0F; getSpecialData().rangedAttackDamage += 2.0F;
getSpecialData().rangedAttackSpread *= 0.5F;
} }
/** Override to change this entity's chance to spawn with a melee weapon. */
@Override
protected double getVariantMeleeChance() { return 0.0; }
/** Override to apply effects when this entity hits a target with a melee attack. */ /** Override to apply effects when this entity hits a target with a melee attack. */
@Override @Override
protected void onVariantAttack( Entity target ) { protected void onVariantAttack( Entity target ) {
@ -85,8 +90,28 @@ public class SpitfireSkeletonEntity extends _SpecialSkeletonEntity {
/** Called to attack the target with a ranged attack. */ /** Called to attack the target with a ranged attack. */
@Override @Override
public void performRangedAttack( LivingEntity target, float damageMulti ) { public void performRangedAttack( LivingEntity target, float damageMulti ) {
//TODO if( !isSilent() ) level.levelEvent( null, 1018, blockPosition(), 0 );
final float accelVariance = MathHelper.sqrt( distanceTo( target ) ) * 0.5F * getSpecialData().rangedAttackSpread;
for( int i = 0; i < 3; i++ ) {
final double dX = target.getX() - getX() + getRandom().nextGaussian() * accelVariance;
final double dY = target.getEyeY() - getEyeY();
final double dZ = target.getZ() - getZ() + getRandom().nextGaussian() * accelVariance;
final SmallFireballEntity fireball = new SmallFireballEntity( level, this, dX, dY, dZ );
fireball.setPos( fireball.getX(), getEyeY() - 0.1, fireball.getZ() );
level.addFreshEntity( fireball );
} }
}
/** Sets this entity as a baby. */
@Override
public void setBaby( boolean value ) { }
/** @return True if this entity is a baby. */
@Override
public boolean isBaby() { return false; }
private static final ResourceLocation[] TEXTURES = { private static final ResourceLocation[] TEXTURES = {
GET_TEXTURE_PATH( "fire" ) GET_TEXTURE_PATH( "fire" )

View file

@ -12,8 +12,10 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap; import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes; import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.projectile.SmallFireballEntity;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
@ -62,7 +64,7 @@ public class SpitfireWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
public SpitfireWitherSkeletonEntity( EntityType<? extends _SpecialWitherSkeletonEntity> entityType, World world ) { public SpitfireWitherSkeletonEntity( EntityType<? extends _SpecialWitherSkeletonEntity> entityType, World world ) {
super( entityType, world ); super( entityType, world );
getSpecialData().setBaseScale( 1.5F ); getSpecialData().setBaseScale( 1.8F );
getSpecialData().setDamagedByWater( true ); getSpecialData().setDamagedByWater( true );
maxUpStep = 1.0F; maxUpStep = 1.0F;
xpReward += 2; xpReward += 2;
@ -72,9 +74,12 @@ public class SpitfireWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
@Override @Override
protected void registerVariantGoals() { protected void registerVariantGoals() {
getSpecialData().rangedAttackDamage += 2.0F; getSpecialData().rangedAttackDamage += 2.0F;
getSpecialData().rangedAttackSpread *= 0.5F;
} }
/** Override to change this entity's chance to spawn with a bow. */
@Override
protected double getVariantBowChance() { return 1.0; }
/** Override to apply effects when this entity hits a target with a melee attack. */ /** Override to apply effects when this entity hits a target with a melee attack. */
@Override @Override
protected void onVariantAttack( Entity target ) { protected void onVariantAttack( Entity target ) {
@ -84,8 +89,28 @@ public class SpitfireWitherSkeletonEntity extends _SpecialWitherSkeletonEntity {
/** Called to attack the target with a ranged attack. */ /** Called to attack the target with a ranged attack. */
@Override @Override
public void performRangedAttack( LivingEntity target, float damageMulti ) { public void performRangedAttack( LivingEntity target, float damageMulti ) {
//TODO if( !isSilent() ) level.levelEvent( null, 1018, blockPosition(), 0 );
final float accelVariance = MathHelper.sqrt( distanceTo( target ) ) * 0.5F * getSpecialData().rangedAttackSpread;
for( int i = 0; i < 4; i++ ) {
final double dX = target.getX() - getX() + getRandom().nextGaussian() * accelVariance;
final double dY = target.getEyeY() - getEyeY();
final double dZ = target.getZ() - getZ() + getRandom().nextGaussian() * accelVariance;
final SmallFireballEntity fireball = new SmallFireballEntity( level, this, dX, dY, dZ );
fireball.setPos( fireball.getX(), getEyeY() - 0.1, fireball.getZ() );
level.addFreshEntity( fireball );
} }
}
/** Sets this entity as a baby. */
@Override
public void setBaby( boolean value ) { }
/** @return True if this entity is a baby. */
@Override
public boolean isBaby() { return false; }
private static final ResourceLocation[] TEXTURES = { private static final ResourceLocation[] TEXTURES = {
GET_TEXTURE_PATH( "fire" ) GET_TEXTURE_PATH( "fire" )

View file

@ -75,6 +75,10 @@ public class FireZombieEntity extends _SpecialZombieEntity {
return arrow; return arrow;
} }
/** @return True if this entity should appear to be on fire. */
@Override
public boolean isOnFire() { return isAlive() && !isInWaterRainOrBubble(); }
/** @return The sound this entity makes idly. */ /** @return The sound this entity makes idly. */
@Override @Override
protected SoundEvent getAmbientSound() { return SoundEvents.HUSK_AMBIENT; } protected SoundEvent getAmbientSound() { return SoundEvents.HUSK_AMBIENT; }