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

Could any tell me how I would return a empty bottle after crafting instead of destroying it.

 

{
	"type": "minecraft:crafting_shaped",
	"pattern": [
		"   ",
		"S  ",
		"FW "
	],
	"key": {
		"S": {
			"item": "minecraft:sugar"
		},
		"F": {
			"item": "sicmish:flour"
		},
		"W": {
			"item": "minecraft:potion" //Retun glass_bottle
		}
	},
	"result": {
		"item": "sicmish:dough"
	}
}

 

Edited by Sicmish

You'll need a custom recipe type that implements IRecipe#getRemainingItems to return a list of remaining items, using the container item (ForgeHooks.getContainerItem) for every slot except the one with the potion in it, which you'll use an empty bottle for instead.

 

I recommend extending ShapedRecipes or ShapedOreRecipes so you don't have to re-implement everything yourself.

 

To use this new recipe type from JSON recipe files, you'll need to create a class that implements IRecipeFactory to parse the recipe from the supplied JSON object. Specify this factory class in your recipes/_factories.json file.

 

Look at the CraftingHelper.init method to see the IRecipeFactory implementations for the Vanilla and Forge recipe types.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author
12 minutes ago, Choonster said:

You'll need a custom recipe type that implements IRecipe#getRemainingItems to return a list of remaining items, using the container item (ForgeHooks.getContainerItem) for every slot except the one with the potion in it, which you'll use an empty bottle for instead.

 

I recommend extending ShapedRecipes or ShapedOreRecipes so you don't have to re-implement everything yourself.

 

To use this new recipe type from JSON recipe files, you'll need to create a class that implements IRecipeFactory to parse the recipe from the supplied JSON object. Specify this factory class in your recipes/_factories.json file.

 

Look at the CraftingHelper.init method to see the IRecipeFactory implementations for the Vanilla and Forge recipe types.

Well I really appreciate the help! but that is a lot to try and figure out lol.

But I did find a way to over ride the json in a way(Don't really know if this is overriding/over looking the recipe.json).

 

I just had to make sure the recipes were the same.

ItemStack recipeOutput = new ItemStack(SicmishItems.dough, 1);

GameRegistry.addShapedRecipe(new ResourceLocation(Reference.MOD_ID, "dough.recipe"), null, recipeOutput,
				new String[] { 
								"   ", 
							  	"S  ",
							   	"FW "
							 }, 
								'S', net.minecraft.init.Items.SUGAR,
								'F', SicmishItems.flour,
				 				'W', net.minecraft.init.Items.POTIONITEM.setContainerItem(net.minecraft.init.Items.GLASS_BOTTLE)
				);

Again thanks for the help!

Edited by Sicmish

Item#setContainerItem sets the container item for that Item instance globally, which means it now returns that item in every recipe rather than just yours. This probably isn't what you want to do.

 

Either specify the recipe in a JSON file (recommended) or specify it in code, don't do both.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author
56 minutes ago, Choonster said:

Item#setContainerItem sets the container item for that Item instance globally, which means it now returns that item in every recipe rather than just yours. This probably isn't what you want to do.

 

Either specify the recipe in a JSON file (recommended) or specify it in code, don't do both.

You was absolutely right about that!

Hmm, well I think I'm way to new to the minecraft/forge extension to try and jump in this kind of project I think I'll just keep it simple for now.

Build op some knowledge before I tackle that.

Thanks!

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.