Fixed items dieing improperly due to new EntityItem sync changes, also made items render offset when rendered in 3d.
This commit is contained in:
parent
efee38095b
commit
d6c4f37eb5
4 changed files with 37 additions and 19 deletions
|
@ -231,7 +231,7 @@ public class ForgeHooksClient
|
||||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
|
||||||
if (customRenderer == null)
|
if (customRenderer == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION))
|
if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION))
|
||||||
|
|
|
@ -36,8 +36,8 @@ public class ForgeInternalHandler
|
||||||
|
|
||||||
if (stack == null)
|
if (stack == null)
|
||||||
{
|
{
|
||||||
entity.setDead();
|
//entity.setDead();
|
||||||
event.setCanceled(true);
|
//event.setCanceled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,12 @@
|
||||||
|
|
||||||
if (this.field_77024_a)
|
if (this.field_77024_a)
|
||||||
{
|
{
|
||||||
@@ -257,14 +256,7 @@
|
@@ -255,16 +254,16 @@
|
||||||
{
|
|
||||||
GL11.glTranslatef(0.0F, 0.0F, var16 + var17);
|
|
||||||
|
|
||||||
|
for (int var20 = 0; var20 < var24; ++var20)
|
||||||
|
{
|
||||||
|
- GL11.glTranslatef(0.0F, 0.0F, var16 + var17);
|
||||||
|
-
|
||||||
- if (Block.blocksList[var18.itemID] != null)
|
- if (Block.blocksList[var18.itemID] != null)
|
||||||
- {
|
- {
|
||||||
- this.loadTexture("/terrain.png");
|
- this.loadTexture("/terrain.png");
|
||||||
|
@ -100,11 +102,20 @@
|
||||||
- {
|
- {
|
||||||
- this.loadTexture("/gui/items.png");
|
- this.loadTexture("/gui/items.png");
|
||||||
- }
|
- }
|
||||||
|
+ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
|
||||||
|
+ if (var20 > 0)
|
||||||
|
+ {
|
||||||
|
+ float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||||
|
+ float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||||
|
+ float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||||
|
+ GL11.glTranslatef(x, y, var16 + var17);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ this.loadTexture(Item.itemsList[var18.itemID].getTextureFile());
|
+ this.loadTexture(Item.itemsList[var18.itemID].getTextureFile());
|
||||||
|
|
||||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||||
ItemRenderer.renderItemIn2D(var8, var10, var11, var9, var12, var16);
|
ItemRenderer.renderItemIn2D(var8, var10, var11, var9, var12, var16);
|
||||||
@@ -348,10 +340,10 @@
|
@@ -348,10 +347,10 @@
|
||||||
float var13;
|
float var13;
|
||||||
float var16;
|
float var16;
|
||||||
|
|
||||||
|
@ -118,7 +129,7 @@
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel);
|
GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel);
|
||||||
GL11.glScalef(10.0F, 10.0F, 10.0F);
|
GL11.glScalef(10.0F, 10.0F, 10.0F);
|
||||||
@@ -382,11 +374,11 @@
|
@@ -382,11 +381,11 @@
|
||||||
if (Item.itemsList[var6].requiresMultipleRenderPasses())
|
if (Item.itemsList[var6].requiresMultipleRenderPasses())
|
||||||
{
|
{
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
@ -135,7 +146,7 @@
|
||||||
int var11 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, var9);
|
int var11 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, var9);
|
||||||
var12 = (float)(var11 >> 16 & 255) / 255.0F;
|
var12 = (float)(var11 >> 16 & 255) / 255.0F;
|
||||||
var13 = (float)(var11 >> 8 & 255) / 255.0F;
|
var13 = (float)(var11 >> 8 & 255) / 255.0F;
|
||||||
@@ -406,14 +398,7 @@
|
@@ -406,14 +405,7 @@
|
||||||
{
|
{
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
@ -151,7 +162,7 @@
|
||||||
|
|
||||||
var9 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, 0);
|
var9 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, 0);
|
||||||
float var17 = (float)(var9 >> 16 & 255) / 255.0F;
|
float var17 = (float)(var9 >> 16 & 255) / 255.0F;
|
||||||
@@ -440,7 +425,10 @@
|
@@ -440,7 +432,10 @@
|
||||||
{
|
{
|
||||||
if (par3ItemStack != null)
|
if (par3ItemStack != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,7 +146,22 @@
|
@@ -135,7 +146,29 @@
|
||||||
|
|
||||||
++this.age;
|
++this.age;
|
||||||
|
|
||||||
|
@ -41,10 +41,17 @@
|
||||||
+
|
+
|
||||||
+ if (!this.worldObj.isRemote && this.age >= lifespan)
|
+ if (!this.worldObj.isRemote && this.age >= lifespan)
|
||||||
+ {
|
+ {
|
||||||
+ ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj)));
|
+ if (item != null)
|
||||||
+ if (MinecraftForge.EVENT_BUS.post(event))
|
+ {
|
||||||
+ {
|
+ ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj)));
|
||||||
+ lifespan += event.extraLife;
|
+ if (MinecraftForge.EVENT_BUS.post(event))
|
||||||
|
+ {
|
||||||
|
+ lifespan += event.extraLife;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ this.setDead();
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ else
|
+ else
|
||||||
+ {
|
+ {
|
||||||
|
@ -52,11 +59,11 @@
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (item == null || item.stackSize <= 0)
|
+ if (item != null && item.stackSize <= 0)
|
||||||
{
|
{
|
||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
@@ -263,6 +289,7 @@
|
@@ -263,6 +296,7 @@
|
||||||
{
|
{
|
||||||
par1NBTTagCompound.setShort("Health", (short)((byte)this.health));
|
par1NBTTagCompound.setShort("Health", (short)((byte)this.health));
|
||||||
par1NBTTagCompound.setShort("Age", (short)this.age);
|
par1NBTTagCompound.setShort("Age", (short)this.age);
|
||||||
|
@ -64,7 +71,7 @@
|
||||||
|
|
||||||
if (this.func_92014_d() != null)
|
if (this.func_92014_d() != null)
|
||||||
{
|
{
|
||||||
@@ -280,10 +307,17 @@
|
@@ -280,10 +314,17 @@
|
||||||
NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item");
|
NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item");
|
||||||
this.func_92013_a(ItemStack.loadItemStackFromNBT(var2));
|
this.func_92013_a(ItemStack.loadItemStackFromNBT(var2));
|
||||||
|
|
||||||
|
@ -83,7 +90,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -293,10 +327,22 @@
|
@@ -293,10 +334,22 @@
|
||||||
{
|
{
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue