Entity patches progress.
This commit is contained in:
parent
e1b4a150c3
commit
dd32e74e34
|
@ -113,7 +113,23 @@
|
|||
this.field_184239_as = null;
|
||||
entity.func_184225_p(this);
|
||||
}
|
||||
@@ -2053,6 +2067,14 @@
|
||||
@@ -1789,10 +1803,15 @@
|
||||
return !this.func_184188_bt().isEmpty();
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use rider sensitive version
|
||||
public boolean func_205710_ba() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ public boolean canBeRiddenInWater(Entity rider) {
|
||||
+ return func_205710_ba();
|
||||
+ }
|
||||
+
|
||||
public boolean func_70093_af() {
|
||||
return this.func_70083_f(1);
|
||||
}
|
||||
@@ -2053,6 +2072,14 @@
|
||||
|
||||
@Nullable
|
||||
public Entity func_184204_a(int p_184204_1_) {
|
||||
|
@ -128,7 +144,7 @@
|
|||
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) {
|
||||
this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
|
||||
MinecraftServer minecraftserver = this.func_184102_h();
|
||||
@@ -2060,7 +2082,7 @@
|
||||
@@ -2060,7 +2087,7 @@
|
||||
WorldServer worldserver = minecraftserver.func_71218_a(i);
|
||||
WorldServer worldserver1 = minecraftserver.func_71218_a(p_184204_1_);
|
||||
this.field_71093_bK = p_184204_1_;
|
||||
|
@ -137,7 +153,7 @@
|
|||
worldserver1 = minecraftserver.func_200667_a(DimensionType.OVERWORLD);
|
||||
this.field_71093_bK = 0;
|
||||
}
|
||||
@@ -2069,16 +2091,17 @@
|
||||
@@ -2069,16 +2096,17 @@
|
||||
this.field_70128_L = false;
|
||||
this.field_70170_p.field_72984_F.func_76320_a("reposition");
|
||||
BlockPos blockpos;
|
||||
|
@ -160,7 +176,7 @@
|
|||
d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D);
|
||||
d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D);
|
||||
}
|
||||
@@ -2087,8 +2110,7 @@
|
||||
@@ -2087,8 +2115,7 @@
|
||||
d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872);
|
||||
float f = this.field_70177_z;
|
||||
this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F);
|
||||
|
@ -170,7 +186,7 @@
|
|||
blockpos = new BlockPos(this);
|
||||
}
|
||||
|
||||
@@ -2097,7 +2119,7 @@
|
||||
@@ -2097,7 +2124,7 @@
|
||||
Entity entity = this.func_200600_R().func_200721_a(worldserver1);
|
||||
if (entity != null) {
|
||||
entity.func_180432_n(this);
|
||||
|
@ -179,7 +195,7 @@
|
|||
BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M());
|
||||
entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A);
|
||||
} else {
|
||||
@@ -2591,4 +2613,32 @@
|
||||
@@ -2591,4 +2618,32 @@
|
||||
public double func_212107_bY() {
|
||||
return this.field_211517_W;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
--- a/net/minecraft/entity/EntityFlying.java
|
||||
+++ b/net/minecraft/entity/EntityFlying.java
|
||||
@@ -32,14 +32,16 @@
|
||||
} else {
|
||||
float f = 0.91F;
|
||||
if (this.field_70122_E) {
|
||||
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().func_208618_m() * 0.91F;
|
||||
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
|
||||
+ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(field_70170_p, underPos, this) * 0.91F;
|
||||
}
|
||||
|
||||
float f1 = 0.16277137F / (f * f * f);
|
||||
this.func_191958_b(p_191986_1_, p_191986_2_, p_191986_3_, this.field_70122_E ? 0.1F * f1 : 0.02F);
|
||||
f = 0.91F;
|
||||
if (this.field_70122_E) {
|
||||
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().func_208618_m() * 0.91F;
|
||||
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
|
||||
+ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(field_70170_p, underPos, this) * 0.91F;
|
||||
}
|
||||
|
||||
this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y);
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/EntityHanging.java
|
||||
+++ b/net/minecraft/entity/EntityHanging.java
|
||||
@@ -117,6 +117,8 @@
|
||||
int j1 = (j - 1) / -2;
|
||||
blockpos$mutableblockpos.func_189533_g(blockpos).func_189534_c(enumfacing, k + i1).func_189534_c(EnumFacing.UP, l + j1);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos$mutableblockpos);
|
||||
+ if (iblockstate.func_193401_d(this.field_70170_p, blockpos$mutableblockpos, this.field_174860_b) == net.minecraft.block.state.BlockFaceShape.SOLID)
|
||||
+ continue;
|
||||
if (!iblockstate.func_185904_a().func_76220_a() && !BlockRedstoneDiode.func_185546_B(iblockstate)) {
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
--- a/net/minecraft/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/entity/EntityLiving.java
|
||||
@@ -159,6 +159,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<? extends EntityLivingBase> p_70686_1_) {
|
||||
@@ -472,7 +473,7 @@
|
||||
public void func_70636_d() {
|
||||
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))) {
|
||||
if (!entityitem.field_70128_L && !entityitem.func_92059_d().func_190926_b() && !entityitem.func_174874_s()) {
|
||||
this.func_175445_a(entityitem);
|
||||
@@ -556,8 +557,14 @@
|
||||
}
|
||||
|
||||
protected void func_70623_bb() {
|
||||
+ net.minecraftforge.eventbus.api.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.eventbus.api.Event.Result.DEFAULT) {
|
||||
+ if (result == net.minecraftforge.eventbus.api.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);
|
||||
if (entity != null) {
|
||||
@@ -675,7 +682,6 @@
|
||||
return !p_205019_1_.func_72953_d(this.func_174813_aQ()) && p_205019_1_.func_195586_b(this, this.func_174813_aQ()) && p_205019_1_.func_195587_c(this, this.func_174813_aQ());
|
||||
}
|
||||
|
||||
- @OnlyIn(Dist.CLIENT)
|
||||
public float func_70603_bj() {
|
||||
return 1.0F;
|
||||
}
|
||||
@@ -803,6 +809,8 @@
|
||||
}
|
||||
|
||||
public static EntityEquipmentSlot func_184640_d(ItemStack p_184640_0_) {
|
||||
+ final EntityEquipmentSlot slot = p_184640_0_.getEquipmentSlot();
|
||||
+ 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
|
||||
Item item = p_184640_0_.func_77973_b();
|
||||
if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof ItemBlock) || !(((ItemBlock)item).func_179223_d() instanceof BlockAbstractSkull))) {
|
||||
if (item instanceof ItemArmor) {
|
||||
@@ -810,7 +818,7 @@
|
||||
} else if (item == Items.field_185160_cR) {
|
||||
return EntityEquipmentSlot.CHEST;
|
||||
} else {
|
||||
- return item == Items.field_185159_cQ ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND;
|
||||
+ return p_184640_0_.isShield(null) ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND;
|
||||
}
|
||||
} else {
|
||||
return EntityEquipmentSlot.HEAD;
|
||||
@@ -1133,10 +1141,10 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer)p_70652_1_;
|
||||
ItemStack itemstack = this.func_184614_ca();
|
||||
ItemStack itemstack1 = entityplayer.func_184587_cr() ? entityplayer.func_184607_cu() : ItemStack.field_190927_a;
|
||||
- if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b() instanceof ItemAxe && itemstack1.func_77973_b() == Items.field_185159_cQ) {
|
||||
+ if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.canDisableShield(itemstack1, entityplayer, this) && itemstack1.isShield(entityplayer)) {
|
||||
float f1 = 0.25F + (float)EnchantmentHelper.func_185293_e(this) * 0.05F;
|
||||
if (this.field_70146_Z.nextFloat() < f1) {
|
||||
- entityplayer.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100);
|
||||
+ entityplayer.func_184811_cZ().func_185145_a(itemstack1.func_77973_b(), 100);
|
||||
this.field_70170_p.func_72960_a(entityplayer, (byte)30);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,72 @@
|
|||
--- a/net/minecraft/entity/EntityLivingBase.java
|
||||
+++ b/net/minecraft/entity/EntityLivingBase.java
|
||||
@@ -622,6 +622,27 @@
|
||||
@@ -92,6 +92,7 @@
|
||||
private static final Logger field_190632_a = LogManager.getLogger();
|
||||
private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
||||
private static final AttributeModifier field_110157_c = (new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, 2)).func_111168_a(false);
|
||||
+ public static final net.minecraft.entity.ai.attributes.IAttribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_111112_a(true);
|
||||
protected static final DataParameter<Byte> field_184621_as = EntityDataManager.<Byte>func_187226_a(EntityLivingBase.class, DataSerializers.field_187191_a);
|
||||
private static final DataParameter<Float> field_184632_c = EntityDataManager.<Float>func_187226_a(EntityLivingBase.class, DataSerializers.field_187193_c);
|
||||
private static final DataParameter<Integer> field_184633_f = EntityDataManager.<Integer>func_187226_a(EntityLivingBase.class, DataSerializers.field_187192_b);
|
||||
@@ -199,6 +200,7 @@
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111263_d);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188791_g);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_189429_h);
|
||||
+ this.func_110140_aT().func_111150_b(SWIM_SPEED);
|
||||
}
|
||||
|
||||
protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, IBlockState p_184231_4_, BlockPos p_184231_5_) {
|
||||
@@ -208,9 +210,10 @@
|
||||
|
||||
if (!this.field_70170_p.field_72995_K && this.field_70143_R > 3.0F && p_184231_3_) {
|
||||
float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F);
|
||||
- if (!p_184231_4_.func_196958_f()) {
|
||||
+ if (!p_184231_4_.isAir(field_70170_p, p_184231_5_)) {
|
||||
double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int)(150.0D * d0);
|
||||
+ if (!p_184231_4_.addLandingEffects((WorldServer)this.field_70170_p, p_184231_5_, p_184231_4_, this, i))
|
||||
((WorldServer)this.field_70170_p).func_195598_a(new BlockParticleData(Particles.field_197611_d, p_184231_4_), this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, (double)0.15F);
|
||||
}
|
||||
}
|
||||
@@ -274,7 +277,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().func_205710_ba()) {
|
||||
+ if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().canBeRiddenInWater(this)) {
|
||||
this.func_184210_p();
|
||||
}
|
||||
} else if (this.func_70086_ai() < this.func_205010_bg()) {
|
||||
@@ -356,6 +359,7 @@
|
||||
if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot"))) {
|
||||
int i = this.func_70693_a(this.field_70717_bb);
|
||||
|
||||
+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i);
|
||||
while(i > 0) {
|
||||
int j = EntityXPOrb.func_70527_a(i);
|
||||
i -= j;
|
||||
@@ -412,6 +416,7 @@
|
||||
public void func_70604_c(@Nullable EntityLivingBase p_70604_1_) {
|
||||
this.field_70755_b = p_70604_1_;
|
||||
this.field_70756_c = this.field_70173_aa;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70604_1_);
|
||||
}
|
||||
|
||||
public EntityLivingBase func_110144_aD() {
|
||||
@@ -584,8 +589,10 @@
|
||||
this.func_82142_c(false);
|
||||
} else {
|
||||
Collection<PotionEffect> collection = this.field_70713_bf.values();
|
||||
- this.field_70180_af.func_187227_b(field_184634_g, func_184593_a(collection));
|
||||
- this.field_70180_af.func_187227_b(field_184633_f, PotionUtils.func_185181_a(collection));
|
||||
+ net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.func_185181_a(collection), func_184593_a(collection), collection);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
|
||||
+ this.field_70180_af.func_187227_b(field_184634_g, event.areParticlesHidden());
|
||||
+ this.field_70180_af.func_187227_b(field_184633_f, event.getColor());
|
||||
this.func_82142_c(this.func_70644_a(MobEffects.field_76441_p));
|
||||
}
|
||||
|
||||
@@ -622,6 +629,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,3 +94,330 @@
|
|||
public Collection<PotionEffect> func_70651_bq() {
|
||||
return this.field_70713_bf.values();
|
||||
}
|
||||
@@ -714,6 +742,8 @@
|
||||
}
|
||||
|
||||
public void func_70691_i(float p_70691_1_) {
|
||||
+ p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_);
|
||||
+ if (p_70691_1_ <= 0) return;
|
||||
float f = this.func_110143_aJ();
|
||||
if (f > 0.0F) {
|
||||
this.func_70606_j(f + p_70691_1_);
|
||||
@@ -730,6 +760,7 @@
|
||||
}
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false;
|
||||
if (this.func_180431_b(p_70097_1_)) {
|
||||
return false;
|
||||
} else if (this.field_70170_p.field_72995_K) {
|
||||
@@ -789,8 +820,8 @@
|
||||
if (entity1 instanceof EntityPlayer) {
|
||||
this.field_70718_bc = 100;
|
||||
this.field_70717_bb = (EntityPlayer)entity1;
|
||||
- } else if (entity1 instanceof EntityWolf) {
|
||||
- EntityWolf entitywolf = (EntityWolf)entity1;
|
||||
+ } else if (entity1 instanceof net.minecraft.entity.passive.EntityTameable) {
|
||||
+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity1;
|
||||
if (entitywolf.func_70909_n()) {
|
||||
this.field_70718_bc = 100;
|
||||
this.field_70717_bb = null;
|
||||
@@ -938,11 +969,12 @@
|
||||
}
|
||||
|
||||
public void func_70669_a(ItemStack p_70669_1_) {
|
||||
- super.func_184185_a(SoundEvents.field_187635_cQ, 0.8F, 0.8F + this.field_70170_p.field_73012_v.nextFloat() * 0.4F);
|
||||
+ this.field_70170_p.func_184148_a(null, this.field_70165_t, this.field_70163_u, this.field_70161_v, SoundEvents.field_187635_cQ, this.func_184176_by(), 0.8F, 0.8F + this.field_70170_p.field_73012_v.nextFloat() * 0.4F); //Forge: Fix MC-2518 Items are not damaged on the client so client needs packet as well.
|
||||
this.func_195062_a(p_70669_1_, 5);
|
||||
}
|
||||
|
||||
public void func_70645_a(DamageSource p_70645_1_) {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
|
||||
if (!this.field_70729_aU) {
|
||||
Entity entity = p_70645_1_.func_76346_g();
|
||||
EntityLivingBase entitylivingbase = this.func_94060_bK();
|
||||
@@ -957,15 +989,16 @@
|
||||
this.field_70729_aU = true;
|
||||
this.func_110142_aN().func_94549_h();
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
- int i = 0;
|
||||
- if (entity instanceof EntityPlayer) {
|
||||
- i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity);
|
||||
- }
|
||||
+ int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_70645_1_);
|
||||
+ this.captureDrops(new java.util.ArrayList<>());
|
||||
|
||||
if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) {
|
||||
boolean flag = this.field_70718_bc > 0;
|
||||
this.func_184610_a(flag, i, p_70645_1_);
|
||||
}
|
||||
+ Collection<EntityItem> drops = captureDrops(null);
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, drops, i, field_70718_bc > 0))
|
||||
+ drops.forEach(e -> field_70170_p.func_72838_d(e));
|
||||
}
|
||||
|
||||
this.field_70170_p.func_72960_a(this, (byte)3);
|
||||
@@ -981,6 +1014,9 @@
|
||||
}
|
||||
|
||||
public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) {
|
||||
+ net.minecraftforge.event.entity.living.LivingKnockBackEvent event = net.minecraftforge.common.ForgeHooks.onLivingKnockBack(this, p_70653_1_, p_70653_2_, p_70653_3_, p_70653_5_);
|
||||
+ if(event.isCanceled()) return;
|
||||
+ p_70653_2_ = event.getStrength(); p_70653_3_ = event.getRatioX(); p_70653_5_ = event.getRatioZ();
|
||||
if (!(this.field_70146_Z.nextDouble() < this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())) {
|
||||
this.field_70160_al = true;
|
||||
float f = MathHelper.func_76133_a(p_70653_3_ * p_70653_3_ + p_70653_5_ * p_70653_5_);
|
||||
@@ -1025,12 +1061,7 @@
|
||||
} else {
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
- Block block = iblockstate.func_177230_c();
|
||||
- if (block != Blocks.field_150468_ap && block != Blocks.field_150395_bd) {
|
||||
- return block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate);
|
||||
- } else {
|
||||
- return true;
|
||||
- }
|
||||
+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, field_70170_p, blockpos, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1050,6 +1081,9 @@
|
||||
}
|
||||
|
||||
public void func_180430_e(float p_180430_1_, float p_180430_2_) {
|
||||
+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_180430_1_, p_180430_2_);
|
||||
+ if (ret == null) return;
|
||||
+ p_180430_1_ = ret[0]; p_180430_2_ = ret[1];
|
||||
super.func_180430_e(p_180430_1_, p_180430_2_);
|
||||
PotionEffect potioneffect = this.func_70660_b(MobEffects.field_76430_j);
|
||||
float f = potioneffect == null ? 0.0F : (float)(potioneffect.func_76458_c() + 1);
|
||||
@@ -1062,7 +1096,7 @@
|
||||
int l = MathHelper.func_76128_c(this.field_70161_v);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(new BlockPos(j, k, l));
|
||||
if (!iblockstate.func_196958_f()) {
|
||||
- SoundType soundtype = iblockstate.func_177230_c().func_185467_w();
|
||||
+ SoundType soundtype = iblockstate.getSoundType(field_70170_p, new BlockPos(j, k, l), this);
|
||||
this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
|
||||
}
|
||||
}
|
||||
@@ -1122,15 +1156,18 @@
|
||||
|
||||
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
|
||||
if (!this.func_180431_b(p_70665_1_)) {
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
|
||||
+ if (p_70665_2_ <= 0) return;
|
||||
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
|
||||
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
|
||||
float f = p_70665_2_;
|
||||
p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
|
||||
this.func_110149_m(this.func_110139_bj() - (f - p_70665_2_));
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_);
|
||||
if (p_70665_2_ != 0.0F) {
|
||||
float f1 = this.func_110143_aJ();
|
||||
- this.func_70606_j(f1 - p_70665_2_);
|
||||
this.func_110142_aN().func_94547_a(p_70665_1_, f1, p_70665_2_);
|
||||
+ this.func_70606_j(f1 - p_70665_2_); // Forge: moved to fix MC-121048
|
||||
this.func_110149_m(this.func_110139_bj() - p_70665_2_);
|
||||
}
|
||||
}
|
||||
@@ -1172,6 +1209,8 @@
|
||||
}
|
||||
|
||||
public void func_184609_a(EnumHand p_184609_1_) {
|
||||
+ ItemStack stack = this.func_184586_b(p_184609_1_);
|
||||
+ if (!stack.func_190926_b() && stack.onEntitySwing(this)) return;
|
||||
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) {
|
||||
this.field_110158_av = -1;
|
||||
this.field_82175_bq = true;
|
||||
@@ -1356,18 +1395,18 @@
|
||||
double d12 = d6 + d10;
|
||||
AxisAlignedBB axisalignedbb1 = axisalignedbb.func_72317_d(d9, 0.0D, d10);
|
||||
if (this.field_70170_p.func_195586_b((Entity)null, axisalignedbb1)) {
|
||||
- if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).func_185896_q()) {
|
||||
+ if (this.field_70170_p.func_195595_w(new BlockPos(d11, this.field_70163_u, d12))) {
|
||||
this.func_70634_a(d11, this.field_70163_u + 1.0D, d12);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12);
|
||||
- if (this.field_70170_p.func_180495_p(blockpos).func_185896_q() || this.field_70170_p.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) {
|
||||
+ if (this.field_70170_p.func_195595_w(blockpos) || this.field_70170_p.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) {
|
||||
d1 = d11;
|
||||
d13 = this.field_70163_u + 1.0D;
|
||||
d14 = d12;
|
||||
}
|
||||
- } else if (this.field_70170_p.func_195586_b((Entity)null, axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).func_185896_q()) {
|
||||
+ } else if (this.field_70170_p.func_195586_b((Entity)null, axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_195595_w(new BlockPos(d11, this.field_70163_u + 1.0D, d12))) {
|
||||
d1 = d11;
|
||||
d13 = this.field_70163_u + 2.0D;
|
||||
d14 = d12;
|
||||
@@ -1422,15 +1461,16 @@
|
||||
}
|
||||
|
||||
this.field_70160_al = true;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
protected void func_203010_cG() {
|
||||
- this.field_70181_x -= (double)0.04F;
|
||||
+ this.field_70181_x -= (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
}
|
||||
|
||||
protected void func_180466_bG(Tag<Fluid> p_180466_1_) {
|
||||
- this.field_70181_x += (double)0.04F;
|
||||
+ this.field_70181_x += (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
}
|
||||
|
||||
protected float func_189749_co() {
|
||||
@@ -1501,7 +1541,7 @@
|
||||
|
||||
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185345_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)) {
|
||||
if (this.field_70122_E) {
|
||||
- f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos).func_177230_c().func_208618_m() * 0.91F;
|
||||
+ f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos).getSlipperiness(field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F;
|
||||
}
|
||||
|
||||
float f8 = 0.16277137F / (f7 * f7 * f7);
|
||||
@@ -1515,7 +1555,7 @@
|
||||
this.func_191958_b(p_191986_1_, p_191986_2_, p_191986_3_, f9);
|
||||
f7 = 0.91F;
|
||||
if (this.field_70122_E) {
|
||||
- f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.91F;
|
||||
+ f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).getSlipperiness(field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F;
|
||||
}
|
||||
|
||||
if (this.func_70617_f_()) {
|
||||
@@ -1646,6 +1686,7 @@
|
||||
}
|
||||
|
||||
public void func_70071_h_() {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return;
|
||||
super.func_70071_h_();
|
||||
this.func_184608_ct();
|
||||
this.func_205014_p();
|
||||
@@ -1677,7 +1718,9 @@
|
||||
|
||||
ItemStack itemstack1 = this.func_184582_a(entityequipmentslot);
|
||||
if (!ItemStack.func_77989_b(itemstack1, itemstack)) {
|
||||
+ if (!ItemStack.areItemStacksEqualUsingNBTShareTag(itemstack1, itemstack))
|
||||
((WorldServer)this.field_70170_p).func_73039_n().func_151247_a(this, new SPacketEntityEquipment(this.func_145782_y(), entityequipmentslot, itemstack1));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, entityequipmentslot, itemstack, itemstack1));
|
||||
if (!itemstack.func_190926_b()) {
|
||||
this.func_110140_aT().func_111148_a(itemstack.func_111283_C(entityequipmentslot));
|
||||
}
|
||||
@@ -2117,11 +2160,18 @@
|
||||
protected void func_184608_ct() {
|
||||
if (this.func_184587_cr()) {
|
||||
if (this.func_184586_b(this.func_184600_cs()) == this.field_184627_bm) {
|
||||
+
|
||||
+ if (!this.field_184627_bm.func_190926_b()) {
|
||||
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
|
||||
+ if (field_184628_bn > 0)
|
||||
+ field_184627_bm.onUsingTick(this, field_184628_bn);
|
||||
+ }
|
||||
+
|
||||
if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) {
|
||||
this.func_184584_a(this.field_184627_bm, 5);
|
||||
}
|
||||
|
||||
- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K) {
|
||||
+ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K) {
|
||||
this.func_71036_o();
|
||||
}
|
||||
} else {
|
||||
@@ -2155,8 +2205,10 @@
|
||||
public void func_184598_c(EnumHand p_184598_1_) {
|
||||
ItemStack itemstack = this.func_184586_b(p_184598_1_);
|
||||
if (!itemstack.func_190926_b() && !this.func_184587_cr()) {
|
||||
+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m());
|
||||
+ if (duration <= 0) return;
|
||||
this.field_184627_bm = itemstack;
|
||||
- this.field_184628_bn = itemstack.func_77988_m();
|
||||
+ this.field_184628_bn = duration;
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
this.func_204802_c(1, true);
|
||||
this.func_204802_c(2, p_184598_1_ == EnumHand.OFF_HAND);
|
||||
@@ -2212,6 +2264,9 @@
|
||||
vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F));
|
||||
vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F));
|
||||
vec3d1 = vec3d1.func_72441_c(this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v);
|
||||
+ if (this.field_70170_p instanceof WorldServer) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant
|
||||
+ ((WorldServer)this.field_70170_p).func_195598_a(new ItemParticleData(Particles.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, 1, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, 0.0D);
|
||||
+ else
|
||||
this.field_70170_p.func_195594_a(new ItemParticleData(Particles.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c);
|
||||
}
|
||||
|
||||
@@ -2220,7 +2275,9 @@
|
||||
protected void func_71036_o() {
|
||||
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) {
|
||||
this.func_184584_a(this.field_184627_bm, 16);
|
||||
- this.func_184611_a(this.func_184600_cs(), this.field_184627_bm.func_77950_b(this.field_70170_p, this));
|
||||
+ ItemStack copy = this.field_184627_bm.func_77946_l();
|
||||
+ ItemStack stack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, func_184605_cv(), this.field_184627_bm.func_77950_b(this.field_70170_p, this));
|
||||
+ this.func_184611_a(this.func_184600_cs(), stack);
|
||||
this.func_184602_cy();
|
||||
}
|
||||
|
||||
@@ -2240,6 +2297,7 @@
|
||||
|
||||
public void func_184597_cx() {
|
||||
if (!this.field_184627_bm.func_190926_b()) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv()))
|
||||
this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
|
||||
}
|
||||
|
||||
@@ -2346,4 +2404,53 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void func_191987_a(BlockPos p_191987_1_, boolean p_191987_2_) {
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted.
|
||||
+ * currently only used in vanilla code by pigs.
|
||||
+ *
|
||||
+ * @param player The player who is riding the entity.
|
||||
+ * @return If the player should orient the same direction as this entity.
|
||||
+ */
|
||||
+ public boolean shouldRiderFaceForward(EntityPlayer player) {
|
||||
+ return this instanceof net.minecraft.entity.passive.EntityPig;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void func_191958_b(float strafe, float up, float forward, float friction) {
|
||||
+ float f = strafe * strafe + up * up + forward * forward;
|
||||
+ if (f >= 1.0E-4F) {
|
||||
+ f = MathHelper.func_76129_c(f);
|
||||
+ if (f < 1.0F) f = 1.0F;
|
||||
+ f = friction / f;
|
||||
+ strafe *= f;
|
||||
+ up *= f;
|
||||
+ forward *= f;
|
||||
+
|
||||
+ if (this.func_70090_H() || this.func_180799_ab()) {
|
||||
+ float speed = (float)this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
+ strafe *= speed;
|
||||
+ up *= speed;
|
||||
+ forward *= speed;
|
||||
+ }
|
||||
+
|
||||
+ float f1 = MathHelper.func_76126_a(this.field_70177_z * ((float)Math.PI / 180F));
|
||||
+ float f2 = MathHelper.func_76134_b(this.field_70177_z * ((float)Math.PI / 180F));
|
||||
+ this.field_70159_w += (double)(strafe * f2 - forward * f1);
|
||||
+ this.field_70181_x += (double)up;
|
||||
+ this.field_70179_y += (double)(forward * f2 + strafe * f1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private final net.minecraftforge.common.capabilities.OptionalCapabilityInstance<?>[] handlers = net.minecraftforge.items.wrapper.EntityEquipmentInvWrapper.create(this);
|
||||
+
|
||||
+ @Override
|
||||
+ public <T> net.minecraftforge.common.capabilities.OptionalCapabilityInstance<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
+ if (facing == null) return handlers[2].cast();
|
||||
+ else if (facing.func_176740_k().func_200128_b()) return handlers[0].cast();
|
||||
+ else if (facing.func_176740_k().func_176722_c()) return handlers[1].cast();
|
||||
+ }
|
||||
+ return super.getCapability(capability, facing);
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/entity/EntitySpawnPlacementRegistry.java
|
||||
+++ b/net/minecraft/entity/EntitySpawnPlacementRegistry.java
|
||||
@@ -17,6 +17,7 @@
|
||||
}
|
||||
|
||||
public static void func_209346_a(EntityType<?> p_209346_0_, EntitySpawnPlacementRegistry.SpawnPlacementType p_209346_1_, Heightmap.Type p_209346_2_, @Nullable Tag<Block> p_209346_3_) {
|
||||
+ if (field_209347_a.containsKey(p_209346_0_)) throw new IllegalArgumentException("Invalid register call, " + p_209346_0_ + " already registered.");
|
||||
field_209347_a.put(p_209346_0_, new EntitySpawnPlacementRegistry.Entry(p_209346_2_, p_209346_1_, p_209346_3_));
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
--- a/net/minecraft/entity/EntityTracker.java
|
||||
+++ b/net/minecraft/entity/EntityTracker.java
|
||||
@@ -296,4 +296,18 @@
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily
|
||||
+ /**
|
||||
+ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to.
|
||||
+ * @param entity the Entity
|
||||
+ * @return all players tracking the Entity
|
||||
+ */
|
||||
+ public Set<? extends net.minecraft.entity.player.EntityPlayer> getTrackingPlayers(Entity entity) {
|
||||
+ EntityTrackerEntry entry = (EntityTrackerEntry)field_72794_c.func_76041_a(entity.func_145782_y());
|
||||
+ if (entry == null)
|
||||
+ return java.util.Collections.emptySet();
|
||||
+ else
|
||||
+ return java.util.Collections.unmodifiableSet(entry.field_73134_o);
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
--- a/net/minecraft/entity/EntityTrackerEntry.java
|
||||
+++ b/net/minecraft/entity/EntityTrackerEntry.java
|
||||
@@ -143,7 +143,7 @@
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame)this.field_73132_a;
|
||||
ItemStack itemstack = entityitemframe.func_82335_i();
|
||||
if (itemstack.func_77973_b() instanceof ItemMap) {
|
||||
- MapData mapdata = ItemMap.func_195950_a(itemstack, this.field_73132_a.field_70170_p);
|
||||
+ MapData mapdata = ((ItemMap)itemstack.func_77973_b()).getMapDataOverride(itemstack, this.field_73132_a.field_70170_p);
|
||||
|
||||
for(EntityPlayer entityplayer : p_73122_1_) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP)entityplayer;
|
||||
@@ -376,11 +376,13 @@
|
||||
|
||||
this.field_73132_a.func_184178_b(p_73117_1_);
|
||||
p_73117_1_.func_184848_d(this.field_73132_a);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(field_73132_a, p_73117_1_);
|
||||
}
|
||||
} else if (this.field_73134_o.contains(p_73117_1_)) {
|
||||
this.field_73134_o.remove(p_73117_1_);
|
||||
this.field_73132_a.func_184203_c(p_73117_1_);
|
||||
p_73117_1_.func_152339_d(this.field_73132_a);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(field_73132_a, p_73117_1_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -409,6 +411,9 @@
|
||||
field_151262_p.warn("Fetching addPacket for removed entity");
|
||||
}
|
||||
|
||||
+ Packet<?> pkt = net.minecraftforge.fml.network.NetworkHooks.getEntitySpawningPacket(this.field_73132_a);
|
||||
+ if (pkt != null) return pkt;
|
||||
+
|
||||
if (this.field_73132_a instanceof EntityPlayerMP) {
|
||||
return new SPacketSpawnPlayer((EntityPlayer)this.field_73132_a);
|
||||
} else if (this.field_73132_a instanceof IAnimal) {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/SharedMonsterAttributes.java
|
||||
+++ b/net/minecraft/entity/SharedMonsterAttributes.java
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public class SharedMonsterAttributes {
|
||||
private static final Logger field_151476_f = LogManager.getLogger();
|
||||
- public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).func_111117_a("Max Health").func_111112_a(true);
|
||||
+ public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, Float.MIN_VALUE, 1024.0D)).func_111117_a("Max Health").func_111112_a(true); // Forge: set smallest max-health value to fix MC-119183. This gets rounded to float so we use the smallest positive float value.
|
||||
public static final IAttribute field_111265_b = (new RangedAttribute((IAttribute)null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).func_111117_a("Follow Range");
|
||||
public static final IAttribute field_111266_c = (new RangedAttribute((IAttribute)null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).func_111117_a("Knockback Resistance");
|
||||
public static final IAttribute field_111263_d = (new RangedAttribute((IAttribute)null, "generic.movementSpeed", (double)0.7F, 0.0D, 1024.0D)).func_111117_a("Movement Speed").func_111112_a(true);
|
|
@ -0,0 +1,46 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIAttackMelee.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIAttackMelee.java
|
||||
@@ -18,6 +18,8 @@
|
||||
private double field_151495_j;
|
||||
private double field_151496_k;
|
||||
protected final int field_188493_g = 20;
|
||||
+ private int failedPathFindingPenalty = 0;
|
||||
+ private boolean canPenalize = false;
|
||||
|
||||
public EntityAIAttackMelee(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) {
|
||||
this.field_75441_b = p_i1636_1_;
|
||||
@@ -33,6 +35,15 @@
|
||||
} else if (!entitylivingbase.func_70089_S()) {
|
||||
return false;
|
||||
} else {
|
||||
+ if (canPenalize) {
|
||||
+ if (--this.field_75445_i <= 0) {
|
||||
+ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase);
|
||||
+ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7);
|
||||
+ return this.field_75438_g != null;
|
||||
+ } else {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase);
|
||||
if (this.field_75438_g != null) {
|
||||
return true;
|
||||
@@ -81,6 +92,18 @@
|
||||
this.field_151495_j = entitylivingbase.func_174813_aQ().field_72338_b;
|
||||
this.field_151496_k = entitylivingbase.field_70161_v;
|
||||
this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7);
|
||||
+ if (this.canPenalize) {
|
||||
+ this.field_75445_i += failedPathFindingPenalty;
|
||||
+ if (this.field_75441_b.func_70661_as().func_75505_d() != null) {
|
||||
+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c();
|
||||
+ if (finalPathPoint != null && entitylivingbase.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1)
|
||||
+ failedPathFindingPenalty = 0;
|
||||
+ else
|
||||
+ failedPathFindingPenalty += 10;
|
||||
+ } else {
|
||||
+ failedPathFindingPenalty += 10;
|
||||
+ }
|
||||
+ }
|
||||
if (d0 > 1024.0D) {
|
||||
this.field_75445_i += 10;
|
||||
} else if (d0 > 256.0D) {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIBreakBlock.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIBreakBlock.java
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
public boolean func_75250_a() {
|
||||
- if (!this.field_203118_g.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_203118_g.field_70170_p, this.field_203118_g) || !this.field_203118_g.field_70170_p.func_180495_p(this.field_179494_b).canEntityDestroy(this.field_203118_g.field_70170_p, this.field_179494_b, this.field_203118_g) || !net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.field_203118_g, this.field_179494_b, this.field_203118_g.field_70170_p.func_180495_p(this.field_179494_b))) {
|
||||
return false;
|
||||
} else {
|
||||
return this.field_203118_g.func_70681_au().nextInt(20) != 0 ? false : super.func_75250_a();
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIBreakDoor.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIBreakDoor.java
|
||||
@@ -15,7 +15,7 @@
|
||||
public boolean func_75250_a() {
|
||||
if (!super.func_75250_a()) {
|
||||
return false;
|
||||
- } else if (!this.field_75356_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_75356_a.field_70170_p, this.field_75356_a) || !this.field_75356_a.field_70170_p.func_180495_p(this.field_179507_b).canEntityDestroy(this.field_75356_a.field_70170_p, this.field_179507_b, this.field_75356_a) || !net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.field_75356_a, this.field_179507_b, this.field_75356_a.field_70170_p.func_180495_p(this.field_179507_b))) {
|
||||
return false;
|
||||
} else {
|
||||
return !this.func_195922_f();
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIEatGrass.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIEatGrass.java
|
||||
@@ -57,7 +57,7 @@
|
||||
if (this.field_151502_a == 4) {
|
||||
BlockPos blockpos = new BlockPos(this.field_151500_b.field_70165_t, this.field_151500_b.field_70163_u, this.field_151500_b.field_70161_v);
|
||||
if (field_179505_b.test(this.field_151501_c.func_180495_p(blockpos))) {
|
||||
- if (this.field_151501_c.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) {
|
||||
this.field_151501_c.func_175655_b(blockpos, false);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
} else {
|
||||
BlockPos blockpos1 = blockpos.func_177977_b();
|
||||
if (this.field_151501_c.func_180495_p(blockpos1).func_177230_c() == Blocks.field_196658_i) {
|
||||
- if (this.field_151501_c.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) {
|
||||
this.field_151501_c.func_175718_b(2001, blockpos1, Block.func_196246_j(Blocks.field_196658_i.func_176223_P()));
|
||||
this.field_151501_c.func_180501_a(blockpos1, Blocks.field_150346_d.func_176223_P(), 2);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIHarvestFarmland.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIHarvestFarmland.java
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
public boolean func_75250_a() {
|
||||
if (this.field_179496_a <= 0) {
|
||||
- if (!this.field_179504_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179504_c.field_70170_p, this.field_179504_c)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@
|
||||
} else if (itemstack.func_77973_b() == Items.field_185163_cU) {
|
||||
iworld.func_180501_a(blockpos, Blocks.field_185773_cZ.func_176223_P(), 3);
|
||||
flag = true;
|
||||
+ } else if (itemstack.func_77973_b() instanceof net.minecraftforge.common.IPlantable) {
|
||||
+ if (((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlantType(iworld, blockpos) == net.minecraftforge.common.EnumPlantType.Crop) {
|
||||
+ iworld.func_180501_a(blockpos, ((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlant(iworld, blockpos),3);
|
||||
+ flag = true;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIMate.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIMate.java
|
||||
@@ -76,6 +76,17 @@
|
||||
|
||||
protected void func_75388_i() {
|
||||
EntityAgeable entityageable = this.field_75390_d.func_90011_a(this.field_75391_e);
|
||||
+ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75390_d, field_75391_e, entityageable);
|
||||
+ final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
|
||||
+ entityageable = event.getChild();
|
||||
+ if (cancelled) {
|
||||
+ //Reset the "inLove" state for the animals
|
||||
+ this.field_75390_d.func_70873_a(6000);
|
||||
+ this.field_75391_e.func_70873_a(6000);
|
||||
+ this.field_75390_d.func_70875_t();
|
||||
+ this.field_75391_e.func_70875_t();
|
||||
+ return;
|
||||
+ }
|
||||
if (entityageable != null) {
|
||||
EntityPlayerMP entityplayermp = this.field_75390_d.func_191993_do();
|
||||
if (entityplayermp == null && this.field_75391_e.func_191993_do() != null) {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java
|
||||
@@ -52,7 +52,7 @@
|
||||
if (entity instanceof EntityPlayer) {
|
||||
int i = this.field_111180_a.func_110252_cg();
|
||||
int j = this.field_111180_a.func_190676_dC();
|
||||
- if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i) {
|
||||
+ if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(field_111180_a, (EntityPlayer)entity)) {
|
||||
this.field_111180_a.func_110263_g((EntityPlayer)entity);
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
--- a/net/minecraft/entity/ai/EntityAIVillagerMate.java
|
||||
+++ b/net/minecraft/entity/ai/EntityAIVillagerMate.java
|
||||
@@ -82,11 +82,14 @@
|
||||
}
|
||||
|
||||
private void func_75447_i() {
|
||||
- EntityVillager entityvillager = this.field_75450_b.func_90011_a(this.field_75451_c);
|
||||
+ net.minecraft.entity.EntityAgeable entityvillager = this.field_75450_b.func_90011_a(this.field_75451_c);
|
||||
this.field_75451_c.func_70873_a(6000);
|
||||
this.field_75450_b.func_70873_a(6000);
|
||||
this.field_75451_c.func_175549_o(false);
|
||||
this.field_75450_b.func_175549_o(false);
|
||||
+ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75450_b, field_75451_c, entityvillager);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event) || event.getChild() == null) return;
|
||||
+ entityvillager = event.getChild();
|
||||
entityvillager.func_70873_a(-24000);
|
||||
entityvillager.func_70012_b(this.field_75450_b.field_70165_t, this.field_75450_b.field_70163_u, this.field_75450_b.field_70161_v, 0.0F, 0.0F);
|
||||
this.field_75448_d.func_72838_d(entityvillager);
|
|
@ -0,0 +1,16 @@
|
|||
--- a/net/minecraft/entity/boss/EntityDragon.java
|
||||
+++ b/net/minecraft/entity/boss/EntityDragon.java
|
||||
@@ -415,10 +415,10 @@
|
||||
BlockPos blockpos = new BlockPos(k1, l1, i2);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
Block block = iblockstate.func_177230_c();
|
||||
- if (!iblockstate.func_196958_f() && iblockstate.func_185904_a() != Material.field_151581_o) {
|
||||
- if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (!iblockstate.isAir(field_70170_p, blockpos) && iblockstate.func_185904_a() != Material.field_151581_o) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) {
|
||||
flag = true;
|
||||
- } else if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150384_bq && block != Blocks.field_150378_br) {
|
||||
+ } else if (iblockstate.canEntityDestroy(this.field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, iblockstate)) {
|
||||
if (block != Blocks.field_150483_bI && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.field_150411_aY && block != Blocks.field_185775_db) {
|
||||
flag1 = this.field_70170_p.func_175698_g(blockpos) || flag1;
|
||||
} else {
|
|
@ -0,0 +1,29 @@
|
|||
--- a/net/minecraft/entity/boss/EntityWither.java
|
||||
+++ b/net/minecraft/entity/boss/EntityWither.java
|
||||
@@ -208,7 +208,7 @@
|
||||
if (this.func_82212_n() > 0) {
|
||||
int j1 = this.func_82212_n() - 1;
|
||||
if (j1 <= 0) {
|
||||
- this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"));
|
||||
+ this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this));
|
||||
this.field_70170_p.func_175669_a(1023, new BlockPos(this), 0);
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@
|
||||
|
||||
if (this.field_82222_j > 0) {
|
||||
--this.field_82222_j;
|
||||
- if (this.field_82222_j == 0 && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (this.field_82222_j == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) {
|
||||
int i1 = MathHelper.func_76128_c(this.field_70163_u);
|
||||
int l1 = MathHelper.func_76128_c(this.field_70165_t);
|
||||
int i2 = MathHelper.func_76128_c(this.field_70161_v);
|
||||
@@ -297,7 +297,7 @@
|
||||
BlockPos blockpos = new BlockPos(i3, k, l);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
Block block = iblockstate.func_177230_c();
|
||||
- if (!iblockstate.func_196958_f() && func_181033_a(block)) {
|
||||
+ if (!iblockstate.isAir(field_70170_p, blockpos) && block.canEntityDestroy(iblockstate, field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, iblockstate)) {
|
||||
flag = this.field_70170_p.func_175655_b(blockpos, true) || flag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java
|
||||
+++ b/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java
|
||||
@@ -58,7 +58,7 @@
|
||||
double d2 = this.field_188661_a.field_70986_h.field_70163_u + (double)(this.field_188661_a.field_70986_h.field_70131_O / 2.0F);
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d2), MathHelper.func_76128_c(d1));
|
||||
|
||||
- while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos)) {
|
||||
+ while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos) && d2 >= 0) { //Forge: Fix infinite loop if ground is missing.
|
||||
--d2;
|
||||
blockpos$mutableblockpos.func_181079_c(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d2), MathHelper.func_76128_c(d1));
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/entity/effect/EntityLightningBolt.java
|
||||
+++ b/net/minecraft/entity/effect/EntityLightningBolt.java
|
||||
@@ -75,6 +75,7 @@
|
||||
|
||||
for(int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = list.get(i);
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this))
|
||||
entity.func_70077_a(this);
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
--- a/net/minecraft/entity/item/EntityEnderPearl.java
|
||||
+++ b/net/minecraft/entity/item/EntityEnderPearl.java
|
||||
@@ -74,6 +74,9 @@
|
||||
if (entitylivingbase instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP)entitylivingbase;
|
||||
if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn()) {
|
||||
+
|
||||
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F);
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { // Don't indent to lower patch size
|
||||
if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) {
|
||||
EntityEndermite entityendermite = new EntityEndermite(this.field_70170_p);
|
||||
entityendermite.func_175496_a(true);
|
||||
@@ -85,9 +88,10 @@
|
||||
entitylivingbase.func_184210_p();
|
||||
}
|
||||
|
||||
- entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v);
|
||||
+ entitylivingbase.func_70634_a(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
entitylivingbase.field_70143_R = 0.0F;
|
||||
- entitylivingbase.func_70097_a(DamageSource.field_76379_h, 5.0F);
|
||||
+ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.getAttackDamage());
|
||||
+ }
|
||||
}
|
||||
} else if (entitylivingbase != null) {
|
||||
entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v);
|
||||
@@ -109,12 +113,13 @@
|
||||
|
||||
}
|
||||
|
||||
+ @Override
|
||||
@Nullable
|
||||
- public Entity func_184204_a(int p_184204_1_) {
|
||||
- if (this.field_70192_c.field_71093_bK != p_184204_1_) {
|
||||
+ public Entity changeDimension(int dimensionIn, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
+ if (this.field_70192_c.field_71093_bK != dimensionIn) {
|
||||
this.field_70192_c = null;
|
||||
}
|
||||
|
||||
- return super.func_184204_a(p_184204_1_);
|
||||
+ return super.changeDimension(dimensionIn, teleporter);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
--- a/net/minecraft/entity/item/EntityFallingBlock.java
|
||||
+++ b/net/minecraft/entity/item/EntityFallingBlock.java
|
||||
@@ -137,6 +137,7 @@
|
||||
}
|
||||
} else {
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos1);
|
||||
+ if (this.field_70170_p.func_175623_d(new BlockPos(this.field_70165_t, this.field_70163_u - (double)0.01F, this.field_70161_v))) //Forge: Don't indent below.
|
||||
if (!flag1 && BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - (double)0.01F, this.field_70161_v)))) {
|
||||
this.field_70122_E = false;
|
||||
return;
|
||||
@@ -153,7 +154,7 @@
|
||||
((BlockFalling)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, iblockstate);
|
||||
}
|
||||
|
||||
- if (this.field_145810_d != null && block instanceof ITileEntityProvider) {
|
||||
+ if (this.field_145810_d != null && this.field_175132_d.hasTileEntity()) {
|
||||
TileEntity tileentity = this.field_70170_p.func_175625_s(blockpos1);
|
||||
if (tileentity != null) {
|
||||
NBTTagCompound nbttagcompound = tileentity.func_189515_b(new NBTTagCompound());
|
|
@ -0,0 +1,129 @@
|
|||
--- a/net/minecraft/entity/item/EntityItem.java
|
||||
+++ b/net/minecraft/entity/item/EntityItem.java
|
||||
@@ -34,6 +34,10 @@
|
||||
private UUID field_145801_f;
|
||||
private UUID field_145802_g;
|
||||
public float field_70290_d;
|
||||
+ /**
|
||||
+ * The maximum age of this EntityItem. The item is expired once this is reached.
|
||||
+ */
|
||||
+ public int lifespan = 6000;
|
||||
|
||||
public EntityItem(World p_i1711_1_) {
|
||||
super(EntityType.field_200765_E, p_i1711_1_);
|
||||
@@ -54,6 +58,7 @@
|
||||
public EntityItem(World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_) {
|
||||
this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_);
|
||||
this.func_92058_a(p_i1710_8_);
|
||||
+ this.lifespan = (p_i1710_8_.func_77973_b() == null ? 6000 : p_i1710_8_.getEntityLifespan(p_i1710_1_));
|
||||
}
|
||||
|
||||
protected boolean func_70041_e_() {
|
||||
@@ -65,6 +70,7 @@
|
||||
}
|
||||
|
||||
public void func_70071_h_() {
|
||||
+ if (func_92059_d().onEntityItemUpdate(this)) return;
|
||||
if (this.func_92059_d().func_190926_b()) {
|
||||
this.func_70106_y();
|
||||
} else {
|
||||
@@ -108,7 +114,8 @@
|
||||
|
||||
float f = 0.98F;
|
||||
if (this.field_70122_E) {
|
||||
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().func_208618_m() * 0.98F;
|
||||
+ BlockPos pos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
|
||||
+ f = this.field_70170_p.func_180495_p(pos).getSlipperiness(this.field_70170_p, pos, this) * 0.98F;
|
||||
}
|
||||
|
||||
this.field_70159_w *= (double)f;
|
||||
@@ -133,7 +140,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000) {
|
||||
+ ItemStack item = this.func_92059_d();
|
||||
+ if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan) {
|
||||
+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item);
|
||||
+ if (hook < 0) this.func_70106_y();
|
||||
+ else this.lifespan += hook;
|
||||
+ }
|
||||
+
|
||||
+ if (item.func_190926_b()) {
|
||||
this.func_70106_y();
|
||||
}
|
||||
|
||||
@@ -176,6 +190,8 @@
|
||||
return p_70289_1_.func_70289_a(this);
|
||||
} else if (itemstack1.func_190916_E() + itemstack.func_190916_E() > itemstack1.func_77976_d()) {
|
||||
return false;
|
||||
+ } else if (!itemstack.areCapsCompatible(itemstack1)) {
|
||||
+ return false;
|
||||
} else {
|
||||
itemstack1.func_190917_f(itemstack.func_190916_E());
|
||||
p_70289_1_.field_145804_b = Math.max(p_70289_1_.field_145804_b, this.field_145804_b);
|
||||
@@ -204,6 +220,7 @@
|
||||
}
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return false; //Forge: Fixes MC-53850
|
||||
if (this.func_180431_b(p_70097_1_)) {
|
||||
return false;
|
||||
} else if (!this.func_92059_d().func_190926_b() && this.func_92059_d().func_77973_b() == Items.field_151156_bN && p_70097_1_.func_94541_c()) {
|
||||
@@ -223,6 +240,7 @@
|
||||
p_70014_1_.func_74777_a("Health", (short)this.field_70291_e);
|
||||
p_70014_1_.func_74777_a("Age", (short)this.field_70292_b);
|
||||
p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b);
|
||||
+ p_70014_1_.func_74768_a("Lifespan", lifespan);
|
||||
if (this.func_200214_m() != null) {
|
||||
p_70014_1_.func_74782_a("Thrower", NBTUtil.func_186862_a(this.func_200214_m()));
|
||||
}
|
||||
@@ -243,6 +261,7 @@
|
||||
if (p_70037_1_.func_74764_b("PickupDelay")) {
|
||||
this.field_145804_b = p_70037_1_.func_74765_d("PickupDelay");
|
||||
}
|
||||
+ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan");
|
||||
|
||||
if (p_70037_1_.func_150297_b("Owner", 10)) {
|
||||
this.field_145802_g = NBTUtil.func_186860_b(p_70037_1_.func_74775_l("Owner"));
|
||||
@@ -262,12 +281,17 @@
|
||||
|
||||
public void func_70100_b_(EntityPlayer p_70100_1_) {
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
+ if (this.field_145804_b > 0) return;
|
||||
ItemStack itemstack = this.func_92059_d();
|
||||
Item item = itemstack.func_77973_b();
|
||||
int i = itemstack.func_190916_E();
|
||||
- if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_110124_au())) && p_70100_1_.field_71071_by.func_70441_a(itemstack)) {
|
||||
- p_70100_1_.func_71001_a(this, i);
|
||||
+
|
||||
+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_);
|
||||
+ if (hook < 0) return;
|
||||
+
|
||||
+ if (this.field_145804_b == 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_110124_au())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack))) {
|
||||
if (itemstack.func_190926_b()) {
|
||||
+ p_70100_1_.func_71001_a(this, i);
|
||||
this.func_70106_y();
|
||||
itemstack.func_190920_e(i);
|
||||
}
|
||||
@@ -287,9 +311,10 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
@Nullable
|
||||
- public Entity func_184204_a(int p_184204_1_) {
|
||||
- Entity entity = super.func_184204_a(p_184204_1_);
|
||||
+ public Entity changeDimension(int dimensionIn, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
+ Entity entity = super.changeDimension(dimensionIn, teleporter);
|
||||
if (!this.field_70170_p.field_72995_K && entity instanceof EntityItem) {
|
||||
((EntityItem)entity).func_85054_d();
|
||||
}
|
||||
@@ -354,6 +379,6 @@
|
||||
|
||||
public void func_174870_v() {
|
||||
this.func_174871_r();
|
||||
- this.field_70292_b = 5999;
|
||||
+ this.field_70292_b = func_92059_d().getEntityLifespan(field_70170_p) - 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
--- a/net/minecraft/entity/item/EntityMinecartContainer.java
|
||||
+++ b/net/minecraft/entity/item/EntityMinecartContainer.java
|
||||
@@ -119,10 +119,11 @@
|
||||
return 64;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
@Nullable
|
||||
- public Entity func_184204_a(int p_184204_1_) {
|
||||
+ public Entity changeDimension(int dimensionIn, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
this.field_94112_b = false;
|
||||
- return super.func_184204_a(p_184204_1_);
|
||||
+ return super.changeDimension(dimensionIn, teleporter);
|
||||
}
|
||||
|
||||
public void func_70106_y() {
|
||||
@@ -163,6 +164,7 @@
|
||||
}
|
||||
|
||||
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) {
|
||||
+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true;
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
p_184230_1_.func_71007_a(this);
|
||||
}
|
||||
@@ -215,9 +217,9 @@
|
||||
random = new Random(this.field_184291_d);
|
||||
}
|
||||
|
||||
- LootContext.Builder lootcontext$builder = (new LootContext.Builder((WorldServer)this.field_70170_p)).func_204313_a(new BlockPos(this));
|
||||
+ LootContext.Builder lootcontext$builder = (new LootContext.Builder((WorldServer)this.field_70170_p)).func_204313_a(new BlockPos(this)).func_186472_a(this); // Forge: add looted entity to LootContext
|
||||
if (p_184288_1_ != null) {
|
||||
- lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da());
|
||||
+ lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()).func_186470_a(p_184288_1_); // Forge: add player to LootContext
|
||||
}
|
||||
|
||||
loottable.func_186460_a(this, random, lootcontext$builder.func_186471_a());
|
||||
@@ -238,4 +240,13 @@
|
||||
public ResourceLocation func_184276_b() {
|
||||
return this.field_184290_c;
|
||||
}
|
||||
+
|
||||
+ private net.minecraftforge.common.capabilities.OptionalCapabilityInstance<?> itemHandler = net.minecraftforge.common.capabilities.OptionalCapabilityInstance.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this));
|
||||
+
|
||||
+ @Override
|
||||
+ public <T> net.minecraftforge.common.capabilities.OptionalCapabilityInstance<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing) {
|
||||
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
+ return itemHandler.cast();
|
||||
+ return super.getCapability(capability, facing);
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/monster/EntityCreeper.java
|
||||
+++ b/net/minecraft/entity/monster/EntityCreeper.java
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
private void func_146077_cc() {
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
- boolean flag = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing");
|
||||
+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this);
|
||||
float f = this.func_70830_n() ? 2.0F : 1.0F;
|
||||
this.field_70729_aU = true;
|
||||
this.field_70170_p.func_72876_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_82226_g * f, flag);
|
|
@ -0,0 +1,31 @@
|
|||
--- a/net/minecraft/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/entity/monster/EntityEnderman.java
|
||||
@@ -209,7 +209,9 @@
|
||||
}
|
||||
|
||||
private boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_) {
|
||||
- boolean flag = this.func_184595_k(p_70825_1_, p_70825_3_, p_70825_5_);
|
||||
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false;
|
||||
+ boolean flag = this.func_184595_k(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
if (flag) {
|
||||
this.field_70170_p.func_184148_a((EntityPlayer)null, this.field_70169_q, this.field_70167_r, this.field_70166_s, SoundEvents.field_187534_aX, this.func_184176_by(), 1.0F, 1.0F);
|
||||
this.func_184185_a(SoundEvents.field_187534_aX, 1.0F, 1.0F);
|
||||
@@ -356,7 +358,7 @@
|
||||
public boolean func_75250_a() {
|
||||
if (this.field_179475_a.func_195405_dq() == null) {
|
||||
return false;
|
||||
- } else if (!this.field_179475_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179475_a.field_70170_p, this.field_179475_a)) {
|
||||
return false;
|
||||
} else {
|
||||
return this.field_179475_a.func_70681_au().nextInt(2000) == 0;
|
||||
@@ -395,7 +397,7 @@
|
||||
public boolean func_75250_a() {
|
||||
if (this.field_179473_a.func_195405_dq() != null) {
|
||||
return false;
|
||||
- } else if (!this.field_179473_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179473_a.field_70170_p, this.field_179473_a)) {
|
||||
return false;
|
||||
} else {
|
||||
return this.field_179473_a.func_70681_au().nextInt(20) == 0;
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/monster/EntityEvoker.java
|
||||
+++ b/net/minecraft/entity/monster/EntityEvoker.java
|
||||
@@ -287,7 +287,7 @@
|
||||
return false;
|
||||
} else if (EntityEvoker.this.field_70173_aa < this.field_193322_d) {
|
||||
return false;
|
||||
- } else if (!EntityEvoker.this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(EntityEvoker.this.field_70170_p, EntityEvoker.this)) {
|
||||
return false;
|
||||
} else {
|
||||
List<EntitySheep> list = EntityEvoker.this.field_70170_p.<EntitySheep>func_175647_a(EntitySheep.class, EntityEvoker.this.func_174813_aQ().func_72314_b(16.0D, 4.0D, 16.0D), this.field_190879_a);
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/monster/EntityIronGolem.java
|
||||
+++ b/net/minecraft/entity/monster/EntityIronGolem.java
|
||||
@@ -231,7 +231,7 @@
|
||||
|
||||
public void func_70645_a(DamageSource p_70645_1_) {
|
||||
if (!this.func_70850_q() && this.field_70717_bb != null && this.field_70857_d != null) {
|
||||
- this.field_70857_d.func_82688_a(this.field_70717_bb.func_146103_bH().getName(), -5);
|
||||
+ this.field_70857_d.modifyPlayerReputation(this.field_70717_bb.func_146103_bH().getId(), -5);
|
||||
}
|
||||
|
||||
super.func_70645_a(p_70645_1_);
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/entity/monster/EntityMagmaCube.java
|
||||
+++ b/net/minecraft/entity/monster/EntityMagmaCube.java
|
||||
@@ -77,6 +77,7 @@
|
||||
protected void func_70664_aZ() {
|
||||
this.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F);
|
||||
this.field_70160_al = true;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
|
||||
}
|
||||
|
||||
protected void func_180466_bG(Tag<Fluid> p_180466_1_) {
|
|
@ -0,0 +1,16 @@
|
|||
--- a/net/minecraft/entity/monster/EntityShulker.java
|
||||
+++ b/net/minecraft/entity/monster/EntityShulker.java
|
||||
@@ -338,6 +338,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (flag)
|
||||
+ {
|
||||
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p(), 0);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) flag = false;
|
||||
+ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
+ }
|
||||
+
|
||||
if (flag) {
|
||||
this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F);
|
||||
this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1));
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/entity/monster/EntitySilverfish.java
|
||||
+++ b/net/minecraft/entity/monster/EntitySilverfish.java
|
||||
@@ -144,7 +144,7 @@
|
||||
return false;
|
||||
} else {
|
||||
Random random = this.field_75457_a.func_70681_au();
|
||||
- if (this.field_75457_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing") && random.nextInt(10) == 0) {
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_75457_a.field_70170_p, this.field_75457_a) && random.nextInt(10) == 0) {
|
||||
this.field_179483_b = EnumFacing.func_176741_a(random);
|
||||
BlockPos blockpos = (new BlockPos(this.field_75457_a.field_70165_t, this.field_75457_a.field_70163_u + 0.5D, this.field_75457_a.field_70161_v)).func_177972_a(this.field_179483_b);
|
||||
IBlockState iblockstate = this.field_75457_a.field_70170_p.func_180495_p(blockpos);
|
||||
@@ -213,7 +213,7 @@
|
||||
IBlockState iblockstate = world.func_180495_p(blockpos1);
|
||||
Block block = iblockstate.func_177230_c();
|
||||
if (block instanceof BlockSilverfish) {
|
||||
- if (world.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, field_179464_a)) {
|
||||
world.func_175655_b(blockpos1, true);
|
||||
} else {
|
||||
world.func_180501_a(blockpos1, ((BlockSilverfish)block).func_196468_d().func_176223_P(), 3);
|
|
@ -0,0 +1,32 @@
|
|||
--- a/net/minecraft/entity/monster/EntitySlime.java
|
||||
+++ b/net/minecraft/entity/monster/EntitySlime.java
|
||||
@@ -122,6 +122,7 @@
|
||||
if (this.field_70122_E && !this.field_175452_bi) {
|
||||
int i = this.func_70809_q();
|
||||
|
||||
+ if (spawnCustomParticles()) i = 0; // don't spawn particles if it's handled by the implementation itself
|
||||
for(int j = 0; j < i * 8; ++j) {
|
||||
float f = this.field_70146_Z.nextFloat() * ((float)Math.PI * 2F);
|
||||
float f1 = this.field_70146_Z.nextFloat() * 0.5F + 0.5F;
|
||||
@@ -255,7 +256,7 @@
|
||||
|
||||
public boolean func_205020_a(IWorld p_205020_1_) {
|
||||
BlockPos blockpos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v));
|
||||
- if (p_205020_1_.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1) {
|
||||
+ if (p_205020_1_.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p)) {
|
||||
return false;
|
||||
} else {
|
||||
if (p_205020_1_.func_175659_aa() != EnumDifficulty.PEACEFUL) {
|
||||
@@ -308,6 +309,12 @@
|
||||
return this.func_189101_db() ? SoundEvents.field_189110_fE : SoundEvents.field_187882_fq;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Called when the slime spawns particles on landing, see onUpdate.
|
||||
+ * Return true to prevent the spawning of the default particles.
|
||||
+ */
|
||||
+ protected boolean spawnCustomParticles() { return false; }
|
||||
+
|
||||
static class AISlimeAttack extends EntityAIBase {
|
||||
private final EntitySlime field_179466_a;
|
||||
private int field_179465_b;
|
|
@ -0,0 +1,40 @@
|
|||
--- a/net/minecraft/entity/monster/EntitySnowman.java
|
||||
+++ b/net/minecraft/entity/monster/EntitySnowman.java
|
||||
@@ -31,7 +31,7 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
|
||||
-public class EntitySnowman extends EntityGolem implements IRangedAttackMob {
|
||||
+public class EntitySnowman extends EntityGolem implements IRangedAttackMob, net.minecraftforge.common.IShearable {
|
||||
private static final DataParameter<Byte> field_184749_a = EntityDataManager.<Byte>func_187226_a(EntitySnowman.class, DataSerializers.field_187191_a);
|
||||
|
||||
public EntitySnowman(World p_i1692_1_) {
|
||||
@@ -85,7 +85,7 @@
|
||||
this.func_70097_a(DamageSource.field_76370_b, 1.0F);
|
||||
}
|
||||
|
||||
- if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
protected boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_) {
|
||||
ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_);
|
||||
- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) {
|
||||
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) { //Forge: Moved to onSheared
|
||||
this.func_184747_a(false);
|
||||
itemstack.func_77972_a(1, p_184645_1_);
|
||||
}
|
||||
@@ -166,4 +166,10 @@
|
||||
|
||||
public void func_184724_a(boolean p_184724_1_) {
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
|
||||
+ this.func_184747_a(false);
|
||||
+ return new java.util.ArrayList<>();
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
--- a/net/minecraft/entity/monster/EntityZombie.java
|
||||
+++ b/net/minecraft/entity/monster/EntityZombie.java
|
||||
@@ -109,7 +109,7 @@
|
||||
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a((double)0.23F);
|
||||
this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D);
|
||||
this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(2.0D);
|
||||
- this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * (double)0.1F);
|
||||
+ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeConfig.GENERAL.zombieBaseSummonChance());
|
||||
}
|
||||
|
||||
protected void func_70088_a() {
|
||||
@@ -285,20 +285,25 @@
|
||||
entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g();
|
||||
}
|
||||
|
||||
- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) {
|
||||
int i = MathHelper.func_76128_c(this.field_70165_t);
|
||||
int j = MathHelper.func_76128_c(this.field_70163_u);
|
||||
int k = MathHelper.func_76128_c(this.field_70161_v);
|
||||
- EntityZombie entityzombie = new EntityZombie(this.field_70170_p);
|
||||
+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e());
|
||||
+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
|
||||
|
||||
+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ||
|
||||
+ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) {
|
||||
+ EntityZombie entityzombie = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : new EntityZombie(this.field_70170_p);
|
||||
+
|
||||
for(int l = 0; l < 50; ++l) {
|
||||
int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
|
||||
int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
|
||||
int k1 = k + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
|
||||
- if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.field_70170_p.func_201696_r(new BlockPos(i1, j1, k1)) < 10) {
|
||||
+ if (this.field_70170_p.func_195595_w(new BlockPos(i1, j1 - 1, k1)) && this.field_70170_p.func_201696_r(new BlockPos(i1, j1, k1)) < 10) {
|
||||
entityzombie.func_70107_b((double)i1, (double)j1, (double)k1);
|
||||
if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_195587_c(entityzombie, entityzombie.func_174813_aQ()) && this.field_70170_p.func_195586_b(entityzombie, entityzombie.func_174813_aQ()) && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) {
|
||||
this.field_70170_p.func_72838_d(entityzombie);
|
||||
+ if (entitylivingbase != null)
|
||||
entityzombie.func_70624_b(entitylivingbase);
|
||||
entityzombie.func_204210_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null, (NBTTagCompound)null);
|
||||
this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", (double)-0.05F, 0));
|
||||
@@ -406,7 +411,7 @@
|
||||
entityzombievillager.func_82149_j(entityvillager);
|
||||
this.field_70170_p.func_72900_e(entityvillager);
|
||||
entityzombievillager.func_204210_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombievillager)), new EntityZombie.GroupData(false), (NBTTagCompound)null);
|
||||
- entityzombievillager.func_190733_a(entityvillager.func_70946_n());
|
||||
+ entityzombievillager.setProfession(entityvillager.getProfessionForge());
|
||||
entityzombievillager.func_82227_f(entityvillager.func_70631_g_());
|
||||
entityzombievillager.func_94061_f(entityvillager.func_175446_cd());
|
||||
if (entityvillager.func_145818_k_()) {
|
||||
@@ -439,7 +444,7 @@
|
||||
float f = p_204210_1_.func_180170_c();
|
||||
this.func_98053_h(this.field_70146_Z.nextFloat() < 0.55F * f);
|
||||
if (p_204210_2_ == null) {
|
||||
- p_204210_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F);
|
||||
+ p_204210_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < net.minecraftforge.common.ForgeConfig.GENERAL.zombieBabyChance());
|
||||
}
|
||||
|
||||
if (p_204210_2_ instanceof EntityZombie.GroupData) {
|
|
@ -16,7 +16,7 @@
|
|||
public void func_70014_b(NBTTagCompound p_70014_1_) {
|
||||
super.func_70014_b(p_70014_1_);
|
||||
p_70014_1_.func_74768_a("Profession", this.func_190736_dl());
|
||||
+ p_70014_1_.func_74778_a("ProfessionName", this.getForgeProfession().getRegistryName().toString());
|
||||
+ p_70014_1_.func_74778_a("ProfessionName", this.getProfessionForge().getRegistryName().toString());
|
||||
p_70014_1_.func_74768_a("ConversionTime", this.func_82230_o() ? this.field_82234_d : -1);
|
||||
if (this.field_191992_by != null) {
|
||||
p_70014_1_.func_186854_a("ConversionPlayer", this.field_191992_by);
|
||||
|
@ -27,7 +27,7 @@
|
|||
+ if (p_70037_1_.func_74764_b("ProfessionName")) {
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName")));
|
||||
+ if (p == null) p = net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?"));
|
||||
+ this.setForgeProfession(p);
|
||||
+ this.setProfession(p);
|
||||
+ }
|
||||
if (p_70037_1_.func_150297_b("ConversionTime", 99) && p_70037_1_.func_74762_e("ConversionTime") > -1) {
|
||||
this.func_191991_a(p_70037_1_.func_186855_b("ConversionPlayer") ? p_70037_1_.func_186857_a("ConversionPlayer") : null, p_70037_1_.func_74762_e("ConversionTime"));
|
||||
|
@ -37,29 +37,24 @@
|
|||
EntityVillager entityvillager = new EntityVillager(this.field_70170_p);
|
||||
entityvillager.func_82149_j(this);
|
||||
- entityvillager.func_70938_b(this.func_190736_dl());
|
||||
+ entityvillager.setProfession(this.getForgeProfession());
|
||||
+ entityvillager.setProfession(this.getProfessionForge());
|
||||
entityvillager.func_190672_a(this.field_70170_p.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, (NBTTagCompound)null, false);
|
||||
entityvillager.func_82187_q();
|
||||
if (this.func_70631_g_()) {
|
||||
@@ -224,4 +232,37 @@
|
||||
@@ -224,4 +232,28 @@
|
||||
protected ItemStack func_190732_dj() {
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+
|
||||
+ @Nullable
|
||||
+ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof;
|
||||
+ public void setForgeProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof)
|
||||
+ {
|
||||
+ public void setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) {
|
||||
+ this.prof = prof;
|
||||
+ this.func_190733_a(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getForgeProfession()
|
||||
+ {
|
||||
+ if (this.prof == null)
|
||||
+ {
|
||||
+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge() {
|
||||
+ if (this.prof == null) {
|
||||
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_190736_dl());
|
||||
+ if (this.prof == null)
|
||||
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?"));
|
||||
|
@ -68,14 +63,10 @@
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void func_184206_a(DataParameter<?> key)
|
||||
+ {
|
||||
+ public void func_184206_a(DataParameter<?> key) {
|
||||
+ super.func_184206_a(key);
|
||||
+ if (key.equals(field_190739_c))
|
||||
+ {
|
||||
+ if (key.equals(field_190739_c)) {
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_190739_c));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* ======================================== FORGE END =====================================*/
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
--- a/net/minecraft/entity/passive/AbstractHorse.java
|
||||
+++ b/net/minecraft/entity/passive/AbstractHorse.java
|
||||
@@ -264,6 +264,7 @@
|
||||
|
||||
this.field_110296_bG.func_110134_a(this);
|
||||
this.func_110232_cE();
|
||||
+ this.itemHandler = net.minecraftforge.common.capabilities.OptionalCapabilityInstance.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG));
|
||||
}
|
||||
|
||||
protected void func_110232_cE() {
|
||||
@@ -960,4 +961,13 @@
|
||||
|
||||
return p_204210_2_;
|
||||
}
|
||||
+
|
||||
+ private net.minecraftforge.common.capabilities.OptionalCapabilityInstance<?> itemHandler = null;
|
||||
+
|
||||
+ @Override
|
||||
+ public <T> net.minecraftforge.common.capabilities.OptionalCapabilityInstance<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing) {
|
||||
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null)
|
||||
+ return itemHandler.cast();
|
||||
+ return super.getCapability(capability, facing);
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
--- a/net/minecraft/entity/passive/EntityHorse.java
|
||||
+++ b/net/minecraft/entity/passive/EntityHorse.java
|
||||
@@ -32,6 +32,7 @@
|
||||
private static final UUID field_184786_bD = UUID.fromString("556E1665-8B10-40C8-8F9D-CF9B1667F295");
|
||||
private static final DataParameter<Integer> field_184789_bG = EntityDataManager.<Integer>func_187226_a(EntityHorse.class, DataSerializers.field_187192_b);
|
||||
private static final DataParameter<Integer> field_184791_bI = EntityDataManager.<Integer>func_187226_a(EntityHorse.class, DataSerializers.field_187192_b);
|
||||
+ private static final DataParameter<ItemStack> HORSE_ARMOR_STACK = EntityDataManager.<ItemStack>func_187226_a(EntityHorse.class, DataSerializers.field_187196_f);
|
||||
private static final String[] field_110268_bz = new String[]{"textures/entity/horse/horse_white.png", "textures/entity/horse/horse_creamy.png", "textures/entity/horse/horse_chestnut.png", "textures/entity/horse/horse_brown.png", "textures/entity/horse/horse_black.png", "textures/entity/horse/horse_gray.png", "textures/entity/horse/horse_darkbrown.png"};
|
||||
private static final String[] field_110269_bA = new String[]{"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"};
|
||||
private static final String[] field_110291_bB = new String[]{null, "textures/entity/horse/horse_markings_white.png", "textures/entity/horse/horse_markings_whitefield.png", "textures/entity/horse/horse_markings_whitedots.png", "textures/entity/horse/horse_markings_blackdots.png"};
|
||||
@@ -47,6 +48,7 @@
|
||||
super.func_70088_a();
|
||||
this.field_70180_af.func_187214_a(field_184789_bG, 0);
|
||||
this.field_70180_af.func_187214_a(field_184791_bI, HorseArmorType.NONE.func_188579_a());
|
||||
+ this.field_70180_af.func_187214_a(HORSE_ARMOR_STACK, ItemStack.field_190927_a);
|
||||
}
|
||||
|
||||
public void func_70014_b(NBTTagCompound p_70014_1_) {
|
||||
@@ -63,7 +65,7 @@
|
||||
this.func_110235_q(p_70037_1_.func_74762_e("Variant"));
|
||||
if (p_70037_1_.func_150297_b("ArmorItem", 10)) {
|
||||
ItemStack itemstack = ItemStack.func_199557_a(p_70037_1_.func_74775_l("ArmorItem"));
|
||||
- if (!itemstack.func_190926_b() && HorseArmorType.func_188577_b(itemstack.func_77973_b())) {
|
||||
+ if (!itemstack.func_190926_b() && func_190682_f(itemstack)) {
|
||||
this.field_110296_bG.func_70299_a(1, itemstack);
|
||||
}
|
||||
}
|
||||
@@ -122,6 +124,7 @@
|
||||
public void func_146086_d(ItemStack p_146086_1_) {
|
||||
HorseArmorType horsearmortype = HorseArmorType.func_188580_a(p_146086_1_);
|
||||
this.field_70180_af.func_187227_b(field_184791_bI, horsearmortype.func_188579_a());
|
||||
+ this.field_70180_af.func_187227_b(HORSE_ARMOR_STACK, p_146086_1_);
|
||||
this.func_110230_cF();
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_188479_b(field_184786_bD);
|
||||
@@ -134,6 +137,8 @@
|
||||
}
|
||||
|
||||
public HorseArmorType func_184783_dl() {
|
||||
+ ItemStack stack = this.field_70180_af.func_187225_a(HORSE_ARMOR_STACK);
|
||||
+ if (!stack.func_190926_b()) return stack.getHorseArmorType();
|
||||
return HorseArmorType.func_188575_a(this.field_70180_af.func_187225_a(field_184791_bI));
|
||||
}
|
||||
|
||||
@@ -168,7 +173,8 @@
|
||||
this.field_70180_af.func_187230_e();
|
||||
this.func_110230_cF();
|
||||
}
|
||||
-
|
||||
+ ItemStack stack = this.field_110296_bG.func_70301_a(1);
|
||||
+ if (func_190682_f(stack)) stack.onHorseArmorTick(field_70170_p, this);
|
||||
}
|
||||
|
||||
protected SoundEvent func_184639_G() {
|
||||
@@ -295,7 +301,7 @@
|
||||
}
|
||||
|
||||
public boolean func_190682_f(ItemStack p_190682_1_) {
|
||||
- return HorseArmorType.func_188577_b(p_190682_1_.func_77973_b());
|
||||
+ return HorseArmorType.isHorseArmor(p_190682_1_);
|
||||
}
|
||||
|
||||
@Nullable
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/passive/EntityRabbit.java
|
||||
+++ b/net/minecraft/entity/passive/EntityRabbit.java
|
||||
@@ -438,7 +438,7 @@
|
||||
|
||||
public boolean func_75250_a() {
|
||||
if (this.field_179496_a <= 0) {
|
||||
- if (!this.field_179500_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179500_c.field_70170_p, this.field_179500_c)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/passive/EntityWolf.java
|
||||
+++ b/net/minecraft/entity/passive/EntityWolf.java
|
||||
@@ -340,7 +340,7 @@
|
||||
}
|
||||
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
- if (this.field_70146_Z.nextInt(3) == 0) {
|
||||
+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) {
|
||||
this.func_193101_c(p_184645_1_);
|
||||
this.field_70699_by.func_75499_g();
|
||||
this.func_70624_b((EntityLivingBase)null);
|
|
@ -0,0 +1,67 @@
|
|||
--- a/net/minecraft/entity/passive/HorseArmorType.java
|
||||
+++ b/net/minecraft/entity/passive/HorseArmorType.java
|
||||
@@ -16,6 +16,7 @@
|
||||
private final String field_188586_e;
|
||||
private final String field_188587_f;
|
||||
private final int field_188588_g;
|
||||
+ private Item item;
|
||||
|
||||
private HorseArmorType(int p_i46799_3_) {
|
||||
this.field_188588_g = p_i46799_3_;
|
||||
@@ -29,6 +30,15 @@
|
||||
this.field_188587_f = p_i46800_5_;
|
||||
}
|
||||
|
||||
+ private HorseArmorType(int strength, String texture, String hash, Item item) {
|
||||
+ this(strength, texture, hash);
|
||||
+ this.item = item;
|
||||
+ }
|
||||
+
|
||||
+ public static HorseArmorType create(String name, int strength, String texture, String hash, Item item) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
public int func_188579_a() {
|
||||
return this.ordinal();
|
||||
}
|
||||
@@ -48,25 +58,38 @@
|
||||
return this.field_188586_e;
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use by name, or ItemStack, ordinals for modded ones are not guaranteed to be in the same order each run.
|
||||
public static HorseArmorType func_188575_a(int p_188575_0_) {
|
||||
return values()[p_188575_0_];
|
||||
}
|
||||
|
||||
public static HorseArmorType func_188580_a(ItemStack p_188580_0_) {
|
||||
- return p_188580_0_.func_190926_b() ? NONE : func_188576_a(p_188580_0_.func_77973_b());
|
||||
+ return p_188580_0_.func_190926_b() ? NONE : p_188580_0_.getHorseArmorType();
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use ItemStack.getHorseArmorType
|
||||
public static HorseArmorType func_188576_a(Item p_188576_0_) {
|
||||
if (p_188576_0_ == Items.field_151138_bX) {
|
||||
return IRON;
|
||||
} else if (p_188576_0_ == Items.field_151136_bY) {
|
||||
return GOLD;
|
||||
+ } else if (p_188576_0_ == Items.field_151125_bZ) {
|
||||
+ return DIAMOND;
|
||||
} else {
|
||||
- return p_188576_0_ == Items.field_151125_bZ ? DIAMOND : NONE;
|
||||
+ for (HorseArmorType type : values()) {
|
||||
+ if (type.item != null && type.item.delegate.get() == p_188576_0_.delegate.get())
|
||||
+ return type;
|
||||
+ }
|
||||
+ return NONE;
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use ItemStack version
|
||||
public static boolean func_188577_b(Item p_188577_0_) {
|
||||
return func_188576_a(p_188577_0_) != NONE;
|
||||
}
|
||||
+
|
||||
+ public static boolean isHorseArmor(ItemStack stack) {
|
||||
+ return stack.getHorseArmorType() != NONE;
|
||||
+ }
|
||||
}
|
|
@ -17,6 +17,15 @@
|
|||
}
|
||||
|
||||
protected void func_70088_a() {
|
||||
@@ -433,7 +436,7 @@
|
||||
this.field_71107_bF = this.field_71109_bG;
|
||||
this.field_71109_bG = 0.0F;
|
||||
this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2);
|
||||
- if (this.func_184187_bx() instanceof EntityPig) {
|
||||
+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_184187_bx()).shouldRiderFaceForward(this)) {
|
||||
this.field_70125_A = f1;
|
||||
this.field_70177_z = f;
|
||||
this.field_70761_aq = ((EntityPig)this.func_184187_bx()).field_70761_aq;
|
||||
@@ -663,7 +666,12 @@
|
||||
return p_184816_1_.func_92059_d();
|
||||
}
|
||||
|
@ -38,3 +47,21 @@
|
|||
return f;
|
||||
}
|
||||
|
||||
@@ -823,7 +832,7 @@
|
||||
|
||||
protected void func_190629_c(EntityLivingBase p_190629_1_) {
|
||||
super.func_190629_c(p_190629_1_);
|
||||
- if (p_190629_1_.func_184614_ca().func_77973_b() instanceof ItemAxe) {
|
||||
+ if (p_190629_1_.func_184614_ca().canDisableShield(this.field_184627_bm, this, p_190629_1_)) {
|
||||
this.func_190777_m(true);
|
||||
}
|
||||
|
||||
@@ -844,7 +853,7 @@
|
||||
}
|
||||
|
||||
protected void func_184590_k(float p_184590_1_) {
|
||||
- if (p_184590_1_ >= 3.0F && this.field_184627_bm.func_77973_b() == Items.field_185159_cQ) {
|
||||
+ if (p_184590_1_ >= 3.0F && this.field_184627_bm.isShield(this)) {
|
||||
int i = 1 + MathHelper.func_76141_d(p_184590_1_);
|
||||
this.field_184627_bm.func_77972_a(i, this);
|
||||
if (this.field_184627_bm.func_190926_b()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/item/ItemMap.java
|
||||
+++ b/net/minecraft/item/ItemMap.java
|
||||
@@ -41,7 +41,7 @@
|
||||
@@ -41,20 +41,26 @@
|
||||
|
||||
public static ItemStack func_195952_a(World p_195952_0_, int p_195952_1_, int p_195952_2_, byte p_195952_3_, boolean p_195952_4_, boolean p_195952_5_) {
|
||||
ItemStack itemstack = new ItemStack(Items.field_151098_aY);
|
||||
|
@ -9,7 +9,8 @@
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
+ @Deprecated //Forge: Use instance version below
|
||||
@Nullable
|
||||
public static MapData func_195950_a(ItemStack p_195950_0_, World p_195950_1_) {
|
||||
MapData mapdata = func_195953_a(p_195950_1_, "map_" + func_195949_f(p_195950_0_));
|
||||
if (mapdata == null && !p_195950_1_.field_72995_K) {
|
||||
|
@ -18,7 +19,17 @@
|
|||
}
|
||||
|
||||
return mapdata;
|
||||
@@ -75,7 +75,7 @@
|
||||
}
|
||||
|
||||
+ @Nullable //Forge: Item instance override version instead of static.
|
||||
+ public MapData getMapDataOverride(ItemStack stack, World world) {
|
||||
+ return ItemMap.func_195950_a(stack, world);
|
||||
+ }
|
||||
+
|
||||
public static int func_195949_f(ItemStack p_195949_0_) {
|
||||
NBTTagCompound nbttagcompound = p_195949_0_.func_77978_p();
|
||||
return nbttagcompound != null && nbttagcompound.func_150297_b("map", 99) ? nbttagcompound.func_74762_e("map") : 0;
|
||||
@@ -75,7 +81,7 @@
|
||||
}
|
||||
|
||||
public void func_77872_a(World p_77872_1_, Entity p_77872_2_, MapData p_77872_3_) {
|
||||
|
@ -27,7 +38,7 @@
|
|||
int i = 1 << p_77872_3_.field_76197_d;
|
||||
int j = p_77872_3_.field_76201_a;
|
||||
int k = p_77872_3_.field_76199_b;
|
||||
@@ -215,7 +215,7 @@
|
||||
@@ -215,7 +221,7 @@
|
||||
public static void func_190905_a(World p_190905_0_, ItemStack p_190905_1_) {
|
||||
MapData mapdata = func_195950_a(p_190905_1_, p_190905_0_);
|
||||
if (mapdata != null) {
|
||||
|
|
|
@ -35,6 +35,15 @@
|
|||
}
|
||||
|
||||
public Chunk func_175726_f(BlockPos p_175726_1_) {
|
||||
@@ -1495,7 +1498,7 @@
|
||||
}
|
||||
|
||||
public boolean func_195595_w(BlockPos p_195595_1_) {
|
||||
- return this.func_195588_v(p_195595_1_) && this.func_180495_p(p_195595_1_).func_185896_q();
|
||||
+ return this.func_195588_v(p_195595_1_) && this.func_180495_p(p_195595_1_).isTopSolid(this, p_195595_1_);
|
||||
}
|
||||
|
||||
public void func_72966_v() {
|
||||
@@ -2397,4 +2400,31 @@
|
||||
public abstract RecipeManager func_199532_z();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
this.field_77133_f = p_i49778_2_;
|
||||
this.field_211890_l = p_i49778_3_;
|
||||
this.field_77134_g = p_i49778_4_;
|
||||
@@ -117,4 +118,22 @@
|
||||
@@ -117,4 +118,26 @@
|
||||
this.field_151361_l = true;
|
||||
return this;
|
||||
}
|
||||
|
@ -29,5 +29,9 @@
|
|||
+ mc.func_147108_a(new net.minecraft.client.gui.GuiCreateFlatWorld(gui, gui.field_146334_a));
|
||||
+ else if (this == WorldType.field_180271_f)
|
||||
+ mc.func_147108_a(new net.minecraft.client.gui.GuiCreateBuffetWorld(gui, gui.field_146334_a));
|
||||
+ }
|
||||
+
|
||||
+ public boolean handleSlimeSpawnReduction(java.util.Random random, World world) {
|
||||
+ return this == field_77138_c ? random.nextInt(4) != 1 : false;
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java
|
||||
@@ -38,7 +38,7 @@
|
||||
{
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
- Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.func_82594_a(ItemMonsterPlacer.func_190908_h(itemstack));
|
||||
+ Class <? extends Entity > oclass = EntityList.getClass(ItemMonsterPlacer.func_190908_h(itemstack));
|
||||
|
||||
if (oclass != null && this.getClass() == oclass)
|
||||
{
|
||||
@@ -79,7 +79,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.func_82594_a(ItemMonsterPlacer.func_190908_h(p_190669_1_));
|
||||
+ Class <? extends Entity > oclass = EntityList.getClass(ItemMonsterPlacer.func_190908_h(p_190669_1_));
|
||||
return oclass != null && p_190669_2_ == oclass;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityFlying.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityFlying.java
|
||||
@@ -44,7 +44,9 @@
|
||||
|
||||
if (this.field_70122_E)
|
||||
{
|
||||
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F;
|
||||
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
|
||||
+ IBlockState underState = this.field_70170_p.func_180495_p(underPos);
|
||||
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F;
|
||||
}
|
||||
|
||||
float f1 = 0.16277136F / (f * f * f);
|
||||
@@ -53,7 +55,9 @@
|
||||
|
||||
if (this.field_70122_E)
|
||||
{
|
||||
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F;
|
||||
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
|
||||
+ IBlockState underState = this.field_70170_p.func_180495_p(underPos);
|
||||
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F;
|
||||
}
|
||||
|
||||
this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y);
|
|
@ -1,12 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java
|
||||
@@ -144,6 +144,9 @@
|
||||
blockpos$mutableblockpos.func_189533_g(blockpos).func_189534_c(enumfacing, k + i1).func_189534_c(EnumFacing.UP, l + j1);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos$mutableblockpos);
|
||||
|
||||
+ if (iblockstate.isSideSolid(this.field_70170_p, blockpos$mutableblockpos, this.field_174860_b))
|
||||
+ continue;
|
||||
+
|
||||
if (!iblockstate.func_185904_a().func_76220_a() && !BlockRedstoneDiode.func_185546_B(iblockstate))
|
||||
{
|
||||
return false;
|
|
@ -1,71 +1,5 @@
|
|||
--- ../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 <? extends EntityLivingBase > 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,
|
||||
|
|
|
@ -1,461 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java
|
||||
@@ -82,6 +82,7 @@
|
||||
private static final Logger field_190632_a = LogManager.getLogger();
|
||||
private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
||||
private static final AttributeModifier field_110157_c = (new AttributeModifier(field_110156_b, "Sprinting speed boost", 0.30000001192092896D, 2)).func_111168_a(false);
|
||||
+ public static final net.minecraft.entity.ai.attributes.IAttribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_111112_a(true);
|
||||
protected static final DataParameter<Byte> field_184621_as = EntityDataManager.<Byte>func_187226_a(EntityLivingBase.class, DataSerializers.field_187191_a);
|
||||
private static final DataParameter<Float> field_184632_c = EntityDataManager.<Float>func_187226_a(EntityLivingBase.class, DataSerializers.field_187193_c);
|
||||
private static final DataParameter<Integer> field_184633_f = EntityDataManager.<Integer>func_187226_a(EntityLivingBase.class, DataSerializers.field_187192_b);
|
||||
@@ -188,6 +189,7 @@
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111263_d);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188791_g);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_189429_h);
|
||||
+ this.func_110140_aT().func_111150_b(SWIM_SPEED);
|
||||
}
|
||||
|
||||
protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, IBlockState p_184231_4_, BlockPos p_184231_5_)
|
||||
@@ -201,10 +203,11 @@
|
||||
{
|
||||
float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F);
|
||||
|
||||
- if (p_184231_4_.func_185904_a() != Material.field_151579_a)
|
||||
+ if (!p_184231_4_.func_177230_c().isAir(p_184231_4_, field_70170_p, p_184231_5_))
|
||||
{
|
||||
double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int)(150.0D * d0);
|
||||
+ if (!p_184231_4_.func_177230_c().addLandingEffects(p_184231_4_, (WorldServer)this.field_70170_p, p_184231_5_, p_184231_4_, this, i))
|
||||
((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.BLOCK_DUST, this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.func_176210_f(p_184231_4_));
|
||||
}
|
||||
}
|
||||
@@ -281,7 +284,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() instanceof EntityLivingBase)
|
||||
+ if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && this.func_184187_bx().shouldDismountInWater(this))
|
||||
{
|
||||
this.func_184210_p();
|
||||
}
|
||||
@@ -380,7 +383,7 @@
|
||||
if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")))
|
||||
{
|
||||
int i = this.func_70693_a(this.field_70717_bb);
|
||||
-
|
||||
+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i);
|
||||
while (i > 0)
|
||||
{
|
||||
int j = EntityXPOrb.func_70527_a(i);
|
||||
@@ -442,6 +445,7 @@
|
||||
{
|
||||
this.field_70755_b = p_70604_1_;
|
||||
this.field_70756_c = this.field_70173_aa;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70604_1_);
|
||||
}
|
||||
|
||||
public EntityLivingBase func_110144_aD()
|
||||
@@ -670,8 +674,10 @@
|
||||
else
|
||||
{
|
||||
Collection<PotionEffect> collection = this.field_70713_bf.values();
|
||||
- this.field_70180_af.func_187227_b(field_184634_g, Boolean.valueOf(func_184593_a(collection)));
|
||||
- this.field_70180_af.func_187227_b(field_184633_f, Integer.valueOf(PotionUtils.func_185181_a(collection)));
|
||||
+ net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.func_185181_a(collection), func_184593_a(collection), collection);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
|
||||
+ this.field_70180_af.func_187227_b(field_184634_g, event.areParticlesHidden());
|
||||
+ this.field_70180_af.func_187227_b(field_184633_f, event.getColor());
|
||||
this.func_82142_c(this.func_70644_a(MobEffects.field_76441_p));
|
||||
}
|
||||
}
|
||||
@@ -819,6 +825,8 @@
|
||||
|
||||
public void func_70691_i(float p_70691_1_)
|
||||
{
|
||||
+ p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_);
|
||||
+ if (p_70691_1_ <= 0) return;
|
||||
float f = this.func_110143_aJ();
|
||||
|
||||
if (f > 0.0F)
|
||||
@@ -839,6 +847,7 @@
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_)
|
||||
{
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false;
|
||||
if (this.func_180431_b(p_70097_1_))
|
||||
{
|
||||
return false;
|
||||
@@ -927,9 +936,9 @@
|
||||
this.field_70718_bc = 100;
|
||||
this.field_70717_bb = (EntityPlayer)entity1;
|
||||
}
|
||||
- else if (entity1 instanceof EntityWolf)
|
||||
+ else if (entity1 instanceof net.minecraft.entity.passive.EntityTameable)
|
||||
{
|
||||
- EntityWolf entitywolf = (EntityWolf)entity1;
|
||||
+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity1;
|
||||
|
||||
if (entitywolf.func_70909_n())
|
||||
{
|
||||
@@ -1127,7 +1136,7 @@
|
||||
|
||||
public void func_70669_a(ItemStack p_70669_1_)
|
||||
{
|
||||
- this.func_184185_a(SoundEvents.field_187635_cQ, 0.8F, 0.8F + this.field_70170_p.field_73012_v.nextFloat() * 0.4F);
|
||||
+ this.field_70170_p.func_184148_a(null, this.field_70165_t, this.field_70163_u, this.field_70161_v, SoundEvents.field_187635_cQ, this.func_184176_by(), 0.8F, 0.8F + this.field_70170_p.field_73012_v.nextFloat() * 0.4F); //Forge: Fix MC-2518 Items are not damaged on the client so client needs packet as well.
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
@@ -1139,12 +1148,17 @@
|
||||
vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * 0.017453292F);
|
||||
vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * 0.017453292F);
|
||||
vec3d1 = vec3d1.func_72441_c(this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v);
|
||||
- this.field_70170_p.func_175688_a(EnumParticleTypes.ITEM_CRACK, vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, Item.func_150891_b(p_70669_1_.func_77973_b()));
|
||||
+ if (this.field_70170_p instanceof WorldServer) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant
|
||||
+ ((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.ITEM_CRACK, vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, 0, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, 0.0D, Item.func_150891_b(p_70669_1_.func_77973_b()), p_70669_1_.func_77960_j());
|
||||
+ else //Fix the fact that spawning ItemCrack uses TWO arguments.
|
||||
+ this.field_70170_p.func_175688_a(EnumParticleTypes.ITEM_CRACK, vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, Item.func_150891_b(p_70669_1_.func_77973_b()), p_70669_1_.func_77960_j());
|
||||
+
|
||||
}
|
||||
}
|
||||
|
||||
public void func_70645_a(DamageSource p_70645_1_)
|
||||
{
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
|
||||
if (!this.field_70729_aU)
|
||||
{
|
||||
Entity entity = p_70645_1_.func_76346_g();
|
||||
@@ -1165,18 +1179,26 @@
|
||||
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
- int i = 0;
|
||||
+ int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_70645_1_);
|
||||
|
||||
- if (entity instanceof EntityPlayer)
|
||||
- {
|
||||
- i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity);
|
||||
- }
|
||||
+ captureDrops = true;
|
||||
+ capturedDrops.clear();
|
||||
|
||||
if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot"))
|
||||
{
|
||||
boolean flag = this.field_70718_bc > 0;
|
||||
this.func_184610_a(flag, i, p_70645_1_);
|
||||
}
|
||||
+
|
||||
+ captureDrops = false;
|
||||
+
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0))
|
||||
+ {
|
||||
+ for (EntityItem item : capturedDrops)
|
||||
+ {
|
||||
+ field_70170_p.func_72838_d(item);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
this.field_70170_p.func_72960_a(this, (byte)3);
|
||||
@@ -1195,6 +1217,9 @@
|
||||
|
||||
public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_)
|
||||
{
|
||||
+ net.minecraftforge.event.entity.living.LivingKnockBackEvent event = net.minecraftforge.common.ForgeHooks.onLivingKnockBack(this, p_70653_1_, p_70653_2_, p_70653_3_, p_70653_5_);
|
||||
+ if(event.isCanceled()) return;
|
||||
+ p_70653_2_ = event.getStrength(); p_70653_3_ = event.getRatioX(); p_70653_5_ = event.getRatioZ();
|
||||
if (this.field_70146_Z.nextDouble() >= this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())
|
||||
{
|
||||
this.field_70160_al = true;
|
||||
@@ -1253,15 +1278,7 @@
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
Block block = iblockstate.func_177230_c();
|
||||
-
|
||||
- if (block != Blocks.field_150468_ap && block != Blocks.field_150395_bd)
|
||||
- {
|
||||
- return block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- return true;
|
||||
- }
|
||||
+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, field_70170_p, new BlockPos(i, j, k), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1287,6 +1304,9 @@
|
||||
|
||||
public void func_180430_e(float p_180430_1_, float p_180430_2_)
|
||||
{
|
||||
+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_180430_1_, p_180430_2_);
|
||||
+ if (ret == null) return;
|
||||
+ p_180430_1_ = ret[0]; p_180430_2_ = ret[1];
|
||||
super.func_180430_e(p_180430_1_, p_180430_2_);
|
||||
PotionEffect potioneffect = this.func_70660_b(MobEffects.field_76430_j);
|
||||
float f = potioneffect == null ? 0.0F : (float)(potioneffect.func_76458_c() + 1);
|
||||
@@ -1303,7 +1323,7 @@
|
||||
|
||||
if (iblockstate.func_185904_a() != Material.field_151579_a)
|
||||
{
|
||||
- SoundType soundtype = iblockstate.func_177230_c().func_185467_w();
|
||||
+ SoundType soundtype = iblockstate.func_177230_c().getSoundType(iblockstate, field_70170_p, new BlockPos(j, k, l), this);
|
||||
this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
|
||||
}
|
||||
}
|
||||
@@ -1380,17 +1400,20 @@
|
||||
{
|
||||
if (!this.func_180431_b(p_70665_1_))
|
||||
{
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
|
||||
+ if (p_70665_2_ <= 0) return;
|
||||
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
|
||||
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
|
||||
float f = p_70665_2_;
|
||||
p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
|
||||
this.func_110149_m(this.func_110139_bj() - (f - p_70665_2_));
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_);
|
||||
|
||||
if (p_70665_2_ != 0.0F)
|
||||
{
|
||||
float f1 = this.func_110143_aJ();
|
||||
- this.func_70606_j(f1 - p_70665_2_);
|
||||
this.func_110142_aN().func_94547_a(p_70665_1_, f1, p_70665_2_);
|
||||
+ this.func_70606_j(f1 - p_70665_2_); // Forge: moved to fix MC-121048
|
||||
this.func_110149_m(this.func_110139_bj() - p_70665_2_);
|
||||
}
|
||||
}
|
||||
@@ -1447,6 +1470,11 @@
|
||||
|
||||
public void func_184609_a(EnumHand p_184609_1_)
|
||||
{
|
||||
+ ItemStack stack = this.func_184586_b(p_184609_1_);
|
||||
+ if (!stack.func_190926_b())
|
||||
+ {
|
||||
+ if (stack.func_77973_b().onEntitySwing(this, stack)) return;
|
||||
+ }
|
||||
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0)
|
||||
{
|
||||
this.field_110158_av = -1;
|
||||
@@ -1694,7 +1722,7 @@
|
||||
|
||||
if (!this.field_70170_p.func_184143_b(axisalignedbb1))
|
||||
{
|
||||
- if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).func_185896_q())
|
||||
+ if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).isSideSolid(field_70170_p, new BlockPos(d11, this.field_70163_u, d12), EnumFacing.UP))
|
||||
{
|
||||
this.func_70634_a(d11, this.field_70163_u + 1.0D, d12);
|
||||
return;
|
||||
@@ -1702,14 +1730,14 @@
|
||||
|
||||
BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12);
|
||||
|
||||
- if (this.field_70170_p.func_180495_p(blockpos).func_185896_q() || this.field_70170_p.func_180495_p(blockpos).func_185904_a() == Material.field_151586_h)
|
||||
+ if (this.field_70170_p.func_180495_p(blockpos).isSideSolid(field_70170_p, blockpos, EnumFacing.UP) || this.field_70170_p.func_180495_p(blockpos).func_185904_a() == Material.field_151586_h)
|
||||
{
|
||||
d1 = d11;
|
||||
d13 = this.field_70163_u + 1.0D;
|
||||
d14 = d12;
|
||||
}
|
||||
}
|
||||
- else if (!this.field_70170_p.func_184143_b(axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).func_185896_q())
|
||||
+ else if (!this.field_70170_p.func_184143_b(axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).isSideSolid(field_70170_p, new BlockPos(d11, this.field_70163_u + 1.0D, d12), EnumFacing.UP))
|
||||
{
|
||||
d1 = d11;
|
||||
d13 = this.field_70163_u + 2.0D;
|
||||
@@ -1781,16 +1809,17 @@
|
||||
}
|
||||
|
||||
this.field_70160_al = true;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
|
||||
}
|
||||
|
||||
protected void func_70629_bd()
|
||||
{
|
||||
- this.field_70181_x += 0.03999999910593033D;
|
||||
+ this.field_70181_x += 0.03999999910593033D * this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
}
|
||||
|
||||
protected void func_180466_bG()
|
||||
{
|
||||
- this.field_70181_x += 0.03999999910593033D;
|
||||
+ this.field_70181_x += 0.03999999910593033D * this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
}
|
||||
|
||||
protected float func_189749_co()
|
||||
@@ -1874,7 +1903,8 @@
|
||||
|
||||
if (this.field_70122_E)
|
||||
{
|
||||
- f6 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos).func_177230_c().field_149765_K * 0.91F;
|
||||
+ IBlockState underState = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos);
|
||||
+ f6 = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F;
|
||||
}
|
||||
|
||||
float f7 = 0.16277136F / (f6 * f6 * f6);
|
||||
@@ -1894,7 +1924,8 @@
|
||||
|
||||
if (this.field_70122_E)
|
||||
{
|
||||
- f6 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().field_149765_K * 0.91F;
|
||||
+ IBlockState underState = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v));
|
||||
+ f6 = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F;
|
||||
}
|
||||
|
||||
if (this.func_70617_f_())
|
||||
@@ -2054,6 +2085,7 @@
|
||||
|
||||
public void func_70071_h_()
|
||||
{
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return;
|
||||
super.func_70071_h_();
|
||||
this.func_184608_ct();
|
||||
|
||||
@@ -2096,7 +2128,9 @@
|
||||
|
||||
if (!ItemStack.func_77989_b(itemstack1, itemstack))
|
||||
{
|
||||
+ if (!ItemStack.areItemStacksEqualUsingNBTShareTag(itemstack1, itemstack))
|
||||
((WorldServer)this.field_70170_p).func_73039_n().func_151247_a(this, new SPacketEntityEquipment(this.func_145782_y(), entityequipmentslot, itemstack1));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, entityequipmentslot, itemstack, itemstack1));
|
||||
|
||||
if (!itemstack.func_190926_b())
|
||||
{
|
||||
@@ -2575,6 +2609,40 @@
|
||||
this.field_70752_e = true;
|
||||
}
|
||||
|
||||
+
|
||||
+ /**
|
||||
+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted.
|
||||
+ * currently only used in vanilla code by pigs.
|
||||
+ *
|
||||
+ * @param player The player who is riding the entity.
|
||||
+ * @return If the player should orient the same direction as this entity.
|
||||
+ */
|
||||
+ public boolean shouldRiderFaceForward(EntityPlayer player)
|
||||
+ {
|
||||
+ return this instanceof net.minecraft.entity.passive.EntityPig;
|
||||
+ }
|
||||
+
|
||||
public abstract EnumHandSide func_184591_cq();
|
||||
|
||||
public boolean func_184587_cr()
|
||||
@@ -2595,12 +2663,19 @@
|
||||
|
||||
if (itemstack == this.field_184627_bm)
|
||||
{
|
||||
+ if (!this.field_184627_bm.func_190926_b())
|
||||
+ {
|
||||
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
|
||||
+ if (field_184628_bn > 0)
|
||||
+ field_184627_bm.func_77973_b().onUsingTick(field_184627_bm, this, field_184628_bn);
|
||||
+ }
|
||||
+
|
||||
if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0)
|
||||
{
|
||||
this.func_184584_a(this.field_184627_bm, 5);
|
||||
}
|
||||
|
||||
- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K)
|
||||
+ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K)
|
||||
{
|
||||
this.func_71036_o();
|
||||
}
|
||||
@@ -2618,8 +2693,10 @@
|
||||
|
||||
if (!itemstack.func_190926_b() && !this.func_184587_cr())
|
||||
{
|
||||
+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m());
|
||||
+ if (duration <= 0) return;
|
||||
this.field_184627_bm = itemstack;
|
||||
- this.field_184628_bn = itemstack.func_77988_m();
|
||||
+ this.field_184628_bn = duration;
|
||||
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
@@ -2700,7 +2777,10 @@
|
||||
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr())
|
||||
{
|
||||
this.func_184584_a(this.field_184627_bm, 16);
|
||||
- this.func_184611_a(this.func_184600_cs(), this.field_184627_bm.func_77950_b(this.field_70170_p, this));
|
||||
+ ItemStack activeItemStackCopy = this.field_184627_bm.func_77946_l();
|
||||
+ ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this);
|
||||
+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, activeItemStackCopy, func_184605_cv(), itemstack);
|
||||
+ this.func_184611_a(this.func_184600_cs(), itemstack);
|
||||
this.func_184602_cy();
|
||||
}
|
||||
}
|
||||
@@ -2724,7 +2804,8 @@
|
||||
{
|
||||
if (!this.field_184627_bm.func_190926_b())
|
||||
{
|
||||
- this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv()))
|
||||
+ this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
|
||||
}
|
||||
|
||||
this.func_184602_cy();
|
||||
@@ -2852,6 +2933,31 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // FORGE
|
||||
+ private final net.minecraftforge.items.IItemHandlerModifiable handHandler = new net.minecraftforge.items.wrapper.EntityHandsInvWrapper(this);
|
||||
+ private final net.minecraftforge.items.IItemHandlerModifiable armorHandler = new net.minecraftforge.items.wrapper.EntityArmorInvWrapper(this);
|
||||
+ private final net.minecraftforge.items.IItemHandler joinedHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(armorHandler, handHandler);
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ @Override
|
||||
+ @Nullable
|
||||
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
+ {
|
||||
+ if (facing == null) return (T) joinedHandler;
|
||||
+ else if (facing.func_176740_k().func_176720_b()) return (T) handHandler;
|
||||
+ else if (facing.func_176740_k().func_176722_c()) return (T) armorHandler;
|
||||
+ }
|
||||
+ return super.getCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
public boolean func_190631_cK()
|
||||
{
|
||||
return true;
|
||||
@@ -2861,4 +2967,30 @@
|
||||
public void func_191987_a(BlockPos p_191987_1_, boolean p_191987_2_)
|
||||
{
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public void func_191958_b(float strafe, float up, float forward, float friction)
|
||||
+ {
|
||||
+ float f = strafe * strafe + up * up + forward * forward;
|
||||
+ if (f >= 1.0E-4F)
|
||||
+ {
|
||||
+ f = MathHelper.func_76129_c(f);
|
||||
+ if (f < 1.0F) f = 1.0F;
|
||||
+ f = friction / f;
|
||||
+ strafe = strafe * f;
|
||||
+ up = up * f;
|
||||
+ forward = forward * f;
|
||||
+ if(this.func_70090_H() || this.func_180799_ab())
|
||||
+ {
|
||||
+ strafe = strafe * (float)this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
+ up = up * (float)this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
+ forward = forward * (float)this.func_110148_a(SWIM_SPEED).func_111126_e();
|
||||
+ }
|
||||
+ float f1 = MathHelper.func_76126_a(this.field_70177_z * 0.017453292F);
|
||||
+ float f2 = MathHelper.func_76134_b(this.field_70177_z * 0.017453292F);
|
||||
+ this.field_70159_w += (double)(strafe * f2 - forward * f1);
|
||||
+ this.field_70181_x += (double)up;
|
||||
+ this.field_70179_y += (double)(forward * f2 + strafe * f1);
|
||||
+ }
|
||||
+ }
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java
|
||||
@@ -50,9 +50,14 @@
|
||||
|
||||
public static EntityLiving.SpawnPlacementType func_180109_a(Class<?> p_180109_0_)
|
||||
{
|
||||
- return field_180110_a.get(p_180109_0_);
|
||||
+ return field_180110_a.getOrDefault(p_180109_0_, EntityLiving.SpawnPlacementType.ON_GROUND);
|
||||
}
|
||||
|
||||
+ public static void setPlacementType(Class<? extends Entity> entityClass, EntityLiving.SpawnPlacementType placementType)
|
||||
+ {
|
||||
+ field_180110_a.putIfAbsent(entityClass, placementType);
|
||||
+ }
|
||||
+
|
||||
static
|
||||
{
|
||||
field_180110_a.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND);
|
|
@ -1,37 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java
|
||||
@@ -77,6 +77,8 @@
|
||||
|
||||
public void func_72786_a(Entity p_72786_1_)
|
||||
{
|
||||
+ if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return;
|
||||
+
|
||||
if (p_72786_1_ instanceof EntityPlayerMP)
|
||||
{
|
||||
this.func_72791_a(p_72786_1_, 512, 2);
|
||||
@@ -339,6 +341,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+
|
||||
+ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily
|
||||
+ /**
|
||||
+ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to.
|
||||
+ * @param entity the Entity
|
||||
+ * @return all players tracking the Entity
|
||||
+ */
|
||||
+ public Set<? extends net.minecraft.entity.player.EntityPlayer> getTrackingPlayers(Entity entity)
|
||||
+ {
|
||||
+ EntityTrackerEntry entry = (EntityTrackerEntry) field_72794_c.func_76041_a(entity.func_145782_y());
|
||||
+ if (entry == null)
|
||||
+ return java.util.Collections.emptySet();
|
||||
+ else
|
||||
+ return java.util.Collections.unmodifiableSet(entry.field_73134_o);
|
||||
+ }
|
||||
+
|
||||
+ /* ======================================== FORGE END =====================================*/
|
||||
+
|
||||
public void func_151248_b(Entity p_151248_1_, Packet<?> p_151248_2_)
|
||||
{
|
||||
EntityTrackerEntry entitytrackerentry = this.field_72794_c.func_76041_a(p_151248_1_.func_145782_y());
|
|
@ -1,44 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java
|
||||
@@ -158,13 +158,13 @@
|
||||
|
||||
if (itemstack.func_77973_b() instanceof ItemMap)
|
||||
{
|
||||
- MapData mapdata = Items.field_151098_aY.func_77873_a(itemstack, this.field_73132_a.field_70170_p);
|
||||
+ MapData mapdata = ((ItemMap) itemstack.func_77973_b()).func_77873_a(itemstack, this.field_73132_a.field_70170_p);
|
||||
|
||||
for (EntityPlayer entityplayer : p_73122_1_)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP)entityplayer;
|
||||
mapdata.func_76191_a(entityplayermp, itemstack);
|
||||
- Packet<?> packet = Items.field_151098_aY.func_150911_c(itemstack, this.field_73132_a.field_70170_p, entityplayermp);
|
||||
+ Packet<?> packet = ((ItemMap) itemstack.func_77973_b()).func_150911_c(itemstack, this.field_73132_a.field_70170_p, entityplayermp);
|
||||
|
||||
if (packet != null)
|
||||
{
|
||||
@@ -457,6 +457,7 @@
|
||||
|
||||
this.field_73132_a.func_184178_b(p_73117_1_);
|
||||
p_73117_1_.func_184848_d(this.field_73132_a);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(field_73132_a, p_73117_1_);
|
||||
}
|
||||
}
|
||||
else if (this.field_73134_o.contains(p_73117_1_))
|
||||
@@ -464,6 +465,7 @@
|
||||
this.field_73134_o.remove(p_73117_1_);
|
||||
this.field_73132_a.func_184203_c(p_73117_1_);
|
||||
p_73117_1_.func_152339_d(this.field_73132_a);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(field_73132_a, p_73117_1_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -496,6 +498,9 @@
|
||||
field_151262_p.warn("Fetching addPacket for removed entity");
|
||||
}
|
||||
|
||||
+ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.field_73132_a);
|
||||
+ if (pkt != null) return pkt;
|
||||
+
|
||||
if (this.field_73132_a instanceof EntityPlayerMP)
|
||||
{
|
||||
return new SPacketSpawnPlayer((EntityPlayer)this.field_73132_a);
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/SharedMonsterAttributes.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/SharedMonsterAttributes.java
|
||||
@@ -16,7 +16,7 @@
|
||||
public class SharedMonsterAttributes
|
||||
{
|
||||
private static final Logger field_151476_f = LogManager.getLogger();
|
||||
- public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).func_111117_a("Max Health").func_111112_a(true);
|
||||
+ public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, Float.MIN_VALUE, 1024.0D)).func_111117_a("Max Health").func_111112_a(true); // Forge: set smallest max-health value to fix MC-119183. This gets rounded to float so we use the smallest positive float value.
|
||||
public static final IAttribute field_111265_b = (new RangedAttribute((IAttribute)null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).func_111117_a("Follow Range");
|
||||
public static final IAttribute field_111266_c = (new RangedAttribute((IAttribute)null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).func_111117_a("Knockback Resistance");
|
||||
public static final IAttribute field_111263_d = (new RangedAttribute((IAttribute)null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).func_111117_a("Movement Speed").func_111112_a(true);
|
|
@ -1,55 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java
|
||||
@@ -21,6 +21,8 @@
|
||||
private double field_151495_j;
|
||||
private double field_151496_k;
|
||||
protected final int field_188493_g = 20;
|
||||
+ private int failedPathFindingPenalty = 0;
|
||||
+ private boolean canPenalize = false;
|
||||
|
||||
public EntityAIAttackMelee(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_)
|
||||
{
|
||||
@@ -45,6 +47,19 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ if (canPenalize)
|
||||
+ {
|
||||
+ if (--this.field_75445_i <= 0)
|
||||
+ {
|
||||
+ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase);
|
||||
+ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7);
|
||||
+ return this.field_75438_g != null;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase);
|
||||
|
||||
if (this.field_75438_g != null)
|
||||
@@ -116,6 +131,23 @@
|
||||
this.field_151496_k = entitylivingbase.field_70161_v;
|
||||
this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7);
|
||||
|
||||
+ if (this.canPenalize)
|
||||
+ {
|
||||
+ this.field_75445_i += failedPathFindingPenalty;
|
||||
+ if (this.field_75441_b.func_70661_as().func_75505_d() != null)
|
||||
+ {
|
||||
+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c();
|
||||
+ if (finalPathPoint != null && entitylivingbase.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1)
|
||||
+ failedPathFindingPenalty = 0;
|
||||
+ else
|
||||
+ failedPathFindingPenalty += 10;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ failedPathFindingPenalty += 10;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (d0 > 1024.0D)
|
||||
{
|
||||
this.field_75445_i += 10;
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java
|
||||
@@ -21,7 +21,7 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
- else if (!this.field_75356_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_75356_a.field_70170_p, this.field_75356_a) || !this.field_75356_a.field_70170_p.func_180495_p(this.field_179507_b).func_177230_c().canEntityDestroy(this.field_75356_a.field_70170_p.func_180495_p(this.field_179507_b), this.field_75356_a.field_70170_p, this.field_179507_b, this.field_75356_a) || !net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.field_75356_a, this.field_179507_b, this.field_75356_a.field_70170_p.func_180495_p(this.field_179507_b)))
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
if (field_179505_b.apply(this.field_151501_c.func_180495_p(blockpos)))
|
||||
{
|
||||
- if (this.field_151501_c.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b))
|
||||
{
|
||||
this.field_151501_c.func_175655_b(blockpos, false);
|
||||
}
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
if (this.field_151501_c.func_180495_p(blockpos1).func_177230_c() == Blocks.field_150349_c)
|
||||
{
|
||||
- if (this.field_151501_c.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b))
|
||||
{
|
||||
this.field_151501_c.func_175718_b(2001, blockpos1, Block.func_149682_b(Blocks.field_150349_c));
|
||||
this.field_151501_c.func_180501_a(blockpos1, Blocks.field_150346_d.func_176223_P(), 2);
|
|
@ -1,24 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java
|
||||
@@ -29,7 +29,7 @@
|
||||
{
|
||||
if (this.field_179496_a <= 0)
|
||||
{
|
||||
- if (!this.field_179504_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179504_c.field_70170_p, this.field_179504_c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -94,6 +94,12 @@
|
||||
world.func_180501_a(blockpos, Blocks.field_185773_cZ.func_176223_P(), 3);
|
||||
flag = true;
|
||||
}
|
||||
+ else if (itemstack.func_77973_b() instanceof net.minecraftforge.common.IPlantable) {
|
||||
+ if(((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlantType(world,blockpos) == net.minecraftforge.common.EnumPlantType.Crop) {
|
||||
+ world.func_180501_a(blockpos, ((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlant(world,blockpos),3);
|
||||
+ flag = true;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
if (flag)
|
|
@ -1,21 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIMate.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIMate.java
|
||||
@@ -92,6 +92,18 @@
|
||||
{
|
||||
EntityAgeable entityageable = this.field_75390_d.func_90011_a(this.field_75391_e);
|
||||
|
||||
+ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75390_d, field_75391_e, entityageable);
|
||||
+ final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
|
||||
+ entityageable = event.getChild();
|
||||
+ if (cancelled) {
|
||||
+ //Reset the "inLove" state for the animals
|
||||
+ this.field_75390_d.func_70873_a(6000);
|
||||
+ this.field_75391_e.func_70873_a(6000);
|
||||
+ this.field_75390_d.func_70875_t();
|
||||
+ this.field_75391_e.func_70875_t();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (entityageable != null)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = this.field_75390_d.func_191993_do();
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java
|
||||
@@ -70,7 +70,7 @@
|
||||
int i = this.field_111180_a.func_110252_cg();
|
||||
int j = this.field_111180_a.func_190676_dC();
|
||||
|
||||
- if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i)
|
||||
+ if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(field_111180_a, (EntityPlayer)entity))
|
||||
{
|
||||
this.field_111180_a.func_110263_g((EntityPlayer)entity);
|
||||
return;
|
|
@ -1,19 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java
|
||||
@@ -113,11 +113,15 @@
|
||||
|
||||
private void func_75447_i()
|
||||
{
|
||||
- EntityVillager entityvillager = this.field_75450_b.func_90011_a(this.field_75451_c);
|
||||
+ net.minecraft.entity.EntityAgeable entityvillager = this.field_75450_b.func_90011_a(this.field_75451_c);
|
||||
this.field_75451_c.func_70873_a(6000);
|
||||
this.field_75450_b.func_70873_a(6000);
|
||||
this.field_75451_c.func_175549_o(false);
|
||||
this.field_75450_b.func_175549_o(false);
|
||||
+
|
||||
+ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75450_b, field_75451_c, entityvillager);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event) || event.getChild() == null) { return; }
|
||||
+ entityvillager = event.getChild();
|
||||
entityvillager.func_70873_a(-24000);
|
||||
entityvillager.func_70012_b(this.field_75450_b.field_70165_t, this.field_75450_b.field_70163_u, this.field_75450_b.field_70161_v, 0.0F, 0.0F);
|
||||
this.field_75448_d.func_72838_d(entityvillager);
|
|
@ -1,19 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java
|
||||
@@ -499,13 +499,13 @@
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
Block block = iblockstate.func_177230_c();
|
||||
|
||||
- if (iblockstate.func_185904_a() != Material.field_151579_a && iblockstate.func_185904_a() != Material.field_151581_o)
|
||||
+ if (!block.isAir(iblockstate, this.field_70170_p, blockpos) && iblockstate.func_185904_a() != Material.field_151581_o)
|
||||
{
|
||||
- if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- else if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150384_bq && block != Blocks.field_150378_br)
|
||||
+ else if (block.canEntityDestroy(iblockstate, this.field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, iblockstate))
|
||||
{
|
||||
if (block != Blocks.field_150483_bI && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.field_150411_aY && block != Blocks.field_185775_db)
|
||||
{
|
|
@ -1,29 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java
|
||||
@@ -255,7 +255,7 @@
|
||||
|
||||
if (j1 <= 0)
|
||||
{
|
||||
- this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"));
|
||||
+ this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this));
|
||||
this.field_70170_p.func_175669_a(1023, new BlockPos(this), 0);
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@
|
||||
{
|
||||
--this.field_82222_j;
|
||||
|
||||
- if (this.field_82222_j == 0 && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (this.field_82222_j == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this))
|
||||
{
|
||||
int i1 = MathHelper.func_76128_c(this.field_70163_u);
|
||||
int l1 = MathHelper.func_76128_c(this.field_70165_t);
|
||||
@@ -382,7 +382,7 @@
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
Block block = iblockstate.func_177230_c();
|
||||
|
||||
- if (iblockstate.func_185904_a() != Material.field_151579_a && func_181033_a(block))
|
||||
+ if (!block.isAir(iblockstate, this.field_70170_p, blockpos) && block.canEntityDestroy(iblockstate, field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, iblockstate))
|
||||
{
|
||||
flag = this.field_70170_p.func_175655_b(blockpos, true) || flag;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java
|
||||
@@ -72,7 +72,7 @@
|
||||
double d2 = this.field_188661_a.field_70986_h.field_70163_u + (double)(this.field_188661_a.field_70986_h.field_70131_O / 2.0F);
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d2), MathHelper.func_76128_c(d1));
|
||||
|
||||
- while (this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos))
|
||||
+ while (this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos) && d2 >= 0) //Forge: Fix infinite loop if ground is missing.
|
||||
{
|
||||
--d2;
|
||||
blockpos$mutableblockpos.func_181079_c(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d2), MathHelper.func_76128_c(d1));
|
|
@ -1,12 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java
|
||||
@@ -104,7 +104,8 @@
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
Entity entity = list.get(i);
|
||||
- entity.func_70077_a(this);
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this))
|
||||
+ entity.func_70077_a(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java
|
||||
@@ -98,6 +98,9 @@
|
||||
|
||||
if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn())
|
||||
{
|
||||
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F);
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
|
||||
+ { // Don't indent to lower patch size
|
||||
if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning"))
|
||||
{
|
||||
EntityEndermite entityendermite = new EntityEndermite(this.field_70170_p);
|
||||
@@ -111,9 +114,10 @@
|
||||
entitylivingbase.func_184210_p();
|
||||
}
|
||||
|
||||
- entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v);
|
||||
+ entitylivingbase.func_70634_a(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
entitylivingbase.field_70143_R = 0.0F;
|
||||
- entitylivingbase.func_70097_a(DamageSource.field_76379_h, 5.0F);
|
||||
+ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.getAttackDamage());
|
||||
+ }
|
||||
}
|
||||
}
|
||||
else if (entitylivingbase != null)
|
||||
@@ -141,13 +145,13 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Entity func_184204_a(int p_184204_1_)
|
||||
+ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter)
|
||||
{
|
||||
if (this.field_70192_c.field_71093_bK != p_184204_1_)
|
||||
{
|
||||
this.field_70192_c = null;
|
||||
}
|
||||
|
||||
- return super.func_184204_a(p_184204_1_);
|
||||
+ return super.changeDimension(p_184204_1_, teleporter);
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/item/EntityFallingBlock.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityFallingBlock.java
|
||||
@@ -166,6 +166,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos1);
|
||||
|
||||
+ if (this.field_70170_p.func_175623_d(new BlockPos(this.field_70165_t, this.field_70163_u - 0.009999999776482582D, this.field_70161_v))) //Forge: Don't indent below.
|
||||
if (!flag1 && BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.009999999776482582D, this.field_70161_v))))
|
||||
{
|
||||
this.field_70122_E = false;
|
||||
@@ -189,7 +190,7 @@
|
||||
((BlockFalling)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, iblockstate);
|
||||
}
|
||||
|
||||
- if (this.field_145810_d != null && block instanceof ITileEntityProvider)
|
||||
+ if (this.field_145810_d != null && block.hasTileEntity(this.field_175132_d))
|
||||
{
|
||||
TileEntity tileentity = this.field_70170_p.func_175625_s(blockpos1);
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java
|
||||
@@ -38,6 +38,11 @@
|
||||
private String field_145802_g;
|
||||
public float field_70290_d;
|
||||
|
||||
+ /**
|
||||
+ * The maximum age of this EntityItem. The item is expired once this is reached.
|
||||
+ */
|
||||
+ public int lifespan = 6000;
|
||||
+
|
||||
public EntityItem(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_)
|
||||
{
|
||||
super(p_i1709_1_);
|
||||
@@ -55,6 +60,7 @@
|
||||
{
|
||||
this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_);
|
||||
this.func_92058_a(p_i1710_8_);
|
||||
+ this.lifespan = (p_i1710_8_.func_77973_b() == null ? 6000 : p_i1710_8_.func_77973_b().getEntityLifespan(p_i1710_8_, p_i1710_1_));
|
||||
}
|
||||
|
||||
protected boolean func_70041_e_()
|
||||
@@ -78,6 +84,7 @@
|
||||
|
||||
public void func_70071_h_()
|
||||
{
|
||||
+ if (func_92059_d().func_77973_b().onEntityItemUpdate(this)) return;
|
||||
if (this.func_92059_d().func_190926_b())
|
||||
{
|
||||
this.func_70106_y();
|
||||
@@ -135,7 +142,9 @@
|
||||
|
||||
if (this.field_70122_E)
|
||||
{
|
||||
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.98F;
|
||||
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
|
||||
+ net.minecraft.block.state.IBlockState underState = this.field_70170_p.func_180495_p(underPos);
|
||||
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.98F;
|
||||
}
|
||||
|
||||
this.field_70159_w *= (double)f;
|
||||
@@ -167,8 +176,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000)
|
||||
+ ItemStack item = this.func_92059_d();
|
||||
+
|
||||
+ if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan)
|
||||
{
|
||||
+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item);
|
||||
+ if (hook < 0) this.func_70106_y();
|
||||
+ else this.lifespan += hook;
|
||||
+ }
|
||||
+ if (item.func_190926_b())
|
||||
+ {
|
||||
this.func_70106_y();
|
||||
}
|
||||
}
|
||||
@@ -225,6 +242,10 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
+ else if (!itemstack.areCapsCompatible(itemstack1))
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
itemstack1.func_190917_f(itemstack.func_190916_E());
|
||||
@@ -282,6 +303,7 @@
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_)
|
||||
{
|
||||
+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return false; //Forge: Fixes MC-53850
|
||||
if (this.func_180431_b(p_70097_1_))
|
||||
{
|
||||
return false;
|
||||
@@ -314,6 +336,7 @@
|
||||
p_70014_1_.func_74777_a("Health", (short)this.field_70291_e);
|
||||
p_70014_1_.func_74777_a("Age", (short)this.field_70292_b);
|
||||
p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b);
|
||||
+ p_70014_1_.func_74768_a("Lifespan", lifespan);
|
||||
|
||||
if (this.func_145800_j() != null)
|
||||
{
|
||||
@@ -358,22 +381,30 @@
|
||||
{
|
||||
this.func_70106_y();
|
||||
}
|
||||
+ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan");
|
||||
}
|
||||
|
||||
public void func_70100_b_(EntityPlayer p_70100_1_)
|
||||
{
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
+ if (this.field_145804_b > 0) return;
|
||||
ItemStack itemstack = this.func_92059_d();
|
||||
Item item = itemstack.func_77973_b();
|
||||
int i = itemstack.func_190916_E();
|
||||
|
||||
- if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && p_70100_1_.field_71071_by.func_70441_a(itemstack))
|
||||
+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_);
|
||||
+ if (hook < 0) return;
|
||||
+ ItemStack clone = itemstack.func_77946_l();
|
||||
+
|
||||
+ if (this.field_145804_b <= 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack) || clone.func_190916_E() > this.func_92059_d().func_190916_E()))
|
||||
{
|
||||
- p_70100_1_.func_71001_a(this, i);
|
||||
+ clone.func_190920_e(clone.func_190916_E() - this.func_92059_d().func_190916_E());
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(p_70100_1_, this, clone);
|
||||
|
||||
if (itemstack.func_190926_b())
|
||||
{
|
||||
+ p_70100_1_.func_71001_a(this, i);
|
||||
this.func_70106_y();
|
||||
itemstack.func_190920_e(i);
|
||||
}
|
||||
@@ -394,9 +425,9 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Entity func_184204_a(int p_184204_1_)
|
||||
+ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter)
|
||||
{
|
||||
- Entity entity = super.func_184204_a(p_184204_1_);
|
||||
+ Entity entity = super.changeDimension(p_184204_1_, teleporter);
|
||||
|
||||
if (!this.field_70170_p.field_72995_K && entity instanceof EntityItem)
|
||||
{
|
||||
@@ -476,6 +507,6 @@
|
||||
public void func_174870_v()
|
||||
{
|
||||
this.func_174871_r();
|
||||
- this.field_70292_b = 5999;
|
||||
+ this.field_70292_b = func_92059_d().func_77973_b().getEntityLifespan(func_92059_d(), field_70170_p) - 1;
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java
|
||||
@@ -138,10 +138,10 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Entity func_184204_a(int p_184204_1_)
|
||||
+ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter)
|
||||
{
|
||||
this.field_94112_b = false;
|
||||
- return super.func_184204_a(p_184204_1_);
|
||||
+ return super.changeDimension(p_184204_1_, teleporter);
|
||||
}
|
||||
|
||||
public void func_70106_y()
|
||||
@@ -202,6 +202,7 @@
|
||||
|
||||
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_)
|
||||
{
|
||||
+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true;
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
p_184230_1_.func_71007_a(this);
|
||||
@@ -270,17 +271,37 @@
|
||||
random = new Random(this.field_184291_d);
|
||||
}
|
||||
|
||||
- LootContext.Builder lootcontext$builder = new LootContext.Builder((WorldServer)this.field_70170_p);
|
||||
+ LootContext.Builder lootcontext$builder = new LootContext.Builder((WorldServer)this.field_70170_p).func_186472_a(this); // Forge: add looted entity to LootContext
|
||||
|
||||
if (p_184288_1_ != null)
|
||||
{
|
||||
- lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da());
|
||||
+ lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()).func_186470_a(p_184288_1_); // Forge: add player to LootContext
|
||||
}
|
||||
|
||||
loottable.func_186460_a(this, random, lootcontext$builder.func_186471_a());
|
||||
}
|
||||
}
|
||||
|
||||
+ public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this);
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ @Override
|
||||
+ @Nullable
|
||||
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
+ {
|
||||
+ return (T) itemHandler;
|
||||
+ }
|
||||
+ return super.getCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
public void func_174888_l()
|
||||
{
|
||||
this.func_184288_f((EntityPlayer)null);
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityCreeper.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityCreeper.java
|
||||
@@ -265,7 +265,7 @@
|
||||
{
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
- boolean flag = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing");
|
||||
+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this);
|
||||
float f = this.func_70830_n() ? 2.0F : 1.0F;
|
||||
this.field_70729_aU = true;
|
||||
this.field_70170_p.func_72876_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_82226_g * f, flag);
|
|
@ -1,50 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java
|
||||
@@ -267,7 +267,9 @@
|
||||
|
||||
private boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_)
|
||||
{
|
||||
- boolean flag = this.func_184595_k(p_70825_1_, p_70825_3_, p_70825_5_);
|
||||
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false;
|
||||
+ boolean flag = this.func_184595_k(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
|
||||
if (flag)
|
||||
{
|
||||
@@ -354,6 +356,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ /*===================================== Forge Start ==============================*/
|
||||
+ public static void setCarriable(Block block, boolean canCarry)
|
||||
+ {
|
||||
+ if (canCarry) field_70827_d.add(block);
|
||||
+ else field_70827_d.remove(block);
|
||||
+ }
|
||||
+ public static boolean getCarriable(Block block)
|
||||
+ {
|
||||
+ return field_70827_d.contains(block);
|
||||
+ }
|
||||
+ /*===================================== Forge End ==============================*/
|
||||
+
|
||||
public boolean func_70823_r()
|
||||
{
|
||||
return ((Boolean)this.field_70180_af.func_187225_a(field_184719_bw)).booleanValue();
|
||||
@@ -486,7 +500,7 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
- else if (!this.field_179475_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179475_a.field_70170_p, this.field_179475_a))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -551,7 +565,7 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
- else if (!this.field_179473_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179473_a.field_70170_p, this.field_179473_a))
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEvoker.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEvoker.java
|
||||
@@ -369,7 +369,7 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
- else if (!EntityEvoker.this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(EntityEvoker.this.field_70170_p, EntityEvoker.this))
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityIronGolem.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityIronGolem.java
|
||||
@@ -294,7 +294,7 @@
|
||||
{
|
||||
if (!this.func_70850_q() && this.field_70717_bb != null && this.field_70857_d != null)
|
||||
{
|
||||
- this.field_70857_d.func_82688_a(this.field_70717_bb.func_70005_c_(), -5);
|
||||
+ this.field_70857_d.modifyPlayerReputation(this.field_70717_bb.func_110124_au(), -5);
|
||||
}
|
||||
|
||||
super.func_70645_a(p_70645_1_);
|
|
@ -1,10 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java
|
||||
@@ -96,6 +96,7 @@
|
||||
{
|
||||
this.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F);
|
||||
this.field_70160_al = true;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
|
||||
}
|
||||
|
||||
protected void func_180466_bG()
|
|
@ -1,18 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityMob.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMob.java
|
||||
@@ -120,13 +120,13 @@
|
||||
ItemStack itemstack = this.func_184614_ca();
|
||||
ItemStack itemstack1 = entityplayer.func_184587_cr() ? entityplayer.func_184607_cu() : ItemStack.field_190927_a;
|
||||
|
||||
- if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b() instanceof ItemAxe && itemstack1.func_77973_b() == Items.field_185159_cQ)
|
||||
+ if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b().canDisableShield(itemstack, itemstack1, entityplayer, this) && itemstack1.func_77973_b().isShield(itemstack1, entityplayer))
|
||||
{
|
||||
float f1 = 0.25F + (float)EnchantmentHelper.func_185293_e(this) * 0.05F;
|
||||
|
||||
if (this.field_70146_Z.nextFloat() < f1)
|
||||
{
|
||||
- entityplayer.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100);
|
||||
+ entityplayer.func_184811_cZ().func_185145_a(itemstack1.func_77973_b(), 100);
|
||||
this.field_70170_p.func_72960_a(entityplayer, (byte)30);
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityShulker.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityShulker.java
|
||||
@@ -426,6 +426,13 @@
|
||||
|
||||
if (flag)
|
||||
{
|
||||
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p(), 0);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) flag = false;
|
||||
+ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
+ }
|
||||
+
|
||||
+ if (flag)
|
||||
+ {
|
||||
this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F);
|
||||
this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1));
|
||||
this.field_70180_af.func_187227_b(field_184702_c, Byte.valueOf((byte)0));
|
|
@ -1,20 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
|
||||
@@ -184,7 +184,7 @@
|
||||
{
|
||||
Random random = this.field_75457_a.func_70681_au();
|
||||
|
||||
- if (this.field_75457_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing") && random.nextInt(10) == 0)
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_75457_a.field_70170_p, this.field_75457_a) && random.nextInt(10) == 0)
|
||||
{
|
||||
this.field_179483_b = EnumFacing.func_176741_a(random);
|
||||
BlockPos blockpos = (new BlockPos(this.field_75457_a.field_70165_t, this.field_75457_a.field_70163_u + 0.5D, this.field_75457_a.field_70161_v)).func_177972_a(this.field_179483_b);
|
||||
@@ -273,7 +273,7 @@
|
||||
|
||||
if (iblockstate.func_177230_c() == Blocks.field_150418_aU)
|
||||
{
|
||||
- if (world.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this.field_179464_a))
|
||||
{
|
||||
world.func_175655_b(blockpos1, true);
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java
|
||||
@@ -137,7 +137,7 @@
|
||||
if (this.field_70122_E && !this.field_175452_bi)
|
||||
{
|
||||
int i = this.func_70809_q();
|
||||
-
|
||||
+ if (spawnCustomParticles()) { i = 0; } // don't spawn particles if it's handled by the implementation itself
|
||||
for (int j = 0; j < i * 8; ++j)
|
||||
{
|
||||
float f = this.field_70146_Z.nextFloat() * ((float)Math.PI * 2F);
|
||||
@@ -304,7 +304,7 @@
|
||||
BlockPos blockpos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v));
|
||||
Chunk chunk = this.field_70170_p.func_175726_f(blockpos);
|
||||
|
||||
- if (this.field_70170_p.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1)
|
||||
+ if (this.field_70170_p.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -370,6 +370,14 @@
|
||||
return this.func_189101_db() ? SoundEvents.field_189110_fE : SoundEvents.field_187882_fq;
|
||||
}
|
||||
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+ /**
|
||||
+ * Called when the slime spawns particles on landing, see onUpdate.
|
||||
+ * Return true to prevent the spawning of the default particles.
|
||||
+ */
|
||||
+ protected boolean spawnCustomParticles() { return false; }
|
||||
+ /* ======================================== FORGE END =====================================*/
|
||||
+
|
||||
static class AISlimeAttack extends EntityAIBase
|
||||
{
|
||||
private final EntitySlime field_179466_a;
|
|
@ -1,44 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySnowman.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySnowman.java
|
||||
@@ -31,7 +31,7 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
|
||||
-public class EntitySnowman extends EntityGolem implements IRangedAttackMob
|
||||
+public class EntitySnowman extends EntityGolem implements IRangedAttackMob, net.minecraftforge.common.IShearable
|
||||
{
|
||||
private static final DataParameter<Byte> field_184749_a = EntityDataManager.<Byte>func_187226_a(EntitySnowman.class, DataSerializers.field_187191_a);
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
this.func_70097_a(DamageSource.field_76370_b, 1.0F);
|
||||
}
|
||||
|
||||
- if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -152,7 +152,7 @@
|
||||
{
|
||||
ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_);
|
||||
|
||||
- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K)
|
||||
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) //Forge: Moved to onSheared
|
||||
{
|
||||
this.func_184747_a(false);
|
||||
itemstack.func_77972_a(1, p_184645_1_);
|
||||
@@ -198,6 +198,14 @@
|
||||
return SoundEvents.field_187801_fC;
|
||||
}
|
||||
|
||||
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos) { return this.func_184748_o(); }
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
|
||||
+ {
|
||||
+ this.func_184747_a(false);
|
||||
+ return com.google.common.collect.Lists.newArrayList();
|
||||
+ }
|
||||
+
|
||||
public void func_184724_a(boolean p_184724_1_)
|
||||
{
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java
|
||||
@@ -98,7 +98,7 @@
|
||||
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.23000000417232513D);
|
||||
this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D);
|
||||
this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(2.0D);
|
||||
- this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * 0.10000000149011612D);
|
||||
+ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance);
|
||||
}
|
||||
|
||||
protected void func_70088_a()
|
||||
@@ -239,12 +239,24 @@
|
||||
entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g();
|
||||
}
|
||||
|
||||
- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning"))
|
||||
+ int i = MathHelper.func_76128_c(this.field_70165_t);
|
||||
+ int j = MathHelper.func_76128_c(this.field_70163_u);
|
||||
+ int k = MathHelper.func_76128_c(this.field_70161_v);
|
||||
+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e());
|
||||
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true;
|
||||
+
|
||||
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW ||
|
||||
+ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning"))
|
||||
{
|
||||
- int i = MathHelper.func_76128_c(this.field_70165_t);
|
||||
- int j = MathHelper.func_76128_c(this.field_70163_u);
|
||||
- int k = MathHelper.func_76128_c(this.field_70161_v);
|
||||
- EntityZombie entityzombie = new EntityZombie(this.field_70170_p);
|
||||
+ EntityZombie entityzombie;
|
||||
+ if (summonAid.getCustomSummonedAid() != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW)
|
||||
+ {
|
||||
+ entityzombie = summonAid.getCustomSummonedAid();
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ entityzombie = new EntityZombie(this.field_70170_p);
|
||||
+ }
|
||||
|
||||
for (int l = 0; l < 50; ++l)
|
||||
{
|
||||
@@ -252,14 +264,14 @@
|
||||
int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
|
||||
int k1 = k + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
|
||||
|
||||
- if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.field_70170_p.func_175671_l(new BlockPos(i1, j1, k1)) < 10)
|
||||
+ if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).isSideSolid(this.field_70170_p, new BlockPos(i1, j1 - 1, k1), net.minecraft.util.EnumFacing.UP) && this.field_70170_p.func_175671_l(new BlockPos(i1, j1, k1)) < 10)
|
||||
{
|
||||
entityzombie.func_70107_b((double)i1, (double)j1, (double)k1);
|
||||
|
||||
if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_72917_a(entityzombie.func_174813_aQ(), entityzombie) && this.field_70170_p.func_184144_a(entityzombie, entityzombie.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ()))
|
||||
{
|
||||
this.field_70170_p.func_72838_d(entityzombie);
|
||||
- entityzombie.func_70624_b(entitylivingbase);
|
||||
+ if (entitylivingbase != null) entityzombie.func_70624_b(entitylivingbase);
|
||||
entityzombie.func_180482_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null);
|
||||
this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
|
||||
entityzombie.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
|
||||
@@ -435,7 +447,7 @@
|
||||
|
||||
if (p_180482_2_ == null)
|
||||
{
|
||||
- p_180482_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F);
|
||||
+ p_180482_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance);
|
||||
}
|
||||
|
||||
if (p_180482_2_ instanceof EntityZombie.GroupData)
|
|
@ -1,86 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java
|
||||
@@ -53,11 +53,14 @@
|
||||
public void func_190733_a(int p_190733_1_)
|
||||
{
|
||||
this.field_70180_af.func_187227_b(field_190739_c, Integer.valueOf(p_190733_1_));
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_190733_1_);
|
||||
}
|
||||
|
||||
+ //Use Forge Variant below
|
||||
+ @Deprecated
|
||||
public int func_190736_dl()
|
||||
{
|
||||
- return Math.max(((Integer)this.field_70180_af.func_187225_a(field_190739_c)).intValue() % 6, 0);
|
||||
+ return Math.max(((Integer)this.field_70180_af.func_187225_a(field_190739_c)).intValue(), 0);
|
||||
}
|
||||
|
||||
public static void func_190737_b(DataFixer p_190737_0_)
|
||||
@@ -69,6 +72,7 @@
|
||||
{
|
||||
super.func_70014_b(p_70014_1_);
|
||||
p_70014_1_.func_74768_a("Profession", this.func_190736_dl());
|
||||
+ p_70014_1_.func_74778_a("ProfessionName", this.getForgeProfession().getRegistryName().toString());
|
||||
p_70014_1_.func_74768_a("ConversionTime", this.func_82230_o() ? this.field_82234_d : -1);
|
||||
|
||||
if (this.field_191992_by != null)
|
||||
@@ -81,6 +85,12 @@
|
||||
{
|
||||
super.func_70037_a(p_70037_1_);
|
||||
this.func_190733_a(p_70037_1_.func_74762_e("Profession"));
|
||||
+ if (p_70037_1_.func_74764_b("ProfessionName"))
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName")));
|
||||
+ if (p == null) p = net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER;
|
||||
+ this.setForgeProfession(p);
|
||||
+ }
|
||||
|
||||
if (p_70037_1_.func_150297_b("ConversionTime", 99) && p_70037_1_.func_74762_e("ConversionTime") > -1)
|
||||
{
|
||||
@@ -175,7 +185,7 @@
|
||||
{
|
||||
EntityVillager entityvillager = new EntityVillager(this.field_70170_p);
|
||||
entityvillager.func_82149_j(this);
|
||||
- entityvillager.func_70938_b(this.func_190736_dl());
|
||||
+ entityvillager.setProfession(this.getForgeProfession());
|
||||
entityvillager.func_190672_a(this.field_70170_p.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, false);
|
||||
entityvillager.func_82187_q();
|
||||
|
||||
@@ -278,4 +288,37 @@
|
||||
{
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+
|
||||
+ @Nullable
|
||||
+ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof;
|
||||
+ public void setForgeProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof)
|
||||
+ {
|
||||
+ this.prof = prof;
|
||||
+ this.func_190733_a(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getForgeProfession()
|
||||
+ {
|
||||
+ if (this.prof == null)
|
||||
+ {
|
||||
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_190736_dl());
|
||||
+ if (this.prof == null)
|
||||
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER;
|
||||
+ }
|
||||
+ return this.prof;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void func_184206_a(DataParameter<?> key)
|
||||
+ {
|
||||
+ super.func_184206_a(key);
|
||||
+ if (key.equals(field_190739_c))
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_190739_c));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* ======================================== FORGE END =====================================*/
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/AbstractHorse.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/AbstractHorse.java
|
||||
@@ -312,6 +312,7 @@
|
||||
|
||||
this.field_110296_bG.func_110134_a(this);
|
||||
this.func_110232_cE();
|
||||
+ this.itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG);
|
||||
}
|
||||
|
||||
protected void func_110232_cE()
|
||||
@@ -1227,4 +1228,22 @@
|
||||
|
||||
return p_180482_2_;
|
||||
}
|
||||
+
|
||||
+ // FORGE
|
||||
+ private net.minecraftforge.items.IItemHandler itemHandler = null; // Initialized by initHorseChest above.
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ @Override
|
||||
+ @Nullable
|
||||
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) itemHandler;
|
||||
+ return super.getCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
+ }
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java
|
||||
@@ -34,6 +34,7 @@
|
||||
private static final UUID field_184786_bD = UUID.fromString("556E1665-8B10-40C8-8F9D-CF9B1667F295");
|
||||
private static final DataParameter<Integer> field_184789_bG = EntityDataManager.<Integer>func_187226_a(EntityHorse.class, DataSerializers.field_187192_b);
|
||||
private static final DataParameter<Integer> field_184791_bI = EntityDataManager.<Integer>func_187226_a(EntityHorse.class, DataSerializers.field_187192_b);
|
||||
+ private static final DataParameter<ItemStack> HORSE_ARMOR_STACK = EntityDataManager.<ItemStack>func_187226_a(EntityHorse.class, DataSerializers.field_187196_f);
|
||||
private static final String[] field_110268_bz = new String[] {"textures/entity/horse/horse_white.png", "textures/entity/horse/horse_creamy.png", "textures/entity/horse/horse_chestnut.png", "textures/entity/horse/horse_brown.png", "textures/entity/horse/horse_black.png", "textures/entity/horse/horse_gray.png", "textures/entity/horse/horse_darkbrown.png"};
|
||||
private static final String[] field_110269_bA = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"};
|
||||
private static final String[] field_110291_bB = new String[] {null, "textures/entity/horse/horse_markings_white.png", "textures/entity/horse/horse_markings_whitefield.png", "textures/entity/horse/horse_markings_whitedots.png", "textures/entity/horse/horse_markings_blackdots.png"};
|
||||
@@ -51,6 +52,7 @@
|
||||
super.func_70088_a();
|
||||
this.field_70180_af.func_187214_a(field_184789_bG, Integer.valueOf(0));
|
||||
this.field_70180_af.func_187214_a(field_184791_bI, Integer.valueOf(HorseArmorType.NONE.func_188579_a()));
|
||||
+ this.field_70180_af.func_187214_a(HORSE_ARMOR_STACK, ItemStack.field_190927_a);
|
||||
}
|
||||
|
||||
public static void func_189803_b(DataFixer p_189803_0_)
|
||||
@@ -79,7 +81,7 @@
|
||||
{
|
||||
ItemStack itemstack = new ItemStack(p_70037_1_.func_74775_l("ArmorItem"));
|
||||
|
||||
- if (!itemstack.func_190926_b() && HorseArmorType.func_188577_b(itemstack.func_77973_b()))
|
||||
+ if (!itemstack.func_190926_b() && func_190682_f(itemstack))
|
||||
{
|
||||
this.field_110296_bG.func_70299_a(1, itemstack);
|
||||
}
|
||||
@@ -110,11 +112,12 @@
|
||||
int i = this.func_110202_bQ();
|
||||
int j = (i & 255) % 7;
|
||||
int k = ((i & 65280) >> 8) % 5;
|
||||
- HorseArmorType horsearmortype = this.func_184783_dl();
|
||||
+ ItemStack armorStack = this.field_70180_af.func_187225_a(HORSE_ARMOR_STACK);
|
||||
+ String texture = !armorStack.func_190926_b() ? armorStack.func_77973_b().getHorseArmorTexture(this, armorStack) : HorseArmorType.func_188575_a(this.field_70180_af.func_187225_a(field_184791_bI)).func_188574_d(); //If armorStack is empty, the server is vanilla so the texture should be determined the vanilla way
|
||||
this.field_110280_bR[0] = field_110268_bz[j];
|
||||
this.field_110280_bR[1] = field_110291_bB[k];
|
||||
- this.field_110280_bR[2] = horsearmortype.func_188574_d();
|
||||
- this.field_110286_bQ = "horse/" + field_110269_bA[j] + field_110292_bC[k] + horsearmortype.func_188573_b();
|
||||
+ this.field_110280_bR[2] = texture;
|
||||
+ this.field_110286_bQ = "horse/" + field_110269_bA[j] + field_110292_bC[k] + texture;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -149,6 +152,7 @@
|
||||
{
|
||||
HorseArmorType horsearmortype = HorseArmorType.func_188580_a(p_146086_1_);
|
||||
this.field_70180_af.func_187227_b(field_184791_bI, Integer.valueOf(horsearmortype.func_188579_a()));
|
||||
+ this.field_70180_af.func_187227_b(HORSE_ARMOR_STACK, p_146086_1_);
|
||||
this.func_110230_cF();
|
||||
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
@@ -165,7 +169,9 @@
|
||||
|
||||
public HorseArmorType func_184783_dl()
|
||||
{
|
||||
- return HorseArmorType.func_188575_a(((Integer)this.field_70180_af.func_187225_a(field_184791_bI)).intValue());
|
||||
+ HorseArmorType armor = HorseArmorType.func_188580_a(this.field_70180_af.func_187225_a(HORSE_ARMOR_STACK)); //First check the Forge armor DataParameter
|
||||
+ if (armor == HorseArmorType.NONE) armor = HorseArmorType.func_188575_a(this.field_70180_af.func_187225_a(field_184791_bI)); //If the Forge armor DataParameter returns NONE, fallback to the vanilla armor DataParameter. This is necessary to prevent issues with Forge clients connected to vanilla servers.
|
||||
+ return armor;
|
||||
}
|
||||
|
||||
public void func_76316_a(IInventory p_76316_1_)
|
||||
@@ -207,6 +213,8 @@
|
||||
this.field_70180_af.func_187230_e();
|
||||
this.func_110230_cF();
|
||||
}
|
||||
+ ItemStack armor = this.field_110296_bG.func_70301_a(1);
|
||||
+ if (func_190682_f(armor)) armor.func_77973_b().onHorseArmorTick(field_70170_p, this, armor);
|
||||
}
|
||||
|
||||
protected SoundEvent func_184639_G()
|
||||
@@ -381,7 +389,7 @@
|
||||
|
||||
public boolean func_190682_f(ItemStack p_190682_1_)
|
||||
{
|
||||
- return HorseArmorType.func_188577_b(p_190682_1_.func_77973_b());
|
||||
+ return HorseArmorType.isHorseArmor(p_190682_1_);
|
||||
}
|
||||
|
||||
@Nullable
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityRabbit.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityRabbit.java
|
||||
@@ -551,7 +551,7 @@
|
||||
{
|
||||
if (this.field_179496_a <= 0)
|
||||
{
|
||||
- if (!this.field_179500_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179500_c.field_70170_p, this.field_179500_c))
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityWolf.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityWolf.java
|
||||
@@ -434,7 +434,7 @@
|
||||
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
- if (this.field_70146_Z.nextInt(3) == 0)
|
||||
+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_))
|
||||
{
|
||||
this.func_193101_c(p_184645_1_);
|
||||
this.field_70699_by.func_75499_g();
|
|
@ -1,53 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/HorseArmorType.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/HorseArmorType.java
|
||||
@@ -55,6 +55,7 @@
|
||||
return this.field_188586_e;
|
||||
}
|
||||
|
||||
+ @Deprecated /**Forge: Use getByName. Ordinals of mod-added enum constants are dependent on load order, unlike names.**/
|
||||
public static HorseArmorType func_188575_a(int p_188575_0_)
|
||||
{
|
||||
return values()[p_188575_0_];
|
||||
@@ -62,9 +63,10 @@
|
||||
|
||||
public static HorseArmorType func_188580_a(ItemStack p_188580_0_)
|
||||
{
|
||||
- return p_188580_0_.func_190926_b() ? NONE : func_188576_a(p_188580_0_.func_77973_b());
|
||||
+ return p_188580_0_.func_77973_b().getHorseArmorType(p_188580_0_);
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use getByItemStack
|
||||
public static HorseArmorType func_188576_a(Item p_188576_0_)
|
||||
{
|
||||
if (p_188576_0_ == Items.field_151138_bX)
|
||||
@@ -81,8 +83,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use ItemStack sensitive overload
|
||||
public static boolean func_188577_b(Item p_188577_0_)
|
||||
{
|
||||
return func_188576_a(p_188577_0_) != NONE;
|
||||
}
|
||||
+
|
||||
+ /* ======================================== FORGE START ======================================== */
|
||||
+ //Allows for textures located outside the vanilla horse armor folder
|
||||
+ private HorseArmorType(String defaultTextureLocation, int armorStrengthIn)
|
||||
+ {
|
||||
+ this.field_188588_g = armorStrengthIn;
|
||||
+ this.field_188586_e = defaultTextureLocation;
|
||||
+ this.field_188587_f = "forge";
|
||||
+ }
|
||||
+
|
||||
+ public static HorseArmorType getByName(String name)
|
||||
+ {
|
||||
+ HorseArmorType type = HorseArmorType.valueOf(name);
|
||||
+ return type != null ? type : NONE;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isHorseArmor(ItemStack stack)
|
||||
+ {
|
||||
+ return func_188580_a(stack) != NONE;
|
||||
+ }
|
||||
+ /* ======================================== FORGE END ======================================== */
|
||||
}
|
|
@ -45,11 +45,6 @@
|
|||
+ return this == field_77138_c ? 1.0D : 0.03125D;
|
||||
+ }
|
||||
+
|
||||
+ public boolean handleSlimeSpawnReduction(java.util.Random random, World world)
|
||||
+ {
|
||||
+ return this == field_77138_c ? random.nextInt(4) != 1 : false;
|
||||
+ }
|
||||
+
|
||||
+ /*=================================================== FORGE START ======================================*/
|
||||
+ private static int getNextID()
|
||||
+ {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java
|
||||
@@ -77,6 +77,8 @@
|
||||
|
||||
public void func_72786_a(Entity p_72786_1_)
|
||||
{
|
||||
+ if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return;
|
||||
+
|
||||
if (p_72786_1_ instanceof EntityPlayerMP)
|
||||
{
|
||||
this.func_72791_a(p_72786_1_, 512, 2);
|
|
@ -746,13 +746,6 @@ public class ForgeHooksClient
|
|||
MinecraftForge.EVENT_BUS.post(new InputUpdateEvent(player, movementInput));
|
||||
}
|
||||
|
||||
public static String getHorseArmorTexture(EntityHorse horse, ItemStack armorStack)
|
||||
{
|
||||
String texture = armorStack.getItem().getHorseArmorTexture(horse, armorStack);
|
||||
if(texture == null) texture = horse.getHorseArmorType().getTextureName();
|
||||
return texture;
|
||||
}
|
||||
|
||||
public static void refreshResources(Minecraft mc, VanillaResourceType... types) {
|
||||
SelectiveReloadStateHandler.INSTANCE.beginReload(ReloadRequirements.include(types));
|
||||
mc.refreshResources();
|
||||
|
|
|
@ -143,13 +143,22 @@ public class ForgeConfig
|
|||
LogManager.getLogger().debug(CORE, "Loaded FML config from {}", configFile);
|
||||
}
|
||||
|
||||
//TODO: Make this less duplciate? Maybe static CfgEntry<T> zombieBaseSummonChance = create((spec, name) -> spec.comment().translation().define(name), "zombieBaseSummonChance")
|
||||
public static class GENERAL
|
||||
{
|
||||
public static double zombieBaseSummonChance() {
|
||||
return ForgeConfig.INSTANCE.configData.<Double>getOrElse("general.zombieBaseSummonChance", (double)0.01F);
|
||||
}
|
||||
public static float zombieBabyChance() {
|
||||
return ForgeConfig.INSTANCE.configData.<Float>getOrElse("general.zombieBabyChance", 0.05F);
|
||||
}
|
||||
}
|
||||
|
||||
//General
|
||||
//public static boolean disableVersionCheck = false;
|
||||
//public static boolean removeErroringEntities = false;
|
||||
//public static boolean removeErroringTileEntities = false;
|
||||
//public static boolean fullBoundingBoxLadders = false;
|
||||
//public static double zombieSummonBaseChance = 0.1;
|
||||
//public static float zombieBabyChance = 0.05f;
|
||||
//public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration()
|
||||
//public static boolean fixVanillaCascading = false;
|
||||
//public static int dimensionUnloadQueueDelay = 0;
|
||||
|
|
|
@ -406,7 +406,7 @@ public class ForgeHooks
|
|||
return MinecraftForge.EVENT_BUS.post(new LivingDeathEvent(entity, src));
|
||||
}
|
||||
|
||||
public static boolean onLivingDrops(EntityLivingBase entity, DamageSource source, ArrayList<EntityItem> drops, int lootingLevel, boolean recentlyHit)
|
||||
public static boolean onLivingDrops(EntityLivingBase entity, DamageSource source, Collection<EntityItem> drops, int lootingLevel, boolean recentlyHit)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingDropsEvent(entity, source, drops, lootingLevel, recentlyHit));
|
||||
}
|
||||
|
|
|
@ -33,11 +33,15 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.electronwill.nightconfig.core.CommentedConfig;
|
||||
import com.electronwill.nightconfig.core.Config;
|
||||
import com.electronwill.nightconfig.core.ConfigFormat;
|
||||
import com.electronwill.nightconfig.core.InMemoryFormat;
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
import com.electronwill.nightconfig.core.utils.UnmodifiableConfigWrapper;
|
||||
import com.electronwill.nightconfig.core.ConfigSpec.CorrectionAction;
|
||||
import com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener;
|
||||
import com.google.common.base.Joiner;
|
||||
|
@ -50,17 +54,16 @@ import com.google.common.collect.Lists;
|
|||
* and other things Forge configs would find useful.
|
||||
*/
|
||||
|
||||
public class ForgeConfigSpec
|
||||
public class ForgeConfigSpec extends UnmodifiableConfigWrapper<Config>
|
||||
{
|
||||
private final Config storage;
|
||||
private Map<List<String>, String> levelComments = new HashMap<>();
|
||||
private ForgeConfigSpec(Config storage, Map<List<String>, String> levelComments) {
|
||||
this.storage = storage;
|
||||
super(storage);
|
||||
this.levelComments = levelComments;
|
||||
}
|
||||
|
||||
public boolean isCorrect(CommentedConfig config) {
|
||||
return correct(storage, config, null, null, null, true) == 0;
|
||||
return correct(this.config, config, null, null, null, true) == 0;
|
||||
}
|
||||
|
||||
public int correct(CommentedConfig config) {
|
||||
|
@ -68,7 +71,7 @@ public class ForgeConfigSpec
|
|||
}
|
||||
public int correct(CommentedConfig config, CorrectionListener listener) {
|
||||
LinkedList<String> parentPath = new LinkedList<>(); //Linked list for fast add/removes
|
||||
return correct(storage, config, parentPath, Collections.unmodifiableList(parentPath), listener, false);
|
||||
return correct(this.config, config, parentPath, Collections.unmodifiableList(parentPath), listener, false);
|
||||
}
|
||||
|
||||
private int correct(Config spec, CommentedConfig config, LinkedList<String> parentPath, List<String> parentPathUnmodifiable, CorrectionListener listener, boolean dryRun)
|
||||
|
@ -166,6 +169,8 @@ public class ForgeConfigSpec
|
|||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class Builder
|
||||
{
|
||||
private final Config storage = InMemoryFormat.withUniversalSupport().createConfig();
|
||||
|
|
|
@ -1054,4 +1054,17 @@ public interface IForgeBlock
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the top is consider 'solid'. This is a helper for getBlockFaceShape(UP) == SOLID.
|
||||
* Sadly some vanilla logic doesn't sync this value, so we have to have this special function.
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @return True if the top is considered solid
|
||||
*/
|
||||
default boolean isTopSolid(IBlockState state, IWorldReader world, BlockPos pos)
|
||||
{
|
||||
return state.isTopSolid();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -912,6 +912,19 @@ public interface IForgeBlockState
|
|||
return getBlockState().getBlock().isBurning(getBlockState(), world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the top is consider 'solid'. This is a helper for getBlockFaceShape(UP) == SOLID.
|
||||
* Sadly some vanilla logic doesn't sync this value, so we have to have this special function.
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @return True if the top is considered solid
|
||||
*/
|
||||
default boolean isTopSolid(IWorldReader world, BlockPos pos)
|
||||
{
|
||||
return getBlockState().getBlock().isTopSolid(getBlockState(), world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@code PathNodeType} for this block. Return {@code null} for vanilla behavior.
|
||||
*
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.passive.HorseArmorType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -269,10 +270,10 @@ public interface IForgeItem
|
|||
* for cleaner control over the update of the item without having to write a
|
||||
* subclass.
|
||||
*
|
||||
* @param entityItem The entity Item
|
||||
* @param entity The entity Item
|
||||
* @return Return true to skip any further update code.
|
||||
*/
|
||||
default boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem)
|
||||
default boolean onEntityItemUpdate(ItemStack stack, EntityItem entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -421,11 +422,10 @@ public interface IForgeItem
|
|||
/**
|
||||
* Called when a entity tries to play the 'swing' animation.
|
||||
*
|
||||
* @param entityLiving The entity swinging the item.
|
||||
* @param stack The Item stack
|
||||
* @param entity The entity swinging the item.
|
||||
* @return True to cancel any further processing by EntityLiving
|
||||
*/
|
||||
default boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack)
|
||||
default boolean onEntitySwing(ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -744,20 +744,15 @@ public interface IForgeItem
|
|||
return HorseArmorType.getByItem(stack.getItem());
|
||||
}
|
||||
|
||||
default String getHorseArmorTexture(EntityLiving wearer, ItemStack stack)
|
||||
{
|
||||
return getHorseArmorType(stack).getTextureName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called every tick from {@link EntityHorse#onUpdate()} on the item in the
|
||||
* armor slot.
|
||||
*
|
||||
* @param stack the armor itemstack
|
||||
* @param world the world the horse is in
|
||||
* @param horse the horse wearing this armor
|
||||
* @param armor the armor itemstack
|
||||
*/
|
||||
default void onHorseArmorTick(World world, EntityLiving horse, ItemStack armor)
|
||||
default void onHorseArmorTick(ItemStack stack, World world, EntityLiving horse)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -26,14 +26,23 @@ import javax.annotation.Nullable;
|
|||
import net.minecraft.block.state.BlockWorldState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.passive.HorseArmorType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
||||
|
||||
|
@ -178,4 +187,117 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
|
|||
{
|
||||
return getStack().getItem().getItemEnchantability(getStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this to set a non-default armor slot for an ItemStack, but <em>do
|
||||
* not use this to get the armor slot of said stack; for that, use
|
||||
* {@link net.minecraft.entity.EntityLiving#getSlotForItemStack(ItemStack)}.</em>
|
||||
*
|
||||
* @return the armor slot of the ItemStack, or {@code null} to let the default
|
||||
* vanilla logic as per {@code EntityLiving.getSlotForItemStack(stack)}
|
||||
* decide
|
||||
*/
|
||||
@Nullable
|
||||
default EntityEquipmentSlot getEquipmentSlot()
|
||||
{
|
||||
return getStack().getItem().getEquipmentSlot(getStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this Item disable a shield
|
||||
*
|
||||
* @param shield The shield in question
|
||||
* @param entity The EntityLivingBase holding the shield
|
||||
* @param attacker The EntityLivingBase holding the ItemStack
|
||||
* @retrun True if this ItemStack can disable the shield in question.
|
||||
*/
|
||||
default boolean canDisableShield(ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker)
|
||||
{
|
||||
return getStack().getItem().canDisableShield(getStack(), shield, entity, attacker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this Item a shield
|
||||
*
|
||||
* @param entity The Entity holding the ItemStack
|
||||
* @return True if the ItemStack is considered a shield
|
||||
*/
|
||||
default boolean isShield(@Nullable EntityLivingBase entity)
|
||||
{
|
||||
return getStack().getItem().isShield(getStack(), entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a entity tries to play the 'swing' animation.
|
||||
*
|
||||
* @param entity The entity swinging the item.
|
||||
* @return True to cancel any further processing by EntityLiving
|
||||
*/
|
||||
default boolean onEntitySwing(EntityLivingBase entity)
|
||||
{
|
||||
return getStack().getItem().onEntitySwing(getStack(), entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called each tick while using an item.
|
||||
*
|
||||
* @param player The Player using the item
|
||||
* @param count The amount of time in tick the item has been used for
|
||||
* continuously
|
||||
*/
|
||||
default void onUsingTick(EntityLivingBase player, int count)
|
||||
{
|
||||
getStack().getItem().onUsingTick(getStack(), player, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the normal 'lifespan' of this item when it is dropped on the ground
|
||||
* as a EntityItem. This is in ticks, standard result is 6000, or 5 mins.
|
||||
*
|
||||
* @param world The world the entity is in
|
||||
* @return The normal lifespan in ticks.
|
||||
*/
|
||||
default int getEntityLifespan(World world)
|
||||
{
|
||||
return getStack().getItem().getEntityLifespan(getStack(), world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the default implemetation of EntityItem's onUpdate method, allowing
|
||||
* for cleaner control over the update of the item without having to write a
|
||||
* subclass.
|
||||
*
|
||||
* @param entity The entity Item
|
||||
* @return Return true to skip any further update code.
|
||||
*/
|
||||
default boolean onEntityItemUpdate(EntityItem entity)
|
||||
{
|
||||
return getStack().getItem().onEntityItemUpdate(getStack(), entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum constant of type {@code HorseArmorType}. The returned enum
|
||||
* constant will be used to determine the armor value and texture of this item
|
||||
* when equipped.
|
||||
*
|
||||
* @return an enum constant of type {@code HorseArmorType}. Return
|
||||
* HorseArmorType.NONE if this is not horse armor
|
||||
*/
|
||||
default HorseArmorType getHorseArmorType()
|
||||
{
|
||||
return getStack().getItem().getHorseArmorType(getStack());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called every tick from {@link EntityHorse#onUpdate()} on the item in the
|
||||
* armor slot.
|
||||
*
|
||||
* @param world the world the horse is in
|
||||
* @param horse the horse wearing this armor
|
||||
*/
|
||||
default void onHorseArmorTick(World world, EntityLiving horse)
|
||||
{
|
||||
getStack().getItem().onHorseArmorTick(getStack(), world, horse);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -52,11 +52,11 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
public class LivingDropsEvent extends LivingEvent
|
||||
{
|
||||
private final DamageSource source;
|
||||
private final List<EntityItem> drops;
|
||||
private final Collection<EntityItem> drops;
|
||||
private final int lootingLevel;
|
||||
private final boolean recentlyHit;
|
||||
|
||||
public LivingDropsEvent(EntityLivingBase entity, DamageSource source, List<EntityItem> drops, int lootingLevel, boolean recentlyHit)
|
||||
public LivingDropsEvent(EntityLivingBase entity, DamageSource source, Collection<EntityItem> drops, int lootingLevel, boolean recentlyHit)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
|
@ -70,7 +70,7 @@ public class LivingDropsEvent extends LivingEvent
|
|||
return source;
|
||||
}
|
||||
|
||||
public List<EntityItem> getDrops()
|
||||
public Collection<EntityItem> getDrops()
|
||||
{
|
||||
return drops;
|
||||
}
|
||||
|
|
|
@ -351,8 +351,8 @@ public class VillagerRegistry
|
|||
throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof);
|
||||
}
|
||||
|
||||
if (prof != entity.getForgeProfession())
|
||||
entity.setForgeProfession(prof);
|
||||
if (prof != entity.getProfessionForge())
|
||||
entity.setProfession(prof);
|
||||
}
|
||||
|
||||
@Deprecated public static VillagerProfession getById(int network){ return INSTANCE.REGISTRY.get(network); }
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.capabilities.OptionalCapabilityInstance;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
@ -192,4 +193,14 @@ public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiabl
|
|||
|
||||
return slots.get(slot);
|
||||
}
|
||||
|
||||
public static OptionalCapabilityInstance<IItemHandlerModifiable>[] create(EntityLivingBase entity)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
OptionalCapabilityInstance<IItemHandlerModifiable>[] ret = new OptionalCapabilityInstance[3];
|
||||
ret[0] = OptionalCapabilityInstance.of(() -> new EntityHandsInvWrapper(entity));
|
||||
ret[1] = OptionalCapabilityInstance.of(() -> new EntityArmorInvWrapper(entity));
|
||||
ret[2] = OptionalCapabilityInstance.of(() -> new CombinedInvWrapper(ret[0].orElse(null), ret[1].orElse(null)));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue