Jump to content

Recommended Posts

Posted

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 :D

Posted
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
	return true;
}

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.

Posted

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.

Posted

InventoryBasic might not have that functionality.

Open up that class in Eclipse and dig through it to see what's available.

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.

Posted

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.

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.

Posted

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 ... :D

 

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. :P

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.

Posted

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 xD

 

I have "takes everything slots" (like a chest) then two custom slots with don't accept input (like furnace output).

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.

Posted

I'll have to dig it up later this evening.  Don't have a copy right now.

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.

Posted
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
    }
}

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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