Posted August 31, 201411 yr Hey, As the topic says I want to draw an items icon in my gui that it looks just like it actually is an item How do i do that?
August 31, 201411 yr Author I found drawTexturedModelRectFromIcon and tried it with: this.drawTexturedModelRectFromIcon(100, 100, new ItemStack(Items.apple).getIconIndex(), 16, 16); but that's just painting a big fat "nul" I guess I'm using that ItemStack thing completly wrong?
August 31, 201411 yr You need to bind the itemsheet first. Use this to bind the itemsheet: TextureManager manager = Minecraft.getMinecraft().renderEngine; manager.bindTexture(manager.getResourceLocation(1)); //RENDER ITEMS Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
August 31, 201411 yr Author me again Uhm so i want to delete a slot and draw the items texture over it, I have @Override public void mouseClicked(int x, int y, int z) { super.mouseClicked(x, y, z); if(y - guiTop > 30 && y - guiTop < 55 && x - guiLeft > 92 && x - guiLeft < 141) { tileEntity.onButtonClick(); } } in my gui and public void onButtonClick() { slots[0] = null; } in my tileEntity, however the slot actually becomes invisible, but when i ckick it it still seems to contain the ItemStack I guess thats because the Gui stuff where i call the method is client. Then how do I solve that problem?
September 1, 201411 yr You need to send packets to tell the server a button was clicked, let the server decide if that was possible, and then set it to null. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
September 1, 201411 yr Author You need to send packets to tell the server a button was clicked, let the server decide if that was possible, and then set it to null. Is there a good tutorial for packets? (never worked with that :
September 1, 201411 yr See SimpleNetworkWrapper tutorials in the Tutorials section of this forum's Modder Support
September 1, 201411 yr Author Well, I came up with this: @EventHandler public static void preInit(FMLPreInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel("MyChannel"); network.registerMessage(ClearSlotMessage.Handler.class, ClearSlotMessage.class, 0, Side.SERVER); } public class ClearSlotMessage implements IMessage{ public int x; public int y; public int z; public ClearSlotMessage(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } @Override public void fromBytes(ByteBuf buf) { } @Override public void toBytes(ByteBuf buf) { } public static class Handler implements IMessageHandler<ClearSlotMessage, IMessage> { @Override public IMessage onMessage(ClearSlotMessage message, MessageContext ctx) { TileEntityCutter entity = (TileEntityCutter) ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z); if(entity != null) { // entity. System.out.print("safasfasfasfasfafasfasfas"); } return null; } } } public void onButtonClick() { //the method in my tileEntity FM.network.sendToServer(new ClearSlotMessage(xCoord, yCoord, zCoord)); } I'm not sure how I use the methods fromByte and toByte (just make x y z binary?) And what is the "MyChannel"? Rest ok?
September 2, 201411 yr You can use buf.writeInt(int) and int = buf.readInt() . For more complex stuff, like strings, you can use the ByteBufUtils class. The "MyChannel" is the channel it registers to. If two or more mods use the same channel, you get both messages (I think). You should probably prefix your channel name with your modid. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.