Merge pull request #857 from vlad20012/fix-816
Fix #816 obfuscated field name
This commit is contained in:
commit
1cf283afa8
1 changed files with 23 additions and 4 deletions
|
@ -66,6 +66,26 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
|
|||
private String mOwnerName = "";
|
||||
private NBTTagCompound mRecipeStuff = new NBTTagCompound();
|
||||
|
||||
private static final Field ENTITY_ITEM_HEALTH_FIELD;
|
||||
static
|
||||
{
|
||||
Field f = null;
|
||||
|
||||
try {
|
||||
f = EntityItem.class.getDeclaredField("field_70291_e");
|
||||
f.setAccessible(true);
|
||||
} catch (Exception e1) {
|
||||
try {
|
||||
f = EntityItem.class.getDeclaredField("health");
|
||||
f.setAccessible(true);
|
||||
} catch (Exception e2) {
|
||||
e1.printStackTrace();
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
ENTITY_ITEM_HEALTH_FIELD = f;
|
||||
}
|
||||
|
||||
public BaseMetaTileEntity() {
|
||||
}
|
||||
|
||||
|
@ -1144,10 +1164,9 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
|
|||
tItemEntity.hurtResistantTime = 999999;
|
||||
tItemEntity.lifespan = 60000;
|
||||
try {
|
||||
Field tField = tItemEntity.getClass().getDeclaredField("health");
|
||||
tField.setAccessible(true);
|
||||
tField.setInt(tItemEntity, 99999999);
|
||||
} catch (Exception e) {e.printStackTrace();}
|
||||
if(ENTITY_ITEM_HEALTH_FIELD != null)
|
||||
ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999);
|
||||
} catch (Exception ignored) {}
|
||||
this.worldObj.spawnEntityInWorld(tItemEntity);
|
||||
tItem.stackSize = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue