436 lines
23 KiB
Diff
436 lines
23 KiB
Diff
--- a/net/minecraft/entity/EntityLivingBase.java
|
|
+++ b/net/minecraft/entity/EntityLivingBase.java
|
|
@@ -92,6 +92,8 @@
|
|
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);
|
|
+ public static final net.minecraft.entity.ai.attributes.IAttribute NAMETAG_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_111112_a(true);
|
|
protected static final DataParameter<Byte> field_184621_as = EntityDataManager.func_187226_a(EntityLivingBase.class, DataSerializers.field_187191_a);
|
|
private static final DataParameter<Float> field_184632_c = EntityDataManager.func_187226_a(EntityLivingBase.class, DataSerializers.field_187193_c);
|
|
private static final DataParameter<Integer> field_184633_f = EntityDataManager.func_187226_a(EntityLivingBase.class, DataSerializers.field_187192_b);
|
|
@@ -199,6 +201,8 @@
|
|
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);
|
|
+ this.func_110140_aT().func_111150_b(NAMETAG_DISTANCE);
|
|
}
|
|
|
|
protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, IBlockState p_184231_4_, BlockPos p_184231_5_) {
|
|
@@ -208,9 +212,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 +279,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 +361,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 +418,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 +591,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 +631,27 @@
|
|
}
|
|
}
|
|
|
|
+ /***
|
|
+ * Removes all potion effects that have curativeItem as a curative item for its effect
|
|
+ * @param curativeItem The itemstack we are using to cure potion effects
|
|
+ */
|
|
+ public boolean curePotionEffects(ItemStack curativeItem) {
|
|
+ if (this.field_70170_p.field_72995_K)
|
|
+ return false;
|
|
+ boolean ret = false;
|
|
+ Iterator<PotionEffect> itr = this.field_70713_bf.values().iterator();
|
|
+ while (itr.hasNext()) {
|
|
+ PotionEffect effect = itr.next();
|
|
+ if (effect.isCurativeItem(curativeItem)) {
|
|
+ this.func_70688_c(effect);
|
|
+ itr.remove();
|
|
+ ret = true;
|
|
+ this.field_70752_e = true;
|
|
+ }
|
|
+ }
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
public Collection<PotionEffect> func_70651_bq() {
|
|
return this.field_70713_bf.values();
|
|
}
|
|
@@ -714,6 +744,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 +762,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) {
|
|
@@ -790,8 +823,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;
|
|
@@ -941,11 +974,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();
|
|
@@ -960,15 +994,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);
|
|
@@ -984,6 +1019,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_);
|
|
@@ -1028,12 +1066,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);
|
|
}
|
|
}
|
|
|
|
@@ -1053,6 +1086,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);
|
|
@@ -1065,7 +1101,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);
|
|
}
|
|
}
|
|
@@ -1134,6 +1170,8 @@
|
|
|
|
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_;
|
|
@@ -1144,10 +1182,11 @@
|
|
((EntityPlayerMP)p_70665_1_.func_76346_g()).func_195067_a(StatList.field_212735_F, Math.round(f1 * 10.0F));
|
|
}
|
|
|
|
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_);
|
|
if (p_70665_2_ != 0.0F) {
|
|
float f2 = this.func_110143_aJ();
|
|
- this.func_70606_j(f2 - p_70665_2_);
|
|
this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
|
|
+ this.func_70606_j(f2 - p_70665_2_); // Forge: moved to fix MC-121048
|
|
this.func_110149_m(this.func_110139_bj() - p_70665_2_);
|
|
}
|
|
}
|
|
@@ -1189,6 +1228,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;
|
|
@@ -1373,18 +1414,18 @@
|
|
double d12 = d6 + d10;
|
|
AxisAlignedBB axisalignedbb1 = axisalignedbb.func_72317_d(d9, 0.0D, d10);
|
|
if (this.field_70170_p.func_195586_b(this, 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(this, 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(this, 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;
|
|
@@ -1439,15 +1480,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() {
|
|
@@ -1518,7 +1560,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);
|
|
@@ -1532,7 +1574,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_()) {
|
|
@@ -1663,6 +1705,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();
|
|
@@ -1694,7 +1737,9 @@
|
|
|
|
ItemStack itemstack1 = this.func_184582_a(entityequipmentslot);
|
|
if (!ItemStack.func_77989_b(itemstack1, itemstack)) {
|
|
+ if (!itemstack1.equals(itemstack, true))
|
|
((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));
|
|
}
|
|
@@ -2134,11 +2179,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 {
|
|
@@ -2172,8 +2224,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);
|
|
@@ -2229,6 +2283,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);
|
|
}
|
|
|
|
@@ -2237,7 +2294,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();
|
|
}
|
|
|
|
@@ -2257,6 +2316,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());
|
|
}
|
|
|
|
@@ -2363,4 +2423,62 @@
|
|
@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.util.LazyOptional<?>[] handlers = net.minecraftforge.items.wrapper.EntityEquipmentInvWrapper.create(this);
|
|
+
|
|
+ @Override
|
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable EnumFacing facing) {
|
|
+ if (this.func_70089_S() && 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);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void remove(boolean keepData) {
|
|
+ super.remove(keepData);
|
|
+ if (!keepData) {
|
|
+ for (int x = 0; x < handlers.length; x++)
|
|
+ handlers[x].invalidate();
|
|
+ }
|
|
+ }
|
|
}
|