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.

AntariaN

Members
  • Joined

  • Last visited

Everything posted by AntariaN

  1. Is there any way to change how things work? Eg., using custom workbanch. If so, where can I read more about crafting system modding?
  2. Is there any way to change how things work? Eg., using custom workbanch. If so, where can I read more about crafting system modding?
  3. Try to use ModelBakery.registerItemVariants(Item item, ModelResourceLocation location) instead of addVariantName You can see the example here.
  4. I'm trying to create a Custom Shapless Recipe that implements IRecipe. It should allow registering recipes, that just requires some amount of one Item. Everything works fine, except two things. I've tried to solve it by myself for about 4 hours, but didn't figured out. The problems I have: 1. getRemaningItems method works incorrectly (eg., when It's 5 sticks in input, after crafting there is a stick with 0 amount). 2. If you putting Items into workbanch one by one (RightClick) all in the same Slot the recipe doesn't work. Custom Recipe Class: package com.antarian.testmod.recipe; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; public class ShapelessMultipleItemRecipe implements IRecipe { private final ItemStack recipeOutput; private final Item recipeItem; private final int recipeAmount; public ShapelessMultipleItemRecipe(ItemStack recipeOutput, Item recipeItem, int recipeAmount) { this.recipeOutput = recipeOutput; this.recipeItem = recipeItem; this.recipeAmount = recipeAmount; } public ItemStack getRecipeOutput() { return recipeOutput; } public ItemStack[] getRemainingItems(InventoryCrafting inv) { ItemStack[] itemStackArray = new ItemStack[inv.getSizeInventory()]; int itemsToGet = recipeAmount; for(int i = 0; i < itemStackArray.length; i++) { ItemStack itemStack = inv.getStackInSlot(i); if(itemStack != null && itemsToGet > 0) { int getItems = itemStack.stackSize >= itemsToGet ? itemsToGet : itemStack.stackSize; itemStack.stackSize -= getItems; itemStackArray[i] = itemStack.stackSize > 0 ? itemStack : null; //itemStack.stackSize -= getItems - 1; //itemStackArray[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemStack); itemsToGet -= getItems; } } return itemStackArray; } public boolean matches(InventoryCrafting inv, World worldIn) { Item item = this.recipeItem; int itemCount = 0; for(int i = 0; i < inv.getHeight(); i++) { for(int j = 0; j < inv.getWidth(); j++) { ItemStack currItemStack = inv.getStackInRowAndColumn(j, i); if(currItemStack != null) { if(currItemStack.getItem() == item) { itemCount += currItemStack.stackSize; } } } } if(itemCount >= recipeAmount) { return true; } return false; } public ItemStack getCraftingResult(InventoryCrafting inv) { return recipeOutput.copy(); } public int getRecipeSize() { return 1; } } Some parts of ModRecipes Class: RecipeSorter.register("testmod:shapelessmultipleitem", ShapelessMultipleItemRecipe.class, SHAPELESS, "after:minecraft:shapless"); GameRegistry.addRecipe(new ShapelessMultipleItemRecipe(new ItemStack(ModBlocks.blockBonfire), Items.stick, 4));

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.