Jump to content

[1.7.10] [SOLVED] Return Item Used in Crafting


Whyneb360

Recommended Posts

I'm not sure I understand what you mean. I have done this, and it doesn't let me put the @Override in.

 

public class BoardProp extends BlockContainer{

public BoardProp(Material material) {
	super(material);

	this.setCreativeTab(DesconCreativeTabs.tabGeneral);
	this.setHarvestLevel("axe", 1);
	this.setHardness(1F);
	this.setBlockBounds(0F, 0F, 1F, 1F, 1F, 0.875F);
	this.setBlockTextureName(Main.modID + ":" + "textures/blocks/board.png");
}

@Override
public void getContainerItem() {

}

@Override
public void hasContainerItem() {

}

Link to comment
Share on other sites

and it doesn't let me put the @Override in.

 

Then you did it wrong.  I love how your "get this thing" function returns void.

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.

Link to comment
Share on other sites

Pro tip when someone says to override method x dont just blindly create a method called x and expect it to work because in most cases it wont (unless you are given the full method) Look it up in the super class and override it properly. You should be able to just type the first few letters of the method and your ide will give you a list of methods to override.

I am the author of Draconic Evolution

Link to comment
Share on other sites

Thanks for the advice. I managed to figure it out based on what you said and got the following code for anyone else who wants it:

 

public class YourClassHere extends Item{



@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
{
return false;
}
//Change this to make the item not stay in the crafting grid

@Override
public ItemStack getContainerItem(ItemStack itemstack) {
return itemstack;
}

@Override
public boolean hasContainerItem(ItemStack itemstack) {
	return true;
}
}

 

 

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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