From 68b777bffb5d9b1fcae0289f4c8330efc7c67d75 Mon Sep 17 00:00:00 2001 From: Hendrik Date: Sun, 23 Aug 2020 15:38:40 +0200 Subject: [PATCH] Auto-formatting "fix" and additional stuff Adapt auto-formatting to own weird style Re-added missing Jens AI and loot Fixed creative tab --- .../mod/acgaming/spackenmobs/Spackenmobs.java | 45 +- .../acgaming/spackenmobs/SpackenmobsTab.java | 21 +- .../entities/EntityAIEatDroppedFish.java | 106 +- .../spackenmobs/entities/EntityApoRed.java | 37 +- .../entities/EntityDrachenlord.java | 436 +++--- .../entities/EntityHolzstammhuhn.java | 95 +- .../spackenmobs/entities/EntityIslamist.java | 121 +- .../spackenmobs/entities/EntityJens.java | 467 ++++-- .../entities/EntityMarcellDAvis.java | 39 +- .../spackenmobs/entities/EntityMrBean.java | 39 +- .../spackenmobs/entities/EntitySchalker.java | 1381 +++++++++-------- .../entities/EntitySchalkerBullet.java | 754 +++++---- .../entities/EntitySmavaCreeper.java | 123 +- .../spackenmobs/entities/EntityWolfMZTE.java | 238 +-- .../acgaming/spackenmobs/items/ItemBase.java | 23 +- .../spackenmobs/items/ItemPotion.java | 16 +- .../spackenmobs/misc/BiomeHelper.java | 49 +- .../spackenmobs/misc/ModEntities.java | 28 +- .../acgaming/spackenmobs/misc/ModItems.java | 9 +- .../spackenmobs/misc/ModLootTableList.java | 59 + .../acgaming/spackenmobs/misc/ModPotions.java | 3 +- .../spackenmobs/misc/ModSoundEvents.java | 96 +- .../acgaming/spackenmobs/misc/RegHandler.java | 274 ++-- .../spackenmobs/misc/RegHandlerModels.java | 24 +- .../spackenmobs/render/ModelSchalker.java | 94 +- .../spackenmobs/render/RenderApoRed.java | 69 +- .../spackenmobs/render/RenderDrachenlord.java | 56 +- .../render/RenderHolzstammhuhn.java | 40 +- .../spackenmobs/render/RenderIslamist.java | 42 +- .../spackenmobs/render/RenderJens.java | 39 +- .../render/RenderMarcellDAvis.java | 58 +- .../spackenmobs/render/RenderMrBean.java | 58 +- .../spackenmobs/render/RenderSchalker.java | 330 ++-- .../render/RenderSmavaCreeper.java | 42 +- .../spackenmobs/render/RenderWolfMZTE.java | 86 +- .../assets/spackenmobs/lang/de_de.lang | 17 +- .../assets/spackenmobs/lang/en_us.lang | 17 +- .../loot_tables/entities/jens.json | 26 + 38 files changed, 3063 insertions(+), 2394 deletions(-) create mode 100644 src/main/java/mod/acgaming/spackenmobs/misc/ModLootTableList.java create mode 100644 src/main/resources/assets/spackenmobs/loot_tables/entities/jens.json diff --git a/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java b/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java index e908114..f2e4958 100644 --- a/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java +++ b/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java @@ -12,33 +12,38 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @Mod(modid = "spackenmobs", version = "RC1", acceptedMinecraftVersions = "[1.12.2]") -public class Spackenmobs { - public static final String MODID = "spackenmobs"; - public static final String VERSION = "RC1"; +public class Spackenmobs +{ + public static final String MODID = "spackenmobs"; + public static final String VERSION = "RC1"; - public static final CreativeTabs SPACKENMOBS_TAB = new SpackenmobsTab(); + public static final CreativeTabs SPACKENMOBS_TAB = new SpackenmobsTab("tabSpackenmobs"); - @Instance - public static Spackenmobs instance; + @Instance + public static Spackenmobs instance; - @SideOnly(Side.CLIENT) - @EventHandler - public void preInitClient(FMLPreInitializationEvent event) { - ModEntities.initModels(); - } + @SideOnly(Side.CLIENT) + @EventHandler + public void preInitClient(FMLPreInitializationEvent event) + { + ModEntities.initModels(); + } - @EventHandler - public void preInit(FMLPreInitializationEvent event) { + @EventHandler + public void preInit(FMLPreInitializationEvent event) + { - } + } - @EventHandler - public void init(FMLInitializationEvent event) { + @EventHandler + public void init(FMLInitializationEvent event) + { - } + } - @EventHandler - public void postInit(FMLPostInitializationEvent event) { + @EventHandler + public void postInit(FMLPostInitializationEvent event) + { - } + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java b/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java index 18241f7..b4f5df6 100644 --- a/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java +++ b/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java @@ -6,14 +6,17 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class SpackenmobsTab extends CreativeTabs { - public SpackenmobsTab() { - super(Spackenmobs.MODID); - } +public class SpackenmobsTab extends CreativeTabs +{ + public SpackenmobsTab(String name) + { + super(Spackenmobs.MODID + "." + name); + } - @SideOnly(Side.CLIENT) - @Override - public ItemStack getTabIconItem() { - return new ItemStack(ModItems.RAM); - } + @SideOnly(Side.CLIENT) + @Override + public ItemStack getTabIconItem() + { + return new ItemStack(ModItems.RAM); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityAIEatDroppedFish.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityAIEatDroppedFish.java index 9ae4c04..d2ca4cc 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityAIEatDroppedFish.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityAIEatDroppedFish.java @@ -9,60 +9,70 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; -public class EntityAIEatDroppedFish extends EntityAIBase { - private EntityJens jens; - private Random rand = new Random(); - private World world = null; - double searchDistance = 10.0D; +public class EntityAIEatDroppedFish extends EntityAIBase +{ + private EntityJens jens; + private Random rand = new Random(); + private World world = null; + double searchDistance = 10.0D; - public EntityAIEatDroppedFish(EntityJens jens) { - this.jens = jens; - this.world = jens.world; - } - - public EntityItem getNearbyFood() { - List items = getItems(); - for (EntityItem item : items) { - EntityItem stack = item; - if (items != null) { - return stack; - } + public EntityAIEatDroppedFish(EntityJens jens) + { + this.jens = jens; + this.world = jens.world; } - return null; - } - List 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 getNearbyFood = getNearbyFood(); - if (getNearbyFood != null && !this.jens.isChild() && this.jens.yummy_in_tummy == false - && this.jens.isFishItem(getNearbyFood.getItem())) { - execute(this.jens, getNearbyFood); + public EntityItem getNearbyFood() + { + List items = getItems(); + for (EntityItem item : items) + { + EntityItem stack = item; + if (items != null) + { + return stack; + } + } + return null; } - return false; - } - public boolean execute(EntityJens jens, EntityItem item) { - if (jens.getNavigator().tryMoveToXYZ(item.posX, item.posY, item.posZ, 1.25D)) { - if (jens.getDistance(item) < 1.0F) { - eatItem(item); - jens.digestFish(); - } + List 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)); } - return true; - } - public void eatItem(EntityItem item) { - ItemStack stack = item.getItem(); - stack.setCount(stack.getCount() - 1); - if (stack.getCount() == 0) { - item.setDead(); + @Override + public boolean shouldExecute() + { + EntityItem getNearbyFood = getNearbyFood(); + if (getNearbyFood != null && !this.jens.isChild() && this.jens.yummy_in_tummy == false && this.jens.isFishItem(getNearbyFood.getItem())) + { + execute(this.jens, getNearbyFood); + } + return false; + } + + public boolean execute(EntityJens jens, EntityItem item) + { + if (jens.getNavigator().tryMoveToXYZ(item.posX, item.posY, item.posZ, 1.25D)) + { + if (jens.getDistance(item) < 1.0F) + { + eatItem(item); + jens.digestFish(); + } + } + return true; + } + + public void eatItem(EntityItem item) + { + ItemStack stack = item.getItem(); + stack.setCount(stack.getCount() - 1); + if (stack.getCount() == 0) + { + item.setDead(); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java index ae84ba1..6d65a93 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java @@ -6,23 +6,28 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; -public class EntityApoRed extends EntitySkeleton { - public EntityApoRed(World worldIn) { - super(worldIn); - } +public class EntityApoRed extends EntitySkeleton +{ + public EntityApoRed(World worldIn) + { + super(worldIn); + } - @Override - protected SoundEvent getAmbientSound() { - return ModSoundEvents.ENTITY_APORED_AMBIENT; - } + @Override + protected SoundEvent getAmbientSound() + { + return ModSoundEvents.ENTITY_APORED_AMBIENT; + } - @Override - protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return ModSoundEvents.ENTITY_APORED_HURT; - } + @Override + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return ModSoundEvents.ENTITY_APORED_HURT; + } - @Override - protected SoundEvent getDeathSound() { - return ModSoundEvents.ENTITY_APORED_DEATH; - } + @Override + protected SoundEvent getDeathSound() + { + return ModSoundEvents.ENTITY_APORED_DEATH; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java index 038dd6b..793a636 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java @@ -30,209 +30,253 @@ import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; -public class EntityDrachenlord extends EntityZombie { - 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); - private int angerLevel; - private int randomSoundDelay; - private UUID angerTargetUUID; +public class EntityDrachenlord extends EntityZombie +{ + 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); + private int angerLevel; + private int randomSoundDelay; + private UUID angerTargetUUID; - public EntityDrachenlord(World worldIn) { - super(worldIn); - this.isImmuneToFire = true; - } - - @Override - public void setRevengeTarget(@Nullable EntityLivingBase livingBase) { - super.setRevengeTarget(livingBase); - - if (livingBase != null) { - this.angerTargetUUID = livingBase.getUniqueID(); - } - } - - @Override - protected void applyEntityAI() { - this.targetTasks.addTask(1, new EntityDrachenlord.AIHurtByAggressor(this)); - this.targetTasks.addTask(2, new EntityDrachenlord.AITargetAggressor(this)); - } - - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0.0D); - this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(5.0D); - } - - @Override - protected void updateAITasks() { - IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); - - if (this.isAngry()) { - if (!this.isChild() && !iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER)) { - iattributeinstance.applyModifier(ATTACK_SPEED_BOOST_MODIFIER); - } - - --this.angerLevel; - } else if (iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER)) { - iattributeinstance.removeModifier(ATTACK_SPEED_BOOST_MODIFIER); - } - - if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0) { - this.playSound(ModSoundEvents.ENTITY_DRACHENLORD_ANGRY, this.getSoundVolume() * 2.0F, 1.0F); - } - - if (this.angerLevel > 0 && this.angerTargetUUID != null && this.getRevengeTarget() == null) { - EntityPlayer entityplayer = this.world.getPlayerEntityByUUID(this.angerTargetUUID); - this.setRevengeTarget(entityplayer); - this.attackingPlayer = entityplayer; - this.recentlyHit = this.getRevengeTimer(); - } - - 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) { - super.writeEntityToNBT(compound); - compound.setShort("Anger", (short) this.angerLevel); - - if (this.angerTargetUUID != null) { - compound.setString("HurtBy", this.angerTargetUUID.toString()); - } else { - 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); + public EntityDrachenlord(World worldIn) + { + super(worldIn); + this.isImmuneToFire = true; } @Override - protected void setEntityAttackTarget(EntityCreature creatureIn, EntityLivingBase entityLivingBaseIn) { - super.setEntityAttackTarget(creatureIn, entityLivingBaseIn); + public void setRevengeTarget(@Nullable + EntityLivingBase livingBase) + { + super.setRevengeTarget(livingBase); - if (creatureIn instanceof EntityDrachenlord) { - ((EntityDrachenlord) creatureIn).becomeAngryAt(entityLivingBaseIn); - } - } - } - - static class AITargetAggressor extends EntityAINearestAttackableTarget { - public AITargetAggressor(EntityDrachenlord p_i45829_1_) { - super(p_i45829_1_, EntityPlayer.class, true); + if (livingBase != null) + { + this.angerTargetUUID = livingBase.getUniqueID(); + } } @Override - public boolean shouldExecute() { - return ((EntityDrachenlord) this.taskOwner).isAngry() && super.shouldExecute(); + protected void applyEntityAI() + { + this.targetTasks.addTask(1, new EntityDrachenlord.AIHurtByAggressor(this)); + this.targetTasks.addTask(2, new EntityDrachenlord.AITargetAggressor(this)); + } + + @Override + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0.0D); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(5.0D); + } + + @Override + protected void updateAITasks() + { + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); + + if (this.isAngry()) + { + if (!this.isChild() && !iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER)) + { + iattributeinstance.applyModifier(ATTACK_SPEED_BOOST_MODIFIER); + } + + --this.angerLevel; + } + else if (iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER)) + { + iattributeinstance.removeModifier(ATTACK_SPEED_BOOST_MODIFIER); + } + + if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0) + { + this.playSound(ModSoundEvents.ENTITY_DRACHENLORD_ANGRY, this.getSoundVolume() * 2.0F, 1.0F); + } + + if (this.angerLevel > 0 && this.angerTargetUUID != null && this.getRevengeTarget() == null) + { + EntityPlayer entityplayer = this.world.getPlayerEntityByUUID(this.angerTargetUUID); + this.setRevengeTarget(entityplayer); + this.attackingPlayer = entityplayer; + this.recentlyHit = this.getRevengeTimer(); + } + + 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) + { + super.writeEntityToNBT(compound); + compound.setShort("Anger", (short) this.angerLevel); + + if (this.angerTargetUUID != null) + { + compound.setString("HurtBy", this.angerTargetUUID.toString()); + } + else + { + 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 + { + public AITargetAggressor(EntityDrachenlord p_i45829_1_) + { + super(p_i45829_1_, EntityPlayer.class, true); + } + + @Override + public boolean shouldExecute() + { + return ((EntityDrachenlord) this.taskOwner).isAngry() && super.shouldExecute(); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java index 4cb7478..73488ae 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java @@ -26,55 +26,64 @@ import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class EntityHolzstammhuhn extends EntityChicken { - private static final Set TEMPTATION_ITEMS = Sets.newHashSet(Items.STICK); +public class EntityHolzstammhuhn extends EntityChicken +{ + private static final Set TEMPTATION_ITEMS = Sets.newHashSet(Items.STICK); - public EntityHolzstammhuhn(World worldIn) { - super(worldIn); - this.setSize(0.4F, 0.7F); - this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; - this.setPathPriority(PathNodeType.WATER, 0.0F); - } + public EntityHolzstammhuhn(World worldIn) + { + super(worldIn); + this.setSize(0.4F, 0.7F); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + this.setPathPriority(PathNodeType.WATER, 0.0F); + } - @Override - protected void initEntityAI() { - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); - this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); - this.tasks.addTask(3, new EntityAITempt(this, 1.0D, false, TEMPTATION_ITEMS)); - this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); - this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 1.0D)); - this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(7, new EntityAILookIdle(this)); - } + @Override + protected void initEntityAI() + { + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.0D, false, TEMPTATION_ITEMS)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + } - @Override - public boolean isBreedingItem(ItemStack stack) { - return TEMPTATION_ITEMS.contains(stack.getItem()); - } + @Override + public boolean isBreedingItem(ItemStack stack) + { + return TEMPTATION_ITEMS.contains(stack.getItem()); + } - @Override - protected SoundEvent getAmbientSound() { - return SoundEvents.BLOCK_WOOD_PLACE; - } + @Override + protected SoundEvent getAmbientSound() + { + return SoundEvents.BLOCK_WOOD_PLACE; + } - @Override - protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return SoundEvents.BLOCK_WOOD_HIT; - } + @Override + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return SoundEvents.BLOCK_WOOD_HIT; + } - @Override - protected SoundEvent getDeathSound() { - return SoundEvents.BLOCK_WOOD_BREAK; - } + @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 + 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); - } + @Override + public EntityHolzstammhuhn createChild(EntityAgeable ageable) + { + return new EntityHolzstammhuhn(this.world); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java index 3a73bad..d8caca4 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java @@ -6,66 +6,77 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; -public class EntityIslamist extends EntityCreeper { - private int lastActiveTime; - private int timeSinceIgnited; - private int fuseTime = 30; - private int explosionRadius = 6; +public class EntityIslamist extends EntityCreeper +{ + private int lastActiveTime; + private int timeSinceIgnited; + private int fuseTime = 30; + private int explosionRadius = 6; - public EntityIslamist(World worldIn) { - super(worldIn); - this.setSize(0.6F, 1.7F); - } - - @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_ISLAMIST_FUSE, 1.0F, 0.5F); - } - - this.timeSinceIgnited += i; - - if (this.timeSinceIgnited < 0) { - this.timeSinceIgnited = 0; - } - - if (this.timeSinceIgnited >= this.fuseTime) { - this.timeSinceIgnited = this.fuseTime; - this.explode(); - } + public EntityIslamist(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 1.7F); } - super.onUpdate(); - } + @Override + public void onUpdate() + { + if (this.isEntityAlive()) + { + this.lastActiveTime = this.timeSinceIgnited; - 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(), 1.0F, - 1.0F); - this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * f, flag); - this.setDead(); + if (this.hasIgnited()) + { + this.setCreeperState(1); + } + + int i = this.getCreeperState(); + + if (i > 0 && this.timeSinceIgnited == 0) + { + this.playSound(ModSoundEvents.ENTITY_ISLAMIST_FUSE, 1.0F, 0.5F); + } + + 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 SoundEvent getHurtSound(DamageSource damageSourceIn) { - return ModSoundEvents.ENTITY_ISLAMIST_HURT; - } + 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(), 1.0F, 1.0F); + this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * f, flag); + this.setDead(); + } + } - @Override - protected SoundEvent getAmbientSound() { - return ModSoundEvents.ENTITY_ISLAMIST_AMBIENT; - } + @Override + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return ModSoundEvents.ENTITY_ISLAMIST_HURT; + } + + @Override + protected SoundEvent getAmbientSound() + { + return ModSoundEvents.ENTITY_ISLAMIST_AMBIENT; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java index 6a4d438..d38aecc 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java @@ -2,13 +2,17 @@ package mod.acgaming.spackenmobs.entities; import java.util.Set; +import javax.annotation.Nullable; + import com.google.common.collect.Sets; import mod.acgaming.spackenmobs.misc.ModItems; +import mod.acgaming.spackenmobs.misc.ModLootTableList; import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAILookIdle; @@ -18,148 +22,365 @@ import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITempt; import net.minecraft.entity.ai.EntityAIWanderAvoidWater; import net.minecraft.entity.ai.EntityAIWatchClosest; -import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; 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.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; +import net.minecraft.util.datafix.DataFixer; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -public class EntityJens extends EntityAnimal { - private static final Set TEMPTATION_ITEMS = Sets.newHashSet(ModItems.RAM); - private static final Set FISH_ITEMS = Sets.newHashSet(Items.FISH); +public class EntityJens extends EntityPig +{ + private static final DataParameter SADDLED = EntityDataManager.createKey(EntityJens.class, DataSerializers.BOOLEAN); + private static final DataParameter BOOST_TIME = EntityDataManager.createKey(EntityJens.class, DataSerializers.VARINT); + private static final Set TEMPTATION_ITEMS = Sets.newHashSet(ModItems.RAM); + private static final Set FISH_ITEMS = Sets.newHashSet(Items.FISH); - public boolean yummy_in_tummy = false; - public int time_until_surstroemming = 0; + private boolean boosting; + private int boostTime; + private int totalBoostTime; + public boolean yummy_in_tummy = false; + public int time_until_surstroemming = 0; - Minecraft MINECRAFT = Minecraft.getMinecraft(); + Minecraft MINECRAFT = Minecraft.getMinecraft(); - public EntityJens(World worldIn) { - super(worldIn); - 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() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); - } - - @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 boolean canBeSteered() { - Entity entity = this.getControllingPassenger(); - - if (!(entity instanceof EntityPlayer)) { - return false; - } else { - EntityPlayer entityplayer = (EntityPlayer) entity; - return entityplayer.getHeldItemMainhand().getItem() == ModItems.RAM_ON_A_STICK - || entityplayer.getHeldItemOffhand().getItem() == ModItems.RAM_ON_A_STICK; - } - } - - @Override - public EntityJens createChild(EntityAgeable ageable) { - return new EntityJens(this.world); - } - - @Override - public boolean processInteract(EntityPlayer player, EnumHand hand) { - ItemStack itemstack = player.getHeldItem(hand); - - if (itemstack.getItem() == Items.FISH && !player.capabilities.isCreativeMode && !this.isChild() - && this.yummy_in_tummy == false) { - itemstack.shrink(1); - digestFish(); - return true; - } else { - return super.processInteract(player, hand); - } - } - - @Override - public void onLivingUpdate() { - super.onLivingUpdate(); - - if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming > 0) { - this.time_until_surstroemming--; + public EntityJens(World worldIn) + { + super(worldIn); + setSize(0.6F, 2.2F); } - if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming <= 0) { - 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.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.playSound(ModSoundEvents.ENTITY_JENS_POOP, 1.0F, - (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - this.dropItem(ModItems.SURSTROEMMING, 1); - this.yummy_in_tummy = false; - this.time_until_surstroemming = 0; + @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)); } - } - public void digestFish() { - this.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F); - - this.yummy_in_tummy = true; - this.time_until_surstroemming = 200; - - 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 + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); } - } - @Override - protected SoundEvent getAmbientSound() { - return ModSoundEvents.ENTITY_JENS_AMBIENT; - } + @Override + @Nullable + public Entity getControllingPassenger() + { + return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); + } - @Override - protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return ModSoundEvents.ENTITY_JENS_HURT; - } + @Override + public boolean canBeSteered() + { + Entity entity = this.getControllingPassenger(); - @Override - protected SoundEvent getDeathSound() { - return ModSoundEvents.ENTITY_JENS_DEATH; - } + if (!(entity instanceof EntityPlayer)) + { + return false; + } + else + { + EntityPlayer entityplayer = (EntityPlayer) entity; + return entityplayer.getHeldItemMainhand().getItem() == ModItems.RAM_ON_A_STICK || entityplayer.getHeldItemOffhand().getItem() == ModItems.RAM_ON_A_STICK; + } + } + + @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 + protected void entityInit() + { + super.entityInit(); + this.dataManager.register(SADDLED, Boolean.valueOf(false)); + this.dataManager.register(BOOST_TIME, Integer.valueOf(0)); + } + + public static void registerFixesJens(DataFixer fixer) + { + EntityLiving.registerFixesMob(fixer, EntityJens.class); + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) + { + super.writeEntityToNBT(compound); + compound.setBoolean("Saddle", this.getSaddled()); + } + + @Override + public void readEntityFromNBT(NBTTagCompound compound) + { + super.readEntityFromNBT(compound); + this.setSaddled(compound.getBoolean("Saddle")); + } + + @Override + public void onDeath(DamageSource cause) + { + super.onDeath(cause); + + if (!this.world.isRemote) + { + if (this.getSaddled()) + { + this.dropItem(Items.SADDLE, 1); + } + } + } + + @Override + public boolean getSaddled() + { + return this.dataManager.get(SADDLED).booleanValue(); + } + + @Override + public void setSaddled(boolean saddled) + { + if (saddled) + { + this.dataManager.set(SADDLED, Boolean.valueOf(true)); + } + else + { + this.dataManager.set(SADDLED, Boolean.valueOf(false)); + } + } + + @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) + { + if (!super.processInteract(player, hand)) + { + ItemStack itemstack = player.getHeldItem(hand); + if (itemstack.getItem() == Items.FISH && !player.capabilities.isCreativeMode && !this.isChild() && this.yummy_in_tummy == false) + { + itemstack.shrink(1); + digestFish(); + return true; + } + else if (itemstack.getItem() == Items.NAME_TAG) + { + itemstack.interactWithEntity(player, this, hand); + return true; + } + else if (this.getSaddled() && !this.isBeingRidden()) + { + if (!this.world.isRemote) + { + player.startRiding(this); + } + return true; + } + else if (itemstack.getItem() == Items.SADDLE) + { + itemstack.interactWithEntity(player, this, hand); + return true; + } + else + { + return false; + } + } + else + { + return true; + } + } + + @Override + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming > 0) + { + this.time_until_surstroemming--; + } + + if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming <= 0) + { + 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.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.playSound(ModSoundEvents.ENTITY_JENS_POOP, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.dropItem(ModItems.SURSTROEMMING, 1); + this.yummy_in_tummy = false; + this.time_until_surstroemming = 0; + } + } + + public void digestFish() + { + this.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F); + + this.yummy_in_tummy = true; + this.time_until_surstroemming = 200; + + 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 + public void travel(float strafe, float vertical, float forward) + { + Entity entity = this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); + + if (this.isBeingRidden() && this.canBeSteered()) + { + this.rotationYaw = entity.rotationYaw; + this.prevRotationYaw = this.rotationYaw; + this.rotationPitch = entity.rotationPitch * 0.5F; + this.setRotation(this.rotationYaw, this.rotationPitch); + this.renderYawOffset = this.rotationYaw; + this.rotationYawHead = this.rotationYaw; + this.stepHeight = 1.0F; + this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F; + + if (this.boosting && this.boostTime++ > this.totalBoostTime) + { + this.boosting = false; + } + + if (this.canPassengerSteer()) + { + float f = (float) this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() * 0.225F; + + if (this.boosting) + { + f += f * 1.15F * MathHelper.sin((float) this.boostTime / (float) this.totalBoostTime * (float) Math.PI); + } + + this.setAIMoveSpeed(f); + super.travel(0.0F, 0.0F, 1.0F); + } + else + { + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + double d1 = this.posX - this.prevPosX; + double d0 = this.posZ - this.prevPosZ; + float f1 = MathHelper.sqrt(d1 * d1 + d0 * d0) * 4.0F; + + if (f1 > 1.0F) + { + f1 = 1.0F; + } + + this.limbSwingAmount += (f1 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + else + { + this.stepHeight = 0.5F; + this.jumpMovementFactor = 0.02F; + super.travel(strafe, vertical, forward); + } + } + + @Override + public boolean boost() + { + 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; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java index 8018265..2966ab3 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java @@ -6,24 +6,29 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; -public class EntityMarcellDAvis extends EntityZombie { - public EntityMarcellDAvis(World worldIn) { - super(worldIn); - this.setSize(0.6F, 1.95F); - } +public class EntityMarcellDAvis extends EntityZombie +{ + public EntityMarcellDAvis(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 1.95F); + } - @Override - protected SoundEvent getAmbientSound() { - return ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT; - } + @Override + protected SoundEvent getAmbientSound() + { + return ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT; + } - @Override - protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return ModSoundEvents.ENTITY_MARCELLDAVIS_HURT; - } + @Override + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return ModSoundEvents.ENTITY_MARCELLDAVIS_HURT; + } - @Override - protected SoundEvent getDeathSound() { - return ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH; - } + @Override + protected SoundEvent getDeathSound() + { + return ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java index 6569036..d0faa00 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java @@ -6,24 +6,29 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; -public class EntityMrBean extends EntityZombie { - public EntityMrBean(World worldIn) { - super(worldIn); - this.setSize(0.6F, 1.95F); - } +public class EntityMrBean extends EntityZombie +{ + public EntityMrBean(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 1.95F); + } - @Override - protected SoundEvent getAmbientSound() { - return ModSoundEvents.ENTITY_MRBEAN_AMBIENT; - } + @Override + protected SoundEvent getAmbientSound() + { + return ModSoundEvents.ENTITY_MRBEAN_AMBIENT; + } - @Override - protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return ModSoundEvents.ENTITY_MRBEAN_HURT; - } + @Override + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return ModSoundEvents.ENTITY_MRBEAN_HURT; + } - @Override - protected SoundEvent getDeathSound() { - return ModSoundEvents.ENTITY_MRBEAN_DEATH; - } + @Override + protected SoundEvent getDeathSound() + { + return ModSoundEvents.ENTITY_MRBEAN_DEATH; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java index c444ee1..28b8e26 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java @@ -52,689 +52,824 @@ import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class EntitySchalker extends EntityGolem implements IMob { - private static final UUID COVERED_ARMOR_BONUS_ID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F"); - private static final AttributeModifier COVERED_ARMOR_BONUS_MODIFIER = (new AttributeModifier(COVERED_ARMOR_BONUS_ID, - "Covered armor bonus", 20.0D, 0)).setSaved(false); - protected static final DataParameter ATTACHED_FACE = EntityDataManager - .createKey(EntitySchalker.class, DataSerializers.FACING); - protected static final DataParameter> ATTACHED_BLOCK_POS = EntityDataManager - .>createKey(EntitySchalker.class, DataSerializers.OPTIONAL_BLOCK_POS); - protected static final DataParameter PEEK_TICK = EntityDataManager.createKey(EntitySchalker.class, - DataSerializers.BYTE); - protected static final DataParameter COLOR = EntityDataManager.createKey(EntitySchalker.class, - DataSerializers.BYTE); - public static final EnumDyeColor DEFAULT_COLOR = EnumDyeColor.PURPLE; - private float prevPeekAmount; - private float peekAmount; - private BlockPos currentAttachmentPosition; - private int clientSideTeleportInterpolation; +public class EntitySchalker extends EntityGolem implements IMob +{ + private static final UUID COVERED_ARMOR_BONUS_ID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F"); + private static final AttributeModifier COVERED_ARMOR_BONUS_MODIFIER = (new AttributeModifier(COVERED_ARMOR_BONUS_ID, "Covered armor bonus", 20.0D, 0)).setSaved(false); + protected static final DataParameter ATTACHED_FACE = EntityDataManager.createKey(EntitySchalker.class, DataSerializers.FACING); + protected static final DataParameter> ATTACHED_BLOCK_POS = EntityDataManager.>createKey(EntitySchalker.class, DataSerializers.OPTIONAL_BLOCK_POS); + protected static final DataParameter PEEK_TICK = EntityDataManager.createKey(EntitySchalker.class, DataSerializers.BYTE); + protected static final DataParameter COLOR = EntityDataManager.createKey(EntitySchalker.class, DataSerializers.BYTE); + public static final EnumDyeColor DEFAULT_COLOR = EnumDyeColor.PURPLE; + private float prevPeekAmount; + private float peekAmount; + private BlockPos currentAttachmentPosition; + private int clientSideTeleportInterpolation; - public EntitySchalker(World worldIn) { - super(worldIn); - this.setSize(1.0F, 1.0F); - this.prevRenderYawOffset = 180.0F; - this.renderYawOffset = 180.0F; - this.isImmuneToFire = true; - this.currentAttachmentPosition = null; - this.experienceValue = 5; - } - - @Override - @Nullable - public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) { - this.renderYawOffset = 180.0F; - this.prevRenderYawOffset = 180.0F; - this.rotationYaw = 180.0F; - this.prevRotationYaw = 180.0F; - this.rotationYawHead = 180.0F; - this.prevRotationYawHead = 180.0F; - return super.onInitialSpawn(difficulty, livingdata); - } - - @Override - protected void initEntityAI() { - this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(4, new EntitySchalker.AIAttack()); - this.tasks.addTask(7, new EntitySchalker.AIPeek()); - this.tasks.addTask(8, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); - this.targetTasks.addTask(2, new EntitySchalker.AIAttackNearest(this)); - this.targetTasks.addTask(3, new EntitySchalker.AIDefenseAttack(this)); - } - - @Override - protected boolean canTriggerWalking() { - return false; - } - - @Override - public SoundCategory getSoundCategory() { - return SoundCategory.HOSTILE; - } - - @Override - protected SoundEvent getAmbientSound() { - return ModSoundEvents.ENTITY_SCHALKER_AMBIENT; - } - - @Override - public void playLivingSound() { - if (!this.isClosed()) { - super.playLivingSound(); - } - } - - @Override - protected SoundEvent getDeathSound() { - return ModSoundEvents.ENTITY_SCHALKER_DEATH; - } - - @Override - protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return this.isClosed() ? SoundEvents.ENTITY_SHULKER_HURT_CLOSED : SoundEvents.ENTITY_SHULKER_HURT; - } - - @Override - protected void entityInit() { - super.entityInit(); - this.dataManager.register(ATTACHED_FACE, EnumFacing.DOWN); - this.dataManager.register(ATTACHED_BLOCK_POS, Optional.absent()); - this.dataManager.register(PEEK_TICK, Byte.valueOf((byte) 0)); - this.dataManager.register(COLOR, Byte.valueOf((byte) DEFAULT_COLOR.getMetadata())); - } - - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30.0D); - } - - @Override - protected EntityBodyHelper createBodyHelper() { - return new EntitySchalker.BodyHelper(this); - } - - public static void registerFixesSchalker(DataFixer fixer) { - EntityLiving.registerFixesMob(fixer, EntitySchalker.class); - } - - @Override - public void readEntityFromNBT(NBTTagCompound compound) { - super.readEntityFromNBT(compound); - this.dataManager.set(ATTACHED_FACE, EnumFacing.getFront(compound.getByte("AttachFace"))); - this.dataManager.set(PEEK_TICK, Byte.valueOf(compound.getByte("Peek"))); - this.dataManager.set(COLOR, Byte.valueOf(compound.getByte("Color"))); - - if (compound.hasKey("APX")) { - int i = compound.getInteger("APX"); - int j = compound.getInteger("APY"); - int k = compound.getInteger("APZ"); - this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(new BlockPos(i, j, k))); - } else { - this.dataManager.set(ATTACHED_BLOCK_POS, Optional.absent()); - } - } - - @Override - public void writeEntityToNBT(NBTTagCompound compound) { - super.writeEntityToNBT(compound); - compound.setByte("AttachFace", (byte) this.dataManager.get(ATTACHED_FACE).getIndex()); - compound.setByte("Peek", this.dataManager.get(PEEK_TICK).byteValue()); - compound.setByte("Color", this.dataManager.get(COLOR).byteValue()); - BlockPos blockpos = this.getAttachmentPos(); - - if (blockpos != null) { - compound.setInteger("APX", blockpos.getX()); - compound.setInteger("APY", blockpos.getY()); - compound.setInteger("APZ", blockpos.getZ()); - } - } - - @Override - public void onUpdate() { - super.onUpdate(); - BlockPos blockpos = (BlockPos) ((Optional) this.dataManager.get(ATTACHED_BLOCK_POS)).orNull(); - - if (blockpos == null && !this.world.isRemote) { - blockpos = new BlockPos(this); - this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos)); + public EntitySchalker(World worldIn) + { + super(worldIn); + this.setSize(1.0F, 1.0F); + this.prevRenderYawOffset = 180.0F; + this.renderYawOffset = 180.0F; + this.isImmuneToFire = true; + this.currentAttachmentPosition = null; + this.experienceValue = 5; } - if (this.isRiding()) { - blockpos = null; - float f = this.getRidingEntity().rotationYaw; - this.rotationYaw = f; - this.renderYawOffset = f; - this.prevRenderYawOffset = f; - this.clientSideTeleportInterpolation = 0; - } else if (!this.world.isRemote) { - IBlockState iblockstate = this.world.getBlockState(blockpos); + @Override + @Nullable + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable + IEntityLivingData livingdata) + { + this.renderYawOffset = 180.0F; + this.prevRenderYawOffset = 180.0F; + this.rotationYaw = 180.0F; + this.prevRotationYaw = 180.0F; + this.rotationYawHead = 180.0F; + this.prevRotationYawHead = 180.0F; + return super.onInitialSpawn(difficulty, livingdata); + } - if (iblockstate.getMaterial() != Material.AIR) { - if (iblockstate.getBlock() == Blocks.PISTON_EXTENSION) { - EnumFacing enumfacing = iblockstate.getValue(BlockDirectional.FACING); + @Override + protected void initEntityAI() + { + this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(4, new EntitySchalker.AIAttack()); + this.tasks.addTask(7, new EntitySchalker.AIPeek()); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); + this.targetTasks.addTask(2, new EntitySchalker.AIAttackNearest(this)); + this.targetTasks.addTask(3, new EntitySchalker.AIDefenseAttack(this)); + } - if (this.world.isAirBlock(blockpos.offset(enumfacing))) { - blockpos = blockpos.offset(enumfacing); + @Override + protected boolean canTriggerWalking() + { + return false; + } + + @Override + public SoundCategory getSoundCategory() + { + return SoundCategory.HOSTILE; + } + + @Override + protected SoundEvent getAmbientSound() + { + return ModSoundEvents.ENTITY_SCHALKER_AMBIENT; + } + + @Override + public void playLivingSound() + { + if (!this.isClosed()) + { + super.playLivingSound(); + } + } + + @Override + protected SoundEvent getDeathSound() + { + return ModSoundEvents.ENTITY_SCHALKER_DEATH; + } + + @Override + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return this.isClosed() ? SoundEvents.ENTITY_SHULKER_HURT_CLOSED : SoundEvents.ENTITY_SHULKER_HURT; + } + + @Override + protected void entityInit() + { + super.entityInit(); + this.dataManager.register(ATTACHED_FACE, EnumFacing.DOWN); + this.dataManager.register(ATTACHED_BLOCK_POS, Optional.absent()); + this.dataManager.register(PEEK_TICK, Byte.valueOf((byte) 0)); + this.dataManager.register(COLOR, Byte.valueOf((byte) DEFAULT_COLOR.getMetadata())); + } + + @Override + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30.0D); + } + + @Override + protected EntityBodyHelper createBodyHelper() + { + return new EntitySchalker.BodyHelper(this); + } + + public static void registerFixesSchalker(DataFixer fixer) + { + EntityLiving.registerFixesMob(fixer, EntitySchalker.class); + } + + @Override + public void readEntityFromNBT(NBTTagCompound compound) + { + super.readEntityFromNBT(compound); + this.dataManager.set(ATTACHED_FACE, EnumFacing.getFront(compound.getByte("AttachFace"))); + this.dataManager.set(PEEK_TICK, Byte.valueOf(compound.getByte("Peek"))); + this.dataManager.set(COLOR, Byte.valueOf(compound.getByte("Color"))); + + if (compound.hasKey("APX")) + { + int i = compound.getInteger("APX"); + int j = compound.getInteger("APY"); + int k = compound.getInteger("APZ"); + this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(new BlockPos(i, j, k))); + } + else + { + this.dataManager.set(ATTACHED_BLOCK_POS, Optional.absent()); + } + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) + { + super.writeEntityToNBT(compound); + compound.setByte("AttachFace", (byte) this.dataManager.get(ATTACHED_FACE).getIndex()); + compound.setByte("Peek", this.dataManager.get(PEEK_TICK).byteValue()); + compound.setByte("Color", this.dataManager.get(COLOR).byteValue()); + BlockPos blockpos = this.getAttachmentPos(); + + if (blockpos != null) + { + compound.setInteger("APX", blockpos.getX()); + compound.setInteger("APY", blockpos.getY()); + compound.setInteger("APZ", blockpos.getZ()); + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + BlockPos blockpos = (BlockPos) ((Optional) this.dataManager.get(ATTACHED_BLOCK_POS)).orNull(); + + if (blockpos == null && !this.world.isRemote) + { + blockpos = new BlockPos(this); this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos)); - } else { - this.tryTeleportToNewPosition(); - } - } else if (iblockstate.getBlock() == Blocks.PISTON_HEAD) { - EnumFacing enumfacing3 = iblockstate.getValue(BlockDirectional.FACING); - - if (this.world.isAirBlock(blockpos.offset(enumfacing3))) { - blockpos = blockpos.offset(enumfacing3); - this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos)); - } else { - this.tryTeleportToNewPosition(); - } - } else { - this.tryTeleportToNewPosition(); - } - } - - BlockPos blockpos1 = blockpos.offset(this.getAttachmentFacing()); - - if (!this.world.isBlockNormalCube(blockpos1, false)) { - boolean flag = false; - - for (EnumFacing enumfacing1 : EnumFacing.values()) { - blockpos1 = blockpos.offset(enumfacing1); - - if (this.world.isBlockNormalCube(blockpos1, false)) { - this.dataManager.set(ATTACHED_FACE, enumfacing1); - flag = true; - break; - } } - if (!flag) { - this.tryTeleportToNewPosition(); + if (this.isRiding()) + { + blockpos = null; + float f = this.getRidingEntity().rotationYaw; + this.rotationYaw = f; + this.renderYawOffset = f; + this.prevRenderYawOffset = f; + this.clientSideTeleportInterpolation = 0; } - } + else if (!this.world.isRemote) + { + IBlockState iblockstate = this.world.getBlockState(blockpos); - BlockPos blockpos2 = blockpos.offset(this.getAttachmentFacing().getOpposite()); + if (iblockstate.getMaterial() != Material.AIR) + { + if (iblockstate.getBlock() == Blocks.PISTON_EXTENSION) + { + EnumFacing enumfacing = iblockstate.getValue(BlockDirectional.FACING); - if (this.world.isBlockNormalCube(blockpos2, false)) { - this.tryTeleportToNewPosition(); - } - } + if (this.world.isAirBlock(blockpos.offset(enumfacing))) + { + blockpos = blockpos.offset(enumfacing); + this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos)); + } + else + { + this.tryTeleportToNewPosition(); + } + } + else if (iblockstate.getBlock() == Blocks.PISTON_HEAD) + { + EnumFacing enumfacing3 = iblockstate.getValue(BlockDirectional.FACING); - float f1 = this.getPeekTick() * 0.01F; - this.prevPeekAmount = this.peekAmount; - - if (this.peekAmount > f1) { - this.peekAmount = MathHelper.clamp(this.peekAmount - 0.05F, f1, 1.0F); - } else if (this.peekAmount < f1) { - this.peekAmount = MathHelper.clamp(this.peekAmount + 0.05F, 0.0F, f1); - } - - if (blockpos != null) { - if (this.world.isRemote) { - if (this.clientSideTeleportInterpolation > 0 && this.currentAttachmentPosition != null) { - --this.clientSideTeleportInterpolation; - } else { - this.currentAttachmentPosition = blockpos; - } - } - - this.posX = blockpos.getX() + 0.5D; - this.posY = blockpos.getY(); - this.posZ = blockpos.getZ() + 0.5D; - if (this.isAddedToWorld() && !this.world.isRemote) - this.world.updateEntityWithOptionalForce(this, false); // Forge - // - - // Process - // chunk - // registration - // after - // moving. - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.lastTickPosX = this.posX; - this.lastTickPosY = this.posY; - this.lastTickPosZ = this.posZ; - double d3 = 0.5D - MathHelper.sin((0.5F + this.peekAmount) * (float) Math.PI) * 0.5D; - double d4 = 0.5D - MathHelper.sin((0.5F + this.prevPeekAmount) * (float) Math.PI) * 0.5D; - double d5 = d3 - d4; - double d0 = 0.0D; - double d1 = 0.0D; - double d2 = 0.0D; - EnumFacing enumfacing2 = this.getAttachmentFacing(); - - switch (enumfacing2) { - case DOWN: - this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D, - this.posX + 0.5D, this.posY + 1.0D + d3, this.posZ + 0.5D)); - d1 = d5; - break; - case UP: - this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY - d3, this.posZ - 0.5D, - this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D)); - d1 = -d5; - break; - case NORTH: - this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D, - this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D + d3)); - d2 = d5; - break; - case SOUTH: - this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D - d3, - this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D)); - d2 = -d5; - break; - case WEST: - this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D, - this.posX + 0.5D + d3, this.posY + 1.0D, this.posZ + 0.5D)); - d0 = d5; - break; - case EAST: - this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D - d3, this.posY, this.posZ - 0.5D, - this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D)); - d0 = -d5; - } - - if (d5 > 0.0D) { - List list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()); - - if (!list.isEmpty()) { - for (Entity entity : list) { - if (!(entity instanceof EntitySchalker) && !entity.noClip) { - entity.move(MoverType.SHULKER, d0, d1, d2); + if (this.world.isAirBlock(blockpos.offset(enumfacing3))) + { + blockpos = blockpos.offset(enumfacing3); + this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos)); + } + else + { + this.tryTeleportToNewPosition(); + } + } + else + { + this.tryTeleportToNewPosition(); + } } - } - } - } - } - } - @Override - public void move(MoverType type, double x, double y, double z) { - if (type == MoverType.SHULKER_BOX) { - this.tryTeleportToNewPosition(); - } else { - super.move(type, x, y, z); - } - } + BlockPos blockpos1 = blockpos.offset(this.getAttachmentFacing()); - @Override - public void setPosition(double x, double y, double z) { - super.setPosition(x, y, z); + if (!this.world.isBlockNormalCube(blockpos1, false)) + { + boolean flag = false; - if (this.dataManager != null && this.ticksExisted != 0) { - Optional optional = this.dataManager.get(ATTACHED_BLOCK_POS); - Optional optional1 = Optional.of(new BlockPos(x, y, z)); + for (EnumFacing enumfacing1 : EnumFacing.values()) + { + blockpos1 = blockpos.offset(enumfacing1); - if (!optional1.equals(optional)) { - this.dataManager.set(ATTACHED_BLOCK_POS, optional1); - this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) 0)); - this.isAirBorne = true; - } - } - } + if (this.world.isBlockNormalCube(blockpos1, false)) + { + this.dataManager.set(ATTACHED_FACE, enumfacing1); + flag = true; + break; + } + } - protected boolean tryTeleportToNewPosition() { - if (!this.isAIDisabled() && this.isEntityAlive()) { - BlockPos blockpos = new BlockPos(this); - - for (int i = 0; i < 5; ++i) { - BlockPos blockpos1 = blockpos.add(8 - this.rand.nextInt(17), 8 - this.rand.nextInt(17), - 8 - this.rand.nextInt(17)); - - if (blockpos1.getY() > 0 && this.world.isAirBlock(blockpos1) && this.world.isInsideWorldBorder(this) - && this.world.getCollisionBoxes(this, new AxisAlignedBB(blockpos1)).isEmpty()) { - boolean flag = false; - - for (EnumFacing enumfacing : EnumFacing.values()) { - if (this.world.isBlockNormalCube(blockpos1.offset(enumfacing), false)) { - this.dataManager.set(ATTACHED_FACE, enumfacing); - flag = true; - break; + if (!flag) + { + this.tryTeleportToNewPosition(); + } } - } - if (flag) { - net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent( - this, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ(), 0); - if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) - flag = false; - blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ()); - } + BlockPos blockpos2 = blockpos.offset(this.getAttachmentFacing().getOpposite()); - if (flag) { - this.playSound(SoundEvents.ENTITY_SHULKER_TELEPORT, 1.0F, 1.0F); - this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos1)); - this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) 0)); - this.setAttackTarget((EntityLivingBase) null); + if (this.world.isBlockNormalCube(blockpos2, false)) + { + this.tryTeleportToNewPosition(); + } + } + + float f1 = this.getPeekTick() * 0.01F; + this.prevPeekAmount = this.peekAmount; + + if (this.peekAmount > f1) + { + this.peekAmount = MathHelper.clamp(this.peekAmount - 0.05F, f1, 1.0F); + } + else if (this.peekAmount < f1) + { + this.peekAmount = MathHelper.clamp(this.peekAmount + 0.05F, 0.0F, f1); + } + + if (blockpos != null) + { + if (this.world.isRemote) + { + if (this.clientSideTeleportInterpolation > 0 && this.currentAttachmentPosition != null) + { + --this.clientSideTeleportInterpolation; + } + else + { + this.currentAttachmentPosition = blockpos; + } + } + + this.posX = blockpos.getX() + 0.5D; + this.posY = blockpos.getY(); + this.posZ = blockpos.getZ() + 0.5D; + if (this.isAddedToWorld() && !this.world.isRemote) + this.world.updateEntityWithOptionalForce(this, false); // Forge + // - + // Process + // chunk + // registration + // after + // moving. + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + double d3 = 0.5D - MathHelper.sin((0.5F + this.peekAmount) * (float) Math.PI) * 0.5D; + double d4 = 0.5D - MathHelper.sin((0.5F + this.prevPeekAmount) * (float) Math.PI) * 0.5D; + double d5 = d3 - d4; + double d0 = 0.0D; + double d1 = 0.0D; + double d2 = 0.0D; + EnumFacing enumfacing2 = this.getAttachmentFacing(); + + switch (enumfacing2) + { + case DOWN: + this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D, this.posX + 0.5D, this.posY + 1.0D + d3, this.posZ + 0.5D)); + d1 = d5; + break; + case UP: + this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY - d3, this.posZ - 0.5D, this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D)); + d1 = -d5; + break; + case NORTH: + this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D, this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D + d3)); + d2 = d5; + break; + case SOUTH: + this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D - d3, this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D)); + d2 = -d5; + break; + case WEST: + this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D, this.posX + 0.5D + d3, this.posY + 1.0D, this.posZ + 0.5D)); + d0 = d5; + break; + case EAST: + this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D - d3, this.posY, this.posZ - 0.5D, this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D)); + d0 = -d5; + } + + if (d5 > 0.0D) + { + List list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()); + + if (!list.isEmpty()) + { + for (Entity entity : list) + { + if (!(entity instanceof EntitySchalker) && !entity.noClip) + { + entity.move(MoverType.SHULKER, d0, d1, d2); + } + } + } + } + } + } + + @Override + public void move(MoverType type, double x, double y, double z) + { + if (type == MoverType.SHULKER_BOX) + { + this.tryTeleportToNewPosition(); + } + else + { + super.move(type, x, y, z); + } + } + + @Override + public void setPosition(double x, double y, double z) + { + super.setPosition(x, y, z); + + if (this.dataManager != null && this.ticksExisted != 0) + { + Optional optional = this.dataManager.get(ATTACHED_BLOCK_POS); + Optional optional1 = Optional.of(new BlockPos(x, y, z)); + + if (!optional1.equals(optional)) + { + this.dataManager.set(ATTACHED_BLOCK_POS, optional1); + this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) 0)); + this.isAirBorne = true; + } + } + } + + protected boolean tryTeleportToNewPosition() + { + if (!this.isAIDisabled() && this.isEntityAlive()) + { + BlockPos blockpos = new BlockPos(this); + + for (int i = 0; i < 5; ++i) + { + BlockPos blockpos1 = blockpos.add(8 - this.rand.nextInt(17), 8 - this.rand.nextInt(17), 8 - this.rand.nextInt(17)); + + if (blockpos1.getY() > 0 && this.world.isAirBlock(blockpos1) && this.world.isInsideWorldBorder(this) && this.world.getCollisionBoxes(this, new AxisAlignedBB(blockpos1)).isEmpty()) + { + boolean flag = false; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (this.world.isBlockNormalCube(blockpos1.offset(enumfacing), false)) + { + this.dataManager.set(ATTACHED_FACE, enumfacing); + flag = true; + break; + } + } + + if (flag) + { + net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, blockpos1.getX(), blockpos1.getY(), + blockpos1.getZ(), 0); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + flag = false; + blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + } + + if (flag) + { + this.playSound(SoundEvents.ENTITY_SHULKER_TELEPORT, 1.0F, 1.0F); + this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos1)); + this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) 0)); + this.setAttackTarget((EntityLivingBase) null); + return true; + } + } + } + + return false; + } + else + { return true; - } } - } - - return false; - } else { - return true; } - } - @Override - public void onLivingUpdate() { - super.onLivingUpdate(); - this.motionX = 0.0D; - this.motionY = 0.0D; - this.motionZ = 0.0D; - this.prevRenderYawOffset = 180.0F; - this.renderYawOffset = 180.0F; - this.rotationYaw = 180.0F; - } + @Override + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevRenderYawOffset = 180.0F; + this.renderYawOffset = 180.0F; + this.rotationYaw = 180.0F; + } - @Override - public void notifyDataManagerChange(DataParameter key) { - if (ATTACHED_BLOCK_POS.equals(key) && this.world.isRemote && !this.isRiding()) { - BlockPos blockpos = this.getAttachmentPos(); + @Override + public void notifyDataManagerChange(DataParameter key) + { + if (ATTACHED_BLOCK_POS.equals(key) && this.world.isRemote && !this.isRiding()) + { + BlockPos blockpos = this.getAttachmentPos(); - if (blockpos != null) { - if (this.currentAttachmentPosition == null) { - this.currentAttachmentPosition = blockpos; - } else { - this.clientSideTeleportInterpolation = 6; + if (blockpos != null) + { + if (this.currentAttachmentPosition == null) + { + this.currentAttachmentPosition = blockpos; + } + else + { + this.clientSideTeleportInterpolation = 6; + } + + this.posX = blockpos.getX() + 0.5D; + this.posY = blockpos.getY(); + this.posZ = blockpos.getZ() + 0.5D; + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + } } - this.posX = blockpos.getX() + 0.5D; - this.posY = blockpos.getY(); - this.posZ = blockpos.getZ() + 0.5D; - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.lastTickPosX = this.posX; - this.lastTickPosY = this.posY; - this.lastTickPosZ = this.posZ; - } - } - - super.notifyDataManagerChange(key); - } - - @Override - @SideOnly(Side.CLIENT) - public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, - int posRotationIncrements, boolean teleport) { - this.newPosRotationIncrements = 0; - } - - @Override - public boolean attackEntityFrom(DamageSource source, float amount) { - if (this.isClosed()) { - Entity entity = source.getImmediateSource(); - - if (entity instanceof EntityArrow) { - return false; - } - } - - if (super.attackEntityFrom(source, amount)) { - if (this.getHealth() < this.getMaxHealth() * 0.5D && this.rand.nextInt(4) == 0) { - this.tryTeleportToNewPosition(); - } - - return true; - } else { - return false; - } - } - - private boolean isClosed() { - return this.getPeekTick() == 0; - } - - @Override - @Nullable - public AxisAlignedBB getCollisionBoundingBox() { - return this.isEntityAlive() ? this.getEntityBoundingBox() : null; - } - - public EnumFacing getAttachmentFacing() { - return this.dataManager.get(ATTACHED_FACE); - } - - @Nullable - public BlockPos getAttachmentPos() { - return (BlockPos) ((Optional) this.dataManager.get(ATTACHED_BLOCK_POS)).orNull(); - } - - public void setAttachmentPos(@Nullable BlockPos pos) { - this.dataManager.set(ATTACHED_BLOCK_POS, Optional.fromNullable(pos)); - } - - public int getPeekTick() { - return this.dataManager.get(PEEK_TICK).byteValue(); - } - - public void updateArmorModifier(int p_184691_1_) { - if (!this.world.isRemote) { - this.getEntityAttribute(SharedMonsterAttributes.ARMOR).removeModifier(COVERED_ARMOR_BONUS_MODIFIER); - - if (p_184691_1_ == 0) { - this.getEntityAttribute(SharedMonsterAttributes.ARMOR).applyModifier(COVERED_ARMOR_BONUS_MODIFIER); - this.playSound(SoundEvents.ENTITY_SHULKER_CLOSE, 1.0F, 1.0F); - } else { - this.playSound(ModSoundEvents.ENTITY_SCHALKER_OPEN, 1.0F, 1.0F); - } - } - - this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) p_184691_1_)); - } - - @SideOnly(Side.CLIENT) - public float getClientPeekAmount(float p_184688_1_) { - return this.prevPeekAmount + (this.peekAmount - this.prevPeekAmount) * p_184688_1_; - } - - @SideOnly(Side.CLIENT) - public int getClientTeleportInterp() { - return this.clientSideTeleportInterpolation; - } - - @SideOnly(Side.CLIENT) - public BlockPos getOldAttachPos() { - return this.currentAttachmentPosition; - } - - @Override - public float getEyeHeight() { - return 0.5F; - } - - @Override - public int getVerticalFaceSpeed() { - return 180; - } - - @Override - public int getHorizontalFaceSpeed() { - return 180; - } - - @Override - public void applyEntityCollision(Entity entityIn) { - } - - @Override - public float getCollisionBorderSize() { - return 0.0F; - } - - @SideOnly(Side.CLIENT) - public boolean isAttachedToBlock() { - return this.currentAttachmentPosition != null && this.getAttachmentPos() != null; - } - - @Override - @Nullable - protected ResourceLocation getLootTable() { - return LootTableList.ENTITIES_SHULKER; - } - - @SideOnly(Side.CLIENT) - public EnumDyeColor getColor() { - return EnumDyeColor.byMetadata(this.dataManager.get(COLOR).byteValue()); - } - - class AIAttack extends EntityAIBase { - private int attackTime; - - public AIAttack() { - this.setMutexBits(3); + super.notifyDataManagerChange(key); } @Override - public boolean shouldExecute() { - EntityLivingBase entitylivingbase = EntitySchalker.this.getAttackTarget(); - - if (entitylivingbase != null && entitylivingbase.isEntityAlive()) { - return EntitySchalker.this.world.getDifficulty() != EnumDifficulty.PEACEFUL; - } else { - return false; - } + @SideOnly(Side.CLIENT) + public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean teleport) + { + this.newPosRotationIncrements = 0; } @Override - public void startExecuting() { - this.attackTime = 20; - EntitySchalker.this.updateArmorModifier(100); - } + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isClosed()) + { + Entity entity = source.getImmediateSource(); - @Override - public void resetTask() { - EntitySchalker.this.updateArmorModifier(0); - } - - @Override - public void updateTask() { - if (EntitySchalker.this.world.getDifficulty() != EnumDifficulty.PEACEFUL) { - --this.attackTime; - EntityLivingBase entitylivingbase = EntitySchalker.this.getAttackTarget(); - EntitySchalker.this.getLookHelper().setLookPositionWithEntity(entitylivingbase, 180.0F, 180.0F); - double d0 = EntitySchalker.this.getDistanceSq(entitylivingbase); - - if (d0 < 400.0D) { - if (this.attackTime <= 0) { - this.attackTime = 20 + EntitySchalker.this.rand.nextInt(10) * 20 / 2; - EntitySchalkerBullet entityschalkerbullet = new EntitySchalkerBullet(EntitySchalker.this.world, - EntitySchalker.this, entitylivingbase, - EntitySchalker.this.getAttachmentFacing().getAxis()); - EntitySchalker.this.world.spawnEntity(entityschalkerbullet); - EntitySchalker.this.playSound(ModSoundEvents.ENTITY_SCHALKER_SHOOT, 2.0F, - (EntitySchalker.this.rand.nextFloat() - EntitySchalker.this.rand.nextFloat()) * 0.2F - + 1.0F); - } - } else { - EntitySchalker.this.setAttackTarget((EntityLivingBase) null); + if (entity instanceof EntityArrow) + { + return false; + } } - super.updateTask(); - } - } - } + if (super.attackEntityFrom(source, amount)) + { + if (this.getHealth() < this.getMaxHealth() * 0.5D && this.rand.nextInt(4) == 0) + { + this.tryTeleportToNewPosition(); + } - class AIAttackNearest extends EntityAINearestAttackableTarget { - public AIAttackNearest(EntitySchalker schalker) { - super(schalker, EntityPlayer.class, true); + return true; + } + else + { + return false; + } + } + + private boolean isClosed() + { + return this.getPeekTick() == 0; } @Override - public boolean shouldExecute() { - return EntitySchalker.this.world.getDifficulty() == EnumDifficulty.PEACEFUL ? false : super.shouldExecute(); + @Nullable + public AxisAlignedBB getCollisionBoundingBox() + { + return this.isEntityAlive() ? this.getEntityBoundingBox() : null; + } + + public EnumFacing getAttachmentFacing() + { + return this.dataManager.get(ATTACHED_FACE); + } + + @Nullable + public BlockPos getAttachmentPos() + { + return (BlockPos) ((Optional) this.dataManager.get(ATTACHED_BLOCK_POS)).orNull(); + } + + public void setAttachmentPos(@Nullable + BlockPos pos) + { + this.dataManager.set(ATTACHED_BLOCK_POS, Optional.fromNullable(pos)); + } + + public int getPeekTick() + { + return this.dataManager.get(PEEK_TICK).byteValue(); + } + + public void updateArmorModifier(int p_184691_1_) + { + if (!this.world.isRemote) + { + this.getEntityAttribute(SharedMonsterAttributes.ARMOR).removeModifier(COVERED_ARMOR_BONUS_MODIFIER); + + if (p_184691_1_ == 0) + { + this.getEntityAttribute(SharedMonsterAttributes.ARMOR).applyModifier(COVERED_ARMOR_BONUS_MODIFIER); + this.playSound(SoundEvents.ENTITY_SHULKER_CLOSE, 1.0F, 1.0F); + } + else + { + this.playSound(ModSoundEvents.ENTITY_SCHALKER_OPEN, 1.0F, 1.0F); + } + } + + this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) p_184691_1_)); + } + + @SideOnly(Side.CLIENT) + public float getClientPeekAmount(float p_184688_1_) + { + return this.prevPeekAmount + (this.peekAmount - this.prevPeekAmount) * p_184688_1_; + } + + @SideOnly(Side.CLIENT) + public int getClientTeleportInterp() + { + return this.clientSideTeleportInterpolation; + } + + @SideOnly(Side.CLIENT) + public BlockPos getOldAttachPos() + { + return this.currentAttachmentPosition; } @Override - protected AxisAlignedBB getTargetableArea(double targetDistance) { - EnumFacing enumfacing = ((EntitySchalker) this.taskOwner).getAttachmentFacing(); - - if (enumfacing.getAxis() == EnumFacing.Axis.X) { - return this.taskOwner.getEntityBoundingBox().grow(4.0D, targetDistance, targetDistance); - } else { - return enumfacing.getAxis() == EnumFacing.Axis.Z - ? this.taskOwner.getEntityBoundingBox().grow(targetDistance, targetDistance, 4.0D) - : this.taskOwner.getEntityBoundingBox().grow(targetDistance, 4.0D, targetDistance); - } + public float getEyeHeight() + { + return 0.5F; } - } - static class AIDefenseAttack extends EntityAINearestAttackableTarget { - public AIDefenseAttack(EntitySchalker schalker) { - super(schalker, EntityLivingBase.class, 10, true, false, new Predicate() { + @Override + public int getVerticalFaceSpeed() + { + return 180; + } + + @Override + public int getHorizontalFaceSpeed() + { + return 180; + } + + @Override + public void applyEntityCollision(Entity entityIn) + { + } + + @Override + public float getCollisionBorderSize() + { + return 0.0F; + } + + @SideOnly(Side.CLIENT) + public boolean isAttachedToBlock() + { + return this.currentAttachmentPosition != null && this.getAttachmentPos() != null; + } + + @Override + @Nullable + protected ResourceLocation getLootTable() + { + return LootTableList.ENTITIES_SHULKER; + } + + @SideOnly(Side.CLIENT) + public EnumDyeColor getColor() + { + return EnumDyeColor.byMetadata(this.dataManager.get(COLOR).byteValue()); + } + + class AIAttack extends EntityAIBase + { + private int attackTime; + + public AIAttack() + { + this.setMutexBits(3); + } + @Override - public boolean apply(@Nullable EntityLivingBase p_apply_1_) { - return p_apply_1_ instanceof IMob; + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = EntitySchalker.this.getAttackTarget(); + + if (entitylivingbase != null && entitylivingbase.isEntityAlive()) + { + return EntitySchalker.this.world.getDifficulty() != EnumDifficulty.PEACEFUL; + } + else + { + return false; + } + } + + @Override + public void startExecuting() + { + this.attackTime = 20; + EntitySchalker.this.updateArmorModifier(100); + } + + @Override + public void resetTask() + { + EntitySchalker.this.updateArmorModifier(0); + } + + @Override + public void updateTask() + { + if (EntitySchalker.this.world.getDifficulty() != EnumDifficulty.PEACEFUL) + { + --this.attackTime; + EntityLivingBase entitylivingbase = EntitySchalker.this.getAttackTarget(); + EntitySchalker.this.getLookHelper().setLookPositionWithEntity(entitylivingbase, 180.0F, 180.0F); + double d0 = EntitySchalker.this.getDistanceSq(entitylivingbase); + + if (d0 < 400.0D) + { + if (this.attackTime <= 0) + { + this.attackTime = 20 + EntitySchalker.this.rand.nextInt(10) * 20 / 2; + EntitySchalkerBullet entityschalkerbullet = new EntitySchalkerBullet(EntitySchalker.this.world, EntitySchalker.this, entitylivingbase, + EntitySchalker.this.getAttachmentFacing().getAxis()); + EntitySchalker.this.world.spawnEntity(entityschalkerbullet); + EntitySchalker.this.playSound(ModSoundEvents.ENTITY_SCHALKER_SHOOT, 2.0F, (EntitySchalker.this.rand.nextFloat() - EntitySchalker.this.rand.nextFloat()) * 0.2F + 1.0F); + } + } + else + { + EntitySchalker.this.setAttackTarget((EntityLivingBase) null); + } + + super.updateTask(); + } } - }); } - @Override - public boolean shouldExecute() { - return this.taskOwner.getTeam() == null ? false : super.shouldExecute(); + class AIAttackNearest extends EntityAINearestAttackableTarget + { + public AIAttackNearest(EntitySchalker schalker) + { + super(schalker, EntityPlayer.class, true); + } + + @Override + public boolean shouldExecute() + { + return EntitySchalker.this.world.getDifficulty() == EnumDifficulty.PEACEFUL ? false : super.shouldExecute(); + } + + @Override + protected AxisAlignedBB getTargetableArea(double targetDistance) + { + EnumFacing enumfacing = ((EntitySchalker) this.taskOwner).getAttachmentFacing(); + + if (enumfacing.getAxis() == EnumFacing.Axis.X) + { + return this.taskOwner.getEntityBoundingBox().grow(4.0D, targetDistance, targetDistance); + } + else + { + return enumfacing.getAxis() == EnumFacing.Axis.Z ? this.taskOwner.getEntityBoundingBox().grow(targetDistance, targetDistance, 4.0D) + : this.taskOwner.getEntityBoundingBox().grow(targetDistance, 4.0D, targetDistance); + } + } } - @Override - protected AxisAlignedBB getTargetableArea(double targetDistance) { - EnumFacing enumfacing = ((EntitySchalker) this.taskOwner).getAttachmentFacing(); + static class AIDefenseAttack extends EntityAINearestAttackableTarget + { + public AIDefenseAttack(EntitySchalker schalker) + { + super(schalker, EntityLivingBase.class, 10, true, false, new Predicate() + { + @Override + public boolean apply(@Nullable + EntityLivingBase p_apply_1_) + { + return p_apply_1_ instanceof IMob; + } + }); + } - if (enumfacing.getAxis() == EnumFacing.Axis.X) { - return this.taskOwner.getEntityBoundingBox().grow(4.0D, targetDistance, targetDistance); - } else { - return enumfacing.getAxis() == EnumFacing.Axis.Z - ? this.taskOwner.getEntityBoundingBox().grow(targetDistance, targetDistance, 4.0D) - : this.taskOwner.getEntityBoundingBox().grow(targetDistance, 4.0D, targetDistance); - } - } - } + @Override + public boolean shouldExecute() + { + return this.taskOwner.getTeam() == null ? false : super.shouldExecute(); + } - class AIPeek extends EntityAIBase { - private int peekTime; + @Override + protected AxisAlignedBB getTargetableArea(double targetDistance) + { + EnumFacing enumfacing = ((EntitySchalker) this.taskOwner).getAttachmentFacing(); - private AIPeek() { + if (enumfacing.getAxis() == EnumFacing.Axis.X) + { + return this.taskOwner.getEntityBoundingBox().grow(4.0D, targetDistance, targetDistance); + } + else + { + return enumfacing.getAxis() == EnumFacing.Axis.Z ? this.taskOwner.getEntityBoundingBox().grow(targetDistance, targetDistance, 4.0D) + : this.taskOwner.getEntityBoundingBox().grow(targetDistance, 4.0D, targetDistance); + } + } } - @Override - public boolean shouldExecute() { - return EntitySchalker.this.getAttackTarget() == null && EntitySchalker.this.rand.nextInt(40) == 0; + class AIPeek extends EntityAIBase + { + private int peekTime; + + private AIPeek() + { + } + + @Override + public boolean shouldExecute() + { + return EntitySchalker.this.getAttackTarget() == null && EntitySchalker.this.rand.nextInt(40) == 0; + } + + @Override + public boolean shouldContinueExecuting() + { + return EntitySchalker.this.getAttackTarget() == null && this.peekTime > 0; + } + + @Override + public void startExecuting() + { + this.peekTime = 20 * (1 + EntitySchalker.this.rand.nextInt(3)); + EntitySchalker.this.updateArmorModifier(30); + } + + @Override + public void resetTask() + { + if (EntitySchalker.this.getAttackTarget() == null) + { + EntitySchalker.this.updateArmorModifier(0); + } + } + + @Override + public void updateTask() + { + --this.peekTime; + } } - @Override - public boolean shouldContinueExecuting() { - return EntitySchalker.this.getAttackTarget() == null && this.peekTime > 0; - } + class BodyHelper extends EntityBodyHelper + { + public BodyHelper(EntityLivingBase theEntity) + { + super(theEntity); + } - @Override - public void startExecuting() { - this.peekTime = 20 * (1 + EntitySchalker.this.rand.nextInt(3)); - EntitySchalker.this.updateArmorModifier(30); + @Override + public void updateRenderAngles() + { + } } - - @Override - public void resetTask() { - if (EntitySchalker.this.getAttackTarget() == null) { - EntitySchalker.this.updateArmorModifier(0); - } - } - - @Override - public void updateTask() { - --this.peekTime; - } - } - - class BodyHelper extends EntityBodyHelper { - public BodyHelper(EntityLivingBase theEntity) { - super(theEntity); - } - - @Override - public void updateRenderAngles() { - } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalkerBullet.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalkerBullet.java index 2ee2590..f78a03c 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalkerBullet.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalkerBullet.java @@ -30,371 +30,439 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class EntitySchalkerBullet extends Entity { - private EntityLivingBase owner; - private Entity target; - @Nullable - private EnumFacing direction; - private int steps; - private double targetDeltaX; - private double targetDeltaY; - private double targetDeltaZ; - @Nullable - private UUID ownerUniqueId; - private BlockPos ownerBlockPos; - @Nullable - private UUID targetUniqueId; - private BlockPos targetBlockPos; +public class EntitySchalkerBullet extends Entity +{ + private EntityLivingBase owner; + private Entity target; + @Nullable + private EnumFacing direction; + private int steps; + private double targetDeltaX; + private double targetDeltaY; + private double targetDeltaZ; + @Nullable + private UUID ownerUniqueId; + private BlockPos ownerBlockPos; + @Nullable + private UUID targetUniqueId; + private BlockPos targetBlockPos; - public EntitySchalkerBullet(World worldIn) { - super(worldIn); - this.setSize(0.3125F, 0.3125F); - 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) { - this(worldIn); - this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); - this.motionX = motionXIn; - this.motionY = motionYIn; - this.motionZ = motionZIn; - } - - public EntitySchalkerBullet(World worldIn, EntityLivingBase ownerIn, Entity targetIn, EnumFacing.Axis p_i46772_4_) { - this(worldIn); - this.owner = ownerIn; - BlockPos blockpos = new BlockPos(ownerIn); - double d0 = blockpos.getX() + 0.5D; - double d1 = blockpos.getY() + 0.5D; - double d2 = blockpos.getZ() + 0.5D; - this.setLocationAndAngles(d0, d1, d2, this.rotationYaw, this.rotationPitch); - this.target = targetIn; - this.direction = EnumFacing.UP; - this.selectNextMoveDirection(p_i46772_4_); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - protected void writeEntityToNBT(NBTTagCompound compound) { - 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); + public EntitySchalkerBullet(World worldIn) + { + super(worldIn); + this.setSize(0.3125F, 0.3125F); + this.noClip = true; } - 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); + @Override + public SoundCategory getSoundCategory() + { + return SoundCategory.HOSTILE; } - if (this.direction != null) { - compound.setInteger("Dir", this.direction.getIndex()); + @SideOnly(Side.CLIENT) + public EntitySchalkerBullet(World worldIn, double x, double y, double z, double motionXIn, double motionYIn, double motionZIn) + { + this(worldIn); + this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); + this.motionX = motionXIn; + this.motionY = motionYIn; + this.motionZ = motionZIn; } - compound.setInteger("Steps", this.steps); - compound.setDouble("TXD", this.targetDeltaX); - compound.setDouble("TYD", this.targetDeltaY); - compound.setDouble("TZD", this.targetDeltaZ); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - protected void readEntityFromNBT(NBTTagCompound compound) { - 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")); + public EntitySchalkerBullet(World worldIn, EntityLivingBase ownerIn, Entity targetIn, EnumFacing.Axis p_i46772_4_) + { + this(worldIn); + this.owner = ownerIn; + BlockPos blockpos = new BlockPos(ownerIn); + double d0 = blockpos.getX() + 0.5D; + double d1 = blockpos.getY() + 0.5D; + double d2 = blockpos.getZ() + 0.5D; + this.setLocationAndAngles(d0, d1, d2, this.rotationYaw, this.rotationPitch); + this.target = targetIn; + this.direction = EnumFacing.UP; + this.selectNextMoveDirection(p_i46772_4_); } - 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")); - } - } - - @Override - protected void entityInit() { - } - - private void setDirection(@Nullable EnumFacing directionIn) { - this.direction = directionIn; - } - - private void selectNextMoveDirection(@Nullable EnumFacing.Axis p_184569_1_) { - 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); - } - - 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) { - BlockPos blockpos1 = new BlockPos(this); - List list = Lists.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); - } - } - - 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; - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() { - if (!this.world.isRemote && this.world.getDifficulty() == EnumDifficulty.PEACEFUL) { - this.setDead(); - } else { - super.onUpdate(); - - if (!this.world.isRemote) { - if (this.target == null && this.targetUniqueId != null) { - for (EntityLivingBase entitylivingbase : this.world.getEntitiesWithinAABB(EntityLivingBase.class, - new AxisAlignedBB(this.targetBlockPos.add(-2, -2, -2), this.targetBlockPos.add(2, 2, 2)))) { - if (entitylivingbase.getUniqueID().equals(this.targetUniqueId)) { - this.target = entitylivingbase; - break; - } - } - - this.targetUniqueId = null; + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + protected void writeEntityToNBT(NBTTagCompound compound) + { + 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); } - if (this.owner == null && this.ownerUniqueId != null) { - for (EntityLivingBase entitylivingbase1 : this.world.getEntitiesWithinAABB(EntityLivingBase.class, - new AxisAlignedBB(this.ownerBlockPos.add(-2, -2, -2), this.ownerBlockPos.add(2, 2, 2)))) { - if (entitylivingbase1.getUniqueID().equals(this.ownerUniqueId)) { - this.owner = entitylivingbase1; - break; - } - } - - this.ownerUniqueId = null; - } - - if (this.target == null || !this.target.isEntityAlive() - || this.target instanceof EntityPlayer && ((EntityPlayer) this.target).isSpectator()) { - if (!this.hasNoGravity()) { - this.motionY -= 0.04D; - } - } else { - this.targetDeltaX = MathHelper.clamp(this.targetDeltaX * 1.025D, -1.0D, 1.0D); - this.targetDeltaY = MathHelper.clamp(this.targetDeltaY * 1.025D, -1.0D, 1.0D); - this.targetDeltaZ = MathHelper.clamp(this.targetDeltaZ * 1.025D, -1.0D, 1.0D); - this.motionX += (this.targetDeltaX - this.motionX) * 0.2D; - this.motionY += (this.targetDeltaY - this.motionY) * 0.2D; - this.motionZ += (this.targetDeltaZ - this.motionZ) * 0.2D; - } - - RayTraceResult raytraceresult = ProjectileHelper.forwardsRaycast(this, true, false, this.owner); - - if (raytraceresult != null - && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.bulletHit(raytraceresult); - } - } - - this.setPosition(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - ProjectileHelper.rotateTowardsMovement(this, 0.5F); - - if (this.world.isRemote) { - this.world.spawnParticle(EnumParticleTypes.END_ROD, this.posX - this.motionX, - this.posY - this.motionY + 0.15D, this.posZ - this.motionZ, 0.0D, 0.0D, 0.0D); - } else if (this.target != null && !this.target.isDead) { - if (this.steps > 0) { - --this.steps; - - if (this.steps == 0) { - this.selectNextMoveDirection(this.direction == null ? null : this.direction.getAxis()); - } - } - - if (this.direction != null) { - BlockPos blockpos = new BlockPos(this); - EnumFacing.Axis enumfacing$axis = this.direction.getAxis(); - - if (this.world.isBlockNormalCube(blockpos.offset(this.direction), false)) { - this.selectNextMoveDirection(enumfacing$axis); - } else { + 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); + } - if (enumfacing$axis == EnumFacing.Axis.X && blockpos.getX() == blockpos1.getX() - || enumfacing$axis == EnumFacing.Axis.Z && blockpos.getZ() == blockpos1.getZ() - || enumfacing$axis == EnumFacing.Axis.Y && blockpos.getY() == blockpos1.getY()) { - this.selectNextMoveDirection(enumfacing$axis); + 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); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + protected void readEntityFromNBT(NBTTagCompound compound) + { + 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")); + } + } + + @Override + protected void entityInit() + { + } + + private void setDirection(@Nullable + EnumFacing directionIn) + { + this.direction = directionIn; + } + + private void selectNextMoveDirection(@Nullable + EnumFacing.Axis p_184569_1_) + { + 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); + } + + 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) + { + BlockPos blockpos1 = new BlockPos(this); + List list = Lists.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); + } } - } + + 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(); } - } - } - } - /** - * Returns true if the entity is on fire. Used by render to add the fire effect - * on rendering. - */ - @Override - public boolean isBurning() { - return false; - } + 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); - /** - * Checks if the entity is in range to render. - */ - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double distance) { - return distance < 16384.0D; - } - - /** - * Gets how bright this entity is. - */ - @Override - public float getBrightness() { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender() { - return 15728880; - } - - protected void bulletHit(RayTraceResult result) { - 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)); + 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; } - this.setDead(); - } + /** + * Called to update the entity's position/logic. + */ + @Override + public void onUpdate() + { + if (!this.world.isRemote && this.world.getDifficulty() == EnumDifficulty.PEACEFUL) + { + this.setDead(); + } + else + { + super.onUpdate(); - /** - * Returns true if other Entities should be prevented from moving through this - * Entity. - */ - @Override - public boolean canBeCollidedWith() { - return true; - } + if (!this.world.isRemote) + { + if (this.target == null && this.targetUniqueId != null) + { + for (EntityLivingBase entitylivingbase : this.world.getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(this.targetBlockPos.add(-2, -2, -2), this.targetBlockPos.add(2, 2, 2)))) + { + if (entitylivingbase.getUniqueID().equals(this.targetUniqueId)) + { + this.target = entitylivingbase; + break; + } + } - /** - * Called when the entity is attacked. - */ - @Override - public boolean attackEntityFrom(DamageSource source, float amount) { - 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(); + this.targetUniqueId = null; + } + + if (this.owner == null && this.ownerUniqueId != null) + { + for (EntityLivingBase entitylivingbase1 : this.world.getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(this.ownerBlockPos.add(-2, -2, -2), this.ownerBlockPos.add(2, 2, 2)))) + { + if (entitylivingbase1.getUniqueID().equals(this.ownerUniqueId)) + { + this.owner = entitylivingbase1; + break; + } + } + + this.ownerUniqueId = null; + } + + if (this.target == null || !this.target.isEntityAlive() || this.target instanceof EntityPlayer && ((EntityPlayer) this.target).isSpectator()) + { + if (!this.hasNoGravity()) + { + this.motionY -= 0.04D; + } + } + else + { + this.targetDeltaX = MathHelper.clamp(this.targetDeltaX * 1.025D, -1.0D, 1.0D); + this.targetDeltaY = MathHelper.clamp(this.targetDeltaY * 1.025D, -1.0D, 1.0D); + this.targetDeltaZ = MathHelper.clamp(this.targetDeltaZ * 1.025D, -1.0D, 1.0D); + this.motionX += (this.targetDeltaX - this.motionX) * 0.2D; + this.motionY += (this.targetDeltaY - this.motionY) * 0.2D; + this.motionZ += (this.targetDeltaZ - this.motionZ) * 0.2D; + } + + RayTraceResult raytraceresult = ProjectileHelper.forwardsRaycast(this, true, false, this.owner); + + if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) + { + this.bulletHit(raytraceresult); + } + } + + this.setPosition(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + ProjectileHelper.rotateTowardsMovement(this, 0.5F); + + if (this.world.isRemote) + { + this.world.spawnParticle(EnumParticleTypes.END_ROD, this.posX - this.motionX, this.posY - this.motionY + 0.15D, this.posZ - this.motionZ, 0.0D, 0.0D, 0.0D); + } + else if (this.target != null && !this.target.isDead) + { + if (this.steps > 0) + { + --this.steps; + + if (this.steps == 0) + { + this.selectNextMoveDirection(this.direction == null ? null : this.direction.getAxis()); + } + } + + if (this.direction != null) + { + BlockPos blockpos = new BlockPos(this); + EnumFacing.Axis enumfacing$axis = this.direction.getAxis(); + + if (this.world.isBlockNormalCube(blockpos.offset(this.direction), false)) + { + this.selectNextMoveDirection(enumfacing$axis); + } + else + { + BlockPos blockpos1 = new BlockPos(this.target); + + if (enumfacing$axis == EnumFacing.Axis.X && blockpos.getX() == blockpos1.getX() || enumfacing$axis == EnumFacing.Axis.Z && blockpos.getZ() == blockpos1.getZ() + || enumfacing$axis == EnumFacing.Axis.Y && blockpos.getY() == blockpos1.getY()) + { + this.selectNextMoveDirection(enumfacing$axis); + } + } + } + } + } } - return true; - } + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + @Override + public boolean isBurning() + { + return false; + } + + /** + * Checks if the entity is in range to render. + */ + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(double distance) + { + return distance < 16384.0D; + } + + /** + * Gets how bright this entity is. + */ + @Override + public float getBrightness() + { + return 1.0F; + } + + @Override + @SideOnly(Side.CLIENT) + public int getBrightnessForRender() + { + return 15728880; + } + + protected void bulletHit(RayTraceResult result) + { + 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)); + } + } + } + + this.setDead(); + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + @Override + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + @Override + public boolean attackEntityFrom(DamageSource source, float amount) + { + 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(); + } + + return true; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java index a8b7ca2..a76ae71 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java @@ -7,67 +7,78 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; -public class EntitySmavaCreeper extends EntityCreeper { - private int lastActiveTime; - private int timeSinceIgnited; - private int fuseTime = 20; - private int explosionRadius = 6; +public class EntitySmavaCreeper extends EntityCreeper +{ + private int lastActiveTime; + private int timeSinceIgnited; + private int fuseTime = 20; + private int explosionRadius = 6; - public EntitySmavaCreeper(World worldIn) { - super(worldIn); - setSize(0.6F, 1.7F); - getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D); - } - - @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_SMAVACREEPER_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(); - } + public EntitySmavaCreeper(World worldIn) + { + super(worldIn); + setSize(0.6F, 1.7F); + getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D); } - super.onUpdate(); - } + @Override + public void onUpdate() + { + if (this.isEntityAlive()) + { + this.lastActiveTime = this.timeSinceIgnited; - 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(); + if (this.hasIgnited()) + { + this.setCreeperState(1); + } + + int i = this.getCreeperState(); + + if (i > 0 && this.timeSinceIgnited == 0) + { + this.playSound(ModSoundEvents.ENTITY_SMAVACREEPER_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 SoundEvent getHurtSound(DamageSource damageSourceIn) { - return ModSoundEvents.ENTITY_SMAVACREEPER_HURT; - } + 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(); + } + } - @Override - protected SoundEvent getAmbientSound() { - return ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT; - } + @Override + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return ModSoundEvents.ENTITY_SMAVACREEPER_HURT; + } + + @Override + protected SoundEvent getAmbientSound() + { + return ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityWolfMZTE.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityWolfMZTE.java index ebc58f6..a3dc9ea 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityWolfMZTE.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityWolfMZTE.java @@ -18,123 +18,153 @@ import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.world.World; -public class EntityWolfMZTE extends EntityWolf { - private static final DataParameter DATA_HEALTH_ID = EntityDataManager.createKey(EntityWolf.class, - DataSerializers.FLOAT); - private static final DataParameter BEGGING = EntityDataManager.createKey(EntityWolf.class, - DataSerializers.BOOLEAN); - private static final DataParameter COLLAR_COLOR = EntityDataManager.createKey(EntityWolf.class, - DataSerializers.VARINT); - private float headRotationCourse; - private float headRotationCourseOld; - private boolean isWet; - private boolean isShaking; - private float timeWolfIsShaking; - private float prevTimeWolfIsShaking; +public class EntityWolfMZTE extends EntityWolf +{ + private static final DataParameter DATA_HEALTH_ID = EntityDataManager.createKey(EntityWolf.class, DataSerializers.FLOAT); + private static final DataParameter BEGGING = EntityDataManager.createKey(EntityWolf.class, DataSerializers.BOOLEAN); + private static final DataParameter COLLAR_COLOR = EntityDataManager.createKey(EntityWolf.class, DataSerializers.VARINT); + private float headRotationCourse; + private float headRotationCourseOld; + private boolean isWet; + private boolean isShaking; + private float timeWolfIsShaking; + private float prevTimeWolfIsShaking; - public EntityWolfMZTE(World worldIn) { - super(worldIn); - this.setSize(0.6F, 0.85F); - 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); + public EntityWolfMZTE(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 0.85F); + this.setTamed(false); } - return entitywolfmzte; - } + @Override + public EntityWolfMZTE createChild(EntityAgeable ageable) + { + EntityWolfMZTE entitywolfmzte = new EntityWolfMZTE(this.world); + UUID uuid = this.getOwnerId(); - @Override - public boolean canMateWith(EntityAnimal otherAnimal) { - if (otherAnimal == this) { - return false; - } else if (!this.isTamed()) { - return false; - } else if (!(otherAnimal instanceof EntityWolfMZTE)) { - return false; - } else { - EntityWolfMZTE entitywolfmzte = (EntityWolfMZTE) otherAnimal; - - if (!entitywolfmzte.isTamed()) { - return false; - } else if (entitywolfmzte.isSitting()) { - return false; - } else { - return this.isInLove() && entitywolfmzte.isInLove(); - } - } - } - - @Override - public boolean shouldAttackEntity(EntityLivingBase target, EntityLivingBase owner) { - if (!(target instanceof EntityCreeper) && !(target instanceof EntityGhast)) { - if (target instanceof EntityWolfMZTE) { - EntityWolfMZTE entitywolfmzte = (EntityWolfMZTE) target; - - if (entitywolfmzte.isTamed() && entitywolfmzte.getOwner() == owner) { - return false; + if (uuid != null) + { + entitywolfmzte.setOwnerId(uuid); + entitywolfmzte.setTamed(true); } - } - if (target instanceof EntityPlayer && owner instanceof EntityPlayer - && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target)) { - return false; - } else { - return !(target instanceof AbstractHorse) || !((AbstractHorse) target).isTame(); - } - } else { - return false; - } - } - - class AIAvoidEntity extends EntityAIAvoidEntity { - private final EntityWolfMZTE wolf; - - public AIAvoidEntity(EntityWolfMZTE wolfIn, Class 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; + return entitywolfmzte; } - /** - * Returns whether the EntityAIBase should begin execution. - */ @Override - public boolean shouldExecute() { - if (super.shouldExecute() && this.closestLivingEntity instanceof EntityLlama) { - return !this.wolf.isTamed() && this.avoidLlama((EntityLlama) this.closestLivingEntity); - } else { - return false; - } + public boolean canMateWith(EntityAnimal otherAnimal) + { + if (otherAnimal == this) + { + return false; + } + else if (!this.isTamed()) + { + return false; + } + else if (!(otherAnimal instanceof EntityWolfMZTE)) + { + return false; + } + else + { + EntityWolfMZTE entitywolfmzte = (EntityWolfMZTE) otherAnimal; + + if (!entitywolfmzte.isTamed()) + { + return false; + } + else if (entitywolfmzte.isSitting()) + { + return false; + } + else + { + return this.isInLove() && entitywolfmzte.isInLove(); + } + } } - private boolean avoidLlama(EntityLlama p_190854_1_) { - return p_190854_1_.getStrength() >= EntityWolfMZTE.this.rand.nextInt(5); - } - - /** - * Execute a one shot task or start executing a continuous task - */ @Override - public void startExecuting() { - EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null); - super.startExecuting(); + public boolean shouldAttackEntity(EntityLivingBase target, EntityLivingBase owner) + { + if (!(target instanceof EntityCreeper) && !(target instanceof EntityGhast)) + { + if (target instanceof EntityWolfMZTE) + { + EntityWolfMZTE entitywolfmzte = (EntityWolfMZTE) target; + + if (entitywolfmzte.isTamed() && entitywolfmzte.getOwner() == owner) + { + return false; + } + } + + if (target instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target)) + { + return false; + } + else + { + return !(target instanceof AbstractHorse) || !((AbstractHorse) target).isTame(); + } + } + else + { + return false; + } } - /** - * Keep ticking a continuous task that has already been started - */ - @Override - public void updateTask() { - EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null); - super.updateTask(); + class AIAvoidEntity extends EntityAIAvoidEntity + { + private final EntityWolfMZTE wolf; + + public AIAvoidEntity(EntityWolfMZTE wolfIn, Class 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; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + @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); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + @Override + public void startExecuting() + { + EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null); + super.startExecuting(); + } + + /** + * Keep ticking a continuous task that has already been started + */ + @Override + public void updateTask() + { + EntityWolfMZTE.this.setAttackTarget((EntityLivingBase) null); + super.updateTask(); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/items/ItemBase.java b/src/main/java/mod/acgaming/spackenmobs/items/ItemBase.java index fb650c7..87ee3fc 100644 --- a/src/main/java/mod/acgaming/spackenmobs/items/ItemBase.java +++ b/src/main/java/mod/acgaming/spackenmobs/items/ItemBase.java @@ -8,15 +8,18 @@ import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class ItemBase extends Item { - public ItemBase(String name, CreativeTabs tab) { - setRegistryName(name); - setUnlocalizedName(Spackenmobs.MODID + "." + name); - setCreativeTab(tab); - } +public class ItemBase extends Item +{ + public ItemBase(String name, CreativeTabs tab) + { + setRegistryName(name); + setUnlocalizedName(Spackenmobs.MODID + "." + name); + setCreativeTab(tab); + } - @SideOnly(Side.CLIENT) - public void initModel() { - ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory")); - } + @SideOnly(Side.CLIENT) + public void initModel() + { + ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory")); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/items/ItemPotion.java b/src/main/java/mod/acgaming/spackenmobs/items/ItemPotion.java index 91f3ed5..fac9d47 100644 --- a/src/main/java/mod/acgaming/spackenmobs/items/ItemPotion.java +++ b/src/main/java/mod/acgaming/spackenmobs/items/ItemPotion.java @@ -2,11 +2,13 @@ package mod.acgaming.spackenmobs.items; import net.minecraft.potion.Potion; -public class ItemPotion extends Potion { - public ItemPotion(String name, boolean isBadPotion, int color, int iconIndexX, int iconIndexY) { - super(isBadPotion, color); - setPotionName("effect." + name); - setIconIndex(iconIndexX, iconIndexY); - setRegistryName(name); - } +public class ItemPotion extends Potion +{ + public ItemPotion(String name, boolean isBadPotion, int color, int iconIndexX, int iconIndexY) + { + super(isBadPotion, color); + setPotionName("effect." + name); + setIconIndex(iconIndexX, iconIndexY); + setRegistryName(name); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/BiomeHelper.java b/src/main/java/mod/acgaming/spackenmobs/misc/BiomeHelper.java index 60729a1..78fd718 100644 --- a/src/main/java/mod/acgaming/spackenmobs/misc/BiomeHelper.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/BiomeHelper.java @@ -9,31 +9,38 @@ import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome.SpawnListEntry; // Thanks to Vazkii! -public class BiomeHelper { +public class BiomeHelper +{ - public static Biome[] getBiomesWithMonster(Class clazz) { - List biomes = new ArrayList<>(); - for (Biome b : Biome.REGISTRY) { - List spawnList = b.getSpawnableList(EnumCreatureType.MONSTER); - for (SpawnListEntry e : spawnList) - if (e.entityClass == clazz) { - biomes.add(b); - break; + public static Biome[] getBiomesWithMonster(Class clazz) + { + List biomes = new ArrayList<>(); + for (Biome b : Biome.REGISTRY) + { + List spawnList = b.getSpawnableList(EnumCreatureType.MONSTER); + for (SpawnListEntry e : spawnList) + if (e.entityClass == clazz) + { + biomes.add(b); + break; + } } + return biomes.toArray(new Biome[0]); } - return biomes.toArray(new Biome[0]); - } - public static Biome[] getBiomesWithCreature(Class clazz) { - List biomes = new ArrayList<>(); - for (Biome b : Biome.REGISTRY) { - List spawnList = b.getSpawnableList(EnumCreatureType.CREATURE); - for (SpawnListEntry e : spawnList) - if (e.entityClass == clazz) { - biomes.add(b); - break; + public static Biome[] getBiomesWithCreature(Class clazz) + { + List biomes = new ArrayList<>(); + for (Biome b : Biome.REGISTRY) + { + List spawnList = b.getSpawnableList(EnumCreatureType.CREATURE); + for (SpawnListEntry e : spawnList) + if (e.entityClass == clazz) + { + biomes.add(b); + break; + } } + return biomes.toArray(new Biome[0]); } - return biomes.toArray(new Biome[0]); - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/ModEntities.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModEntities.java index 4aa6496..3603db6 100644 --- a/src/main/java/mod/acgaming/spackenmobs/misc/ModEntities.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModEntities.java @@ -22,17 +22,19 @@ import mod.acgaming.spackenmobs.render.RenderSmavaCreeper; import mod.acgaming.spackenmobs.render.RenderWolfMZTE; import net.minecraftforge.fml.client.registry.RenderingRegistry; -public class ModEntities { - public static void initModels() { - RenderingRegistry.registerEntityRenderingHandler(EntityApoRed.class, RenderApoRed.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntityDrachenlord.class, RenderDrachenlord.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntityIslamist.class, RenderIslamist.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntityJens.class, RenderJens.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntityMarcellDAvis.class, RenderMarcellDAvis.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntityMrBean.class, RenderMrBean.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntitySchalker.class, RenderSchalker.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntitySmavaCreeper.class, RenderSmavaCreeper.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntityWolfMZTE.class, RenderWolfMZTE.FACTORY); - RenderingRegistry.registerEntityRenderingHandler(EntityHolzstammhuhn.class, RenderHolzstammhuhn.FACTORY); - } +public class ModEntities +{ + public static void initModels() + { + RenderingRegistry.registerEntityRenderingHandler(EntityApoRed.class, RenderApoRed.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityDrachenlord.class, RenderDrachenlord.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityIslamist.class, RenderIslamist.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityJens.class, RenderJens.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityMarcellDAvis.class, RenderMarcellDAvis.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityMrBean.class, RenderMrBean.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntitySchalker.class, RenderSchalker.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntitySmavaCreeper.class, RenderSmavaCreeper.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityWolfMZTE.class, RenderWolfMZTE.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityHolzstammhuhn.class, RenderHolzstammhuhn.FACTORY); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/ModItems.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModItems.java index 4c6cd04..8c9be5c 100644 --- a/src/main/java/mod/acgaming/spackenmobs/misc/ModItems.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModItems.java @@ -6,8 +6,9 @@ import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; @ObjectHolder(Spackenmobs.MODID) -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); +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); } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/ModLootTableList.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModLootTableList.java new file mode 100644 index 0000000..1fa28d1 --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModLootTableList.java @@ -0,0 +1,59 @@ +package mod.acgaming.spackenmobs.misc; + +import java.io.File; +import java.util.Collections; +import java.util.Set; + +import com.google.common.collect.Sets; + +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.storage.loot.LootTable; +import net.minecraft.world.storage.loot.LootTableManager; + +public class ModLootTableList +{ + private static final Set LOOT_TABLES = Sets.newHashSet(); + private static final Set READ_ONLY_LOOT_TABLES = Collections.unmodifiableSet(LOOT_TABLES); + public static final ResourceLocation EMPTY = register("empty"); + public static final ResourceLocation ENTITIES_JENS = register("entities/jens"); + + private static ResourceLocation register(String id) + { + return register(new ResourceLocation("spackenmobs", id)); + } + + public static ResourceLocation register(ResourceLocation id) + { + if (LOOT_TABLES.add(id)) + { + return id; + } + else + { + throw new IllegalArgumentException(id + " is already a registered built-in loot table"); + } + } + + /** + * An unmodifiable set is returned + */ + public static Set getAll() + { + return READ_ONLY_LOOT_TABLES; + } + + public static boolean test() + { + LootTableManager loottablemanager = new LootTableManager((File) null); + + for (ResourceLocation resourcelocation : READ_ONLY_LOOT_TABLES) + { + if (loottablemanager.getLootTableFromLocation(resourcelocation) == LootTable.EMPTY_LOOT_TABLE) + { + return false; + } + } + + return true; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/ModPotions.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModPotions.java index f3590cc..86eacc9 100644 --- a/src/main/java/mod/acgaming/spackenmobs/misc/ModPotions.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModPotions.java @@ -1,5 +1,6 @@ package mod.acgaming.spackenmobs.misc; -public class ModPotions { +public class ModPotions +{ } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/ModSoundEvents.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModSoundEvents.java index fe8a349..5056916 100644 --- a/src/main/java/mod/acgaming/spackenmobs/misc/ModSoundEvents.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModSoundEvents.java @@ -6,74 +6,44 @@ import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; @ObjectHolder(Spackenmobs.MODID) -public class ModSoundEvents { - public static final SoundEvent ENTITY_SMAVACREEPER_FUSE = new SoundEvent( - new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); - public static final SoundEvent ENTITY_SMAVACREEPER_BLOW = new SoundEvent( - new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); - public static final SoundEvent ENTITY_SMAVACREEPER_HURT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); - public static final SoundEvent ENTITY_SMAVACREEPER_AMBIENT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); +public class ModSoundEvents +{ + public static final SoundEvent ENTITY_SMAVACREEPER_FUSE = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); + public static final SoundEvent ENTITY_SMAVACREEPER_BLOW = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); + public static final SoundEvent ENTITY_SMAVACREEPER_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); + public static final SoundEvent ENTITY_SMAVACREEPER_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); - public static final SoundEvent ENTITY_MARCELLDAVIS_AMBIENT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); - public static final SoundEvent ENTITY_MARCELLDAVIS_HURT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); - public static final SoundEvent ENTITY_MARCELLDAVIS_DEATH = new SoundEvent( - new ResourceLocation("spackenmobs:entities.marcell_davis.death")); + public static final SoundEvent ENTITY_MARCELLDAVIS_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); + public static final SoundEvent ENTITY_MARCELLDAVIS_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); + public static final SoundEvent ENTITY_MARCELLDAVIS_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.death")); - public static final SoundEvent ENTITY_ISLAMIST_FUSE = new SoundEvent( - new ResourceLocation("spackenmobs:entities.islamist.fuse")); - public static final SoundEvent ENTITY_ISLAMIST_BLOW = new SoundEvent( - new ResourceLocation("spackenmobs:entities.islamist.blow")); - public static final SoundEvent ENTITY_ISLAMIST_HURT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.islamist.hurt")); - public static final SoundEvent ENTITY_ISLAMIST_AMBIENT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.islamist.ambient")); + public static final SoundEvent ENTITY_ISLAMIST_FUSE = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.fuse")); + public static final SoundEvent ENTITY_ISLAMIST_BLOW = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.blow")); + public static final SoundEvent ENTITY_ISLAMIST_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.hurt")); + public static final SoundEvent ENTITY_ISLAMIST_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.ambient")); - public static final SoundEvent ENTITY_APORED_AMBIENT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.apored.ambient")); - public static final SoundEvent ENTITY_APORED_HURT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.apored.hurt")); - public static final SoundEvent ENTITY_APORED_DEATH = new SoundEvent( - new ResourceLocation("spackenmobs:entities.apored.death")); + public static final SoundEvent ENTITY_APORED_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.ambient")); + public static final SoundEvent ENTITY_APORED_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.hurt")); + public static final SoundEvent ENTITY_APORED_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.death")); - public static final SoundEvent ENTITY_MRBEAN_AMBIENT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); - public static final SoundEvent ENTITY_MRBEAN_HURT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); - public static final SoundEvent ENTITY_MRBEAN_DEATH = new SoundEvent( - new ResourceLocation("spackenmobs:entities.mr_bean.death")); + public static final SoundEvent ENTITY_MRBEAN_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); + public static final SoundEvent ENTITY_MRBEAN_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); + public static final SoundEvent ENTITY_MRBEAN_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.death")); - public static final SoundEvent ENTITY_DRACHENLORD_AMBIENT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); - public static final SoundEvent ENTITY_DRACHENLORD_HURT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); - public static final SoundEvent ENTITY_DRACHENLORD_DEATH = new SoundEvent( - new ResourceLocation("spackenmobs:entities.drachenlord.death")); - public static final SoundEvent ENTITY_DRACHENLORD_ANGRY = new SoundEvent( - new ResourceLocation("spackenmobs:entities.drachenlord.angry")); + public static final SoundEvent ENTITY_DRACHENLORD_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); + public static final SoundEvent ENTITY_DRACHENLORD_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); + public static final SoundEvent ENTITY_DRACHENLORD_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.death")); + 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")); + 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")); - public static final SoundEvent ENTITY_JENS_AMBIENT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.jens.ambient")); - public static final SoundEvent ENTITY_JENS_HURT = new SoundEvent( - new ResourceLocation("spackenmobs:entities.jens.hurt")); - 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_JENS_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.ambient")); + public static final SoundEvent ENTITY_JENS_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.hurt")); + 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")); } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/RegHandler.java b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandler.java index 49f3c67..c17284d 100644 --- a/src/main/java/mod/acgaming/spackenmobs/misc/RegHandler.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandler.java @@ -11,7 +11,6 @@ import mod.acgaming.spackenmobs.entities.EntityMrBean; import mod.acgaming.spackenmobs.entities.EntitySchalker; import mod.acgaming.spackenmobs.entities.EntitySmavaCreeper; import mod.acgaming.spackenmobs.entities.EntityWolfMZTE; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityPigZombie; @@ -31,178 +30,141 @@ import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.EntityRegistry; @EventBusSubscriber(modid = Spackenmobs.MODID) -public class RegHandler { - @SubscribeEvent - public static void registerItems(Register event) { - final Item[] items = { - new Item().setRegistryName(Spackenmobs.MODID, "ram").setUnlocalizedName(Spackenmobs.MODID + "." + "ram") - .setCreativeTab(CreativeTabs.MISC), - new Item().setRegistryName(Spackenmobs.MODID, "ram_on_a_stick") - .setUnlocalizedName(Spackenmobs.MODID + "." + "ram_on_a_stick") - .setCreativeTab(CreativeTabs.MISC), - new Item().setRegistryName(Spackenmobs.MODID, "surstroemming") - .setUnlocalizedName(Spackenmobs.MODID + "." + "surstroemming") - .setCreativeTab(CreativeTabs.MISC) }; - event.getRegistry().registerAll(items); - } +public class RegHandler +{ + @SubscribeEvent + public static void registerItems(Register 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 event) { - int id = 1; + @SubscribeEvent + public static void registerEntities(Register event) + { + int id = 1; - // Smava Creeper - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:smava_creeper"), EntitySmavaCreeper.class, - "smava_creeper", id++, Spackenmobs.instance, 64, 1, true, 7649828, 11053224); - EntityRegistry.addSpawn(EntitySmavaCreeper.class, 25, 1, 4, EnumCreatureType.MONSTER, - BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); + // Smava Creeper + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:smava_creeper"), EntitySmavaCreeper.class, "smava_creeper", id++, Spackenmobs.instance, 64, 1, true, 7649828, 11053224); + EntityRegistry.addSpawn(EntitySmavaCreeper.class, 25, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); - // Marcell D'Avis - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:marcell_davis"), EntityMarcellDAvis.class, - "marcell_davis", id++, Spackenmobs.instance, 64, 1, true, 15759, 16777215); - EntityRegistry.addSpawn(EntityMarcellDAvis.class, 50, 1, 4, EnumCreatureType.MONSTER, - BiomeHelper.getBiomesWithMonster(EntityZombie.class)); + // Marcell D'Avis + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:marcell_davis"), EntityMarcellDAvis.class, "marcell_davis", id++, Spackenmobs.instance, 64, 1, true, 15759, 16777215); + EntityRegistry.addSpawn(EntityMarcellDAvis.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityZombie.class)); - // Islamist - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:islamist"), EntityIslamist.class, "islamist", - id++, Spackenmobs.instance, 64, 1, true, 15263976, 15211548); - EntityRegistry.addSpawn(EntityIslamist.class, 50, 1, 4, EnumCreatureType.MONSTER, - BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); + // Islamist + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:islamist"), EntityIslamist.class, "islamist", id++, Spackenmobs.instance, 64, 1, true, 15263976, 15211548); + EntityRegistry.addSpawn(EntityIslamist.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); - // ApoRed - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:apored"), EntityApoRed.class, "apored", id++, - Spackenmobs.instance, 64, 1, true, 2039583, 16711680); - EntityRegistry.addSpawn(EntityApoRed.class, 50, 1, 4, EnumCreatureType.MONSTER, - BiomeHelper.getBiomesWithMonster(EntitySkeleton.class)); + // ApoRed + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:apored"), EntityApoRed.class, "apored", id++, Spackenmobs.instance, 64, 1, true, 2039583, 16711680); + EntityRegistry.addSpawn(EntityApoRed.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntitySkeleton.class)); - // Mr. Bean - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:mr_bean"), EntityMrBean.class, "mr_bean", - id++, Spackenmobs.instance, 64, 1, true, 4802350, 3220238); - EntityRegistry.addSpawn(EntityMrBean.class, 50, 1, 4, EnumCreatureType.MONSTER, - BiomeHelper.getBiomesWithMonster(EntityZombie.class)); + // Mr. Bean + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:mr_bean"), EntityMrBean.class, "mr_bean", id++, Spackenmobs.instance, 64, 1, true, 4802350, 3220238); + EntityRegistry.addSpawn(EntityMrBean.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityZombie.class)); - // Drachenlord - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:drachenlord"), EntityDrachenlord.class, - "drachenlord", id++, Spackenmobs.instance, 64, 1, true, 15256745, 8738878); - EntityRegistry.addSpawn(EntityDrachenlord.class, 50, 1, 4, EnumCreatureType.MONSTER, - BiomeHelper.getBiomesWithMonster(EntityPigZombie.class)); + // Drachenlord + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:drachenlord"), EntityDrachenlord.class, "drachenlord", id++, Spackenmobs.instance, 64, 1, true, 15256745, 8738878); + EntityRegistry.addSpawn(EntityDrachenlord.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityPigZombie.class)); - // Schalker - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:schalker"), EntitySchalker.class, "schalker", - id++, Spackenmobs.instance, 64, 1, true, 24745, 16777215); - EntityRegistry.addSpawn(EntitySchalker.class, 50, 1, 4, EnumCreatureType.MONSTER, - BiomeHelper.getBiomesWithMonster(EntityShulker.class)); + // Schalker + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:schalker"), EntitySchalker.class, "schalker", id++, Spackenmobs.instance, 64, 1, true, 24745, 16777215); + EntityRegistry.addSpawn(EntitySchalker.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityShulker.class)); - // Jens - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:jens"), EntityJens.class, "jens", id++, - Spackenmobs.instance, 64, 1, true, 6704526, 6767911); - EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, - BiomeHelper.getBiomesWithCreature(EntityPig.class)); + // Jens + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:jens"), EntityJens.class, "jens", id++, Spackenmobs.instance, 64, 1, true, 6704526, 6767911); + EntityRegistry.addSpawn(EntityJens.class, 25, 1, 4, EnumCreatureType.CREATURE, BiomeHelper.getBiomesWithCreature(EntityPig.class)); - // WolfMZTE - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:wolfmzte"), EntityWolfMZTE.class, "wolfmzte", - id++, Spackenmobs.instance, 64, 1, true, 16711680, 0); - EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, - BiomeHelper.getBiomesWithCreature(EntityWolf.class)); + // WolfMZTE + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:wolfmzte"), EntityWolfMZTE.class, "wolfmzte", id++, Spackenmobs.instance, 64, 1, true, 16711680, 0); + EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, BiomeHelper.getBiomesWithCreature(EntityWolf.class)); - // Holzstammhuhn - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:holzstammhuhn"), EntityHolzstammhuhn.class, - "holzstammhuhn", id++, Spackenmobs.instance, 64, 1, true, 12096347, 5295899); - EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, - BiomeHelper.getBiomesWithCreature(EntityChicken.class)); + // Holzstammhuhn + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:holzstammhuhn"), EntityHolzstammhuhn.class, "holzstammhuhn", id++, Spackenmobs.instance, 64, 1, true, 12096347, 5295899); + EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, BiomeHelper.getBiomesWithCreature(EntityChicken.class)); + } - // LootTableList.register(EntityJens.LOOT); - } + @SubscribeEvent + public static void registerSounds(Register event) + { + // Smava Creeper + ModSoundEvents.ENTITY_SMAVACREEPER_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); + event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_FUSE); + ModSoundEvents.ENTITY_SMAVACREEPER_BLOW.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); + event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_BLOW); + ModSoundEvents.ENTITY_SMAVACREEPER_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); + event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_HURT); + ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); + event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT); - @SubscribeEvent - public static void registerSounds(Register event) { - // Smava Creeper - ModSoundEvents.ENTITY_SMAVACREEPER_FUSE - .setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); - event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_FUSE); - ModSoundEvents.ENTITY_SMAVACREEPER_BLOW - .setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); - event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_BLOW); - ModSoundEvents.ENTITY_SMAVACREEPER_HURT - .setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); - event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_HURT); - ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT - .setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); - event.getRegistry().register(ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT); + // Islamist + ModSoundEvents.ENTITY_ISLAMIST_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.fuse")); + event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_FUSE); + ModSoundEvents.ENTITY_ISLAMIST_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.hurt")); + event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_HURT); - // Islamist - ModSoundEvents.ENTITY_ISLAMIST_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.fuse")); - event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_FUSE); - ModSoundEvents.ENTITY_ISLAMIST_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.hurt")); - event.getRegistry().register(ModSoundEvents.ENTITY_ISLAMIST_HURT); + // Marcell D'Avis + ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); + event.getRegistry().register(ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT); + ModSoundEvents.ENTITY_MARCELLDAVIS_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); + event.getRegistry().register(ModSoundEvents.ENTITY_MARCELLDAVIS_HURT); + ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.death")); + event.getRegistry().register(ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH); - // Marcell D'Avis - ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT - .setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); - event.getRegistry().register(ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT); - ModSoundEvents.ENTITY_MARCELLDAVIS_HURT - .setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); - event.getRegistry().register(ModSoundEvents.ENTITY_MARCELLDAVIS_HURT); - ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH - .setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.death")); - event.getRegistry().register(ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH); + // Mr. Bean + ModSoundEvents.ENTITY_MRBEAN_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); + event.getRegistry().register(ModSoundEvents.ENTITY_MRBEAN_AMBIENT); + ModSoundEvents.ENTITY_MRBEAN_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); + event.getRegistry().register(ModSoundEvents.ENTITY_MRBEAN_HURT); + ModSoundEvents.ENTITY_MRBEAN_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.death")); + event.getRegistry().register(ModSoundEvents.ENTITY_MRBEAN_DEATH); - // Mr. Bean - ModSoundEvents.ENTITY_MRBEAN_AMBIENT - .setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); - event.getRegistry().register(ModSoundEvents.ENTITY_MRBEAN_AMBIENT); - ModSoundEvents.ENTITY_MRBEAN_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); - event.getRegistry().register(ModSoundEvents.ENTITY_MRBEAN_HURT); - ModSoundEvents.ENTITY_MRBEAN_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.death")); - event.getRegistry().register(ModSoundEvents.ENTITY_MRBEAN_DEATH); + // ApoRed + ModSoundEvents.ENTITY_APORED_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.ambient")); + event.getRegistry().register(ModSoundEvents.ENTITY_APORED_AMBIENT); + ModSoundEvents.ENTITY_APORED_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.hurt")); + event.getRegistry().register(ModSoundEvents.ENTITY_APORED_HURT); + ModSoundEvents.ENTITY_APORED_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.death")); + event.getRegistry().register(ModSoundEvents.ENTITY_APORED_DEATH); - // ApoRed - ModSoundEvents.ENTITY_APORED_AMBIENT - .setRegistryName(new ResourceLocation("spackenmobs:entities.apored.ambient")); - event.getRegistry().register(ModSoundEvents.ENTITY_APORED_AMBIENT); - ModSoundEvents.ENTITY_APORED_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.hurt")); - event.getRegistry().register(ModSoundEvents.ENTITY_APORED_HURT); - ModSoundEvents.ENTITY_APORED_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.death")); - event.getRegistry().register(ModSoundEvents.ENTITY_APORED_DEATH); + // Drachenlord + ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); + event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT); + ModSoundEvents.ENTITY_DRACHENLORD_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); + event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_HURT); + ModSoundEvents.ENTITY_DRACHENLORD_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.death")); + event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_DEATH); + ModSoundEvents.ENTITY_DRACHENLORD_ANGRY.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.angry")); + event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_ANGRY); - // Drachenlord - ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT - .setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); - event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT); - ModSoundEvents.ENTITY_DRACHENLORD_HURT - .setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); - event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_HURT); - ModSoundEvents.ENTITY_DRACHENLORD_DEATH - .setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.death")); - event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_DEATH); - ModSoundEvents.ENTITY_DRACHENLORD_ANGRY - .setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.angry")); - event.getRegistry().register(ModSoundEvents.ENTITY_DRACHENLORD_ANGRY); + // 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")); + event.getRegistry().register(ModSoundEvents.ENTITY_SCHALKER_OPEN); + ModSoundEvents.ENTITY_SCHALKER_SHOOT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.shoot")); + event.getRegistry().register(ModSoundEvents.ENTITY_SCHALKER_SHOOT); - // 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")); - event.getRegistry().register(ModSoundEvents.ENTITY_SCHALKER_OPEN); - ModSoundEvents.ENTITY_SCHALKER_SHOOT - .setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.shoot")); - event.getRegistry().register(ModSoundEvents.ENTITY_SCHALKER_SHOOT); - - // Jens - ModSoundEvents.ENTITY_JENS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.ambient")); - event.getRegistry().register(ModSoundEvents.ENTITY_JENS_AMBIENT); - ModSoundEvents.ENTITY_JENS_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.hurt")); - event.getRegistry().register(ModSoundEvents.ENTITY_JENS_HURT); - ModSoundEvents.ENTITY_JENS_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.death")); - event.getRegistry().register(ModSoundEvents.ENTITY_JENS_DEATH); - ModSoundEvents.ENTITY_JENS_EAT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.eat")); - 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); - } + // Jens + ModSoundEvents.ENTITY_JENS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.ambient")); + event.getRegistry().register(ModSoundEvents.ENTITY_JENS_AMBIENT); + ModSoundEvents.ENTITY_JENS_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.hurt")); + event.getRegistry().register(ModSoundEvents.ENTITY_JENS_HURT); + ModSoundEvents.ENTITY_JENS_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.death")); + event.getRegistry().register(ModSoundEvents.ENTITY_JENS_DEATH); + ModSoundEvents.ENTITY_JENS_EAT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.eat")); + 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); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/RegHandlerModels.java b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandlerModels.java index 61c533d..6466c51 100644 --- a/src/main/java/mod/acgaming/spackenmobs/misc/RegHandlerModels.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandlerModels.java @@ -10,16 +10,18 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; @EventBusSubscriber(value = Side.CLIENT, modid = Spackenmobs.MODID) -public class RegHandlerModels { - @SubscribeEvent - public static void registerModels(ModelRegistryEvent event) { - registerModel(ModItems.RAM, 0); - registerModel(ModItems.RAM_ON_A_STICK, 0); - registerModel(ModItems.SURSTROEMMING, 0); - } +public class RegHandlerModels +{ + @SubscribeEvent + public static void registerModels(ModelRegistryEvent event) + { + registerModel(ModItems.RAM, 0); + 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")); - } + private static void registerModel(Item item, int meta) + { + ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory")); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/ModelSchalker.java b/src/main/java/mod/acgaming/spackenmobs/render/ModelSchalker.java index 02e4680..be42c93 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/ModelSchalker.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/ModelSchalker.java @@ -9,54 +9,60 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class ModelSchalker extends ModelBase { - public final ModelRenderer base; - public final ModelRenderer lid; - public ModelRenderer head; +public class ModelSchalker extends ModelBase +{ + public final ModelRenderer base; + public final ModelRenderer lid; + public ModelRenderer head; - public ModelSchalker() { - this.textureHeight = 64; - this.textureWidth = 64; - this.lid = new ModelRenderer(this); - this.base = new ModelRenderer(this); - this.head = new ModelRenderer(this); - this.lid.setTextureOffset(0, 0).addBox(-8.0F, -16.0F, -8.0F, 16, 12, 16); - this.lid.setRotationPoint(0.0F, 24.0F, 0.0F); - this.base.setTextureOffset(0, 28).addBox(-8.0F, -8.0F, -8.0F, 16, 8, 16); - this.base.setRotationPoint(0.0F, 24.0F, 0.0F); - this.head.setTextureOffset(0, 52).addBox(-3.0F, 0.0F, -3.0F, 6, 6, 6); - this.head.setRotationPoint(0.0F, 12.0F, 0.0F); - } - - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, - float headPitch, float scaleFactor, Entity entityIn) { - EntitySchalker EntitySchalker = (EntitySchalker) entityIn; - float f = ageInTicks - EntitySchalker.ticksExisted; - float f1 = (0.5F + EntitySchalker.getClientPeekAmount(f)) * (float) Math.PI; - float f2 = -1.0F + MathHelper.sin(f1); - float f3 = 0.0F; - - if (f1 > (float) Math.PI) { - f3 = MathHelper.sin(ageInTicks * 0.1F) * 0.7F; + public ModelSchalker() + { + this.textureHeight = 64; + this.textureWidth = 64; + this.lid = new ModelRenderer(this); + this.base = new ModelRenderer(this); + this.head = new ModelRenderer(this); + this.lid.setTextureOffset(0, 0).addBox(-8.0F, -16.0F, -8.0F, 16, 12, 16); + this.lid.setRotationPoint(0.0F, 24.0F, 0.0F); + this.base.setTextureOffset(0, 28).addBox(-8.0F, -8.0F, -8.0F, 16, 8, 16); + this.base.setRotationPoint(0.0F, 24.0F, 0.0F); + this.head.setTextureOffset(0, 52).addBox(-3.0F, 0.0F, -3.0F, 6, 6, 6); + this.head.setRotationPoint(0.0F, 12.0F, 0.0F); } - this.lid.setRotationPoint(0.0F, 16.0F + MathHelper.sin(f1) * 8.0F + f3, 0.0F); + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) + { + EntitySchalker EntitySchalker = (EntitySchalker) entityIn; + float f = ageInTicks - EntitySchalker.ticksExisted; + float f1 = (0.5F + EntitySchalker.getClientPeekAmount(f)) * (float) Math.PI; + float f2 = -1.0F + MathHelper.sin(f1); + float f3 = 0.0F; - if (EntitySchalker.getClientPeekAmount(f) > 0.3F) { - this.lid.rotateAngleY = f2 * f2 * f2 * f2 * (float) Math.PI * 0.125F; - } else { - this.lid.rotateAngleY = 0.0F; + if (f1 > (float) Math.PI) + { + f3 = MathHelper.sin(ageInTicks * 0.1F) * 0.7F; + } + + this.lid.setRotationPoint(0.0F, 16.0F + MathHelper.sin(f1) * 8.0F + f3, 0.0F); + + if (EntitySchalker.getClientPeekAmount(f) > 0.3F) + { + this.lid.rotateAngleY = f2 * f2 * f2 * f2 * (float) Math.PI * 0.125F; + } + else + { + this.lid.rotateAngleY = 0.0F; + } + + this.head.rotateAngleX = headPitch * 0.017453292F; + this.head.rotateAngleY = netHeadYaw * 0.017453292F; } - 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); - } + @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); + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderApoRed.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderApoRed.java index aa6de14..159d5f0 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderApoRed.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderApoRed.java @@ -15,37 +15,44 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderApoRed extends RenderSkeleton { - private static final ResourceLocation APORED_TEXTURE = new ResourceLocation( - "spackenmobs:textures/entities/apored.png"); - public static final Factory FACTORY = new Factory(); +public class RenderApoRed extends RenderSkeleton +{ + private static final ResourceLocation APORED_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/apored.png"); + public static final Factory FACTORY = new Factory(); - public RenderApoRed(RenderManager renderManagerIn) { - super(renderManagerIn); - this.addLayer(new LayerHeldItem(this)); - this.addLayer(new LayerBipedArmor(this) { - @Override - protected void initArmor() { - this.modelLeggings = new ModelSkeleton(0.5F, true); - this.modelArmor = new ModelSkeleton(1.0F, true); - } - }); - } - - @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 { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderApoRed(manager); + public RenderApoRed(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.addLayer(new LayerHeldItem(this)); + this.addLayer(new LayerBipedArmor(this) + { + @Override + protected void initArmor() + { + this.modelLeggings = new ModelSkeleton(0.5F, true); + this.modelArmor = new ModelSkeleton(1.0F, true); + } + }); + } + + @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 + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderApoRed(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderDrachenlord.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderDrachenlord.java index 64e47b5..becf2da 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderDrachenlord.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderDrachenlord.java @@ -13,31 +13,37 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderDrachenlord extends RenderZombie { - private static final ResourceLocation DRACHENLORD_TEXTURE = new ResourceLocation( - "spackenmobs:textures/entities/drachenlord.png"); - public static final Factory FACTORY = new Factory(); +public class RenderDrachenlord extends RenderZombie +{ + private static final ResourceLocation DRACHENLORD_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/drachenlord.png"); + public static final Factory FACTORY = new Factory(); - public RenderDrachenlord(RenderManager renderManagerIn) { - super(renderManagerIn); - this.addLayer(new LayerBipedArmor(this) { - @Override - protected void initArmor() { - this.modelLeggings = new ModelZombie(0.5F, true); - this.modelArmor = new ModelZombie(1.0F, true); - } - }); - } - - @Override - protected ResourceLocation getEntityTexture(EntityZombie entity) { - return DRACHENLORD_TEXTURE; - } - - public static class Factory implements IRenderFactory { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderDrachenlord(manager); + public RenderDrachenlord(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.addLayer(new LayerBipedArmor(this) + { + @Override + protected void initArmor() + { + this.modelLeggings = new ModelZombie(0.5F, true); + this.modelArmor = new ModelZombie(1.0F, true); + } + }); + } + + @Override + protected ResourceLocation getEntityTexture(EntityZombie entity) + { + return DRACHENLORD_TEXTURE; + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderDrachenlord(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderHolzstammhuhn.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderHolzstammhuhn.java index 12b0be4..ca56d8d 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderHolzstammhuhn.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderHolzstammhuhn.java @@ -11,24 +11,28 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderHolzstammhuhn extends RenderChicken { - private static final ResourceLocation HOLZSTAMMHUHN_TEXTURE = new ResourceLocation( - "spackenmobs:textures/entities/holzstammhuhn.png"); - public static final Factory FACTORY = new Factory(); +public class RenderHolzstammhuhn extends RenderChicken +{ + private static final ResourceLocation HOLZSTAMMHUHN_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/holzstammhuhn.png"); + public static final Factory FACTORY = new Factory(); - public RenderHolzstammhuhn(RenderManager renderManagerIn) { - super(renderManagerIn); - } - - @Override - protected ResourceLocation getEntityTexture(EntityChicken entity) { - return HOLZSTAMMHUHN_TEXTURE; - } - - public static class Factory implements IRenderFactory { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderHolzstammhuhn(manager); + public RenderHolzstammhuhn(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + @Override + protected ResourceLocation getEntityTexture(EntityChicken entity) + { + return HOLZSTAMMHUHN_TEXTURE; + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderHolzstammhuhn(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderIslamist.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderIslamist.java index 9fa1298..e085400 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderIslamist.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderIslamist.java @@ -12,25 +12,29 @@ import net.minecraftforge.fml.relauncher.Side; 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 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 { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderIslamist(manager); + 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 + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderIslamist(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java index 78f57dd..228f967 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java @@ -11,23 +11,28 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderJens extends RenderBiped { - private static final ResourceLocation JENS_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/jens.png"); - public static final Factory FACTORY = new Factory(); +public class RenderJens extends RenderBiped +{ + private static final ResourceLocation JENS_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/jens.png"); + public static final Factory FACTORY = new Factory(); - public RenderJens(RenderManager renderManagerIn) { - super(renderManagerIn, new ModelBiped(), 0.25F); - } - - @Override - protected ResourceLocation getEntityTexture(EntityJens entity) { - return JENS_TEXTURE; - } - - private static class Factory implements IRenderFactory { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderJens(manager); + public RenderJens(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelBiped(), 0.25F); + } + + @Override + protected ResourceLocation getEntityTexture(EntityJens entity) + { + return JENS_TEXTURE; + } + + private static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderJens(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderMarcellDAvis.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderMarcellDAvis.java index c6d6d2f..86f6284 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderMarcellDAvis.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderMarcellDAvis.java @@ -13,32 +13,38 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderMarcellDAvis extends RenderZombie { - private static final ResourceLocation MARCELLDAVIS_TEXTURE = new ResourceLocation( - "spackenmobs:textures/entities/marcell_davis.png"); - public static final Factory FACTORY = new Factory(); +public class RenderMarcellDAvis extends RenderZombie +{ + 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) { - super(renderManagerIn); - LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { - @Override - protected void initArmor() { - this.modelLeggings = new ModelZombie(0.5F, true); - this.modelArmor = new ModelZombie(1.0F, true); - } - }; - this.addLayer(layerbipedarmor); - } - - @Override - protected ResourceLocation getEntityTexture(EntityZombie entity) { - return MARCELLDAVIS_TEXTURE; - } - - public static class Factory implements IRenderFactory { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderMarcellDAvis(manager); + public RenderMarcellDAvis(RenderManager renderManagerIn) + { + super(renderManagerIn); + LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) + { + @Override + protected void initArmor() + { + this.modelLeggings = new ModelZombie(0.5F, true); + this.modelArmor = new ModelZombie(1.0F, true); + } + }; + this.addLayer(layerbipedarmor); + } + + @Override + protected ResourceLocation getEntityTexture(EntityZombie entity) + { + return MARCELLDAVIS_TEXTURE; + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderMarcellDAvis(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderMrBean.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderMrBean.java index 131247f..bfabb04 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderMrBean.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderMrBean.java @@ -13,32 +13,38 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderMrBean extends RenderZombie { - private static final ResourceLocation MRBEAN_TEXTURE = new ResourceLocation( - "spackenmobs:textures/entities/mr_bean.png"); - public static final Factory FACTORY = new Factory(); +public class RenderMrBean extends RenderZombie +{ + 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) { - super(renderManagerIn); - LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { - @Override - protected void initArmor() { - this.modelLeggings = new ModelZombie(0.5F, true); - this.modelArmor = new ModelZombie(1.0F, true); - } - }; - this.addLayer(layerbipedarmor); - } - - @Override - protected ResourceLocation getEntityTexture(EntityZombie entity) { - return MRBEAN_TEXTURE; - } - - public static class Factory implements IRenderFactory { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderMrBean(manager); + public RenderMrBean(RenderManager renderManagerIn) + { + super(renderManagerIn); + LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) + { + @Override + protected void initArmor() + { + this.modelLeggings = new ModelZombie(0.5F, true); + this.modelArmor = new ModelZombie(1.0F, true); + } + }; + this.addLayer(layerbipedarmor); + } + + @Override + protected ResourceLocation getEntityTexture(EntityZombie entity) + { + return MRBEAN_TEXTURE; + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderMrBean(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java index c0e5bc5..c79c9e3 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java @@ -17,179 +17,193 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderSchalker extends RenderLiving { - 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 class RenderSchalker extends RenderLiving +{ + 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 ModelSchalker getMainModel() { - return (ModelSchalker) super.getMainModel(); - } - - @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); + public RenderSchalker(RenderManager p_i47194_1_) + { + super(p_i47194_1_, new ModelSchalker(), 0.0F); + this.addLayer(new RenderSchalker.HeadLayer()); } - } - @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()); + @Override + public ModelSchalker getMainModel() + { + return (ModelSchalker) super.getMainModel(); + } - if (camera.isBoundingBoxInFrustum( - new AxisAlignedBB(vec3d1.x, vec3d1.y, vec3d1.z, vec3d.x, vec3d.y, vec3d.z))) { - return true; + @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); } - } - - 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) - class HeadLayer implements LayerRenderer { - private HeadLayer() { } @Override - public void doRenderLayer(EntitySchalker entitylivingbaseIn, float limbSwing, float limbSwingAmount, - float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { - GlStateManager.pushMatrix(); + 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()); - switch (entitylivingbaseIn.getAttachmentFacing()) { - case DOWN: - default: - break; - case EAST: - GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(1.0F, -1.0F, 0.0F); - GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); - break; - case WEST: - GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(-1.0F, -1.0F, 0.0F); - GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); - break; - case NORTH: - GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(0.0F, -1.0F, -1.0F); - break; - case SOUTH: - GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(0.0F, -1.0F, 1.0F); - break; - case UP: - GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(0.0F, -2.0F, 0.0F); - } + if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(vec3d1.x, vec3d1.y, vec3d1.z, vec3d.x, vec3d.y, vec3d.z))) + { + return true; + } + } - ModelRenderer modelrenderer = RenderSchalker.this.getMainModel().head; - modelrenderer.rotateAngleY = netHeadYaw * 0.017453292F; - modelrenderer.rotateAngleX = headPitch * 0.017453292F; - RenderSchalker.this - .bindTexture(RenderSchalker.SCHALKER_TEXTURE[entitylivingbaseIn.getColor().getMetadata()]); - modelrenderer.render(scale); - GlStateManager.popMatrix(); + return false; + } } @Override - public boolean shouldCombineTextures() { - return false; + protected ResourceLocation getEntityTexture(EntitySchalker entity) + { + return SCHALKER_TEXTURE[entity.getColor().getMetadata()]; } - } - public static class Factory implements IRenderFactory { @Override - public Render createRenderFor(RenderManager manager) { - return new RenderSchalker(manager); + 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) + class HeadLayer implements LayerRenderer + { + private HeadLayer() + { + } + + @Override + public void doRenderLayer(EntitySchalker entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + GlStateManager.pushMatrix(); + + switch (entitylivingbaseIn.getAttachmentFacing()) + { + case DOWN: + default: + break; + case EAST: + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(1.0F, -1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + break; + case WEST: + GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(-1.0F, -1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + break; + case NORTH: + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0.0F, -1.0F, -1.0F); + break; + case SOUTH: + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0.0F, -1.0F, 1.0F); + break; + case UP: + GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0.0F, -2.0F, 0.0F); + } + + ModelRenderer modelrenderer = RenderSchalker.this.getMainModel().head; + modelrenderer.rotateAngleY = netHeadYaw * 0.017453292F; + modelrenderer.rotateAngleX = headPitch * 0.017453292F; + RenderSchalker.this.bindTexture(RenderSchalker.SCHALKER_TEXTURE[entitylivingbaseIn.getColor().getMetadata()]); + modelrenderer.render(scale); + GlStateManager.popMatrix(); + } + + @Override + public boolean shouldCombineTextures() + { + return false; + } + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderSchalker(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderSmavaCreeper.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderSmavaCreeper.java index fae28ff..0efccea 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderSmavaCreeper.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderSmavaCreeper.java @@ -12,25 +12,29 @@ import net.minecraftforge.fml.relauncher.Side; 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 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 { - @Override - public Render createRenderFor(RenderManager manager) { - return new RenderSmavaCreeper(manager); + 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 + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderSmavaCreeper(manager); + } } - } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderWolfMZTE.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderWolfMZTE.java index ab7eef5..e1cf866 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderWolfMZTE.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderWolfMZTE.java @@ -13,48 +13,56 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderWolfMZTE extends RenderWolf { - 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 class RenderWolfMZTE extends RenderWolf +{ + 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) { - super(renderManagerIn); - 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) { - if (entity.isWolfWet()) { - float f = entity.getBrightness() * entity.getShadingWhileWet(partialTicks); - GlStateManager.color(f, f, f); + public RenderWolfMZTE(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.addLayer(new LayerWolfCollar(this)); } - super.doRender(entity, x, y, z, entityYaw, partialTicks); - } - - @Override - protected ResourceLocation getEntityTexture(EntityWolf entity) { - if (entity.isTamed()) { - return TAMED_WOLFMZTE_TEXTURE; - } else { - return entity.isAngry() ? ANRGY_WOLFMZTE_TEXTURE : WOLFMZTE_TEXTURE; - } - } - - public static class Factory implements IRenderFactory { @Override - public Render createRenderFor(RenderManager manager) { - return new RenderWolfMZTE(manager); + 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) + { + if (entity.isWolfWet()) + { + float f = entity.getBrightness() * entity.getShadingWhileWet(partialTicks); + GlStateManager.color(f, f, f); + } + + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + @Override + protected ResourceLocation getEntityTexture(EntityWolf entity) + { + if (entity.isTamed()) + { + return TAMED_WOLFMZTE_TEXTURE; + } + else + { + return entity.isAngry() ? ANRGY_WOLFMZTE_TEXTURE : WOLFMZTE_TEXTURE; + } + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderWolfMZTE(manager); + } } - } } \ No newline at end of file diff --git a/src/main/resources/assets/spackenmobs/lang/de_de.lang b/src/main/resources/assets/spackenmobs/lang/de_de.lang index cc3e053..fd4f9bb 100644 --- a/src/main/resources/assets/spackenmobs/lang/de_de.lang +++ b/src/main/resources/assets/spackenmobs/lang/de_de.lang @@ -1,13 +1,14 @@ -entity.smava_creeper.name=Smava-Creeper -entity.marcell_davis.name=Marcell D'Avis -entity.islamist.name=Islamist entity.apored.name=ApoRed -entity.mr_bean.name=Mr. Bean entity.drachenlord.name=Drachenlord -entity.schalker.name=Schalker -entity.jens.name=Jens -entity.wolfmzte.name=WolfMZTE entity.holzstammhuhn.name=Holzstammhuhn +entity.islamist.name=Islamist +entity.jens.name=Jens +entity.marcell_davis.name=Marcell D'Avis +entity.mr_bean.name=Mr. Bean +entity.schalker.name=Schalker +entity.smava_creeper.name=Smava-Creeper +entity.wolfmzte.name=WolfMZTE item.spackenmobs.ram.name=RAM item.spackenmobs.ram_on_a_stick.name=RAM-Rute -item.spackenmobs.surstroemming.name=Surströmming \ No newline at end of file +item.spackenmobs.surstroemming.name=Surströmming +itemGroup.spackenmobs.tabSpackenmobs=Spackenmobs \ No newline at end of file diff --git a/src/main/resources/assets/spackenmobs/lang/en_us.lang b/src/main/resources/assets/spackenmobs/lang/en_us.lang index 266c989..497aa6d 100644 --- a/src/main/resources/assets/spackenmobs/lang/en_us.lang +++ b/src/main/resources/assets/spackenmobs/lang/en_us.lang @@ -1,13 +1,14 @@ -entity.smava_creeper.name=Smava Creeper -entity.marcell_davis.name=Marcell D'Avis -entity.islamist.name=Islamist entity.apored.name=ApoRed -entity.mr_bean.name=Mr. Bean entity.drachenlord.name=Drachenlord -entity.schalker.name=Schalker -entity.jens.name=Jens -entity.wolfmzte.name=WolfMZTE entity.holzstammhuhn.name=Holzstammhuhn +entity.islamist.name=Islamist +entity.jens.name=Jens +entity.marcell_davis.name=Marcell D'Avis +entity.mr_bean.name=Mr. Bean +entity.schalker.name=Schalker +entity.smava_creeper.name=Smava Creeper +entity.wolfmzte.name=WolfMZTE item.spackenmobs.ram.name=RAM item.spackenmobs.ram_on_a_stick.name=RAM on a Stick -item.spackenmobs.surstroemming.name=Surströmming \ No newline at end of file +item.spackenmobs.surstroemming.name=Surströmming +itemGroup.spackenmobs.tabSpackenmobs=Spackenmobs \ No newline at end of file diff --git a/src/main/resources/assets/spackenmobs/loot_tables/entities/jens.json b/src/main/resources/assets/spackenmobs/loot_tables/entities/jens.json new file mode 100644 index 0000000..373ef26 --- /dev/null +++ b/src/main/resources/assets/spackenmobs/loot_tables/entities/jens.json @@ -0,0 +1,26 @@ +{ + "pools": [{ + "name": "jens", + "rolls": 1, + "entries": [{ + "type": "item", + "name": "spackenmobs:ram", + "weight": 1, + "functions": [{ + "function": "set_count", + "count": { + "min": 1, + "max": 3 + } + }, + { + "function": "looting_enchant", + "count": { + "min": 0, + "max": 1 + } + } + ] + }] + }] +} \ No newline at end of file