Everything posted by Sokaya
-
[1.7.2] How to detect that is somebody using a container?
Like in topic.
-
[1.7.2] How to set slot to null or itemstack
Aha helped a lot-_- How to send itemstack using packets?
-
[1.7.2] How to set slot to null or itemstack
Can anyone help me? @up The method works but value isn't saving (when drawing the changed item in slot, the previous item shows).
-
[1.7.2] How to set slot to null or itemstack
In my ContainerGUI, at button click event.
-
[1.7.2] How to set slot to null or itemstack
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(); }
-
[1.7.2] How to make container don't drop items after close and...
When i want draw the item, it get out for a while from place and back to normal.
-
[1.7.2] How to make container don't drop items after close and...
Ehh, changed it to 64 and still i can't click on the item in slot and move it to another:(
-
[1.7.2] How to make container don't drop items after close and...
Same thing when changed:(
-
[1.7.2] How to make container don't drop items after close and...
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); } } } }
-
[1.7.2] How to make container don't drop items after close and...
Still have a problem. When do't have 9 slots then i can't pickup the item from inventory:(
-
[1.7.10]Sending generic entity data that contorls rendering to client side
You can use DataWatcher then write method do return your datawatcher data and use it ex. in render class
-
[1.7.2] How to make container don't drop items after close and...
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
-
[1.7.2] How to make container don't drop items after close and...
My question: How to make container don't drop items after close and how to pass container slot limit (max. 9)? Thanks for help!
-
[1.7.2] Make the fire placeable on my block
And how make it no burn the block?
-
[1.7.2] Make the fire placeable on my block
Hi! I have problem to make palce fire on my custom rendered block. How to make it fireable?
-
Entity mountable with passenger
Not what I meant. I want on 1 mountable can sit 2 passenger and they have small interval between them.
-
Entity mountable with passenger
Hi! I have question: How make the entity mountable to drive with passenger? Thanks, for help Sokaya
-
Send a chat message as the player
For example: Minecraft.getMinecraft().thePlayer.sendChatMessage("/time set 12");
-
[1.7.2] How to draw skin face on the gui?
Working! Thanks for help!
-
[1.7.10] Making a Mod Client/Server Side Compatible
In ClientProxy you extends CommonProxy. ClientProxy is for functions only client-side(ex. tileentity render). CommonProxy is for ex. registering items .
-
[1.7.10] Making a Mod Client/Server Side Compatible
This code is for telling Minecraft that we have proxies: @SidedProxy(clientSide = "com.example.ClientProxy", serverSide = "com.example.CommonProxy") public static CommonProxy proxy;
-
[1.7.2] How to draw skin face on the gui?
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.
-
[1.7.2] Open GUI On ItemRightClick?
Here's the code: player.openGui(mod.instance, 3, world, 0, 0, 0);
-
Polish Chars in GUI
Thanks:P That's resolving my problem.
-
Polish Chars in GUI
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
IPS spam blocked by CleanTalk.