--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java @@ -170,6 +170,7 @@ public void func_70624_b(@Nullable EntityLivingBase p_70624_1_) { this.field_70696_bz = p_70624_1_; + net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); } public boolean func_70686_a(Class p_70686_1_) @@ -576,7 +577,7 @@ super.func_70636_d(); this.field_70170_p.field_72984_F.func_76320_a("looting"); - if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) + if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { for (EntityItem entityitem : this.field_70170_p.func_72872_a(EntityItem.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D))) { @@ -702,10 +703,22 @@ protected void func_70623_bb() { + net.minecraftforge.fml.common.eventhandler.Event.Result result = null; if (this.field_82179_bU) { this.field_70708_bq = 0; } + else if ((this.field_70708_bq & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) + { + if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { + this.field_70708_bq = 0; + } + else + { + this.func_70106_y(); + } + } else { Entity entity = this.field_70170_p.func_72890_a(this, -1.0D); @@ -839,7 +852,6 @@ return !this.field_70170_p.func_72953_d(this.func_174813_aQ()) && this.field_70170_p.func_184144_a(this, this.func_174813_aQ()).isEmpty() && this.field_70170_p.func_72917_a(this.func_174813_aQ(), this); } - @SideOnly(Side.CLIENT) public float func_70603_bj() { return 1.0F; @@ -991,6 +1003,8 @@ public static EntityEquipmentSlot func_184640_d(ItemStack p_184640_0_) { + final EntityEquipmentSlot slot = p_184640_0_.func_77973_b().getEquipmentSlot(p_184640_0_); + if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item if (p_184640_0_.func_77973_b() != Item.func_150898_a(Blocks.field_150423_aK) && p_184640_0_.func_77973_b() != Items.field_151144_bL) { if (p_184640_0_.func_77973_b() instanceof ItemArmor) @@ -1003,7 +1017,7 @@ } else { - return p_184640_0_.func_77973_b() == Items.field_185159_cQ ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND; + return p_184640_0_.func_77973_b().isShield(p_184640_0_, null) ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND; } } else @@ -1434,5 +1448,19 @@ ON_GROUND, IN_AIR, IN_WATER; + + private final java.util.function.BiPredicate spawnPredicate; + + SpawnPlacementType() { this.spawnPredicate = null; } + + SpawnPlacementType(java.util.function.BiPredicate spawnPredicate) + { + this.spawnPredicate = spawnPredicate; + } + + public boolean canSpawnAt(World world, BlockPos pos) + { + return this.spawnPredicate != null ? this.spawnPredicate.test(world, pos) : net.minecraft.world.WorldEntitySpawner.canCreatureTypeSpawnBody(this, world, pos); + } } }