Merge branch 'mithionchanges'

This commit is contained in:
Christian 2013-03-23 22:03:18 -04:00
commit ada4bff990
4 changed files with 50 additions and 50 deletions

View file

@ -56,7 +56,7 @@
public Entity(World par1World) public Entity(World par1World)
{ {
@@ -274,6 +293,14 @@ @@ -274,6 +293,15 @@
this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
this.dataWatcher.addObject(1, Short.valueOf((short)300)); this.dataWatcher.addObject(1, Short.valueOf((short)300));
this.entityInit(); this.entityInit();
@ -65,13 +65,14 @@
+ +
+ MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this)); + MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));
+ +
+ for (IExtendedEntityProperties props : this.extendedProperties.values()){ + for (IExtendedEntityProperties props : this.extendedProperties.values())
+ {
+ props.init(this, par1World); + props.init(this, par1World);
+ } + }
} }
protected abstract void entityInit(); protected abstract void entityInit();
@@ -554,7 +581,7 @@ @@ -554,7 +582,7 @@
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
this.setFlag(0, this.fire > 0); this.setFlag(0, this.fire > 0);
@ -80,7 +81,7 @@
} }
this.firstUpdate = false; this.firstUpdate = false;
@@ -1534,6 +1561,21 @@ @@ -1534,6 +1562,21 @@
par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal); par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal);
par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits()); par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits());
par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits()); par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits());
@ -102,7 +103,7 @@
this.writeEntityToNBT(par1NBTTagCompound); this.writeEntityToNBT(par1NBTTagCompound);
if (this.ridingEntity != null) if (this.ridingEntity != null)
@@ -1604,6 +1646,26 @@ @@ -1604,6 +1647,26 @@
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch); this.setRotation(this.rotationYaw, this.rotationPitch);
@ -129,7 +130,7 @@
this.readEntityFromNBT(par1NBTTagCompound); this.readEntityFromNBT(par1NBTTagCompound);
} }
catch (Throwable throwable) 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 entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
entityitem.delayBeforeCanPickup = 10; entityitem.delayBeforeCanPickup = 10;
@ -145,7 +146,7 @@
return entityitem; return entityitem;
} }
@@ -2056,7 +2125,7 @@ @@ -2056,7 +2126,7 @@
*/ */
public boolean isRiding() 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) 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) 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(); return this.getEntityName();
} }
@ -270,23 +271,28 @@
+ * @param properties The instanceof IExtendedProperties to register + * @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. + * @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){ + public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
+ if (identifier == null){ + {
+ 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."); + FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability.");
+ return ""; + 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."); + FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability.");
+ return ""; + return "";
+ } + }
+ +
+ String baseIdentifier = identifier; + String baseIdentifier = identifier;
+ int identifierModCount = 1; + int identifierModCount = 1;
+ while (this.extendedProperties.containsKey(identifier)){ + while (this.extendedProperties.containsKey(identifier))
+ identifier = String.format("%s%d", baseIdentifier, identifierModCount); + {
+ 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); + 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);
+ } + }
+ +
@ -299,7 +305,8 @@
+ * @param identifier The key that identifies the extended properties. + * @param identifier The key that identifies the extended properties.
+ * @return The instance of IExtendedProperties that was found, or null. + * @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); + return this.extendedProperties.get(identifier);
+ } + }
} }

View file

@ -16,11 +16,11 @@
- this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); - this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ);
- this.getThrower().fallDistance = 0.0F; - this.getThrower().fallDistance = 0.0F;
- this.getThrower().attackEntityFrom(DamageSource.fall, 5); - 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)){ + if (!MinecraftForge.EVENT_BUS.post(event)){
+ this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); + this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
+ this.getThrower().fallDistance = 0.0F; + this.getThrower().fallDistance = 0.0F;
+ this.getThrower().attackEntityFrom(DamageSource.fall, 5); + this.getThrower().attackEntityFrom(DamageSource.fall, event.attackDamage);
+ } + }
+ +
} }

View file

@ -13,7 +13,7 @@
*/ */
protected boolean teleportTo(double par1, double par3, double par5) 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)){ + if (MinecraftForge.EVENT_BUS.post(event)){
+ return false; + return false;
+ } + }
@ -30,15 +30,6 @@
boolean flag = false; boolean flag = false;
int i = MathHelper.floor_double(this.posX); int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY); 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 @@ @@ -439,7 +446,7 @@
} }
} }

View file

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