Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

deerangle

Members
  • Joined

  • Last visited

Everything posted by deerangle

  1. It was the condition, without it, it works! It seems, that getting the itemstack, returns "null".
  2. if(tile.getStackInSlot(0) == new ItemStack(Items.diamond)){ tile.setInventorySlotContents(0, new ItemStack(ModItems.crystalVivium)); } it is
  3. It is registered in the pre-init method. Is there a way to send the tileentity, istead of getting it by coordinates?
  4. Im not calling the handler, all im doing, is this : MainRegistry.network.sendToServer(new SlotChangeMessage(tile)); Where do i call the handler?
  5. Thanks, Its not crashing anymore, but it still doesnt do anything, i added a println statement, to check if the values are sent properly, and its recieving the values.
  6. I have programmed my mod, so it will send a packet: public class SlotChangeMessage implements IMessage{ int x,y,z; public SlotChangeMessage(int x, int y, int z){ this.x = x; this.y = y; this.z = z; } @Override public void fromBytes(ByteBuf buf) { this.x = buf.readInt(); this.y = buf.readInt(); this.z = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); } public static class Handler implements IMessageHandler<SlotChangeMessage, SlotChangeMessage>{ @Override public SlotChangeMessage onMessage(SlotChangeMessage message, MessageContext ctx) { World world = ctx.getServerHandler().playerEntity.worldObj; TileEntityTableLives tile = (TileEntityTableLives) world.getTileEntity(message.x, message.y, message.z); if(tile.getStackInSlot(0) == new ItemStack(Items.diamond)){ tile.setInventorySlotContents(0, new ItemStack(ModItems.crystalVivium)); } return null; } } } but it crashes! I have heared, that the constructor must be empty, but how do i then put the values into the packet?
  7. Thanks Ernio, sometimes my mistakes are so stupid! Sorry for wasting your time.
  8. I have created a method: private void sBlock(int x, int y, int z, Block b){ this.worldObj.setBlock(xCoord + x, xCoord + y, xCoord + z, b, 0, 2); } but when i call it, it does... nothing.
  9. how would i recieve the packet, sent by the gui, in the container class
  10. Thank you! (this was quite obvious, but i wasn't sure)
  11. I have got a Gui, and i want it, so if i click the guibutton, the content of my slot changes. How do i do this?
  12. I am using minecraft forge 1.7.10
  13. What is "LayerArmorBase"? I didnt find a class/method/object anywhere
  14. I am trying to make an armor, that has a grayscale texture, and gets colorized into for instance pink, (I want to colorize the armor, not the items) but I couldn't find any methods in the leather armor, except for these: @Override public int getColor(ItemStack item){ return color; } @Override @SideOnly(Side.CLIENT) public boolean hasColor(ItemStack item){ return true; } but it is still not working.
  15. Thank you a lot, but one more question, except for colorizing the tesselator, is there an easier way to colorize it? EDIT - Solved it. THANK YOU SO MUCH!
  16. I am trying to make a block class, that takes two textures, and colorizes one of them, before stitching them together... like the potions, they have a background and a overlay texture, that gets colored.
  17. Now It is working. Thanks a lot for the help, and for extending my java knowledge about getters.
  18. How Exactly do I use this method? I tried: Item item = new Item(); item.setUnlocalizedName(name); item.setTextureName(Reference.MODID + ":" + tex); item.setCreativeTab(tab); item.getColorFromItemStack(new ItemStack(item), color); GameRegistry.registerItem(item, name);
  19. I did this before... just overwrite the items code, where is looses durability, to loose 0 durability: package com.yourmod.main; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.world.World; public class ItemNoDamage extends ItemSword{ public ItemNoDamage(ToolMaterial mat) { super(mat); } @Override public boolean hitEntity(ItemStack item, EntityLivingBase entity, EntityLivingBase player) { item.damageItem(0, player); return true; } @Override public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase player) { if ((double)block.getBlockHardness(world, x, y, z) != 0.0D) { item.damageItem(0, player); } return true; } }
  20. I am making a mod, that will have a lot of ingot textures, so lots of similar textures. So I am colorizing them on preinitialization... But I don't know, how I can read the files from the exported jar file, and where can I save the converted textures, to use them for items/blocks.
  21. I created a custom slot class and set the "isitemValid" to similar to what was in the method from the tileentity and now it works. PS: i never made a more complex gui than a chest before. THANK YOU
  22. package com.wizcraft.gui; import com.wizcraft.tile.entity.TileEntityTableWittle; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerTableWittle extends Container { protected TileEntityTableWittle tile; public ContainerTableWittle(InventoryPlayer invPlayer, TileEntityTableWittle tile){ this.tile = tile; this.addSlotToContainer(new Slot(tile, 0, 52, 7)); this.addSlotToContainer(new Slot(tile, 1, 52, 34)); this.addSlotToContainer(new Slot(tile, 2, 52, 61)); this.addSlotToContainer(new Slot(tile, 3, 25, 34)); this.addSlotToContainer(new Slot(tile, 4, 79, 34)); this.addSlotToContainer(new Slot(tile, 5, 131, 34)); bindPlayerInventory(invPlayer); } @Override public boolean canInteractWith(EntityPlayer player) { return tile.isUseableByPlayer(player); } protected void bindPlayerInventory(InventoryPlayer invPlayer) { for(int i = 0; i<3;i++){ for(int j = 0; j<9;j++){ this.addSlotToContainer(new Slot(invPlayer, 9+j+i*9, 8 + j*18, 84+i*18)); } } for(int i = 0; i<9;i++){ this.addSlotToContainer(new Slot(invPlayer, i, 8 + i*18, 142)); } } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); //null checks and checks if the item can be stacked (maxStackSize > 1) if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); //merges the item into player inventory since its in the tile if (slot < tile.getSizeInventory()) { if (!this.mergeItemStack(stackInSlot, tile.getSizeInventory(), 36+tile.getSizeInventory(), true)) { return null; } } //places it into the tile is possible since its in the player inventory else if (!this.mergeItemStack(stackInSlot, 0, tile.getSizeInventory(), false)) { return null; } if (stackInSlot.stackSize == 0) { slotObject.putStack(null); } else { slotObject.onSlotChanged(); } if (stackInSlot.stackSize == stack.stackSize) { return null; } slotObject.onPickupFromSlot(player, stackInSlot); } return stack; } }
  23. thats how i tried it: @Override public boolean isItemValidForSlot(int slot, ItemStack item) { if(slot == 0 && item.getItem() == ModItems.toolOsniumKnife) return true; return false; }
  24. I am trying to lock a slot in my inventory to a specific item, so i can oly inert THAT item in THAT slot and no other. i tried it with "isItemValidForSlot" but i couldnt get it to work that way.
  25. and you have to do the tessellating, using the texture afterwards. this.bindTexture(texture); Tessellator tess = new Tessellator.getInstance(); //tessellating stuffs tess.addVertexWithUV(0, 0, 0, 0, 0); //etc.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.