2012-08-09 10:06:41 +00:00
|
|
|
--- ../src_base/common/net/minecraft/src/Entity.java
|
|
|
|
+++ ../src_work/common/net/minecraft/src/Entity.java
|
|
|
|
@@ -2,6 +2,8 @@
|
2012-08-06 22:07:53 +00:00
|
|
|
|
2012-08-09 10:06:41 +00:00
|
|
|
import cpw.mods.fml.common.Side;
|
|
|
|
import cpw.mods.fml.common.asm.SideOnly;
|
|
|
|
+
|
2012-08-06 22:07:53 +00:00
|
|
|
+import java.util.ArrayList;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Random;
|
2012-08-09 10:06:41 +00:00
|
|
|
@@ -186,6 +188,10 @@
|
|
|
|
public boolean ignoreFrustumCheck;
|
2012-08-06 22:07:53 +00:00
|
|
|
public boolean isAirBorne;
|
|
|
|
public EnumEntitySize myEntitySize;
|
|
|
|
+ /** Forge: Used to store custom data for each entity. */
|
|
|
|
+ private NBTTagCompound customEntityData;
|
|
|
|
+ protected boolean captureDrops = false;
|
|
|
|
+ protected ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
|
2012-08-09 10:06:41 +00:00
|
|
|
|
2012-08-06 22:07:53 +00:00
|
|
|
public Entity(World par1World)
|
|
|
|
{
|
2012-08-09 10:06:41 +00:00
|
|
|
@@ -1382,6 +1388,10 @@
|
2012-08-06 22:07:53 +00:00
|
|
|
par1NBTTagCompound.setShort("Fire", (short)this.fire);
|
|
|
|
par1NBTTagCompound.setShort("Air", (short)this.getAir());
|
|
|
|
par1NBTTagCompound.setBoolean("OnGround", this.onGround);
|
|
|
|
+ if (customEntityData != null)
|
|
|
|
+ {
|
|
|
|
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
|
|
|
|
+ }
|
|
|
|
this.writeEntityToNBT(par1NBTTagCompound);
|
|
|
|
}
|
|
|
|
|
2012-08-09 10:06:41 +00:00
|
|
|
@@ -1423,6 +1433,10 @@
|
2012-08-06 22:07:53 +00:00
|
|
|
this.onGround = par1NBTTagCompound.getBoolean("OnGround");
|
|
|
|
this.setPosition(this.posX, this.posY, this.posZ);
|
|
|
|
this.setRotation(this.rotationYaw, this.rotationPitch);
|
|
|
|
+ if (par1NBTTagCompound.hasKey("ForgeData"))
|
|
|
|
+ {
|
|
|
|
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
|
|
|
|
+ }
|
|
|
|
this.readEntityFromNBT(par1NBTTagCompound);
|
|
|
|
}
|
|
|
|
|
2012-08-09 10:06:41 +00:00
|
|
|
@@ -1509,7 +1523,14 @@
|
2012-08-06 22:07:53 +00:00
|
|
|
{
|
|
|
|
EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
|
|
|
|
var3.delayBeforeCanPickup = 10;
|
|
|
|
- this.worldObj.spawnEntityInWorld(var3);
|
|
|
|
+ if (captureDrops)
|
|
|
|
+ {
|
|
|
|
+ capturedDrops.add(var3);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ this.worldObj.spawnEntityInWorld(var3);
|
|
|
|
+ }
|
|
|
|
return var3;
|
|
|
|
}
|
|
|
|
|
2012-08-09 10:06:41 +00:00
|
|
|
@@ -1843,7 +1864,7 @@
|
2012-08-06 22:07:53 +00:00
|
|
|
*/
|
|
|
|
public boolean isRiding()
|
|
|
|
{
|
|
|
|
- return this.ridingEntity != null || this.getFlag(2);
|
|
|
|
+ return (this.ridingEntity != null && ridingEntity.shouldRiderSit()) || this.getFlag(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-08-09 10:06:41 +00:00
|
|
|
@@ -2107,4 +2128,27 @@
|
2012-08-06 22:07:53 +00:00
|
|
|
{
|
|
|
|
return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] {this.getClass().getSimpleName(), this.getEntityName(), Integer.valueOf(this.entityId), this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(), Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)});
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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;
|
|
|
|
+ }
|
2012-08-09 10:06:41 +00:00
|
|
|
+
|
2012-08-06 22:07:53 +00:00
|
|
|
+ /**
|
|
|
|
+ * 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;
|
|
|
|
+ }
|
|
|
|
}
|