Update patches!

This commit is contained in:
Christian 2013-03-23 22:02:58 -04:00
parent 300f471c57
commit 177b5123c9
4 changed files with 50 additions and 50 deletions

View file

@ -51,27 +51,28 @@
+ public boolean captureDrops = false;
+ public ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
+ private UUID persistentID;
+
+
+ private HashMap<String, IExtendedEntityProperties> extendedProperties;
public Entity(World par1World)
{
@@ -274,6 +293,14 @@
@@ -274,6 +293,15 @@
this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
this.dataWatcher.addObject(1, Short.valueOf((short)300));
this.entityInit();
+
+
+ extendedProperties = new HashMap<String, IExtendedEntityProperties>();
+
+
+ MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));
+
+ for (IExtendedEntityProperties props : this.extendedProperties.values()){
+
+ for (IExtendedEntityProperties props : this.extendedProperties.values())
+ {
+ props.init(this, par1World);
+ }
}
protected abstract void entityInit();
@@ -554,7 +581,7 @@
@@ -554,7 +582,7 @@
if (!this.worldObj.isRemote)
{
this.setFlag(0, this.fire > 0);
@ -80,7 +81,7 @@
}
this.firstUpdate = false;
@@ -1534,6 +1561,21 @@
@@ -1534,6 +1562,21 @@
par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal);
par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits());
par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits());
@ -88,7 +89,7 @@
+ {
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
+ }
+
+
+ for (String identifier : this.extendedProperties.keySet()){
+ try{
+ IExtendedEntityProperties props = this.extendedProperties.get(identifier);
@ -98,11 +99,11 @@
+ t.printStackTrace();
+ }
+ }
+
+
this.writeEntityToNBT(par1NBTTagCompound);
if (this.ridingEntity != null)
@@ -1604,6 +1646,26 @@
@@ -1604,6 +1647,26 @@
this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch);
@ -110,7 +111,7 @@
+ {
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
+ }
+
+
+ for (String identifier : this.extendedProperties.keySet()){
+ try{
+ IExtendedEntityProperties props = this.extendedProperties.get(identifier);
@ -120,7 +121,7 @@
+ t.printStackTrace();
+ }
+ }
+
+
+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly
+ if (par1NBTTagCompound.hasKey("PersistentIDMSB") && par1NBTTagCompound.hasKey("PersistentIDLSB"))
+ {
@ -129,7 +130,7 @@
this.readEntityFromNBT(par1NBTTagCompound);
}
catch (Throwable throwable)
@@ -1698,7 +1760,14 @@
@@ -1698,7 +1761,14 @@
{
EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
entityitem.delayBeforeCanPickup = 10;
@ -145,7 +146,7 @@
return entityitem;
}
@@ -2056,7 +2125,7 @@
@@ -2056,7 +2126,7 @@
*/
public boolean isRiding()
{
@ -154,7 +155,7 @@
}
/**
@@ -2400,7 +2469,7 @@
@@ -2400,7 +2470,7 @@
public float func_82146_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block)
{
@ -163,7 +164,7 @@
}
public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7)
@@ -2455,4 +2524,139 @@
@@ -2455,4 +2525,145 @@
{
return this.getEntityName();
}
@ -270,36 +271,42 @@
+ * @param properties The instanceof IExtendedProperties to register
+ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique.
+ */
+ public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties){
+ if (identifier == null){
+ public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
+ {
+ if (identifier == null)
+ {
+ FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability.");
+ return "";
+ }
+ if (properties == null){
+ if (properties == null)
+ {
+ FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability.");
+ return "";
+ }
+
+
+ String baseIdentifier = identifier;
+ int identifierModCount = 1;
+ while (this.extendedProperties.containsKey(identifier)){
+ identifier = String.format("%s%d", baseIdentifier, identifierModCount);
+ while (this.extendedProperties.containsKey(identifier))
+ {
+ identifier = String.format("%s%d", baseIdentifier, identifierModCount++);
+ }
+
+ if (baseIdentifier != identifier){
+
+ if (baseIdentifier != identifier)
+ {
+ FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
+ }
+
+
+ this.extendedProperties.put(identifier, properties);
+ return identifier;
+ }
+
+
+ /**
+ * Gets the extended properties identified by the passed in key
+ * @param identifier The key that identifies the extended properties.
+ * @return The instance of IExtendedProperties that was found, or null.
+ */
+ public IExtendedEntityProperties getExtendedProperties(String identifier){
+ public IExtendedEntityProperties getExtendedProperties(String identifier)
+ {
+ return this.extendedProperties.get(identifier);
+ }
}

View file

@ -16,13 +16,13 @@
- this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ);
- this.getThrower().fallDistance = 0.0F;
- this.getThrower().attackEntityFrom(DamageSource.fall, 5);
+ EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ);
+ EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5);
+ if (!MinecraftForge.EVENT_BUS.post(event)){
+ this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
+ this.getThrower().fallDistance = 0.0F;
+ this.getThrower().attackEntityFrom(DamageSource.fall, 5);
+ this.getThrower().attackEntityFrom(DamageSource.fall, event.attackDamage);
+ }
+
+
}
}

View file

@ -13,11 +13,11 @@
*/
protected boolean teleportTo(double par1, double par3, double par5)
{
+ EnderTeleportEvent event = new EnderTeleportEvent(this, par1, par3, par5);
+ EnderTeleportEvent event = new EnderTeleportEvent(this, par1, par3, par5, 0);
+ if (MinecraftForge.EVENT_BUS.post(event)){
+ return false;
+ }
+
+
double d3 = this.posX;
double d4 = this.posY;
double d5 = this.posZ;
@ -30,15 +30,6 @@
boolean flag = false;
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY);
@@ -296,7 +303,7 @@
}
if (flag1)
- {
+ {
this.setPosition(this.posX, this.posY, this.posZ);
if (this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox))
@@ -439,7 +446,7 @@
}
}

View file

@ -316,16 +316,18 @@
{
case 0:
return 90.0F;
@@ -1834,6 +1941,8 @@
}
@@ -1835,6 +1942,10 @@
super.fall(par1);
+ }else{
+ MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(this, par1));
}
+ else
+ {
+ MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(this, par1));
+ }
}
@@ -1876,7 +1985,7 @@
/**
@@ -1876,7 +1987,7 @@
{
if (par1ItemStack.getItem().requiresMultipleRenderPasses())
{
@ -334,7 +336,7 @@
}
if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID)
@@ -1898,6 +2007,7 @@
@@ -1898,6 +2009,7 @@
return Item.bow.func_94599_c(0);
}
}
@ -342,7 +344,7 @@
}
return icon;
@@ -2137,6 +2247,14 @@
@@ -2137,6 +2249,14 @@
}
this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest;
@ -357,7 +359,7 @@
}
/**
@@ -2208,7 +2326,14 @@
@@ -2208,7 +2328,14 @@
*/
public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack)
{