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.

Sokaya

Forge Modder
  • Joined

  • Last visited

Everything posted by Sokaya

  1. Aha helped a lot-_- How to send itemstack using packets?
  2. Can anyone help me? @up The method works but value isn't saving (when drawing the changed item in slot, the previous item shows).
  3. In my ContainerGUI, at button click event.
  4. Hi! I want to set programically item in slot to null or itemstack. But using setInventorySlotContents don't do his work. There's that method: @Override public void setInventorySlotContents(int var1, ItemStack var2) { if (var1 >= 0 && var1 < this.inventory.length) { this.inventory[var1] = var2; } if (var2 != null && var2.stackSize > this.getInventoryStackLimit()) { var2.stackSize = this.getInventoryStackLimit(); } this.markDirty(); }
  5. When i want draw the item, it get out for a while from place and back to normal.
  6. Ehh, changed it to 64 and still i can't click on the item in slot and move it to another:(
  7. Container: package sokaya.client.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class KociolekContainer extends Container { protected IInventory tileEntity; public KociolekContainer(InventoryPlayer inventoryPlayer, IInventory tileEntity2){ tileEntity = tileEntity2; addSlotToContainer(new Slot(inventoryPlayer, 0, 17, 27)); addSlotToContainer(new Slot(inventoryPlayer, 1, 17, 45)); addSlotToContainer(new Slot(inventoryPlayer, 2, 35, 36)); bindPlayerInventory(inventoryPlayer); } /*@Override public void onContainerClosed(EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); }*/ @Override public boolean canInteractWith(EntityPlayer player) { return true; } protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (int i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); } } } TileEntity: package sokaya.tileentities; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityKociolek extends TileEntity implements IInventory{ private final String name = "Kociolek"; private final String tagName = "kociolekCreate"; public static final int INV_SIZE = 3; private ItemStack[] inventory = new ItemStack[iNV_SIZE]; public TileEntityKociolek(){} @Override public int getSizeInventory() { return inventory.length; } @Override public ItemStack getStackInSlot(int var1) { return inventory[var1]; } @Override public ItemStack decrStackSize(int var1, int var2) { ItemStack stack = getStackInSlot(var1); if (stack != null) { if (stack.stackSize > var2) { stack = stack.splitStack(var2); if (stack.stackSize == 0) { setInventorySlotContents(var1, null); } } else { setInventorySlotContents(var1, null); } this.markDirty(); } return stack; } @Override public ItemStack getStackInSlotOnClosing(int var1) { ItemStack stack = getStackInSlot(var1); if (stack != null) { setInventorySlotContents(var1, null); } return stack; } @Override public void setInventorySlotContents(int var1, ItemStack var2) { this.inventory[var1] = var2; if (var2 != null && var2.stackSize > this.getInventoryStackLimit()) { var2.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } @Override public String getInventoryName() { return name; } @Override public boolean hasCustomInventoryName() { return false; } @Override public int getInventoryStackLimit() { return 1; } @Override public void markDirty() { for (int i = 0; i < this.getSizeInventory(); ++i) { if (this.getStackInSlot(i) != null && this.getStackInSlot(i).stackSize == 0) this.setInventorySlotContents(i, null); } } @Override public boolean isUseableByPlayer(EntityPlayer var1) { return true; } @Override public void openInventory(){} @Override public void closeInventory(){} @Override public boolean isItemValidForSlot(int var1, ItemStack var2) { return true; } public void writeToNBT(NBTTagCompound compound) { NBTTagList items = new NBTTagList(); for (int i = 0; i < getSizeInventory(); ++i) { if (getStackInSlot(i) != null) { NBTTagCompound item = new NBTTagCompound(); item.setByte("Slot", (byte) i); getStackInSlot(i).writeToNBT(item); items.appendTag(item); } } compound.setTag(tagName, items); } public void readFromNBT(NBTTagCompound compound) { NBTTagList items = compound.getTagList(tagName,compound.getId()); for (int i = 0; i < items.tagCount(); ++i) { NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i); byte slot = item.getByte("Slot"); if (slot >= 0 && slot < getSizeInventory()) { inventory[slot] = ItemStack.loadItemStackFromNBT(item); } } } }
  8. Still have a problem. When do't have 9 slots then i can't pickup the item from inventory:(
  9. You can use DataWatcher then write method do return your datawatcher data and use it ex. in render class
  10. Still can't place item into inventory when more than 9 slots (you are thinking about slot stacksize, but i'm thinking about same slot (as I see there's a limiter to 9 slots in container)). There's my classes (GUI class not neccesary): xxx
  11. My question: How to make container don't drop items after close and how to pass container slot limit (max. 9)? Thanks for help!
  12. And how make it no burn the block?
  13. Hi! I have problem to make palce fire on my custom rendered block. How to make it fireable?
  14. Not what I meant. I want on 1 mountable can sit 2 passenger and they have small interval between them.
  15. Hi! I have question: How make the entity mountable to drive with passenger? Thanks, for help Sokaya
  16. For example: Minecraft.getMinecraft().thePlayer.sendChatMessage("/time set 12");
  17. Working! Thanks for help!
  18. In ClientProxy you extends CommonProxy. ClientProxy is for functions only client-side(ex. tileentity render). CommonProxy is for ex. registering items .
  19. This code is for telling Minecraft that we have proxies: @SidedProxy(clientSide = "com.example.ClientProxy", serverSide = "com.example.CommonProxy") public static CommonProxy proxy;
  20. Hi! I have problem with drawing skin face on the gui. Here's my code: this.ownerface = AbstractClientPlayer.getLocationSkin(player.getDisplayName()); Minecraft.getMinecraft().renderEngine.bindTexture(ownerface); this.drawTexturedModalRect(xPos2 - 1, yPos + 200, 8, 8, 8, ; The face isn't showing. Thanks for help.
  21. Here's the code: player.openGui(mod.instance, 3, world, 0, 0, 0);
  22. Thanks:P That's resolving my problem.
  23. Hi! I create a single GUI and place text with polish chars ex. "ę", "ą", "ó". In dev environment the chars is showing properly, but in normal Minecraft not. How to fix it? Thanks, Sokaya

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.