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