December 1, 20168 yr Author Because it wants me to. If i remove it, it says add unimplemented methods.
December 1, 20168 yr Author Aaaaand, how do i use it? if i dont implement it, where else am i supposed to put it?
December 1, 20168 yr Author How do i use ItemStackHandler? You said "Use ItemStackHandler", but i dont know how.
December 1, 20168 yr Instantiate it. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 1, 20168 yr Author I thought it requires more things.... I allready had the ItemStackHandler here, but i thought i am supposed to implement IItemHandler But now what do i do with this? this.addSlotToContainer(new SlotItemHandler(te, x + y * 9, 15 + x * 16, 15 + y * 16)); (adding slots to a container)
December 1, 20168 yr te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 1, 20168 yr Author I tried this: this.addSlotToContainer(new SlotItemHandler(te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP), x + y * 9, 15 + x * 16, 15 + y * 16)); } doesn't work
December 1, 20168 yr Author Multiple markers at this line - The constructor SlotItemHandler(TileEntityStoneCrate, int, int, int) is undefined - The constructor SlotItemHandler(Capability, int, int, int) is undefined
December 1, 20168 yr Author I think i have this wrong: ItemStackHandler itemHandler = new ItemStackHandler(81); @Override public boolean hasCapability(Capability capability, EnumFacing facing) { return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ? true : super.hasCapability(capability, facing); } @Override public Capability getCapability(Capability capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return itemHandler; } return super.getCapability(capability, facing); }
December 2, 20168 yr Use generics. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 3, 20168 yr Author I'm back now. i mde some changes and it works, but when i place itemstack in slot, it goes in there, but it is also left in my cursor and when i remove itemstack it just disappears. package com.villfuk02.essence.tileentities; import java.awt.ItemSelectable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; public class TileEntityStoneCrate extends TileEntity implements ICapabilityProvider{ private String customName; private static ItemStackHandler itemHandler = new ItemStackHandler(81); @Override public boolean hasCapability(Capability capability, EnumFacing facing) { return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ? true : super.hasCapability(capability, facing); } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) itemHandler; } return super.getCapability(capability, facing); } public String getCustomName(){ return this.customName; } public void setCustomName(String customName){ this.customName = customName; } public String getName() { return this.hasCustomName() ? this.customName : "Stone Storage Crate"; } public boolean hasCustomName() { return this.customName != null && !this.customName.equals(""); } public int getSizeInventory() { return 81; } public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.getPos()) == this && player.getDistanceSq(this.pos.add(0.5, 0.5, 0.5)) <= 64; } }
December 3, 20168 yr Author I think everything happens twice and doesnt sync perfectly, because when i place less than 32 items in the slot, it just doubles in the slot. When i put 48 items in, in the slot goes 64 and i get 32 back. when i split the stack with rightclicking, in the slot is left just quarter of the items and in my cursor too.
December 3, 20168 yr Post your Container code. 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/
December 3, 20168 yr Author fixed i made new thread here, because people were scared of this, and ignored it. http://www.minecraftforge.net/forum/index.php?topic=43754.0
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.