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

@ -81,6 +81,5 @@ public class ItemRendererGlassBell implements IItemRenderer
GL11.glPopMatrix(); GL11.glPopMatrix();
GL11.glDisable(GL11.GL_ALPHA_TEST);
} }
} }

View file

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