Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

How would you return an item (say a saw) used in crafting to the player without any durability

 

Thanks,

 

-Whyneb360

  • Author

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() {

}

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.

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

  • Author

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

 

 

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.