Zcelo12 Posted May 19, 2013 Posted May 19, 2013 Hello, I made a container and everything works fine. Gui also. Now my problem is that i can put the container-item(right click opens the gui) into another container-item, if i have 2 of them. Is there a funtion to check if the item is the container, then i mustn't put the item ind the container. I hope you understand me Quote
M1kep Posted May 19, 2013 Posted May 19, 2013 Look at the furnace code or the crafting table code, and see how they restrict you from placing an item in the output slot. Quote
Zcelo12 Posted May 19, 2013 Author Posted May 19, 2013 I looked into ContainerWorkbench, ContainerFurnace, TileentityFurnace and Tileentityworkbench, but i can't find the solution for my problem. Quote
Draco18s Posted May 19, 2013 Posted May 19, 2013 public boolean isStackValidForSlot(int i, ItemStack itemstack) { return true; } Quote 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.
Zcelo12 Posted May 20, 2013 Author Posted May 20, 2013 Thanks. I put this into my ContainerB.java , but i still can put the item into the container. public boolean isStackValidForSlot(int i, ItemStack itemstack) { int id = itemstack.itemID; if(id == Items.backpack.itemID) { return true; } return false; } My InventoryBackpack.java doesn't extend TileEntity. It extend InventoryBasic. Quote
Draco18s Posted May 20, 2013 Posted May 20, 2013 InventoryBasic might not have that functionality. Open up that class in Eclipse and dig through it to see what's available. Quote 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.
Zcelo12 Posted May 20, 2013 Author Posted May 20, 2013 I found that function in InventoryBasic, too. But why it doesn't work? Quote
Draco18s Posted May 20, 2013 Posted May 20, 2013 Also: if(id == FoodExItems.backpack.itemID) { return true; } If that code was working, that will only allow a backpack to be placed inside your item's inventory. Quote 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.
godbaba Posted May 20, 2013 Posted May 20, 2013 hey can I get all of your container codes I need some examples to figure out how containers work If you help me , I will be very happy ... Quote http://r1306.hizliresim.com/1b/1/np1mm.png[/img]
Draco18s Posted May 20, 2013 Posted May 20, 2013 hey can I get all of your container codes I need some examples to figure out how containers work If you help me , I will be very happy ... You mean my incomplete and non-selective code that uses tile entities? (That is, it lets anything get placed into it, like a chest) Don't think it'll help you much. Quote 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.
godbaba Posted May 20, 2013 Posted May 20, 2013 I dont need something selective Your code will help me but If you dont want to share no problem mate Quote http://r1306.hizliresim.com/1b/1/np1mm.png[/img]
Draco18s Posted May 20, 2013 Posted May 20, 2013 I dont need something selective Your code will help me but If you dont want to share no problem mate I'm just saying that my code likely won't help I have "takes everything slots" (like a chest) then two custom slots with don't accept input (like furnace output). Quote 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.
godbaba Posted May 20, 2013 Posted May 20, 2013 I dont care what slots do you have slots which I cannot get working If you post your code Im sure it will be helpful for me :D Quote http://r1306.hizliresim.com/1b/1/np1mm.png[/img]
Draco18s Posted May 20, 2013 Posted May 20, 2013 I'll have to dig it up later this evening. Don't have a copy right now. Quote 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.
Draco18s Posted May 21, 2013 Posted May 21, 2013 package draco18s.economy.inventory; import draco18s.economy.EconBankAccounts; import draco18s.economy.entities.EntityShop; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class MySlot extends Slot { public int sellprice = 0; public MySlot(IInventory par1iInventory, int par2, int par3, int par4) { super(par1iInventory, par2, par3, par4); } public boolean canTakeStack(EntityPlayer shopper) { return true; } public boolean isItemValid(ItemStack par1ItemStack) { return false; //returning false prevents the player from putting items into the slot } } Quote 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.
Recommended Posts
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.