forked from ACGaming/Spackenmobs
Baka Mitai Creeper, some failsafe-ish entity copies, member sorting and more
This commit is contained in:
parent
c0db096c64
commit
2b3affbabb
|
@ -24,19 +24,6 @@ public class Spackenmobs
|
|||
@Instance
|
||||
public static Spackenmobs instance;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@EventHandler
|
||||
public void preInitClient(FMLPreInitializationEvent event)
|
||||
{
|
||||
ModEntities.initModels();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
|
@ -48,4 +35,17 @@ public class Spackenmobs
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@EventHandler
|
||||
public void preInitClient(FMLPreInitializationEvent event)
|
||||
{
|
||||
ModEntities.initModels();
|
||||
}
|
||||
}
|
|
@ -23,36 +23,15 @@ public class EntityAIEatDroppedFish extends EntityAIBase
|
|||
this.world = jens.world;
|
||||
}
|
||||
|
||||
public EntityItem getNearbyFood()
|
||||
public void eatItem(EntityItem item)
|
||||
{
|
||||
List<EntityItem> items = getItems();
|
||||
for (EntityItem item : items)
|
||||
ItemStack stack = item.getItem();
|
||||
stack.setCount(stack.getCount() - 1);
|
||||
if (stack.getCount() == 0)
|
||||
{
|
||||
EntityItem stack = item;
|
||||
if (items != null)
|
||||
{
|
||||
return stack;
|
||||
item.setDead();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
List<EntityItem> getItems()
|
||||
{
|
||||
return this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.jens.posX - this.searchDistance, this.jens.posY - this.searchDistance, this.jens.posZ - this.searchDistance,
|
||||
this.jens.posX + this.searchDistance, this.jens.posY + this.searchDistance, this.jens.posZ + this.searchDistance));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
EntityItem nearbyFood = getNearbyFood();
|
||||
if (nearbyFood != null && !this.jens.isChild() && this.jens.digesting == false && this.jens.isFishItem(nearbyFood.getItem()))
|
||||
{
|
||||
execute(this.jens, nearbyFood);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean execute(EntityJens jens, EntityItem item)
|
||||
{
|
||||
|
@ -67,13 +46,34 @@ public class EntityAIEatDroppedFish extends EntityAIBase
|
|||
return true;
|
||||
}
|
||||
|
||||
public void eatItem(EntityItem item)
|
||||
List<EntityItem> getItems()
|
||||
{
|
||||
ItemStack stack = item.getItem();
|
||||
stack.setCount(stack.getCount() - 1);
|
||||
if (stack.getCount() == 0)
|
||||
{
|
||||
item.setDead();
|
||||
return this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.jens.posX - this.searchDistance, this.jens.posY - this.searchDistance, this.jens.posZ - this.searchDistance,
|
||||
this.jens.posX + this.searchDistance, this.jens.posY + this.searchDistance, this.jens.posZ + this.searchDistance));
|
||||
}
|
||||
|
||||
public EntityItem getNearbyFood()
|
||||
{
|
||||
List<EntityItem> items = getItems();
|
||||
for (EntityItem item : items)
|
||||
{
|
||||
EntityItem stack = item;
|
||||
if (items != null)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
EntityItem nearbyFood = getNearbyFood();
|
||||
if (nearbyFood != null && !this.jens.isChild() && this.jens.digesting == false && this.jens.isFishItem(nearbyFood.getItem()))
|
||||
{
|
||||
execute(this.jens, nearbyFood);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,31 @@
|
|||
package mod.acgaming.spackenmobs.entities;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mod.acgaming.spackenmobs.misc.ModSoundEvents;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.projectile.EntitySpectralArrow;
|
||||
import net.minecraft.entity.projectile.EntityTippedArrow;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.datafix.DataFixer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
|
||||
public class EntityApoRed extends EntitySkeleton
|
||||
{
|
||||
public static void registerFixesApoRed(DataFixer fixer)
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntityApoRed.class);
|
||||
}
|
||||
|
||||
public EntityApoRed(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
|
@ -20,9 +38,27 @@ public class EntityApoRed extends EntitySkeleton
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
protected EntityArrow getArrow(float p_190726_1_)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_APORED_HURT;
|
||||
ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
|
||||
if (itemstack.getItem() == Items.SPECTRAL_ARROW)
|
||||
{
|
||||
EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
|
||||
entityspectralarrow.setEnchantmentEffectsFromEntity(this, p_190726_1_);
|
||||
return entityspectralarrow;
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityArrow entityarrow = super.getArrow(p_190726_1_);
|
||||
|
||||
if (itemstack.getItem() == Items.TIPPED_ARROW && entityarrow instanceof EntityTippedArrow)
|
||||
{
|
||||
((EntityTippedArrow) entityarrow).setPotionEffect(itemstack);
|
||||
}
|
||||
|
||||
return entityarrow;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,4 +66,34 @@ public class EntityApoRed extends EntitySkeleton
|
|||
{
|
||||
return ModSoundEvents.ENTITY_APORED_DEATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_APORED_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return LootTableList.ENTITIES_SKELETON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource cause)
|
||||
{
|
||||
super.onDeath(cause);
|
||||
|
||||
if (cause.getTrueSource() instanceof EntityCreeper)
|
||||
{
|
||||
EntityCreeper entitycreeper = (EntityCreeper) cause.getTrueSource();
|
||||
|
||||
if (entitycreeper.getPowered() && entitycreeper.ableToCauseSkullDrop())
|
||||
{
|
||||
entitycreeper.incrementDroppedSkulls();
|
||||
this.entityDropItem(new ItemStack(Items.SKULL, 1, 0), 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,350 @@
|
|||
package mod.acgaming.spackenmobs.entities;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mod.acgaming.spackenmobs.misc.ModSoundEvents;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAreaEffectCloud;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
import net.minecraft.entity.ai.EntityAIAvoidEntity;
|
||||
import net.minecraft.entity.ai.EntityAICreeperSwell;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.datafix.DataFixer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityBakaMitaiCreeper extends EntityCreeper
|
||||
{
|
||||
private static final DataParameter<Integer> STATE = EntityDataManager.<Integer>createKey(EntityBakaMitaiCreeper.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Boolean> POWERED = EntityDataManager.<Boolean>createKey(EntityBakaMitaiCreeper.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Boolean> IGNITED = EntityDataManager.<Boolean>createKey(EntityBakaMitaiCreeper.class, DataSerializers.BOOLEAN);
|
||||
|
||||
public static void registerFixesCreeper(DataFixer fixer)
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntityBakaMitaiCreeper.class);
|
||||
}
|
||||
|
||||
private int lastActiveTime;
|
||||
private int timeSinceIgnited;
|
||||
private int fuseTime = 100;
|
||||
private int explosionRadius = 12;
|
||||
|
||||
private int droppedSkulls;
|
||||
|
||||
public EntityBakaMitaiCreeper(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
this.setSize(0.6F, 1.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ableToCauseSkullDrop()
|
||||
{
|
||||
return this.droppedSkulls < 1 && this.world.getGameRules().getBoolean("doMobLoot");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes()
|
||||
{
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity entityIn)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataManager.register(STATE, Integer.valueOf(-1));
|
||||
this.dataManager.register(POWERED, Boolean.valueOf(false));
|
||||
this.dataManager.register(IGNITED, Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
private void explode()
|
||||
{
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this);
|
||||
float f = this.getPowered() ? 2.0F : 1.0F;
|
||||
this.dead = true;
|
||||
this.world.playSound(null, getPosition(), ModSoundEvents.ENTITY_BAKAMITAICREEPER_BLOW, getSoundCategory(), 1.0F, 1.0F);
|
||||
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * f, flag);
|
||||
this.setDead();
|
||||
this.spawnLingeringCloud();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fall(float distance, float damageMultiplier)
|
||||
{
|
||||
super.fall(distance, damageMultiplier);
|
||||
this.timeSinceIgnited = (int) (this.timeSinceIgnited + distance * 1.5F);
|
||||
|
||||
if (this.timeSinceIgnited > this.fuseTime - 5)
|
||||
{
|
||||
this.timeSinceIgnited = this.fuseTime - 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getCreeperFlashIntensity(float p_70831_1_)
|
||||
{
|
||||
return (this.lastActiveTime + (this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (this.fuseTime - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCreeperState()
|
||||
{
|
||||
return this.dataManager.get(STATE).intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return SoundEvents.ENTITY_CREEPER_DEATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return SoundEvents.ENTITY_CREEPER_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return LootTableList.ENTITIES_CREEPER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFallHeight()
|
||||
{
|
||||
return this.getAttackTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPowered()
|
||||
{
|
||||
return this.dataManager.get(POWERED).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIgnited()
|
||||
{
|
||||
return this.dataManager.get(IGNITED).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignite()
|
||||
{
|
||||
this.dataManager.set(IGNITED, Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementDroppedSkulls()
|
||||
{
|
||||
++this.droppedSkulls;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEntityAI()
|
||||
{
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAICreeperSwell(this));
|
||||
this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D));
|
||||
this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
|
||||
this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 0.8D));
|
||||
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(6, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
|
||||
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource cause)
|
||||
{
|
||||
super.onDeath(cause);
|
||||
|
||||
if (this.world.getGameRules().getBoolean("doMobLoot"))
|
||||
{
|
||||
if (cause.getTrueSource() instanceof EntitySkeleton)
|
||||
{
|
||||
int i = Item.getIdFromItem(Items.RECORD_13);
|
||||
int j = Item.getIdFromItem(Items.RECORD_WAIT);
|
||||
int k = i + this.rand.nextInt(j - i + 1);
|
||||
this.dropItem(Item.getItemById(k), 1);
|
||||
}
|
||||
else if (cause.getTrueSource() instanceof EntityBakaMitaiCreeper && cause.getTrueSource() != this && ((EntityBakaMitaiCreeper) cause.getTrueSource()).getPowered()
|
||||
&& ((EntityBakaMitaiCreeper) cause.getTrueSource()).ableToCauseSkullDrop())
|
||||
{
|
||||
((EntityBakaMitaiCreeper) cause.getTrueSource()).incrementDroppedSkulls();
|
||||
this.entityDropItem(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStruckByLightning(EntityLightningBolt lightningBolt)
|
||||
{
|
||||
super.onStruckByLightning(lightningBolt);
|
||||
this.dataManager.set(POWERED, Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if (this.isEntityAlive())
|
||||
{
|
||||
this.lastActiveTime = this.timeSinceIgnited;
|
||||
|
||||
if (this.hasIgnited())
|
||||
{
|
||||
this.setCreeperState(1);
|
||||
}
|
||||
|
||||
int i = this.getCreeperState();
|
||||
|
||||
if (i > 0 && this.timeSinceIgnited == 0)
|
||||
{
|
||||
this.playSound(ModSoundEvents.ENTITY_BAKAMITAICREEPER_FUSE, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
this.timeSinceIgnited += i;
|
||||
|
||||
if (this.timeSinceIgnited < 0)
|
||||
{
|
||||
this.timeSinceIgnited = 0;
|
||||
}
|
||||
|
||||
if (this.timeSinceIgnited >= this.fuseTime)
|
||||
{
|
||||
this.timeSinceIgnited = this.fuseTime;
|
||||
this.explode();
|
||||
}
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean processInteract(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
|
||||
if (itemstack.getItem() == Items.FLINT_AND_STEEL)
|
||||
{
|
||||
this.world.playSound(player, this.posX, this.posY, this.posZ, SoundEvents.ITEM_FLINTANDSTEEL_USE, this.getSoundCategory(), 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
|
||||
player.swingArm(hand);
|
||||
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
this.ignite();
|
||||
itemstack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.processInteract(player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.readEntityFromNBT(compound);
|
||||
this.dataManager.set(POWERED, Boolean.valueOf(compound.getBoolean("powered")));
|
||||
|
||||
if (compound.hasKey("Fuse", 99))
|
||||
{
|
||||
this.fuseTime = compound.getShort("Fuse");
|
||||
}
|
||||
|
||||
if (compound.hasKey("ExplosionRadius", 99))
|
||||
{
|
||||
this.explosionRadius = compound.getByte("ExplosionRadius");
|
||||
}
|
||||
|
||||
if (compound.getBoolean("ignited"))
|
||||
{
|
||||
this.ignite();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreeperState(int state)
|
||||
{
|
||||
this.dataManager.set(STATE, Integer.valueOf(state));
|
||||
}
|
||||
|
||||
private void spawnLingeringCloud()
|
||||
{
|
||||
Collection<PotionEffect> collection = this.getActivePotionEffects();
|
||||
|
||||
if (!collection.isEmpty())
|
||||
{
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.posX, this.posY, this.posZ);
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration() / 2);
|
||||
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / entityareaeffectcloud.getDuration());
|
||||
|
||||
for (PotionEffect potioneffect : collection)
|
||||
{
|
||||
entityareaeffectcloud.addEffect(new PotionEffect(potioneffect));
|
||||
}
|
||||
|
||||
this.world.spawnEntity(entityareaeffectcloud);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.writeEntityToNBT(compound);
|
||||
|
||||
if (this.dataManager.get(POWERED).booleanValue())
|
||||
{
|
||||
compound.setBoolean("powered", true);
|
||||
}
|
||||
|
||||
compound.setShort("Fuse", (short) this.fuseTime);
|
||||
compound.setByte("ExplosionRadius", (byte) this.explosionRadius);
|
||||
compound.setBoolean("ignited", this.hasIgnited());
|
||||
}
|
||||
}
|
|
@ -32,10 +32,51 @@ import net.minecraft.world.storage.loot.LootTableList;
|
|||
|
||||
public class EntityDrachenlord extends EntityZombie
|
||||
{
|
||||
static class AIHurtByAggressor extends EntityAIHurtByTarget
|
||||
{
|
||||
public AIHurtByAggressor(EntityDrachenlord p_i45828_1_)
|
||||
{
|
||||
super(p_i45828_1_, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEntityAttackTarget(EntityCreature creatureIn, EntityLivingBase entityLivingBaseIn)
|
||||
{
|
||||
super.setEntityAttackTarget(creatureIn, entityLivingBaseIn);
|
||||
|
||||
if (creatureIn instanceof EntityDrachenlord)
|
||||
{
|
||||
((EntityDrachenlord) creatureIn).becomeAngryAt(entityLivingBaseIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class AITargetAggressor extends EntityAINearestAttackableTarget<EntityPlayer>
|
||||
{
|
||||
public AITargetAggressor(EntityDrachenlord p_i45829_1_)
|
||||
{
|
||||
super(p_i45829_1_, EntityPlayer.class, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
return ((EntityDrachenlord) this.taskOwner).isAngry() && super.shouldExecute();
|
||||
}
|
||||
}
|
||||
|
||||
private static final UUID ATTACK_SPEED_BOOST_MODIFIER_UUID = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718");
|
||||
private static final AttributeModifier ATTACK_SPEED_BOOST_MODIFIER = (new AttributeModifier(ATTACK_SPEED_BOOST_MODIFIER_UUID, "Attacking speed boost", 0.05D, 0)).setSaved(false);
|
||||
|
||||
public static void registerFixesPigZombie(DataFixer fixer)
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntityDrachenlord.class);
|
||||
}
|
||||
|
||||
private int angerLevel;
|
||||
|
||||
private int randomSoundDelay;
|
||||
|
||||
private UUID angerTargetUUID;
|
||||
|
||||
public EntityDrachenlord(World worldIn)
|
||||
|
@ -44,18 +85,6 @@ public class EntityDrachenlord extends EntityZombie
|
|||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRevengeTarget(@Nullable
|
||||
EntityLivingBase livingBase)
|
||||
{
|
||||
super.setRevengeTarget(livingBase);
|
||||
|
||||
if (livingBase != null)
|
||||
{
|
||||
this.angerTargetUUID = livingBase.getUniqueID();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAI()
|
||||
{
|
||||
|
@ -72,6 +101,137 @@ public class EntityDrachenlord extends EntityZombie
|
|||
this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(5.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount)
|
||||
{
|
||||
if (this.isEntityInvulnerable(source))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Entity entity = source.getTrueSource();
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
this.becomeAngryAt(entity);
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
}
|
||||
|
||||
private void becomeAngryAt(Entity p_70835_1_)
|
||||
{
|
||||
this.angerLevel = 400 + this.rand.nextInt(400);
|
||||
this.randomSoundDelay = this.rand.nextInt(40);
|
||||
|
||||
if (p_70835_1_ instanceof EntityLivingBase)
|
||||
{
|
||||
this.setRevengeTarget((EntityLivingBase) p_70835_1_);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere()
|
||||
{
|
||||
return this.world.getDifficulty() != EnumDifficulty.PEACEFUL;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_DRACHENLORD_DEATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_DRACHENLORD_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return LootTableList.ENTITIES_ZOMBIE_PIGMAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getSkullDrop()
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public boolean isAngry()
|
||||
{
|
||||
return this.angerLevel > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNotColliding()
|
||||
{
|
||||
return this.world.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty()
|
||||
&& !this.world.containsAnyLiquid(this.getEntityBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreventingPlayerRest(EntityPlayer playerIn)
|
||||
{
|
||||
return this.isAngry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processInteract(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.readEntityFromNBT(compound);
|
||||
this.angerLevel = compound.getShort("Anger");
|
||||
String s = compound.getString("HurtBy");
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
this.angerTargetUUID = UUID.fromString(s);
|
||||
EntityPlayer entityplayer = this.world.getPlayerEntityByUUID(this.angerTargetUUID);
|
||||
this.setRevengeTarget(entityplayer);
|
||||
|
||||
if (entityplayer != null)
|
||||
{
|
||||
this.attackingPlayer = entityplayer;
|
||||
this.recentlyHit = this.getRevengeTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
|
||||
{
|
||||
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_AXE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRevengeTarget(@Nullable
|
||||
EntityLivingBase livingBase)
|
||||
{
|
||||
super.setRevengeTarget(livingBase);
|
||||
|
||||
if (livingBase != null)
|
||||
{
|
||||
this.angerTargetUUID = livingBase.getUniqueID();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateAITasks()
|
||||
{
|
||||
|
@ -107,24 +267,6 @@ public class EntityDrachenlord extends EntityZombie
|
|||
super.updateAITasks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere()
|
||||
{
|
||||
return this.world.getDifficulty() != EnumDifficulty.PEACEFUL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNotColliding()
|
||||
{
|
||||
return this.world.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty()
|
||||
&& !this.world.containsAnyLiquid(this.getEntityBoundingBox());
|
||||
}
|
||||
|
||||
public static void registerFixesPigZombie(DataFixer fixer)
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntityDrachenlord.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound)
|
||||
{
|
||||
|
@ -140,143 +282,4 @@ public class EntityDrachenlord extends EntityZombie
|
|||
compound.setString("HurtBy", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.readEntityFromNBT(compound);
|
||||
this.angerLevel = compound.getShort("Anger");
|
||||
String s = compound.getString("HurtBy");
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
this.angerTargetUUID = UUID.fromString(s);
|
||||
EntityPlayer entityplayer = this.world.getPlayerEntityByUUID(this.angerTargetUUID);
|
||||
this.setRevengeTarget(entityplayer);
|
||||
|
||||
if (entityplayer != null)
|
||||
{
|
||||
this.attackingPlayer = entityplayer;
|
||||
this.recentlyHit = this.getRevengeTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount)
|
||||
{
|
||||
if (this.isEntityInvulnerable(source))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Entity entity = source.getTrueSource();
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
this.becomeAngryAt(entity);
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
}
|
||||
|
||||
private void becomeAngryAt(Entity p_70835_1_)
|
||||
{
|
||||
this.angerLevel = 400 + this.rand.nextInt(400);
|
||||
this.randomSoundDelay = this.rand.nextInt(40);
|
||||
|
||||
if (p_70835_1_ instanceof EntityLivingBase)
|
||||
{
|
||||
this.setRevengeTarget((EntityLivingBase) p_70835_1_);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAngry()
|
||||
{
|
||||
return this.angerLevel > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_DRACHENLORD_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_DRACHENLORD_DEATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return LootTableList.ENTITIES_ZOMBIE_PIGMAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processInteract(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
|
||||
{
|
||||
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_AXE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getSkullDrop()
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreventingPlayerRest(EntityPlayer playerIn)
|
||||
{
|
||||
return this.isAngry();
|
||||
}
|
||||
|
||||
static class AIHurtByAggressor extends EntityAIHurtByTarget
|
||||
{
|
||||
public AIHurtByAggressor(EntityDrachenlord p_i45828_1_)
|
||||
{
|
||||
super(p_i45828_1_, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEntityAttackTarget(EntityCreature creatureIn, EntityLivingBase entityLivingBaseIn)
|
||||
{
|
||||
super.setEntityAttackTarget(creatureIn, entityLivingBaseIn);
|
||||
|
||||
if (creatureIn instanceof EntityDrachenlord)
|
||||
{
|
||||
((EntityDrachenlord) creatureIn).becomeAngryAt(entityLivingBaseIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class AITargetAggressor extends EntityAINearestAttackableTarget<EntityPlayer>
|
||||
{
|
||||
public AITargetAggressor(EntityDrachenlord p_i45829_1_)
|
||||
{
|
||||
super(p_i45829_1_, EntityPlayer.class, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
return ((EntityDrachenlord) this.taskOwner).isAngry() && super.shouldExecute();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,6 +38,30 @@ public class EntityHolzstammhuhn extends EntityChicken
|
|||
this.setPathPriority(PathNodeType.WATER, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityHolzstammhuhn createChild(EntityAgeable ageable)
|
||||
{
|
||||
return new EntityHolzstammhuhn(this.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return SoundEvents.BLOCK_WOOD_PLACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return SoundEvents.BLOCK_WOOD_BREAK;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return SoundEvents.BLOCK_WOOD_HIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEntityAI()
|
||||
{
|
||||
|
@ -57,33 +81,9 @@ public class EntityHolzstammhuhn extends EntityChicken
|
|||
return TEMPTATION_ITEMS.contains(stack.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return SoundEvents.BLOCK_WOOD_PLACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return SoundEvents.BLOCK_WOOD_HIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return SoundEvents.BLOCK_WOOD_BREAK;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void playStepSound(BlockPos pos, Block blockIn)
|
||||
{
|
||||
this.playSound(SoundEvents.BLOCK_WOOD_STEP, 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityHolzstammhuhn createChild(EntityAgeable ageable)
|
||||
{
|
||||
return new EntityHolzstammhuhn(this.world);
|
||||
}
|
||||
}
|
|
@ -1,24 +1,231 @@
|
|||
package mod.acgaming.spackenmobs.entities;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mod.acgaming.spackenmobs.misc.ModSoundEvents;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAreaEffectCloud;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
import net.minecraft.entity.ai.EntityAIAvoidEntity;
|
||||
import net.minecraft.entity.ai.EntityAICreeperSwell;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.datafix.DataFixer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityIslamist extends EntityCreeper
|
||||
{
|
||||
private static final DataParameter<Integer> STATE = EntityDataManager.<Integer>createKey(EntityIslamist.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Boolean> POWERED = EntityDataManager.<Boolean>createKey(EntityIslamist.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Boolean> IGNITED = EntityDataManager.<Boolean>createKey(EntityIslamist.class, DataSerializers.BOOLEAN);
|
||||
|
||||
public static void registerFixesIslamist(DataFixer fixer)
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntityIslamist.class);
|
||||
}
|
||||
|
||||
private int lastActiveTime;
|
||||
private int timeSinceIgnited;
|
||||
private int fuseTime = 30;
|
||||
private int explosionRadius = 6;
|
||||
|
||||
private int droppedSkulls;
|
||||
|
||||
public EntityIslamist(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
this.setSize(0.6F, 1.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ableToCauseSkullDrop()
|
||||
{
|
||||
return this.droppedSkulls < 1 && this.world.getGameRules().getBoolean("doMobLoot");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes()
|
||||
{
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity entityIn)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataManager.register(STATE, Integer.valueOf(-1));
|
||||
this.dataManager.register(POWERED, Boolean.valueOf(false));
|
||||
this.dataManager.register(IGNITED, Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
private void explode()
|
||||
{
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this);
|
||||
float f = this.getPowered() ? 2.0F : 1.0F;
|
||||
this.dead = true;
|
||||
this.world.playSound(null, getPosition(), ModSoundEvents.ENTITY_ISLAMIST_BLOW, getSoundCategory(), 2.0F, 1.0F);
|
||||
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * f, flag);
|
||||
this.setDead();
|
||||
this.spawnLingeringCloud();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fall(float distance, float damageMultiplier)
|
||||
{
|
||||
super.fall(distance, damageMultiplier);
|
||||
this.timeSinceIgnited = (int) (this.timeSinceIgnited + distance * 1.5F);
|
||||
|
||||
if (this.timeSinceIgnited > this.fuseTime - 5)
|
||||
{
|
||||
this.timeSinceIgnited = this.fuseTime - 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_ISLAMIST_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getCreeperFlashIntensity(float p_70831_1_)
|
||||
{
|
||||
return (this.lastActiveTime + (this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (this.fuseTime - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCreeperState()
|
||||
{
|
||||
return this.dataManager.get(STATE).intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_ISLAMIST_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return LootTableList.ENTITIES_CREEPER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFallHeight()
|
||||
{
|
||||
return this.getAttackTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPowered()
|
||||
{
|
||||
return this.dataManager.get(POWERED).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIgnited()
|
||||
{
|
||||
return this.dataManager.get(IGNITED).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignite()
|
||||
{
|
||||
this.dataManager.set(IGNITED, Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementDroppedSkulls()
|
||||
{
|
||||
++this.droppedSkulls;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEntityAI()
|
||||
{
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAICreeperSwell(this));
|
||||
this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D));
|
||||
this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
|
||||
this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 0.8D));
|
||||
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(6, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
|
||||
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource cause)
|
||||
{
|
||||
super.onDeath(cause);
|
||||
|
||||
if (this.world.getGameRules().getBoolean("doMobLoot"))
|
||||
{
|
||||
if (cause.getTrueSource() instanceof EntitySkeleton)
|
||||
{
|
||||
int i = Item.getIdFromItem(Items.RECORD_13);
|
||||
int j = Item.getIdFromItem(Items.RECORD_WAIT);
|
||||
int k = i + this.rand.nextInt(j - i + 1);
|
||||
this.dropItem(Item.getItemById(k), 1);
|
||||
}
|
||||
else if (cause.getTrueSource() instanceof EntityIslamist && cause.getTrueSource() != this && ((EntityIslamist) cause.getTrueSource()).getPowered()
|
||||
&& ((EntityIslamist) cause.getTrueSource()).ableToCauseSkullDrop())
|
||||
{
|
||||
((EntityIslamist) cause.getTrueSource()).incrementDroppedSkulls();
|
||||
this.entityDropItem(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStruckByLightning(EntityLightningBolt lightningBolt)
|
||||
{
|
||||
super.onStruckByLightning(lightningBolt);
|
||||
this.dataManager.set(POWERED, Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
|
@ -55,28 +262,89 @@ public class EntityIslamist extends EntityCreeper
|
|||
super.onUpdate();
|
||||
}
|
||||
|
||||
private void explode()
|
||||
@Override
|
||||
protected boolean processInteract(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
|
||||
if (itemstack.getItem() == Items.FLINT_AND_STEEL)
|
||||
{
|
||||
this.world.playSound(player, this.posX, this.posY, this.posZ, SoundEvents.ITEM_FLINTANDSTEEL_USE, this.getSoundCategory(), 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
|
||||
player.swingArm(hand);
|
||||
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this);
|
||||
float f = this.getPowered() ? 2.0F : 1.0F;
|
||||
this.dead = true;
|
||||
this.world.playSound(null, getPosition(), ModSoundEvents.ENTITY_ISLAMIST_BLOW, getSoundCategory(), 1.0F, 1.0F);
|
||||
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * f, flag);
|
||||
this.setDead();
|
||||
this.ignite();
|
||||
itemstack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.processInteract(player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.readEntityFromNBT(compound);
|
||||
this.dataManager.set(POWERED, Boolean.valueOf(compound.getBoolean("powered")));
|
||||
|
||||
if (compound.hasKey("Fuse", 99))
|
||||
{
|
||||
this.fuseTime = compound.getShort("Fuse");
|
||||
}
|
||||
|
||||
if (compound.hasKey("ExplosionRadius", 99))
|
||||
{
|
||||
this.explosionRadius = compound.getByte("ExplosionRadius");
|
||||
}
|
||||
|
||||
if (compound.getBoolean("ignited"))
|
||||
{
|
||||
this.ignite();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
public void setCreeperState(int state)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_ISLAMIST_HURT;
|
||||
this.dataManager.set(STATE, Integer.valueOf(state));
|
||||
}
|
||||
|
||||
private void spawnLingeringCloud()
|
||||
{
|
||||
Collection<PotionEffect> collection = this.getActivePotionEffects();
|
||||
|
||||
if (!collection.isEmpty())
|
||||
{
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.posX, this.posY, this.posZ);
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration() / 2);
|
||||
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / entityareaeffectcloud.getDuration());
|
||||
|
||||
for (PotionEffect potioneffect : collection)
|
||||
{
|
||||
entityareaeffectcloud.addEffect(new PotionEffect(potioneffect));
|
||||
}
|
||||
|
||||
this.world.spawnEntity(entityareaeffectcloud);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
public void writeEntityToNBT(NBTTagCompound compound)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_ISLAMIST_AMBIENT;
|
||||
super.writeEntityToNBT(compound);
|
||||
|
||||
if (this.dataManager.get(POWERED).booleanValue())
|
||||
{
|
||||
compound.setBoolean("powered", true);
|
||||
}
|
||||
|
||||
compound.setShort("Fuse", (short) this.fuseTime);
|
||||
compound.setByte("ExplosionRadius", (byte) this.explosionRadius);
|
||||
compound.setBoolean("ignited", this.hasIgnited());
|
||||
}
|
||||
}
|
|
@ -50,10 +50,16 @@ public class EntityJens extends EntityPig
|
|||
private static final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(ModItems.RAM);
|
||||
private static final Set<Item> FISH_ITEMS = Sets.newHashSet(Items.FISH);
|
||||
|
||||
public static void registerFixesJens(DataFixer fixer)
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntityJens.class);
|
||||
}
|
||||
|
||||
private boolean boosting;
|
||||
private int boostTime;
|
||||
private int totalBoostTime;
|
||||
public boolean digesting = false;
|
||||
|
||||
public int digest_time = 0;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -65,21 +71,6 @@ public class EntityJens extends EntityPig
|
|||
setSize(0.6F, 2.2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEntityAI()
|
||||
{
|
||||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(1, new EntityAIPanic(this, 1.25D));
|
||||
this.tasks.addTask(2, new EntityAIEatDroppedFish(this));
|
||||
this.tasks.addTask(3, new EntityAIMate(this, 1.0D));
|
||||
this.tasks.addTask(4, new EntityAITempt(this, 1.2D, false, TEMPTATION_ITEMS));
|
||||
this.tasks.addTask(4, new EntityAITempt(this, 1.2D, ModItems.RAM_ON_A_STICK, false));
|
||||
this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D));
|
||||
this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 1.0D));
|
||||
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
|
||||
this.tasks.addTask(8, new EntityAILookIdle(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes()
|
||||
{
|
||||
|
@ -89,10 +80,20 @@ public class EntityJens extends EntityPig
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Entity getControllingPassenger()
|
||||
public boolean boost()
|
||||
{
|
||||
return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0);
|
||||
if (this.boosting)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.boosting = true;
|
||||
this.boostTime = 0;
|
||||
this.totalBoostTime = this.getRNG().nextInt(841) + 140;
|
||||
this.getDataManager().set(BOOST_TIME, Integer.valueOf(this.totalBoostTime));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,16 +113,26 @@ public class EntityJens extends EntityPig
|
|||
}
|
||||
|
||||
@Override
|
||||
public void notifyDataManagerChange(DataParameter<?> key)
|
||||
public EntityJens createChild(EntityAgeable ageable)
|
||||
{
|
||||
if (BOOST_TIME.equals(key) && this.world.isRemote)
|
||||
{
|
||||
this.boosting = true;
|
||||
this.boostTime = 0;
|
||||
this.totalBoostTime = this.dataManager.get(BOOST_TIME).intValue();
|
||||
return new EntityJens(this.world);
|
||||
}
|
||||
|
||||
super.notifyDataManagerChange(key);
|
||||
public void digestFish()
|
||||
{
|
||||
this.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F);
|
||||
|
||||
this.digesting = true;
|
||||
this.digest_time = (ModConfigs.Jens_digest_time * 20);
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
double d0 = this.rand.nextGaussian() * 0.02D;
|
||||
double d1 = this.rand.nextGaussian() * 0.02D;
|
||||
double d2 = this.rand.nextGaussian() * 0.02D;
|
||||
MINECRAFT.world.spawnParticle(EnumParticleTypes.HEART, this.posX + this.rand.nextFloat() * this.width * 2.0F - this.width, this.posY + 0.5D + this.rand.nextFloat() * this.height,
|
||||
this.posZ + this.rand.nextFloat() * this.width * 2.0F - this.width, d0, d1, d2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,23 +143,80 @@ public class EntityJens extends EntityPig
|
|||
this.dataManager.register(BOOST_TIME, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
public static void registerFixesJens(DataFixer fixer)
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntityJens.class);
|
||||
return ModSoundEvents.ENTITY_JENS_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound)
|
||||
@Nullable
|
||||
public Entity getControllingPassenger()
|
||||
{
|
||||
super.writeEntityToNBT(compound);
|
||||
compound.setBoolean("Saddle", this.getSaddled());
|
||||
return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound)
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
super.readEntityFromNBT(compound);
|
||||
this.setSaddled(compound.getBoolean("Saddle"));
|
||||
return ModSoundEvents.ENTITY_JENS_DEATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_JENS_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return ModLootTableList.ENTITIES_JENS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSaddled()
|
||||
{
|
||||
return this.dataManager.get(SADDLED).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEntityAI()
|
||||
{
|
||||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(1, new EntityAIPanic(this, 1.25D));
|
||||
this.tasks.addTask(2, new EntityAIEatDroppedFish(this));
|
||||
this.tasks.addTask(3, new EntityAIMate(this, 1.0D));
|
||||
this.tasks.addTask(4, new EntityAITempt(this, 1.2D, false, TEMPTATION_ITEMS));
|
||||
this.tasks.addTask(4, new EntityAITempt(this, 1.2D, ModItems.RAM_ON_A_STICK, false));
|
||||
this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D));
|
||||
this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 1.0D));
|
||||
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
|
||||
this.tasks.addTask(8, new EntityAILookIdle(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBreedingItem(ItemStack stack)
|
||||
{
|
||||
return TEMPTATION_ITEMS.contains(stack.getItem());
|
||||
}
|
||||
|
||||
public boolean isFishItem(ItemStack stack)
|
||||
{
|
||||
return FISH_ITEMS.contains(stack.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyDataManagerChange(DataParameter<?> key)
|
||||
{
|
||||
if (BOOST_TIME.equals(key) && this.world.isRemote)
|
||||
{
|
||||
this.boosting = true;
|
||||
this.boostTime = 0;
|
||||
this.totalBoostTime = this.dataManager.get(BOOST_TIME).intValue();
|
||||
}
|
||||
|
||||
super.notifyDataManagerChange(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -166,41 +234,32 @@ public class EntityJens extends EntityPig
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean getSaddled()
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
return this.dataManager.get(SADDLED).booleanValue();
|
||||
super.onLivingUpdate();
|
||||
|
||||
if (!this.world.isRemote && this.digesting == true && this.digest_time > 0)
|
||||
{
|
||||
this.digest_time--;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSaddled(boolean saddled)
|
||||
if (!this.world.isRemote && this.digesting == true && this.digest_time <= 0)
|
||||
{
|
||||
if (saddled)
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
this.dataManager.set(SADDLED, Boolean.valueOf(true));
|
||||
double d0 = this.rand.nextGaussian() * 0.02D;
|
||||
double d1 = this.rand.nextGaussian() * 0.02D;
|
||||
double d2 = this.rand.nextGaussian() * 0.02D;
|
||||
MINECRAFT.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + this.rand.nextFloat() * this.width * 2.0F - this.width, this.posY + 0.5D + this.rand.nextFloat() * this.height,
|
||||
this.posZ + this.rand.nextFloat() * this.width * 2.0F - this.width, d0, d1, d2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dataManager.set(SADDLED, Boolean.valueOf(false));
|
||||
this.playSound(ModSoundEvents.ENTITY_JENS_POOP, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||
this.dropItem(ModItems.SURSTROEMMING, 1);
|
||||
this.digesting = false;
|
||||
this.digest_time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBreedingItem(ItemStack stack)
|
||||
{
|
||||
return TEMPTATION_ITEMS.contains(stack.getItem());
|
||||
}
|
||||
|
||||
public boolean isFishItem(ItemStack stack)
|
||||
{
|
||||
return FISH_ITEMS.contains(stack.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityJens createChild(EntityAgeable ageable)
|
||||
{
|
||||
return new EntityJens(this.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processInteract(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
|
@ -243,46 +302,22 @@ public class EntityJens extends EntityPig
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLivingUpdate()
|
||||
public void readEntityFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
|
||||
if (!this.world.isRemote && this.digesting == true && this.digest_time > 0)
|
||||
{
|
||||
this.digest_time--;
|
||||
super.readEntityFromNBT(compound);
|
||||
this.setSaddled(compound.getBoolean("Saddle"));
|
||||
}
|
||||
|
||||
if (!this.world.isRemote && this.digesting == true && this.digest_time <= 0)
|
||||
@Override
|
||||
public void setSaddled(boolean saddled)
|
||||
{
|
||||
for (int i = 0; i < 7; ++i)
|
||||
if (saddled)
|
||||
{
|
||||
double d0 = this.rand.nextGaussian() * 0.02D;
|
||||
double d1 = this.rand.nextGaussian() * 0.02D;
|
||||
double d2 = this.rand.nextGaussian() * 0.02D;
|
||||
MINECRAFT.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + this.rand.nextFloat() * this.width * 2.0F - this.width, this.posY + 0.5D + this.rand.nextFloat() * this.height,
|
||||
this.posZ + this.rand.nextFloat() * this.width * 2.0F - this.width, d0, d1, d2);
|
||||
this.dataManager.set(SADDLED, Boolean.valueOf(true));
|
||||
}
|
||||
this.playSound(ModSoundEvents.ENTITY_JENS_POOP, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||
this.dropItem(ModItems.SURSTROEMMING, 1);
|
||||
this.digesting = false;
|
||||
this.digest_time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void digestFish()
|
||||
else
|
||||
{
|
||||
this.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F);
|
||||
|
||||
this.digesting = true;
|
||||
this.digest_time = (ModConfigs.Jens_digest_time * 20);
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
double d0 = this.rand.nextGaussian() * 0.02D;
|
||||
double d1 = this.rand.nextGaussian() * 0.02D;
|
||||
double d2 = this.rand.nextGaussian() * 0.02D;
|
||||
MINECRAFT.world.spawnParticle(EnumParticleTypes.HEART, this.posX + this.rand.nextFloat() * this.width * 2.0F - this.width, this.posY + 0.5D + this.rand.nextFloat() * this.height,
|
||||
this.posZ + this.rand.nextFloat() * this.width * 2.0F - this.width, d0, d1, d2);
|
||||
this.dataManager.set(SADDLED, Boolean.valueOf(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,43 +383,9 @@ public class EntityJens extends EntityPig
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean boost()
|
||||
public void writeEntityToNBT(NBTTagCompound compound)
|
||||
{
|
||||
if (this.boosting)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.boosting = true;
|
||||
this.boostTime = 0;
|
||||
this.totalBoostTime = this.getRNG().nextInt(841) + 140;
|
||||
this.getDataManager().set(BOOST_TIME, Integer.valueOf(this.totalBoostTime));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return ModLootTableList.ENTITIES_JENS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_JENS_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_JENS_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_JENS_DEATH;
|
||||
super.writeEntityToNBT(compound);
|
||||
compound.setBoolean("Saddle", this.getSaddled());
|
||||
}
|
||||
}
|
|
@ -20,15 +20,15 @@ public class EntityMarcellDAvis extends EntityZombie
|
|||
return ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_MARCELLDAVIS_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_MARCELLDAVIS_HURT;
|
||||
}
|
||||
}
|
|
@ -20,15 +20,15 @@ public class EntityMrBean extends EntityZombie
|
|||
return ModSoundEvents.ENTITY_MRBEAN_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_MRBEAN_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_MRBEAN_DEATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_MRBEAN_HURT;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -54,12 +54,6 @@ public class EntitySchalkerBullet extends Entity
|
|||
this.noClip = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundCategory getSoundCategory()
|
||||
{
|
||||
return SoundCategory.HOSTILE;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EntitySchalkerBullet(World worldIn, double x, double y, double z, double motionXIn, double motionYIn, double motionZIn)
|
||||
{
|
||||
|
@ -85,71 +79,53 @@ public class EntitySchalkerBullet extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound compound)
|
||||
public boolean attackEntityFrom(DamageSource source, float amount)
|
||||
{
|
||||
if (this.owner != null)
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(this.owner);
|
||||
NBTTagCompound nbttagcompound = NBTUtil.createUUIDTag(this.owner.getUniqueID());
|
||||
nbttagcompound.setInteger("X", blockpos.getX());
|
||||
nbttagcompound.setInteger("Y", blockpos.getY());
|
||||
nbttagcompound.setInteger("Z", blockpos.getZ());
|
||||
compound.setTag("Owner", nbttagcompound);
|
||||
this.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HURT, 1.0F, 1.0F);
|
||||
((WorldServer) this.world).spawnParticle(EnumParticleTypes.CRIT, this.posX, this.posY, this.posZ, 15, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if (this.target != null)
|
||||
{
|
||||
BlockPos blockpos1 = new BlockPos(this.target);
|
||||
NBTTagCompound nbttagcompound1 = NBTUtil.createUUIDTag(this.target.getUniqueID());
|
||||
nbttagcompound1.setInteger("X", blockpos1.getX());
|
||||
nbttagcompound1.setInteger("Y", blockpos1.getY());
|
||||
nbttagcompound1.setInteger("Z", blockpos1.getZ());
|
||||
compound.setTag("Target", nbttagcompound1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.direction != null)
|
||||
protected void bulletHit(RayTraceResult result)
|
||||
{
|
||||
compound.setInteger("Dir", this.direction.getIndex());
|
||||
if (result.entityHit == null)
|
||||
{
|
||||
((WorldServer) this.world).spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 2, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
this.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HIT, 1.0F, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean flag = result.entityHit.attackEntityFrom(DamageSource.causeIndirectDamage(this, this.owner).setProjectile(), 4.0F);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.applyEnchantments(this.owner, result.entityHit);
|
||||
|
||||
if (result.entityHit instanceof EntityLivingBase)
|
||||
{
|
||||
((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 200));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compound.setInteger("Steps", this.steps);
|
||||
compound.setDouble("TXD", this.targetDeltaX);
|
||||
compound.setDouble("TYD", this.targetDeltaY);
|
||||
compound.setDouble("TZD", this.targetDeltaZ);
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
* Returns true if other Entities should be prevented from moving through this Entity.
|
||||
*/
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound compound)
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
this.steps = compound.getInteger("Steps");
|
||||
this.targetDeltaX = compound.getDouble("TXD");
|
||||
this.targetDeltaY = compound.getDouble("TYD");
|
||||
this.targetDeltaZ = compound.getDouble("TZD");
|
||||
|
||||
if (compound.hasKey("Dir", 99))
|
||||
{
|
||||
this.direction = EnumFacing.getFront(compound.getInteger("Dir"));
|
||||
}
|
||||
|
||||
if (compound.hasKey("Owner", 10))
|
||||
{
|
||||
NBTTagCompound nbttagcompound = compound.getCompoundTag("Owner");
|
||||
this.ownerUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound);
|
||||
this.ownerBlockPos = new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z"));
|
||||
}
|
||||
|
||||
if (compound.hasKey("Target", 10))
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = compound.getCompoundTag("Target");
|
||||
this.targetUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound1);
|
||||
this.targetBlockPos = new BlockPos(nbttagcompound1.getInteger("X"), nbttagcompound1.getInteger("Y"), nbttagcompound1.getInteger("Z"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,114 +133,45 @@ public class EntitySchalkerBullet extends Entity
|
|||
{
|
||||
}
|
||||
|
||||
private void setDirection(@Nullable
|
||||
EnumFacing directionIn)
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
@Override
|
||||
public float getBrightness()
|
||||
{
|
||||
this.direction = directionIn;
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
private void selectNextMoveDirection(@Nullable
|
||||
EnumFacing.Axis p_184569_1_)
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBrightnessForRender()
|
||||
{
|
||||
double d0 = 0.5D;
|
||||
BlockPos blockpos;
|
||||
|
||||
if (this.target == null)
|
||||
{
|
||||
blockpos = (new BlockPos(this)).down();
|
||||
}
|
||||
else
|
||||
{
|
||||
d0 = this.target.height * 0.5D;
|
||||
blockpos = new BlockPos(this.target.posX, this.target.posY + d0, this.target.posZ);
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
double d1 = blockpos.getX() + 0.5D;
|
||||
double d2 = blockpos.getY() + d0;
|
||||
double d3 = blockpos.getZ() + 0.5D;
|
||||
EnumFacing enumfacing = null;
|
||||
|
||||
if (blockpos.distanceSqToCenter(this.posX, this.posY, this.posZ) >= 4.0D)
|
||||
@Override
|
||||
public SoundCategory getSoundCategory()
|
||||
{
|
||||
BlockPos blockpos1 = new BlockPos(this);
|
||||
List<EnumFacing> list = Lists.<EnumFacing>newArrayList();
|
||||
|
||||
if (p_184569_1_ != EnumFacing.Axis.X)
|
||||
{
|
||||
if (blockpos1.getX() < blockpos.getX() && this.world.isAirBlock(blockpos1.east()))
|
||||
{
|
||||
list.add(EnumFacing.EAST);
|
||||
}
|
||||
else if (blockpos1.getX() > blockpos.getX() && this.world.isAirBlock(blockpos1.west()))
|
||||
{
|
||||
list.add(EnumFacing.WEST);
|
||||
}
|
||||
return SoundCategory.HOSTILE;
|
||||
}
|
||||
|
||||
if (p_184569_1_ != EnumFacing.Axis.Y)
|
||||
/**
|
||||
* Returns true if the entity is on fire. Used by render to add the fire effect on rendering.
|
||||
*/
|
||||
@Override
|
||||
public boolean isBurning()
|
||||
{
|
||||
if (blockpos1.getY() < blockpos.getY() && this.world.isAirBlock(blockpos1.up()))
|
||||
{
|
||||
list.add(EnumFacing.UP);
|
||||
}
|
||||
else if (blockpos1.getY() > blockpos.getY() && this.world.isAirBlock(blockpos1.down()))
|
||||
{
|
||||
list.add(EnumFacing.DOWN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p_184569_1_ != EnumFacing.Axis.Z)
|
||||
/**
|
||||
* Checks if the entity is in range to render.
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
{
|
||||
if (blockpos1.getZ() < blockpos.getZ() && this.world.isAirBlock(blockpos1.south()))
|
||||
{
|
||||
list.add(EnumFacing.SOUTH);
|
||||
}
|
||||
else if (blockpos1.getZ() > blockpos.getZ() && this.world.isAirBlock(blockpos1.north()))
|
||||
{
|
||||
list.add(EnumFacing.NORTH);
|
||||
}
|
||||
}
|
||||
|
||||
enumfacing = EnumFacing.random(this.rand);
|
||||
|
||||
if (list.isEmpty())
|
||||
{
|
||||
for (int i = 5; !this.world.isAirBlock(blockpos1.offset(enumfacing)) && i > 0; --i)
|
||||
{
|
||||
enumfacing = EnumFacing.random(this.rand);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enumfacing = list.get(this.rand.nextInt(list.size()));
|
||||
}
|
||||
|
||||
d1 = this.posX + enumfacing.getFrontOffsetX();
|
||||
d2 = this.posY + enumfacing.getFrontOffsetY();
|
||||
d3 = this.posZ + enumfacing.getFrontOffsetZ();
|
||||
}
|
||||
|
||||
this.setDirection(enumfacing);
|
||||
double d6 = d1 - this.posX;
|
||||
double d7 = d2 - this.posY;
|
||||
double d4 = d3 - this.posZ;
|
||||
double d5 = MathHelper.sqrt(d6 * d6 + d7 * d7 + d4 * d4);
|
||||
|
||||
if (d5 == 0.0D)
|
||||
{
|
||||
this.targetDeltaX = 0.0D;
|
||||
this.targetDeltaY = 0.0D;
|
||||
this.targetDeltaZ = 0.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.targetDeltaX = d6 / d5 * 0.15D;
|
||||
this.targetDeltaY = d7 / d5 * 0.15D;
|
||||
this.targetDeltaZ = d4 / d5 * 0.15D;
|
||||
}
|
||||
|
||||
this.isAirBorne = true;
|
||||
this.steps = 10 + this.rand.nextInt(5) * 10;
|
||||
return distance < 16384.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -382,87 +289,180 @@ public class EntitySchalkerBullet extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if the entity is on fire. Used by render to add the fire effect on rendering.
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public boolean isBurning()
|
||||
protected void readEntityFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
return false;
|
||||
this.steps = compound.getInteger("Steps");
|
||||
this.targetDeltaX = compound.getDouble("TXD");
|
||||
this.targetDeltaY = compound.getDouble("TYD");
|
||||
this.targetDeltaZ = compound.getDouble("TZD");
|
||||
|
||||
if (compound.hasKey("Dir", 99))
|
||||
{
|
||||
this.direction = EnumFacing.getFront(compound.getInteger("Dir"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entity is in range to render.
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
if (compound.hasKey("Owner", 10))
|
||||
{
|
||||
return distance < 16384.0D;
|
||||
NBTTagCompound nbttagcompound = compound.getCompoundTag("Owner");
|
||||
this.ownerUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound);
|
||||
this.ownerBlockPos = new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
@Override
|
||||
public float getBrightness()
|
||||
if (compound.hasKey("Target", 10))
|
||||
{
|
||||
return 1.0F;
|
||||
NBTTagCompound nbttagcompound1 = compound.getCompoundTag("Target");
|
||||
this.targetUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound1);
|
||||
this.targetBlockPos = new BlockPos(nbttagcompound1.getInteger("X"), nbttagcompound1.getInteger("Y"), nbttagcompound1.getInteger("Z"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBrightnessForRender()
|
||||
private void selectNextMoveDirection(@Nullable
|
||||
EnumFacing.Axis p_184569_1_)
|
||||
{
|
||||
return 15728880;
|
||||
}
|
||||
double d0 = 0.5D;
|
||||
BlockPos blockpos;
|
||||
|
||||
protected void bulletHit(RayTraceResult result)
|
||||
if (this.target == null)
|
||||
{
|
||||
if (result.entityHit == null)
|
||||
{
|
||||
((WorldServer) this.world).spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 2, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
this.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HIT, 1.0F, 1.0F);
|
||||
blockpos = (new BlockPos(this)).down();
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean flag = result.entityHit.attackEntityFrom(DamageSource.causeIndirectDamage(this, this.owner).setProjectile(), 4.0F);
|
||||
d0 = this.target.height * 0.5D;
|
||||
blockpos = new BlockPos(this.target.posX, this.target.posY + d0, this.target.posZ);
|
||||
}
|
||||
|
||||
if (flag)
|
||||
double d1 = blockpos.getX() + 0.5D;
|
||||
double d2 = blockpos.getY() + d0;
|
||||
double d3 = blockpos.getZ() + 0.5D;
|
||||
EnumFacing enumfacing = null;
|
||||
|
||||
if (blockpos.distanceSqToCenter(this.posX, this.posY, this.posZ) >= 4.0D)
|
||||
{
|
||||
this.applyEnchantments(this.owner, result.entityHit);
|
||||
BlockPos blockpos1 = new BlockPos(this);
|
||||
List<EnumFacing> list = Lists.<EnumFacing>newArrayList();
|
||||
|
||||
if (result.entityHit instanceof EntityLivingBase)
|
||||
if (p_184569_1_ != EnumFacing.Axis.X)
|
||||
{
|
||||
((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 200));
|
||||
if (blockpos1.getX() < blockpos.getX() && this.world.isAirBlock(blockpos1.east()))
|
||||
{
|
||||
list.add(EnumFacing.EAST);
|
||||
}
|
||||
else if (blockpos1.getX() > blockpos.getX() && this.world.isAirBlock(blockpos1.west()))
|
||||
{
|
||||
list.add(EnumFacing.WEST);
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
if (p_184569_1_ != EnumFacing.Axis.Y)
|
||||
{
|
||||
if (blockpos1.getY() < blockpos.getY() && this.world.isAirBlock(blockpos1.up()))
|
||||
{
|
||||
list.add(EnumFacing.UP);
|
||||
}
|
||||
else if (blockpos1.getY() > blockpos.getY() && this.world.isAirBlock(blockpos1.down()))
|
||||
{
|
||||
list.add(EnumFacing.DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_184569_1_ != EnumFacing.Axis.Z)
|
||||
{
|
||||
if (blockpos1.getZ() < blockpos.getZ() && this.world.isAirBlock(blockpos1.south()))
|
||||
{
|
||||
list.add(EnumFacing.SOUTH);
|
||||
}
|
||||
else if (blockpos1.getZ() > blockpos.getZ() && this.world.isAirBlock(blockpos1.north()))
|
||||
{
|
||||
list.add(EnumFacing.NORTH);
|
||||
}
|
||||
}
|
||||
|
||||
enumfacing = EnumFacing.random(this.rand);
|
||||
|
||||
if (list.isEmpty())
|
||||
{
|
||||
for (int i = 5; !this.world.isAirBlock(blockpos1.offset(enumfacing)) && i > 0; --i)
|
||||
{
|
||||
enumfacing = EnumFacing.random(this.rand);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enumfacing = list.get(this.rand.nextInt(list.size()));
|
||||
}
|
||||
|
||||
d1 = this.posX + enumfacing.getFrontOffsetX();
|
||||
d2 = this.posY + enumfacing.getFrontOffsetY();
|
||||
d3 = this.posZ + enumfacing.getFrontOffsetZ();
|
||||
}
|
||||
|
||||
this.setDirection(enumfacing);
|
||||
double d6 = d1 - this.posX;
|
||||
double d7 = d2 - this.posY;
|
||||
double d4 = d3 - this.posZ;
|
||||
double d5 = MathHelper.sqrt(d6 * d6 + d7 * d7 + d4 * d4);
|
||||
|
||||
if (d5 == 0.0D)
|
||||
{
|
||||
this.targetDeltaX = 0.0D;
|
||||
this.targetDeltaY = 0.0D;
|
||||
this.targetDeltaZ = 0.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.targetDeltaX = d6 / d5 * 0.15D;
|
||||
this.targetDeltaY = d7 / d5 * 0.15D;
|
||||
this.targetDeltaZ = d4 / d5 * 0.15D;
|
||||
}
|
||||
|
||||
this.isAirBorne = true;
|
||||
this.steps = 10 + this.rand.nextInt(5) * 10;
|
||||
}
|
||||
|
||||
private void setDirection(@Nullable
|
||||
EnumFacing directionIn)
|
||||
{
|
||||
this.direction = directionIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if other Entities should be prevented from moving through this Entity.
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public boolean canBeCollidedWith()
|
||||
protected void writeEntityToNBT(NBTTagCompound compound)
|
||||
{
|
||||
return true;
|
||||
if (this.owner != null)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(this.owner);
|
||||
NBTTagCompound nbttagcompound = NBTUtil.createUUIDTag(this.owner.getUniqueID());
|
||||
nbttagcompound.setInteger("X", blockpos.getX());
|
||||
nbttagcompound.setInteger("Y", blockpos.getY());
|
||||
nbttagcompound.setInteger("Z", blockpos.getZ());
|
||||
compound.setTag("Owner", nbttagcompound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount)
|
||||
if (this.target != null)
|
||||
{
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
this.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HURT, 1.0F, 1.0F);
|
||||
((WorldServer) this.world).spawnParticle(EnumParticleTypes.CRIT, this.posX, this.posY, this.posZ, 15, 0.2D, 0.2D, 0.2D, 0.0D);
|
||||
this.setDead();
|
||||
BlockPos blockpos1 = new BlockPos(this.target);
|
||||
NBTTagCompound nbttagcompound1 = NBTUtil.createUUIDTag(this.target.getUniqueID());
|
||||
nbttagcompound1.setInteger("X", blockpos1.getX());
|
||||
nbttagcompound1.setInteger("Y", blockpos1.getY());
|
||||
nbttagcompound1.setInteger("Z", blockpos1.getZ());
|
||||
compound.setTag("Target", nbttagcompound1);
|
||||
}
|
||||
|
||||
return true;
|
||||
if (this.direction != null)
|
||||
{
|
||||
compound.setInteger("Dir", this.direction.getIndex());
|
||||
}
|
||||
|
||||
compound.setInteger("Steps", this.steps);
|
||||
compound.setDouble("TXD", this.targetDeltaX);
|
||||
compound.setDouble("TYD", this.targetDeltaY);
|
||||
compound.setDouble("TZD", this.targetDeltaZ);
|
||||
}
|
||||
}
|
|
@ -1,24 +1,229 @@
|
|||
package mod.acgaming.spackenmobs.entities;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mod.acgaming.spackenmobs.misc.ModSoundEvents;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAreaEffectCloud;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
import net.minecraft.entity.ai.EntityAIAvoidEntity;
|
||||
import net.minecraft.entity.ai.EntityAICreeperSwell;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.datafix.DataFixer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntitySmavaCreeper extends EntityCreeper
|
||||
{
|
||||
private static final DataParameter<Integer> STATE = EntityDataManager.<Integer>createKey(EntitySmavaCreeper.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Boolean> POWERED = EntityDataManager.<Boolean>createKey(EntitySmavaCreeper.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Boolean> IGNITED = EntityDataManager.<Boolean>createKey(EntitySmavaCreeper.class, DataSerializers.BOOLEAN);
|
||||
|
||||
public static void registerFixesSmavaCreeper(DataFixer fixer)
|
||||
{
|
||||
EntityLiving.registerFixesMob(fixer, EntitySmavaCreeper.class);
|
||||
}
|
||||
|
||||
private int lastActiveTime;
|
||||
private int timeSinceIgnited;
|
||||
private int fuseTime = 20;
|
||||
private int explosionRadius = 6;
|
||||
|
||||
private int droppedSkulls;
|
||||
|
||||
public EntitySmavaCreeper(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
setSize(0.6F, 1.7F);
|
||||
getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D);
|
||||
this.setSize(0.6F, 1.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ableToCauseSkullDrop()
|
||||
{
|
||||
return this.droppedSkulls < 1 && this.world.getGameRules().getBoolean("doMobLoot");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes()
|
||||
{
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity entityIn)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataManager.register(STATE, Integer.valueOf(-1));
|
||||
this.dataManager.register(POWERED, Boolean.valueOf(false));
|
||||
this.dataManager.register(IGNITED, Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
private void explode()
|
||||
{
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this);
|
||||
float f = this.getPowered() ? 2.0F : 1.0F;
|
||||
this.dead = true;
|
||||
this.world.playSound(null, getPosition(), ModSoundEvents.ENTITY_SMAVACREEPER_BLOW, getSoundCategory(), 5.0F, 1.0F);
|
||||
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * f, flag);
|
||||
this.setDead();
|
||||
this.spawnLingeringCloud();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fall(float distance, float damageMultiplier)
|
||||
{
|
||||
super.fall(distance, damageMultiplier);
|
||||
this.timeSinceIgnited = (int) (this.timeSinceIgnited + distance * 1.5F);
|
||||
|
||||
if (this.timeSinceIgnited > this.fuseTime - 5)
|
||||
{
|
||||
this.timeSinceIgnited = this.fuseTime - 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getCreeperFlashIntensity(float p_70831_1_)
|
||||
{
|
||||
return (this.lastActiveTime + (this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (this.fuseTime - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCreeperState()
|
||||
{
|
||||
return this.dataManager.get(STATE).intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_SMAVACREEPER_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ResourceLocation getLootTable()
|
||||
{
|
||||
return LootTableList.ENTITIES_CREEPER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFallHeight()
|
||||
{
|
||||
return this.getAttackTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPowered()
|
||||
{
|
||||
return this.dataManager.get(POWERED).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIgnited()
|
||||
{
|
||||
return this.dataManager.get(IGNITED).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignite()
|
||||
{
|
||||
this.dataManager.set(IGNITED, Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementDroppedSkulls()
|
||||
{
|
||||
++this.droppedSkulls;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEntityAI()
|
||||
{
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAICreeperSwell(this));
|
||||
this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D));
|
||||
this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
|
||||
this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 0.8D));
|
||||
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(6, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
|
||||
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource cause)
|
||||
{
|
||||
super.onDeath(cause);
|
||||
|
||||
if (this.world.getGameRules().getBoolean("doMobLoot"))
|
||||
{
|
||||
if (cause.getTrueSource() instanceof EntitySkeleton)
|
||||
{
|
||||
int i = Item.getIdFromItem(Items.RECORD_13);
|
||||
int j = Item.getIdFromItem(Items.RECORD_WAIT);
|
||||
int k = i + this.rand.nextInt(j - i + 1);
|
||||
this.dropItem(Item.getItemById(k), 1);
|
||||
}
|
||||
else if (cause.getTrueSource() instanceof EntitySmavaCreeper && cause.getTrueSource() != this && ((EntitySmavaCreeper) cause.getTrueSource()).getPowered()
|
||||
&& ((EntitySmavaCreeper) cause.getTrueSource()).ableToCauseSkullDrop())
|
||||
{
|
||||
((EntitySmavaCreeper) cause.getTrueSource()).incrementDroppedSkulls();
|
||||
this.entityDropItem(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStruckByLightning(EntityLightningBolt lightningBolt)
|
||||
{
|
||||
super.onStruckByLightning(lightningBolt);
|
||||
this.dataManager.set(POWERED, Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,28 +262,89 @@ public class EntitySmavaCreeper extends EntityCreeper
|
|||
super.onUpdate();
|
||||
}
|
||||
|
||||
private void explode()
|
||||
@Override
|
||||
protected boolean processInteract(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
|
||||
if (itemstack.getItem() == Items.FLINT_AND_STEEL)
|
||||
{
|
||||
this.world.playSound(player, this.posX, this.posY, this.posZ, SoundEvents.ITEM_FLINTANDSTEEL_USE, this.getSoundCategory(), 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
|
||||
player.swingArm(hand);
|
||||
|
||||
if (!this.world.isRemote)
|
||||
{
|
||||
boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this);
|
||||
float f = this.getPowered() ? 2.0F : 1.0F;
|
||||
this.dead = true;
|
||||
this.world.playSound(null, getPosition(), ModSoundEvents.ENTITY_SMAVACREEPER_BLOW, getSoundCategory(), 5.0F, 1.0F);
|
||||
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * f, flag);
|
||||
this.setDead();
|
||||
this.ignite();
|
||||
itemstack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.processInteract(player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.readEntityFromNBT(compound);
|
||||
this.dataManager.set(POWERED, Boolean.valueOf(compound.getBoolean("powered")));
|
||||
|
||||
if (compound.hasKey("Fuse", 99))
|
||||
{
|
||||
this.fuseTime = compound.getShort("Fuse");
|
||||
}
|
||||
|
||||
if (compound.hasKey("ExplosionRadius", 99))
|
||||
{
|
||||
this.explosionRadius = compound.getByte("ExplosionRadius");
|
||||
}
|
||||
|
||||
if (compound.getBoolean("ignited"))
|
||||
{
|
||||
this.ignite();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
||||
public void setCreeperState(int state)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_SMAVACREEPER_HURT;
|
||||
this.dataManager.set(STATE, Integer.valueOf(state));
|
||||
}
|
||||
|
||||
private void spawnLingeringCloud()
|
||||
{
|
||||
Collection<PotionEffect> collection = this.getActivePotionEffects();
|
||||
|
||||
if (!collection.isEmpty())
|
||||
{
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.posX, this.posY, this.posZ);
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration() / 2);
|
||||
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / entityareaeffectcloud.getDuration());
|
||||
|
||||
for (PotionEffect potioneffect : collection)
|
||||
{
|
||||
entityareaeffectcloud.addEffect(new PotionEffect(potioneffect));
|
||||
}
|
||||
|
||||
this.world.spawnEntity(entityareaeffectcloud);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound()
|
||||
public void writeEntityToNBT(NBTTagCompound compound)
|
||||
{
|
||||
return ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT;
|
||||
super.writeEntityToNBT(compound);
|
||||
|
||||
if (this.dataManager.get(POWERED).booleanValue())
|
||||
{
|
||||
compound.setBoolean("powered", true);
|
||||
}
|
||||
|
||||
compound.setShort("Fuse", (short) this.fuseTime);
|
||||
compound.setByte("ExplosionRadius", (byte) this.explosionRadius);
|
||||
compound.setBoolean("ignited", this.hasIgnited());
|
||||
}
|
||||
}
|
|
@ -20,6 +20,49 @@ import net.minecraft.world.World;
|
|||
|
||||
public class EntityWolfMZTE extends EntityWolf
|
||||
{
|
||||
class AIAvoidEntity<T extends Entity> extends EntityAIAvoidEntity<T>
|
||||
{
|
||||
private final EntityWolfMZTE wolf;
|
||||
|
||||
public AIAvoidEntity(EntityWolfMZTE wolfIn, Class<T> p_i47251_3_, float p_i47251_4_, double p_i47251_5_, double p_i47251_7_)
|
||||
{
|
||||
super(wolfIn, p_i47251_3_, p_i47251_4_, p_i47251_5_, p_i47251_7_);
|
||||
this.wolf = wolfIn;
|
||||
}
|
||||
|
||||
private boolean avoidLlama(EntityLlama p_190854_1_)
|
||||
{
|
||||
return p_190854_1_.getStrength() >= EntityWolfMZTE.this.rand.nextInt(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
if (super.shouldExecute() && this.closestLivingEntity instanceof EntityLlama)
|
||||
{
|
||||
return !this.wolf.isTamed() && this.avoidLlama((EntityLlama) this.closestLivingEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null);
|
||||
super.startExecuting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask()
|
||||
{
|
||||
EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null);
|
||||
super.updateTask();
|
||||
}
|
||||
}
|
||||
|
||||
private static final DataParameter<Float> DATA_HEALTH_ID = EntityDataManager.<Float>createKey(EntityWolf.class, DataSerializers.FLOAT);
|
||||
private static final DataParameter<Boolean> BEGGING = EntityDataManager.<Boolean>createKey(EntityWolf.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Integer> COLLAR_COLOR = EntityDataManager.<Integer>createKey(EntityWolf.class, DataSerializers.VARINT);
|
||||
|
@ -28,6 +71,7 @@ public class EntityWolfMZTE extends EntityWolf
|
|||
private boolean isWet;
|
||||
private boolean isShaking;
|
||||
private float timeWolfIsShaking;
|
||||
|
||||
private float prevTimeWolfIsShaking;
|
||||
|
||||
public EntityWolfMZTE(World worldIn)
|
||||
|
@ -37,21 +81,6 @@ public class EntityWolfMZTE extends EntityWolf
|
|||
this.setTamed(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityWolfMZTE createChild(EntityAgeable ageable)
|
||||
{
|
||||
EntityWolfMZTE entitywolfmzte = new EntityWolfMZTE(this.world);
|
||||
UUID uuid = this.getOwnerId();
|
||||
|
||||
if (uuid != null)
|
||||
{
|
||||
entitywolfmzte.setOwnerId(uuid);
|
||||
entitywolfmzte.setTamed(true);
|
||||
}
|
||||
|
||||
return entitywolfmzte;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(EntityAnimal otherAnimal)
|
||||
{
|
||||
|
@ -86,6 +115,21 @@ public class EntityWolfMZTE extends EntityWolf
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityWolfMZTE createChild(EntityAgeable ageable)
|
||||
{
|
||||
EntityWolfMZTE entitywolfmzte = new EntityWolfMZTE(this.world);
|
||||
UUID uuid = this.getOwnerId();
|
||||
|
||||
if (uuid != null)
|
||||
{
|
||||
entitywolfmzte.setOwnerId(uuid);
|
||||
entitywolfmzte.setTamed(true);
|
||||
}
|
||||
|
||||
return entitywolfmzte;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAttackEntity(EntityLivingBase target, EntityLivingBase owner)
|
||||
{
|
||||
|
@ -115,47 +159,4 @@ public class EntityWolfMZTE extends EntityWolf
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class AIAvoidEntity<T extends Entity> extends EntityAIAvoidEntity<T>
|
||||
{
|
||||
private final EntityWolfMZTE wolf;
|
||||
|
||||
public AIAvoidEntity(EntityWolfMZTE wolfIn, Class<T> p_i47251_3_, float p_i47251_4_, double p_i47251_5_, double p_i47251_7_)
|
||||
{
|
||||
super(wolfIn, p_i47251_3_, p_i47251_4_, p_i47251_5_, p_i47251_7_);
|
||||
this.wolf = wolfIn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
if (super.shouldExecute() && this.closestLivingEntity instanceof EntityLlama)
|
||||
{
|
||||
return !this.wolf.isTamed() && this.avoidLlama((EntityLlama) this.closestLivingEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean avoidLlama(EntityLlama p_190854_1_)
|
||||
{
|
||||
return p_190854_1_.getStrength() >= EntityWolfMZTE.this.rand.nextInt(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null);
|
||||
super.startExecuting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask()
|
||||
{
|
||||
EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null);
|
||||
super.updateTask();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ public class SurstroemmingSmellsBadEvent
|
|||
{
|
||||
if (event.player instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.player;
|
||||
EntityPlayer player = event.player;
|
||||
if (player.inventory.hasItemStack(new ItemStack(ModItems.SURSTROEMMING)))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 100));
|
||||
|
|
|
@ -12,22 +12,6 @@ import net.minecraft.world.biome.Biome.SpawnListEntry;
|
|||
public class BiomeHelper
|
||||
{
|
||||
|
||||
public static Biome[] getBiomesWithMonster(Class<? extends Entity> clazz)
|
||||
{
|
||||
List<Biome> biomes = new ArrayList<>();
|
||||
for (Biome b : Biome.REGISTRY)
|
||||
{
|
||||
List<SpawnListEntry> spawnList = b.getSpawnableList(EnumCreatureType.MONSTER);
|
||||
for (SpawnListEntry e : spawnList)
|
||||
if (e.entityClass == clazz)
|
||||
{
|
||||
biomes.add(b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return biomes.toArray(new Biome[0]);
|
||||
}
|
||||
|
||||
public static Biome[] getBiomesWithCreature(Class<? extends Entity> clazz)
|
||||
{
|
||||
List<Biome> biomes = new ArrayList<>();
|
||||
|
@ -43,4 +27,20 @@ public class BiomeHelper
|
|||
}
|
||||
return biomes.toArray(new Biome[0]);
|
||||
}
|
||||
|
||||
public static Biome[] getBiomesWithMonster(Class<? extends Entity> clazz)
|
||||
{
|
||||
List<Biome> biomes = new ArrayList<>();
|
||||
for (Biome b : Biome.REGISTRY)
|
||||
{
|
||||
List<SpawnListEntry> spawnList = b.getSpawnableList(EnumCreatureType.MONSTER);
|
||||
for (SpawnListEntry e : spawnList)
|
||||
if (e.entityClass == clazz)
|
||||
{
|
||||
biomes.add(b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return biomes.toArray(new Biome[0]);
|
||||
}
|
||||
}
|
|
@ -12,8 +12,23 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||
@LangKey("spackenmobs.config.title")
|
||||
public class ModConfigs
|
||||
{
|
||||
@EventBusSubscriber(modid = "spackenmobs")
|
||||
private static class EventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
if (event.getModID().equals("spackenmobs"))
|
||||
{
|
||||
ConfigManager.sync("spackenmobs", Config.Type.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Name("Allow ApoRed to spawn?")
|
||||
public static boolean ApoRed_spawn = true;
|
||||
@Name("Allow Baka Mitai Creeper to spawn?")
|
||||
public static boolean BakaMitaiCreeper_spawn = true;
|
||||
@Name("Allow Drachenlord to spawn?")
|
||||
public static boolean Drachenlord_spawn = true;
|
||||
@Name("Allow Holzstammhuhn to spawn?")
|
||||
|
@ -30,76 +45,84 @@ public class ModConfigs
|
|||
public static boolean Schalker_spawn = true;
|
||||
@Name("Allow Smava Creeper to spawn?")
|
||||
public static boolean SmavaCreeper_spawn = true;
|
||||
|
||||
@Name("Allow WolfMZTE to spawn?")
|
||||
public static boolean WolfMZTE_spawn = true;
|
||||
|
||||
@Name("ApoRed spawn probability:")
|
||||
public static int ApoRed_weight = 50;
|
||||
@Name("ApoRed min group size:")
|
||||
public static int ApoRed_min = 1;
|
||||
|
||||
@Name("ApoRed max group size:")
|
||||
public static int ApoRed_max = 4;
|
||||
@Name("Baka Mitai Creeper spawn probability:")
|
||||
public static int BakaMitaiCreeper_weight = 10;
|
||||
@Name("Baka Mitai Creeper min group size:")
|
||||
public static int BakaMitaiCreeper_min = 1;
|
||||
|
||||
@Name("Baka Mitai Creeper max group size:")
|
||||
public static int BakaMitaiCreeper_max = 2;
|
||||
@Name("Drachenlord spawn probability:")
|
||||
public static int Drachenlord_weight = 50;
|
||||
@Name("Drachenlord min group size:")
|
||||
public static int Drachenlord_min = 1;
|
||||
|
||||
@Name("Drachenlord max group size:")
|
||||
public static int Drachenlord_max = 4;
|
||||
|
||||
@Name("Holzstammhuhn spawn probability:")
|
||||
public static int Holzstammhuhn_weight = 50;
|
||||
@Name("Holzstammhuhn min group size:")
|
||||
public static int Holzstammhuhn_min = 1;
|
||||
|
||||
@Name("Holzstammhuhn max group size:")
|
||||
public static int Holzstammhuhn_max = 4;
|
||||
|
||||
@Name("Islamist spawn probability:")
|
||||
public static int Islamist_weight = 50;
|
||||
@Name("Islamist min group size:")
|
||||
public static int Islamist_min = 1;
|
||||
|
||||
@Name("Islamist max group size:")
|
||||
public static int Islamist_max = 4;
|
||||
|
||||
@Name("Jens spawn probability:")
|
||||
public static int Jens_weight = 25;
|
||||
@Name("Jens min group size:")
|
||||
public static int Jens_min = 1;
|
||||
|
||||
@Name("Jens max group size:")
|
||||
public static int Jens_max = 4;
|
||||
|
||||
@Name("Marcell D'Avis spawn probability:")
|
||||
public static int MarcellDAvis_weight = 50;
|
||||
@Name("Marcell D'Avis min group size:")
|
||||
public static int MarcellDAvis_min = 1;
|
||||
|
||||
@Name("Marcell D'Avis max group size:")
|
||||
public static int MarcellDAvis_max = 4;
|
||||
|
||||
@Name("Mr. Bean spawn probability:")
|
||||
public static int MrBean_weight = 50;
|
||||
@Name("Mr. Bean min group size:")
|
||||
public static int MrBean_min = 1;
|
||||
|
||||
@Name("Mr. Bean max group size:")
|
||||
public static int MrBean_max = 4;
|
||||
|
||||
@Name("Schalker spawn probability:")
|
||||
public static int Schalker_weight = 50;
|
||||
@Name("Schalker min group size:")
|
||||
public static int Schalker_min = 1;
|
||||
|
||||
@Name("Schalker max group size:")
|
||||
public static int Schalker_max = 4;
|
||||
|
||||
@Name("Smava Creeper spawn probability:")
|
||||
public static int SmavaCreeper_weight = 25;
|
||||
@Name("Smava Creeper min group size:")
|
||||
public static int SmavaCreeper_min = 1;
|
||||
|
||||
@Name("Smava Creeper max group size:")
|
||||
public static int SmavaCreeper_max = 4;
|
||||
|
||||
@Name("WolfMZTE spawn probability:")
|
||||
public static int WolfMZTE_weight = 50;
|
||||
@Name("WolfMZTE min group size:")
|
||||
public static int WolfMZTE_min = 1;
|
||||
|
||||
@Name("WolfMZTE max group size:")
|
||||
public static int WolfMZTE_max = 4;
|
||||
|
||||
|
@ -108,17 +131,4 @@ public class ModConfigs
|
|||
|
||||
@Name("Maximum distance in blocks Jens can search for fish:")
|
||||
public static double Jens_search_distance = 10.0;
|
||||
|
||||
@EventBusSubscriber(modid = "spackenmobs")
|
||||
private static class EventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
if (event.getModID().equals("spackenmobs"))
|
||||
{
|
||||
ConfigManager.sync("spackenmobs", Config.Type.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package mod.acgaming.spackenmobs.misc;
|
||||
|
||||
import mod.acgaming.spackenmobs.entities.EntityApoRed;
|
||||
import mod.acgaming.spackenmobs.entities.EntityBakaMitaiCreeper;
|
||||
import mod.acgaming.spackenmobs.entities.EntityDrachenlord;
|
||||
import mod.acgaming.spackenmobs.entities.EntityHolzstammhuhn;
|
||||
import mod.acgaming.spackenmobs.entities.EntityIslamist;
|
||||
|
@ -11,6 +12,7 @@ import mod.acgaming.spackenmobs.entities.EntitySchalker;
|
|||
import mod.acgaming.spackenmobs.entities.EntitySmavaCreeper;
|
||||
import mod.acgaming.spackenmobs.entities.EntityWolfMZTE;
|
||||
import mod.acgaming.spackenmobs.render.RenderApoRed;
|
||||
import mod.acgaming.spackenmobs.render.RenderBakaMitaiCreeper;
|
||||
import mod.acgaming.spackenmobs.render.RenderDrachenlord;
|
||||
import mod.acgaming.spackenmobs.render.RenderHolzstammhuhn;
|
||||
import mod.acgaming.spackenmobs.render.RenderIslamist;
|
||||
|
@ -36,5 +38,6 @@ public class ModEntities
|
|||
RenderingRegistry.registerEntityRenderingHandler(EntitySmavaCreeper.class, RenderSmavaCreeper.FACTORY);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityWolfMZTE.class, RenderWolfMZTE.FACTORY);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHolzstammhuhn.class, RenderHolzstammhuhn.FACTORY);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBakaMitaiCreeper.class, RenderBakaMitaiCreeper.FACTORY);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,13 @@ package mod.acgaming.spackenmobs.misc;
|
|||
|
||||
import mod.acgaming.spackenmobs.Spackenmobs;
|
||||
import mod.acgaming.spackenmobs.items.ItemBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(Spackenmobs.MODID)
|
||||
|
@ -11,4 +17,17 @@ public class ModItems
|
|||
public static final Item RAM = new ItemBase("ram", Spackenmobs.SPACKENMOBS_TAB);
|
||||
public static final Item RAM_ON_A_STICK = new ItemBase("ram_on_a_stick", Spackenmobs.SPACKENMOBS_TAB);
|
||||
public static final Item SURSTROEMMING = new ItemBase("surstroemming", Spackenmobs.SPACKENMOBS_TAB);
|
||||
|
||||
@SubscribeEvent
|
||||
public void SurstroemmingEvent(PlayerTickEvent event)
|
||||
{
|
||||
if (event.player instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = event.player;
|
||||
if (player.inventory.hasItemStack(new ItemStack(ModItems.SURSTROEMMING)))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,9 +17,9 @@ public class ModLootTableList
|
|||
public static final ResourceLocation EMPTY = register("empty");
|
||||
public static final ResourceLocation ENTITIES_JENS = register("entities/jens");
|
||||
|
||||
private static ResourceLocation register(String id)
|
||||
public static Set<ResourceLocation> getAll()
|
||||
{
|
||||
return register(new ResourceLocation("spackenmobs", id));
|
||||
return READ_ONLY_LOOT_TABLES;
|
||||
}
|
||||
|
||||
public static ResourceLocation register(ResourceLocation id)
|
||||
|
@ -34,9 +34,9 @@ public class ModLootTableList
|
|||
}
|
||||
}
|
||||
|
||||
public static Set<ResourceLocation> getAll()
|
||||
private static ResourceLocation register(String id)
|
||||
{
|
||||
return READ_ONLY_LOOT_TABLES;
|
||||
return register(new ResourceLocation("spackenmobs", id));
|
||||
}
|
||||
|
||||
public static boolean test()
|
||||
|
|
|
@ -36,7 +36,6 @@ public class ModSoundEvents
|
|||
public static final SoundEvent ENTITY_DRACHENLORD_ANGRY = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.angry"));
|
||||
|
||||
public static final SoundEvent ENTITY_SCHALKER_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.ambient"));
|
||||
public static final SoundEvent ENTITY_SCHALKER_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.hurt"));
|
||||
public static final SoundEvent ENTITY_SCHALKER_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.death"));
|
||||
public static final SoundEvent ENTITY_SCHALKER_OPEN = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.open"));
|
||||
public static final SoundEvent ENTITY_SCHALKER_SHOOT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.shoot"));
|
||||
|
@ -46,4 +45,7 @@ public class ModSoundEvents
|
|||
public static final SoundEvent ENTITY_JENS_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.death"));
|
||||
public static final SoundEvent ENTITY_JENS_EAT = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.eat"));
|
||||
public static final SoundEvent ENTITY_JENS_POOP = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.poop"));
|
||||
|
||||
public static final SoundEvent ENTITY_BAKAMITAICREEPER_FUSE = new SoundEvent(new ResourceLocation("spackenmobs:entities.bakamitai_creeper.fuse"));
|
||||
public static final SoundEvent ENTITY_BAKAMITAICREEPER_BLOW = new SoundEvent(new ResourceLocation("spackenmobs:entities.bakamitai_creeper.blow"));
|
||||
}
|
|
@ -2,6 +2,7 @@ package mod.acgaming.spackenmobs.misc;
|
|||
|
||||
import mod.acgaming.spackenmobs.Spackenmobs;
|
||||
import mod.acgaming.spackenmobs.entities.EntityApoRed;
|
||||
import mod.acgaming.spackenmobs.entities.EntityBakaMitaiCreeper;
|
||||
import mod.acgaming.spackenmobs.entities.EntityDrachenlord;
|
||||
import mod.acgaming.spackenmobs.entities.EntityHolzstammhuhn;
|
||||
import mod.acgaming.spackenmobs.entities.EntityIslamist;
|
||||
|
@ -32,18 +33,6 @@ import net.minecraftforge.fml.common.registry.EntityRegistry;
|
|||
@EventBusSubscriber(modid = Spackenmobs.MODID)
|
||||
public class RegHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerItems(Register<Item> event)
|
||||
{
|
||||
final Item[] items =
|
||||
{
|
||||
new Item().setRegistryName(Spackenmobs.MODID, "ram").setUnlocalizedName(Spackenmobs.MODID + "." + "ram").setCreativeTab(Spackenmobs.SPACKENMOBS_TAB),
|
||||
new Item().setRegistryName(Spackenmobs.MODID, "ram_on_a_stick").setUnlocalizedName(Spackenmobs.MODID + "." + "ram_on_a_stick").setCreativeTab(Spackenmobs.SPACKENMOBS_TAB),
|
||||
new Item().setRegistryName(Spackenmobs.MODID, "surstroemming").setUnlocalizedName(Spackenmobs.MODID + "." + "surstroemming").setCreativeTab(Spackenmobs.SPACKENMOBS_TAB)
|
||||
};
|
||||
event.getRegistry().registerAll(items);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerEntities(Register<EntityEntry> event)
|
||||
{
|
||||
|
@ -127,6 +116,26 @@ public class RegHandler
|
|||
EntityRegistry.addSpawn(EntityJens.class, ModConfigs.Holzstammhuhn_weight, ModConfigs.Holzstammhuhn_min, ModConfigs.Holzstammhuhn_max, EnumCreatureType.CREATURE,
|
||||
BiomeHelper.getBiomesWithCreature(EntityChicken.class));
|
||||
}
|
||||
|
||||
// Baka Mitai Creeper
|
||||
EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:bakamitai_creeper"), EntityBakaMitaiCreeper.class, "bakamitai_creeper", id++, Spackenmobs.instance, 64, 1, true, 826890, 0);
|
||||
if (ModConfigs.BakaMitaiCreeper_spawn == true)
|
||||
{
|
||||
EntityRegistry.addSpawn(EntityBakaMitaiCreeper.class, ModConfigs.BakaMitaiCreeper_weight, ModConfigs.BakaMitaiCreeper_min, ModConfigs.BakaMitaiCreeper_max, EnumCreatureType.MONSTER,
|
||||
BiomeHelper.getBiomesWithMonster(EntityCreeper.class));
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(Register<Item> event)
|
||||
{
|
||||
final Item[] items =
|
||||
{
|
||||
new Item().setRegistryName(Spackenmobs.MODID, "ram").setUnlocalizedName(Spackenmobs.MODID + "." + "ram").setCreativeTab(Spackenmobs.SPACKENMOBS_TAB),
|
||||
new Item().setRegistryName(Spackenmobs.MODID, "ram_on_a_stick").setUnlocalizedName(Spackenmobs.MODID + "." + "ram_on_a_stick").setCreativeTab(Spackenmobs.SPACKENMOBS_TAB),
|
||||
new Item().setRegistryName(Spackenmobs.MODID, "surstroemming").setUnlocalizedName(Spackenmobs.MODID + "." + "surstroemming").setCreativeTab(Spackenmobs.SPACKENMOBS_TAB)
|
||||
};
|
||||
event.getRegistry().registerAll(items);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -145,8 +154,12 @@ public class RegHandler
|
|||
// Islamist
|
||||
ModSoundEvents.ENTITY_ISLAMIST_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.fuse"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_FUSE);
|
||||
ModSoundEvents.ENTITY_ISLAMIST_BLOW.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.blow"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_BLOW);
|
||||
ModSoundEvents.ENTITY_ISLAMIST_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.hurt"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_HURT);
|
||||
ModSoundEvents.ENTITY_ISLAMIST_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.ambient"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_AMBIENT);
|
||||
|
||||
// Marcell D'Avis
|
||||
ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient"));
|
||||
|
@ -185,8 +198,6 @@ public class RegHandler
|
|||
// Schalker
|
||||
ModSoundEvents.ENTITY_SCHALKER_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.ambient"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_SCHALKER_AMBIENT);
|
||||
ModSoundEvents.ENTITY_SCHALKER_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.hurt"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_SCHALKER_HURT);
|
||||
ModSoundEvents.ENTITY_SCHALKER_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.death"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_SCHALKER_DEATH);
|
||||
ModSoundEvents.ENTITY_SCHALKER_OPEN.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.open"));
|
||||
|
@ -205,5 +216,11 @@ public class RegHandler
|
|||
event.getRegistry().register(ModSoundEvents.ENTITY_JENS_EAT);
|
||||
ModSoundEvents.ENTITY_JENS_POOP.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.poop"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_JENS_POOP);
|
||||
|
||||
// Baka Mitai Creeper
|
||||
ModSoundEvents.ENTITY_BAKAMITAICREEPER_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.bakamitai_creeper.fuse"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_BAKAMITAICREEPER_FUSE);
|
||||
ModSoundEvents.ENTITY_BAKAMITAICREEPER_BLOW.setRegistryName(new ResourceLocation("spackenmobs:entities.bakamitai_creeper.blow"));
|
||||
event.getRegistry().register(ModSoundEvents.ENTITY_BAKAMITAICREEPER_BLOW);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
@EventBusSubscriber(value = Side.CLIENT, modid = Spackenmobs.MODID)
|
||||
public class RegHandlerModels
|
||||
{
|
||||
private static void registerModel(Item item, int meta)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
|
@ -19,9 +24,4 @@ public class RegHandlerModels
|
|||
registerModel(ModItems.RAM_ON_A_STICK, 0);
|
||||
registerModel(ModItems.SURSTROEMMING, 0);
|
||||
}
|
||||
|
||||
private static void registerModel(Item item, int meta)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
}
|
|
@ -30,6 +30,13 @@ public class ModelSchalker extends ModelBase
|
|||
this.head.setRotationPoint(0.0F, 12.0F, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
|
||||
{
|
||||
this.base.render(scale);
|
||||
this.lid.render(scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
||||
{
|
||||
|
@ -58,11 +65,4 @@ public class ModelSchalker extends ModelBase
|
|||
this.head.rotateAngleX = headPitch * 0.017453292F;
|
||||
this.head.rotateAngleY = netHeadYaw * 0.017453292F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
|
||||
{
|
||||
this.base.render(scale);
|
||||
this.lid.render(scale);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderApoRed extends RenderSkeleton
|
||||
{
|
||||
public static class Factory implements IRenderFactory<EntityApoRed>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityApoRed> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderApoRed(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation APORED_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/apored.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderApoRed(RenderManager renderManagerIn)
|
||||
|
@ -35,24 +45,15 @@ public class RenderApoRed extends RenderSkeleton
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformHeldFull3DItemLayer()
|
||||
{
|
||||
GlStateManager.translate(0.09375F, 0.1875F, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(AbstractSkeleton entity)
|
||||
{
|
||||
return APORED_TEXTURE;
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntityApoRed>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityApoRed> createRenderFor(RenderManager manager)
|
||||
public void transformHeldFull3DItemLayer()
|
||||
{
|
||||
return new RenderApoRed(manager);
|
||||
}
|
||||
GlStateManager.translate(0.09375F, 0.1875F, 0.0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package mod.acgaming.spackenmobs.render;
|
||||
|
||||
import mod.acgaming.spackenmobs.entities.EntityBakaMitaiCreeper;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderCreeper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerCreeperCharge;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderBakaMitaiCreeper extends RenderCreeper
|
||||
{
|
||||
public static class Factory implements IRenderFactory<EntityBakaMitaiCreeper>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityBakaMitaiCreeper> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderBakaMitaiCreeper(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation CREEPER_TEXTURE = new ResourceLocation("textures/entity/creeper/creeper.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderBakaMitaiCreeper(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn);
|
||||
this.addLayer(new LayerCreeperCharge(this));
|
||||
}
|
||||
|
||||
protected int getColorMultiplier(EntityBakaMitaiCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
|
||||
{
|
||||
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
||||
|
||||
if ((int) (f * 10.0F) % 2 == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (int) (f * 0.2F * 255.0F);
|
||||
i = MathHelper.clamp(i, 0, 255);
|
||||
return i << 24 | 822083583;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityCreeper entity)
|
||||
{
|
||||
return CREEPER_TEXTURE;
|
||||
}
|
||||
|
||||
protected void preRenderCallback(EntityBakaMitaiCreeper entitylivingbaseIn, float partialTickTime)
|
||||
{
|
||||
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
||||
float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
|
||||
f = MathHelper.clamp(f, 0.0F, 1.0F);
|
||||
f = f * f;
|
||||
f = f * f;
|
||||
float f2 = (1.0F + f * 0.4F) * f1;
|
||||
float f3 = (1.0F + f * 0.1F) / f1;
|
||||
GlStateManager.scale(f2, f3, f2);
|
||||
}
|
||||
}
|
|
@ -15,7 +15,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderDrachenlord extends RenderZombie
|
||||
{
|
||||
public static class Factory implements IRenderFactory<EntityDrachenlord>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityDrachenlord> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderDrachenlord(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation DRACHENLORD_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/drachenlord.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderDrachenlord(RenderManager renderManagerIn)
|
||||
|
@ -37,13 +47,4 @@ public class RenderDrachenlord extends RenderZombie
|
|||
{
|
||||
return DRACHENLORD_TEXTURE;
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntityDrachenlord>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityDrachenlord> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderDrachenlord(manager);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderHolzstammhuhn extends RenderChicken
|
||||
{
|
||||
public static class Factory implements IRenderFactory<EntityHolzstammhuhn>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityHolzstammhuhn> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderHolzstammhuhn(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation HOLZSTAMMHUHN_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/holzstammhuhn.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderHolzstammhuhn(RenderManager renderManagerIn)
|
||||
|
@ -26,13 +36,4 @@ public class RenderHolzstammhuhn extends RenderChicken
|
|||
{
|
||||
return HOLZSTAMMHUHN_TEXTURE;
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntityHolzstammhuhn>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityHolzstammhuhn> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderHolzstammhuhn(manager);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
package mod.acgaming.spackenmobs.render;
|
||||
|
||||
import mod.acgaming.spackenmobs.entities.EntityIslamist;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderCreeper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerCreeperCharge;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -14,21 +16,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderIslamist extends RenderCreeper
|
||||
{
|
||||
private static final ResourceLocation ISLAMIST_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/islamist.png");
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderIslamist(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn);
|
||||
this.addLayer(new LayerCreeperCharge(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityCreeper entity)
|
||||
{
|
||||
return ISLAMIST_TEXTURE;
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntityIslamist>
|
||||
{
|
||||
@Override
|
||||
|
@ -37,4 +24,48 @@ public class RenderIslamist extends RenderCreeper
|
|||
return new RenderIslamist(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation ISLAMIST_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/islamist.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderIslamist(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn);
|
||||
this.addLayer(new LayerCreeperCharge(this));
|
||||
}
|
||||
|
||||
protected int getColorMultiplier(EntityIslamist entitylivingbaseIn, float lightBrightness, float partialTickTime)
|
||||
{
|
||||
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
||||
|
||||
if ((int) (f * 10.0F) % 2 == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (int) (f * 0.2F * 255.0F);
|
||||
i = MathHelper.clamp(i, 0, 255);
|
||||
return i << 24 | 822083583;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityCreeper entity)
|
||||
{
|
||||
return ISLAMIST_TEXTURE;
|
||||
}
|
||||
|
||||
protected void preRenderCallback(EntityIslamist entitylivingbaseIn, float partialTickTime)
|
||||
{
|
||||
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
||||
float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
|
||||
f = MathHelper.clamp(f, 0.0F, 1.0F);
|
||||
f = f * f;
|
||||
f = f * f;
|
||||
float f2 = (1.0F + f * 0.4F) * f1;
|
||||
float f3 = (1.0F + f * 0.1F) / f1;
|
||||
GlStateManager.scale(f2, f3, f2);
|
||||
}
|
||||
}
|
|
@ -13,7 +13,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderJens extends RenderBiped<EntityJens>
|
||||
{
|
||||
private static class Factory implements IRenderFactory<EntityJens>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityJens> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderJens(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation JENS_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/jens.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderJens(RenderManager renderManagerIn)
|
||||
|
@ -26,13 +36,4 @@ public class RenderJens extends RenderBiped<EntityJens>
|
|||
{
|
||||
return JENS_TEXTURE;
|
||||
}
|
||||
|
||||
private static class Factory implements IRenderFactory<EntityJens>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityJens> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderJens(manager);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderMarcellDAvis extends RenderZombie
|
||||
{
|
||||
public static class Factory implements IRenderFactory<EntityMarcellDAvis>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityMarcellDAvis> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderMarcellDAvis(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation MARCELLDAVIS_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/marcell_davis.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderMarcellDAvis(RenderManager renderManagerIn)
|
||||
|
@ -38,13 +48,4 @@ public class RenderMarcellDAvis extends RenderZombie
|
|||
{
|
||||
return MARCELLDAVIS_TEXTURE;
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntityMarcellDAvis>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityMarcellDAvis> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderMarcellDAvis(manager);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderMrBean extends RenderZombie
|
||||
{
|
||||
public static class Factory implements IRenderFactory<EntityMrBean>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityMrBean> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderMrBean(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation MRBEAN_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/mr_bean.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderMrBean(RenderManager renderManagerIn)
|
||||
|
@ -38,13 +48,4 @@ public class RenderMrBean extends RenderZombie
|
|||
{
|
||||
return MRBEAN_TEXTURE;
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntityMrBean>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityMrBean> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderMrBean(manager);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,125 +19,13 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderSchalker extends RenderLiving<EntitySchalker>
|
||||
{
|
||||
public static final ResourceLocation[] SCHALKER_TEXTURE = new ResourceLocation[]
|
||||
public static class Factory implements IRenderFactory<EntitySchalker>
|
||||
{
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png")
|
||||
};
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderSchalker(RenderManager p_i47194_1_)
|
||||
{
|
||||
super(p_i47194_1_, new ModelSchalker(), 0.0F);
|
||||
this.addLayer(new RenderSchalker.HeadLayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelSchalker getMainModel()
|
||||
public Render<? super EntitySchalker> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return (ModelSchalker) super.getMainModel();
|
||||
return new RenderSchalker(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntitySchalker entity, double x, double y, double z, float entityYaw, float partialTicks)
|
||||
{
|
||||
int i = entity.getClientTeleportInterp();
|
||||
|
||||
if (i > 0 && entity.isAttachedToBlock())
|
||||
{
|
||||
BlockPos blockpos = entity.getAttachmentPos();
|
||||
BlockPos blockpos1 = entity.getOldAttachPos();
|
||||
double d0 = (i - partialTicks) / 6.0D;
|
||||
d0 = d0 * d0;
|
||||
double d1 = (blockpos.getX() - blockpos1.getX()) * d0;
|
||||
double d2 = (blockpos.getY() - blockpos1.getY()) * d0;
|
||||
double d3 = (blockpos.getZ() - blockpos1.getZ()) * d0;
|
||||
super.doRender(entity, x - d1, y - d2, z - d3, entityYaw, partialTicks);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(EntitySchalker livingEntity, ICamera camera, double camX, double camY, double camZ)
|
||||
{
|
||||
if (super.shouldRender(livingEntity, camera, camX, camY, camZ))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (livingEntity.getClientTeleportInterp() > 0 && livingEntity.isAttachedToBlock())
|
||||
{
|
||||
BlockPos blockpos = livingEntity.getOldAttachPos();
|
||||
BlockPos blockpos1 = livingEntity.getAttachmentPos();
|
||||
Vec3d vec3d = new Vec3d(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
|
||||
Vec3d vec3d1 = new Vec3d(blockpos.getX(), blockpos.getY(), blockpos.getZ());
|
||||
|
||||
if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(vec3d1.x, vec3d1.y, vec3d1.z, vec3d.x, vec3d.y, vec3d.z)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntitySchalker entity)
|
||||
{
|
||||
return SCHALKER_TEXTURE[entity.getColor().getMetadata()];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyRotations(EntitySchalker entityLiving, float p_77043_2_, float rotationYaw, float partialTicks)
|
||||
{
|
||||
super.applyRotations(entityLiving, p_77043_2_, rotationYaw, partialTicks);
|
||||
|
||||
switch (entityLiving.getAttachmentFacing())
|
||||
{
|
||||
case DOWN:
|
||||
default:
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.translate(-0.5F, 0.5F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case NORTH:
|
||||
GlStateManager.translate(0.0F, 0.5F, -0.5F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case SOUTH:
|
||||
GlStateManager.translate(0.0F, 0.5F, 0.5F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case UP:
|
||||
GlStateManager.translate(0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntitySchalker entitylivingbaseIn, float partialTickTime)
|
||||
{
|
||||
float f = 0.999F;
|
||||
GlStateManager.scale(0.999F, 0.999F, 0.999F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -198,12 +86,125 @@ public class RenderSchalker extends RenderLiving<EntitySchalker>
|
|||
}
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntitySchalker>
|
||||
public static final ResourceLocation[] SCHALKER_TEXTURE = new ResourceLocation[]
|
||||
{
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png"),
|
||||
new ResourceLocation("spackenmobs:textures/entities/schalker.png"), new ResourceLocation("spackenmobs:textures/entities/schalker.png")
|
||||
};
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderSchalker(RenderManager p_i47194_1_)
|
||||
{
|
||||
super(p_i47194_1_, new ModelSchalker(), 0.0F);
|
||||
this.addLayer(new RenderSchalker.HeadLayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Render<? super EntitySchalker> createRenderFor(RenderManager manager)
|
||||
protected void applyRotations(EntitySchalker entityLiving, float p_77043_2_, float rotationYaw, float partialTicks)
|
||||
{
|
||||
return new RenderSchalker(manager);
|
||||
super.applyRotations(entityLiving, p_77043_2_, rotationYaw, partialTicks);
|
||||
|
||||
switch (entityLiving.getAttachmentFacing())
|
||||
{
|
||||
case DOWN:
|
||||
default:
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.translate(-0.5F, 0.5F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case NORTH:
|
||||
GlStateManager.translate(0.0F, 0.5F, -0.5F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case SOUTH:
|
||||
GlStateManager.translate(0.0F, 0.5F, 0.5F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case UP:
|
||||
GlStateManager.translate(0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntitySchalker entity, double x, double y, double z, float entityYaw, float partialTicks)
|
||||
{
|
||||
int i = entity.getClientTeleportInterp();
|
||||
|
||||
if (i > 0 && entity.isAttachedToBlock())
|
||||
{
|
||||
BlockPos blockpos = entity.getAttachmentPos();
|
||||
BlockPos blockpos1 = entity.getOldAttachPos();
|
||||
double d0 = (i - partialTicks) / 6.0D;
|
||||
d0 = d0 * d0;
|
||||
double d1 = (blockpos.getX() - blockpos1.getX()) * d0;
|
||||
double d2 = (blockpos.getY() - blockpos1.getY()) * d0;
|
||||
double d3 = (blockpos.getZ() - blockpos1.getZ()) * d0;
|
||||
super.doRender(entity, x - d1, y - d2, z - d3, entityYaw, partialTicks);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntitySchalker entity)
|
||||
{
|
||||
return SCHALKER_TEXTURE[entity.getColor().getMetadata()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelSchalker getMainModel()
|
||||
{
|
||||
return (ModelSchalker) super.getMainModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntitySchalker entitylivingbaseIn, float partialTickTime)
|
||||
{
|
||||
float f = 0.999F;
|
||||
GlStateManager.scale(0.999F, 0.999F, 0.999F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(EntitySchalker livingEntity, ICamera camera, double camX, double camY, double camZ)
|
||||
{
|
||||
if (super.shouldRender(livingEntity, camera, camX, camY, camZ))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (livingEntity.getClientTeleportInterp() > 0 && livingEntity.isAttachedToBlock())
|
||||
{
|
||||
BlockPos blockpos = livingEntity.getOldAttachPos();
|
||||
BlockPos blockpos1 = livingEntity.getAttachmentPos();
|
||||
Vec3d vec3d = new Vec3d(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
|
||||
Vec3d vec3d1 = new Vec3d(blockpos.getX(), blockpos.getY(), blockpos.getZ());
|
||||
|
||||
if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(vec3d1.x, vec3d1.y, vec3d1.z, vec3d.x, vec3d.y, vec3d.z)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
package mod.acgaming.spackenmobs.render;
|
||||
|
||||
import mod.acgaming.spackenmobs.entities.EntitySmavaCreeper;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderCreeper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerCreeperCharge;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -14,21 +16,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderSmavaCreeper extends RenderCreeper
|
||||
{
|
||||
private static final ResourceLocation SMAVA_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/smava_creeper.png");
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderSmavaCreeper(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn);
|
||||
this.addLayer(new LayerCreeperCharge(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityCreeper entity)
|
||||
{
|
||||
return SMAVA_TEXTURE;
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntitySmavaCreeper>
|
||||
{
|
||||
@Override
|
||||
|
@ -37,4 +24,48 @@ public class RenderSmavaCreeper extends RenderCreeper
|
|||
return new RenderSmavaCreeper(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation SMAVA_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/smava_creeper.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderSmavaCreeper(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn);
|
||||
this.addLayer(new LayerCreeperCharge(this));
|
||||
}
|
||||
|
||||
protected int getColorMultiplier(EntitySmavaCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
|
||||
{
|
||||
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
||||
|
||||
if ((int) (f * 10.0F) % 2 == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (int) (f * 0.2F * 255.0F);
|
||||
i = MathHelper.clamp(i, 0, 255);
|
||||
return i << 24 | 822083583;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityCreeper entity)
|
||||
{
|
||||
return SMAVA_TEXTURE;
|
||||
}
|
||||
|
||||
protected void preRenderCallback(EntitySmavaCreeper entitylivingbaseIn, float partialTickTime)
|
||||
{
|
||||
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
||||
float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
|
||||
f = MathHelper.clamp(f, 0.0F, 1.0F);
|
||||
f = f * f;
|
||||
f = f * f;
|
||||
float f2 = (1.0F + f * 0.4F) * f1;
|
||||
float f3 = (1.0F + f * 0.1F) / f1;
|
||||
GlStateManager.scale(f2, f3, f2);
|
||||
}
|
||||
}
|
|
@ -15,9 +15,19 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderWolfMZTE extends RenderWolf
|
||||
{
|
||||
public static class Factory implements IRenderFactory<EntityWolfMZTE>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityWolfMZTE> createRenderFor(RenderManager manager)
|
||||
{
|
||||
return new RenderWolfMZTE(manager);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation WOLFMZTE_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/wolfmzte.png");
|
||||
private static final ResourceLocation TAMED_WOLFMZTE_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/wolfmzte_tame.png");
|
||||
private static final ResourceLocation ANRGY_WOLFMZTE_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/wolfmzte_angry.png");
|
||||
|
||||
public static final Factory FACTORY = new Factory();
|
||||
|
||||
public RenderWolfMZTE(RenderManager renderManagerIn)
|
||||
|
@ -26,12 +36,6 @@ public class RenderWolfMZTE extends RenderWolf
|
|||
this.addLayer(new LayerWolfCollar(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float handleRotationFloat(EntityWolf livingBase, float partialTicks)
|
||||
{
|
||||
return livingBase.getTailRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityWolf entity, double x, double y, double z, float entityYaw, float partialTicks)
|
||||
{
|
||||
|
@ -57,12 +61,9 @@ public class RenderWolfMZTE extends RenderWolf
|
|||
}
|
||||
}
|
||||
|
||||
public static class Factory implements IRenderFactory<EntityWolfMZTE>
|
||||
{
|
||||
@Override
|
||||
public Render<? super EntityWolfMZTE> createRenderFor(RenderManager manager)
|
||||
protected float handleRotationFloat(EntityWolf livingBase, float partialTicks)
|
||||
{
|
||||
return new RenderWolfMZTE(manager);
|
||||
}
|
||||
return livingBase.getTailRotation();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
entity.apored.name=ApoRed
|
||||
entity.bakamitai_creeper.name=Baka Mitai-Creeper
|
||||
entity.drachenlord.name=Drachenlord
|
||||
entity.holzstammhuhn.name=Holzstammhuhn
|
||||
entity.islamist.name=Islamist
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
entity.apored.name=ApoRed
|
||||
entity.bakamitai_creeper.name=Baka Mitai Creeper
|
||||
entity.drachenlord.name=Drachenlord
|
||||
entity.holzstammhuhn.name=Holzstammhuhn
|
||||
entity.islamist.name=Islamist
|
||||
|
|
|
@ -852,5 +852,15 @@
|
|||
"sounds": [{
|
||||
"name": "spackenmobs:jens/poop"
|
||||
}]
|
||||
},
|
||||
"entities.bakamitai_creeper.fuse": {
|
||||
"sounds": [{
|
||||
"name": "spackenmobs:bakamitai_creeper/fuse"
|
||||
}]
|
||||
},
|
||||
"entities.bakamitai_creeper.blow": {
|
||||
"sounds": [{
|
||||
"name": "spackenmobs:bakamitai_creeper/blow"
|
||||
}]
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue