Fixed #731, render Glass Bell issues

This commit is contained in:
Dynious 2014-10-09 21:10:36 +02:00
parent 17833c0eaa
commit 5189da9612
2 changed files with 8 additions and 43 deletions

View file

@ -80,7 +80,6 @@ public class ItemRendererGlassBell implements IItemRenderer
modelGlassBell.render();
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_ALPHA_TEST);
}
}

View file

@ -1,14 +1,12 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.reference.Colors;
import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import com.pahimar.ee3.util.ColorHelper;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -18,7 +16,7 @@ public class MessageTileEntityGlassBell implements IMessage, IMessageHandler<Mes
public byte orientation;
public byte state;
public String customName, owner;
public int itemId, metaData, stackSize, itemColor;
public ItemStack outputItemStack;
public MessageTileEntityGlassBell()
{
@ -33,21 +31,7 @@ public class MessageTileEntityGlassBell implements IMessage, IMessageHandler<Mes
this.state = (byte) tileEntityGlassBell.getState();
this.customName = tileEntityGlassBell.getCustomName();
this.owner = tileEntityGlassBell.getOwner();
if (outputItemStack != null)
{
this.itemId = Item.getIdFromItem(outputItemStack.getItem());
this.metaData = outputItemStack.getItemDamage();
this.stackSize = outputItemStack.stackSize;
this.itemColor = ColorHelper.getColor(outputItemStack);
}
else
{
this.itemId = -1;
this.metaData = 0;
this.stackSize = 0;
this.itemColor = 0;
}
this.outputItemStack = outputItemStack;
}
@Override
@ -62,10 +46,7 @@ public class MessageTileEntityGlassBell implements IMessage, IMessageHandler<Mes
this.customName = new String(buf.readBytes(customNameLength).array());
int ownerLength = buf.readInt();
this.owner = new String(buf.readBytes(ownerLength).array());
this.itemId = buf.readInt();
this.metaData = buf.readInt();
this.stackSize = buf.readInt();
this.itemColor = buf.readInt();
outputItemStack = ByteBufUtils.readItemStack(buf);
}
@Override
@ -80,10 +61,7 @@ public class MessageTileEntityGlassBell implements IMessage, IMessageHandler<Mes
buf.writeBytes(customName.getBytes());
buf.writeInt(owner.length());
buf.writeBytes(owner.getBytes());
buf.writeInt(itemId);
buf.writeInt(metaData);
buf.writeInt(stackSize);
buf.writeInt(itemColor);
ByteBufUtils.writeItemStack(buf, outputItemStack);
}
@Override
@ -97,19 +75,7 @@ public class MessageTileEntityGlassBell implements IMessage, IMessageHandler<Mes
((TileEntityGlassBell) tileEntity).setState(message.state);
((TileEntityGlassBell) tileEntity).setCustomName(message.customName);
((TileEntityGlassBell) tileEntity).setOwner(message.owner);
ItemStack outputItemStack = null;
if (message.itemId != -1)
{
outputItemStack = new ItemStack(Item.getItemById(message.itemId), message.stackSize, message.metaData);
if (message.itemColor != Integer.parseInt(Colors.PURE_WHITE, 16))
{
ColorHelper.setColor(outputItemStack, itemColor);
}
}
((TileEntityGlassBell) tileEntity).outputItemStack = outputItemStack;
((TileEntityGlassBell) tileEntity).outputItemStack = message.outputItemStack;
//NAME UPDATE
FMLClientHandler.instance().getClient().theWorld.func_147451_t(message.x, message.y, message.z);
@ -121,6 +87,6 @@ public class MessageTileEntityGlassBell implements IMessage, IMessageHandler<Mes
@Override
public String toString()
{
return String.format("MessageTileEntityGlassBell - x:%s, y:%s, z:%s, orientation:%s, state:%s, customName:%s, owner:%s, itemId: %s, metaData: %s, stackSize: %s, itemColor: %s", x, y, z, orientation, state, customName, owner, itemId, metaData, stackSize, itemColor);
return String.format("MessageTileEntityGlassBell - x:%s, y:%s, z:%s, orientation:%s, state:%s, customName:%s, owner:%s, outputItemStack: %s", x, y, z, orientation, state, customName, owner, outputItemStack.toString());
}
}