mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 05:02:18 +00:00
475 lines
21 KiB
Diff
475 lines
21 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/Entity.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/Entity.java
|
|
@@ -85,7 +85,7 @@
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
-public abstract class Entity implements ICommandSender
|
|
+public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable<NBTTagCompound>
|
|
{
|
|
private static final Logger field_184243_a = LogManager.getLogger();
|
|
private static final List<ItemStack> field_190535_b = Collections.<ItemStack>emptyList();
|
|
@@ -177,6 +177,10 @@
|
|
private boolean field_184237_aG;
|
|
private final double[] field_191505_aI;
|
|
private long field_191506_aJ;
|
|
+ /**
|
|
+ * Setting this to true will prevent the world from calling {@link #onUpdate()} for this entity.
|
|
+ */
|
|
+ public boolean updateBlocked;
|
|
|
|
public Entity(World p_i1582_1_)
|
|
{
|
|
@@ -200,7 +204,7 @@
|
|
|
|
if (p_i1582_1_ != null)
|
|
{
|
|
- this.field_71093_bK = p_i1582_1_.field_73011_w.func_186058_p().func_186068_a();
|
|
+ this.field_71093_bK = p_i1582_1_.field_73011_w.getDimension();
|
|
}
|
|
|
|
this.field_70180_af = new EntityDataManager(this);
|
|
@@ -211,8 +215,16 @@
|
|
this.field_70180_af.func_187214_a(field_184234_aB, Boolean.valueOf(false));
|
|
this.field_70180_af.func_187214_a(field_189655_aD, Boolean.valueOf(false));
|
|
this.func_70088_a();
|
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this));
|
|
+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this);
|
|
}
|
|
|
|
+ /** Forge: Used to store custom data for each entity. */
|
|
+ private NBTTagCompound customEntityData;
|
|
+ public boolean captureDrops = false;
|
|
+ public java.util.ArrayList<EntityItem> capturedDrops = new java.util.ArrayList<EntityItem>();
|
|
+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
|
|
+
|
|
public int func_145782_y()
|
|
{
|
|
return this.field_145783_c;
|
|
@@ -344,6 +356,7 @@
|
|
this.field_70165_t = p_70107_1_;
|
|
this.field_70163_u = p_70107_3_;
|
|
this.field_70161_v = p_70107_5_;
|
|
+ if (!this.field_70170_p.field_72995_K && this.isAddedToWorld()) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving.
|
|
float f = this.field_70130_N / 2.0F;
|
|
float f1 = this.field_70131_O;
|
|
this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f));
|
|
@@ -995,6 +1008,7 @@
|
|
this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D;
|
|
this.field_70163_u = axisalignedbb.field_72338_b;
|
|
this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D;
|
|
+ if (!this.field_70170_p.field_72995_K && this.isAddedToWorld()) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving.
|
|
}
|
|
|
|
protected SoundEvent func_184184_Z()
|
|
@@ -1053,7 +1067,7 @@
|
|
|
|
protected void func_180429_a(BlockPos p_180429_1_, Block p_180429_2_)
|
|
{
|
|
- SoundType soundtype = p_180429_2_.func_185467_w();
|
|
+ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p.func_180495_p(p_180429_1_), field_70170_p, p_180429_1_, this);
|
|
|
|
if (this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150431_aC)
|
|
{
|
|
@@ -1259,6 +1273,7 @@
|
|
BlockPos blockpos = new BlockPos(i, j, k);
|
|
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
|
|
|
+ if(!iblockstate.func_177230_c().addRunningEffects(iblockstate, field_70170_p, blockpos, this))
|
|
if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE)
|
|
{
|
|
this.field_70170_p.func_175688_a(EnumParticleTypes.BLOCK_CRACK, this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D, Block.func_176210_f(iblockstate));
|
|
@@ -1277,12 +1292,12 @@
|
|
BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v);
|
|
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
|
|
|
+ Boolean result = iblockstate.func_177230_c().isEntityInsideMaterial(this.field_70170_p, blockpos, iblockstate, this, d0, p_70055_1_, true);
|
|
+ if (result != null) return result;
|
|
+
|
|
if (iblockstate.func_185904_a() == p_70055_1_)
|
|
{
|
|
- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F;
|
|
- float f1 = (float)(blockpos.func_177956_o() + 1) - f;
|
|
- boolean flag = d0 < (double)f1;
|
|
- return !flag && this instanceof EntityPlayer ? false : flag;
|
|
+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(p_70055_1_, this, blockpos);
|
|
}
|
|
else
|
|
{
|
|
@@ -1382,6 +1397,7 @@
|
|
this.field_70126_B -= 360.0F;
|
|
}
|
|
|
|
+ if (!this.field_70170_p.field_72995_K) this.field_70170_p.func_72964_e((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded.
|
|
this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v);
|
|
this.func_70101_b(p_70080_7_, p_70080_8_);
|
|
}
|
|
@@ -1707,6 +1723,7 @@
|
|
{
|
|
p_189511_1_.func_74757_a("Glowing", this.field_184238_ar);
|
|
}
|
|
+ p_189511_1_.func_74757_a("UpdateBlocked", updateBlocked);
|
|
|
|
if (!this.field_184236_aF.isEmpty())
|
|
{
|
|
@@ -1720,6 +1737,9 @@
|
|
p_189511_1_.func_74782_a("Tags", nbttaglist);
|
|
}
|
|
|
|
+ if (customEntityData != null) p_189511_1_.func_74782_a("ForgeData", customEntityData);
|
|
+ if (this.capabilities != null) p_189511_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT());
|
|
+
|
|
this.func_70014_b(p_189511_1_);
|
|
|
|
if (this.func_184207_aI())
|
|
@@ -1826,7 +1846,11 @@
|
|
this.func_174810_b(p_70020_1_.func_74767_n("Silent"));
|
|
this.func_189654_d(p_70020_1_.func_74767_n("NoGravity"));
|
|
this.func_184195_f(p_70020_1_.func_74767_n("Glowing"));
|
|
+ updateBlocked = p_70020_1_.func_74767_n("UpdateBlocked");
|
|
|
|
+ if (p_70020_1_.func_74764_b("ForgeData")) customEntityData = p_70020_1_.func_74775_l("ForgeData");
|
|
+ if (this.capabilities != null && p_70020_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_70020_1_.func_74775_l("ForgeCaps"));
|
|
+
|
|
if (p_70020_1_.func_150297_b("Tags", 9))
|
|
{
|
|
this.field_184236_aF.clear();
|
|
@@ -1918,7 +1942,10 @@
|
|
{
|
|
EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_);
|
|
entityitem.func_174869_p();
|
|
- this.field_70170_p.func_72838_d(entityitem);
|
|
+ if (captureDrops)
|
|
+ this.capturedDrops.add(entityitem);
|
|
+ else
|
|
+ this.field_70170_p.func_72838_d(entityitem);
|
|
return entityitem;
|
|
}
|
|
}
|
|
@@ -1985,6 +2012,7 @@
|
|
this.field_70159_w = 0.0D;
|
|
this.field_70181_x = 0.0D;
|
|
this.field_70179_y = 0.0D;
|
|
+ if(!updateBlocked)
|
|
this.func_70071_h_();
|
|
|
|
if (this.func_184218_aH())
|
|
@@ -2032,6 +2060,7 @@
|
|
}
|
|
}
|
|
|
|
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false;
|
|
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this))
|
|
{
|
|
if (this.func_184218_aH())
|
|
@@ -2067,6 +2096,7 @@
|
|
if (this.field_184239_as != null)
|
|
{
|
|
Entity entity = this.field_184239_as;
|
|
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return;
|
|
this.field_184239_as = null;
|
|
entity.func_184225_p(this);
|
|
}
|
|
@@ -2509,8 +2539,16 @@
|
|
@Nullable
|
|
public Entity func_184204_a(int p_184204_1_)
|
|
{
|
|
+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return null;
|
|
+ return changeDimension(p_184204_1_, this.func_184102_h().func_71218_a(p_184204_1_).func_85176_s());
|
|
+ }
|
|
+
|
|
+ @Nullable // Forge: Entities that require custom handling should override this method, not the other
|
|
+ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter)
|
|
+ {
|
|
if (!this.field_70170_p.field_72995_K && !this.field_70128_L)
|
|
{
|
|
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null;
|
|
this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
|
|
MinecraftServer minecraftserver = this.func_184102_h();
|
|
int i = this.field_71093_bK;
|
|
@@ -2518,7 +2556,7 @@
|
|
WorldServer worldserver1 = minecraftserver.func_71218_a(p_184204_1_);
|
|
this.field_71093_bK = p_184204_1_;
|
|
|
|
- if (i == 1 && p_184204_1_ == 1)
|
|
+ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla())
|
|
{
|
|
worldserver1 = minecraftserver.func_71218_a(0);
|
|
this.field_71093_bK = 0;
|
|
@@ -2529,22 +2567,23 @@
|
|
this.field_70170_p.field_72984_F.func_76320_a("reposition");
|
|
BlockPos blockpos;
|
|
|
|
- if (p_184204_1_ == 1)
|
|
+ if (p_184204_1_ == 1 && teleporter.isVanilla())
|
|
{
|
|
blockpos = worldserver1.func_180504_m();
|
|
}
|
|
else
|
|
{
|
|
- double d0 = this.field_70165_t;
|
|
- double d1 = this.field_70161_v;
|
|
+ double moveFactor = worldserver.field_73011_w.getMovementFactor() / worldserver1.field_73011_w.getMovementFactor();
|
|
+ double d0 = MathHelper.func_151237_a(this.field_70165_t * moveFactor, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D);
|
|
+ double d1 = MathHelper.func_151237_a(this.field_70161_v * moveFactor, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D);
|
|
double d2 = 8.0D;
|
|
|
|
- if (p_184204_1_ == -1)
|
|
+ if (false && p_184204_1_ == -1)
|
|
{
|
|
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);
|
|
}
|
|
- else if (p_184204_1_ == 0)
|
|
+ else if (false && p_184204_1_ == 0)
|
|
{
|
|
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);
|
|
@@ -2554,8 +2593,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);
|
|
- Teleporter teleporter = worldserver1.func_85176_s();
|
|
- teleporter.func_180620_b(this, f);
|
|
+ teleporter.placeEntity(worldserver1, this, f);
|
|
blockpos = new BlockPos(this);
|
|
}
|
|
|
|
@@ -2567,7 +2605,7 @@
|
|
{
|
|
entity.func_180432_n(this);
|
|
|
|
- if (i == 1 && p_184204_1_ == 1)
|
|
+ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla())
|
|
{
|
|
BlockPos blockpos1 = worldserver1.func_175672_r(worldserver1.func_175694_M());
|
|
entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A);
|
|
@@ -2604,7 +2642,7 @@
|
|
|
|
public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_)
|
|
{
|
|
- return p_180428_4_.func_177230_c().func_149638_a(this);
|
|
+ return p_180428_4_.func_177230_c().getExplosionResistance(p_180428_2_, p_180428_3_, this, p_180428_1_);
|
|
}
|
|
|
|
public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_)
|
|
@@ -2901,6 +2939,218 @@
|
|
EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_);
|
|
}
|
|
|
|
+ /* ================================== Forge Start =====================================*/
|
|
+ /**
|
|
+ * Internal use for keeping track of entities that are tracked by a world, to
|
|
+ * allow guarantees that entity position changes will force a chunk load, avoiding
|
|
+ * potential issues with entity desyncing and bad chunk data.
|
|
+ */
|
|
+ private boolean isAddedToWorld;
|
|
+
|
|
+ /**
|
|
+ * Gets whether this entity has been added to a world (for tracking). Specifically
|
|
+ * between the times when an entity is added to a world and the entity being removed
|
|
+ * from the world's tracked lists. See {@link World#onEntityAdded(Entity)} and
|
|
+ * {@link World#onEntityRemoved(Entity)}.
|
|
+ *
|
|
+ * @return True if this entity is being tracked by a world
|
|
+ */
|
|
+ public final boolean isAddedToWorld() { return this.isAddedToWorld; }
|
|
+
|
|
+ /**
|
|
+ * Called after the entity has been added to the world's
|
|
+ * ticking list. Can be overriden, but needs to call super
|
|
+ * to prevent MC-136995.
|
|
+ */
|
|
+ public void onAddedToWorld() {
|
|
+ this.isAddedToWorld = true;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Called after the entity has been removed to the world's
|
|
+ * ticking list. Can be overriden, but needs to call super
|
|
+ * to prevent MC-136995.
|
|
+ */
|
|
+ public void onRemovedFromWorld() {
|
|
+ this.isAddedToWorld = false;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns a NBTTagCompound that can be used to store custom data for this entity.
|
|
+ * It will be written, and read from disc, so it persists over world saves.
|
|
+ * @return A NBTTagCompound
|
|
+ */
|
|
+ public NBTTagCompound getEntityData()
|
|
+ {
|
|
+ if (customEntityData == null)
|
|
+ {
|
|
+ customEntityData = new NBTTagCompound();
|
|
+ }
|
|
+ return customEntityData;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
|
|
+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.
|
|
+ */
|
|
+ public boolean shouldRiderSit()
|
|
+ {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Called when a user uses the creative pick block button on this entity.
|
|
+ *
|
|
+ * @param target The full target the player is looking at
|
|
+ * @return A ItemStack to add to the player's inventory, empty ItemStack if nothing should be added.
|
|
+ */
|
|
+ public ItemStack getPickedResult(RayTraceResult target)
|
|
+ {
|
|
+ if (this instanceof net.minecraft.entity.item.EntityPainting)
|
|
+ {
|
|
+ return new ItemStack(net.minecraft.init.Items.field_151159_an);
|
|
+ }
|
|
+ else if (this instanceof EntityLeashKnot)
|
|
+ {
|
|
+ return new ItemStack(net.minecraft.init.Items.field_151058_ca);
|
|
+ }
|
|
+ else if (this instanceof net.minecraft.entity.item.EntityItemFrame)
|
|
+ {
|
|
+ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).func_82335_i();
|
|
+ if (held.func_190926_b())
|
|
+ {
|
|
+ return new ItemStack(net.minecraft.init.Items.field_151160_bD);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ return held.func_77946_l();
|
|
+ }
|
|
+ }
|
|
+ else if (this instanceof net.minecraft.entity.item.EntityMinecart)
|
|
+ {
|
|
+ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem();
|
|
+ }
|
|
+ else if (this instanceof net.minecraft.entity.item.EntityBoat)
|
|
+ {
|
|
+ return new ItemStack(((EntityBoat)this).func_184455_j());
|
|
+ }
|
|
+ else if (this instanceof net.minecraft.entity.item.EntityArmorStand)
|
|
+ {
|
|
+ return new ItemStack(net.minecraft.init.Items.field_179565_cj);
|
|
+ }
|
|
+ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal)
|
|
+ {
|
|
+ return new ItemStack(net.minecraft.init.Items.field_185158_cP);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ ResourceLocation name = EntityList.func_191301_a(this);
|
|
+ if (name != null && EntityList.field_75627_a.containsKey(name))
|
|
+ {
|
|
+ ItemStack stack = new ItemStack(net.minecraft.init.Items.field_151063_bx);
|
|
+ net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name);
|
|
+ return stack;
|
|
+ }
|
|
+ }
|
|
+ return ItemStack.field_190927_a;
|
|
+ }
|
|
+
|
|
+ public UUID getPersistentID()
|
|
+ {
|
|
+ return field_96093_i;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Reset the entity ID to a new value. Not to be used from Mod code
|
|
+ */
|
|
+ @Deprecated // TODO: remove (1.13?)
|
|
+ public final void resetEntityId()
|
|
+ {
|
|
+ this.field_145783_c = field_70152_a++;
|
|
+ }
|
|
+
|
|
+ public boolean shouldRenderInPass(int pass)
|
|
+ {
|
|
+ return pass == 0;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns true if the entity is of the @link{EnumCreatureType} provided
|
|
+ * @param type The EnumCreatureType type this entity is evaluating
|
|
+ * @param forSpawnCount If this is being invoked to check spawn count caps.
|
|
+ * @return If the creature is of the type provided
|
|
+ */
|
|
+ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount)
|
|
+ {
|
|
+ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).func_104002_bU()) return false;
|
|
+ return type.func_75598_a().isAssignableFrom(this.getClass());
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * If a rider of this entity can interact with this entity. Should return true on the
|
|
+ * ridden entity if so.
|
|
+ *
|
|
+ * @return if the entity can be interacted with from a rider
|
|
+ */
|
|
+ public boolean canRiderInteract()
|
|
+ {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * If the rider should be dismounted from the entity when the entity goes under water
|
|
+ *
|
|
+ * @param rider The entity that is riding
|
|
+ * @return if the entity should be dismounted when under water
|
|
+ */
|
|
+ public boolean shouldDismountInWater(Entity rider)
|
|
+ {
|
|
+ return this instanceof EntityLivingBase;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
|
+ {
|
|
+ return capabilities != null && capabilities.hasCapability(capability, facing);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ @Nullable
|
|
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
|
+ {
|
|
+ return capabilities == null ? null : capabilities.getCapability(capability, facing);
|
|
+ }
|
|
+
|
|
+ public void deserializeNBT(NBTTagCompound nbt)
|
|
+ {
|
|
+ this.func_70020_e(nbt);
|
|
+ }
|
|
+
|
|
+ public NBTTagCompound serializeNBT()
|
|
+ {
|
|
+ NBTTagCompound ret = new NBTTagCompound();
|
|
+ ret.func_74778_a("id", this.func_70022_Q());
|
|
+ return this.func_189511_e(ret);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Checks if this {@link Entity} can trample a {@link Block}.
|
|
+ *
|
|
+ * @param world The world in which the block will be trampled
|
|
+ * @param block The block being tested
|
|
+ * @param pos The block pos
|
|
+ * @param fallDistance The fall distance
|
|
+ * @return {@code true} if this entity can trample, {@code false} otherwise
|
|
+ */
|
|
+ public boolean canTrample(World world, Block block, BlockPos pos, float fallDistance)
|
|
+ {
|
|
+ return world.field_73012_v.nextFloat() < fallDistance - 0.5F
|
|
+ && this instanceof EntityLivingBase
|
|
+ && (this instanceof EntityPlayer || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this))
|
|
+ && this.field_70130_N * this.field_70130_N * this.field_70131_O > 0.512F;
|
|
+ }
|
|
+ /* ================================== Forge End =====================================*/
|
|
+
|
|
public void func_184178_b(EntityPlayerMP p_184178_1_)
|
|
{
|
|
}
|