Jump to content

[1.12.2] Help with custom crafting table & chests (using wood OreDict)


Kitteh6660

Recommended Posts

I've got nearly every thing up and running with my MoreCraft mod after days of painstakingly converting every recipe and integrating advancement functionality to my mod.

It's almost ready but I've came across obstacles. I couldn't seem to be able to have the JSONs take priority over vanilla recipes when it comes to using ore dictionary.

 

While the mod NoMoreRecipeConflict works, that's only a band-aid solution. I could remove the ore dict but then the Netherwood planks can no longer be used in every wooden crafting recipe universally, and that would cripple cross-mod crafting functionality. I want to make sure the ore dict remains but properly fix the recipes. Back in 1.11.2, I had no problems as the coded recipes easily takes priority over the vanilla recipes.

The expected behaviour. Clicking the Netherwood chest without the required planks produces the expected chest on output. The recipe is registered.

PFIdsth.png -

The results. It creates an ordinary chest. For some reasons the mod recipe doesn't take priority over the vanilla recipe. This is the same case for Netherwood Crafting Table (which uses vanilla crafting functionality)

QOLgB9n.png

 

Spoiler

netherwood_chest.json


{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "###",
    "# #",
    "###"
  ],
  "key": {
    "#": {
      "item": "morecraft:netherwood_planks"
    }
  },
  "result": {
    "item": "morecraft:netherwood_chest"
  }
}

netherwood_crafting_table.json


{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "##",
    "##"
  ],
  "key": {
    "#": {
      "item": "morecraft:netherwood_planks"
    }
  },
  "result": {
    "item": "morecraft:netherwood_crafting_table"
  }
}

Snippet from MoreCraft.java


    public static void oreRegistration()
    {
    	//|--| Register blocks to Ore Dictionary |--|\\
		OreDictionary.registerOre("blockGlass", MoreCraftBlocks.SOUL_GLASS);
		OreDictionary.registerOre("blockGlassColorless", MoreCraftBlocks.SOUL_GLASS);
		OreDictionary.registerOre("paneGlass", MoreCraftBlocks.SOUL_GLASS_PANE);
		OreDictionary.registerOre("paneGlassColorless", MoreCraftBlocks.SOUL_GLASS_PANE);
    	
		//Ruby ores and blocks
		OreDictionary.registerOre("oreRuby", MoreCraftBlocks.RUBY_ORE);
		OreDictionary.registerOre("blockRuby", MoreCraftBlocks.RUBY_BLOCK);
		
		//Netherwood
		OreDictionary.registerOre("treeWood", MoreCraftBlocks.NETHERWOOD_LOG);
		OreDictionary.registerOre("plankWood", MoreCraftBlocks.NETHERWOOD_PLANKS);
		OreDictionary.registerOre("stairWood", MoreCraftBlocks.NETHERWOOD_STAIRS);
		OreDictionary.registerOre("slabWood", MoreCraftBlocks.NETHERWOOD_SLAB);
		OreDictionary.registerOre("treeLeaves", MoreCraftBlocks.NETHERWOOD_LEAVES);
		OreDictionary.registerOre("treeSapling", MoreCraftBlocks.NETHERWOOD_SAPLING);
		
		//Blocks made from vanilla resources.
		OreDictionary.registerOre("blockFlesh", MoreCraftBlocks.FLESH_BLOCK);
		OreDictionary.registerOre("blockGunpowder", MoreCraftBlocks.GUNPOWDER_BLOCK);
		OreDictionary.registerOre("blockBlaze", MoreCraftBlocks.BLAZE_BLOCK);
		OreDictionary.registerOre("blockEnder", MoreCraftBlocks.ENDER_BLOCK);
		
		//|--| Register items to Ore Dictionary |--|\\
		OreDictionary.registerOre("gemRuby", MoreCraftItems.RUBY);
		OreDictionary.registerOre("boneWither", MoreCraftItems.WITHER_BONE);
		OreDictionary.registerOre("scaleEnder", MoreCraftItems.ENDERDRAGON_SCALES);
    }

 

Is there a solution to ensure that OreDict'ed ingredients are exempt from certain recipes? I've been trying to make everything done as simple as possible.

Edited by Kitteh6660
Correction of text placement
Link to comment
Share on other sites

4 hours ago, Kitteh6660 said:

I've got nearly every thing up and running with my MoreCraft mod after days of painstakingly converting every recipe and integrating advancement functionality to my mod.

It's almost ready but I've came across obstacles. I couldn't seem to be able to have the JSONs take priority over vanilla recipes when it comes to using ore dictionary.

 

While the mod NoMoreRecipeConflict works, that's only a band-aid solution. I could remove the ore dict but then the Netherwood planks can no longer be used in every wooden crafting recipe universally, and that would cripple cross-mod crafting functionality. I want to make sure the ore dict remains but properly fix the recipes. Back in 1.11.2, I had no problems as the coded recipes easily takes priority over the vanilla recipes.

The expected behaviour. Clicking the Netherwood chest without the required planks produces the expected chest on output. The recipe is registered.

PFIdsth.png -

The results. It creates an ordinary chest. For some reasons the mod recipe doesn't take priority over the vanilla recipe. This is the same case for Netherwood Crafting Table (which uses vanilla crafting functionality)

QOLgB9n.png

 

  Reveal hidden contents

netherwood_chest.json



{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "###",
    "# #",
    "###"
  ],
  "key": {
    "#": {
      "item": "morecraft:netherwood_planks"
    }
  },
  "result": {
    "item": "morecraft:netherwood_chest"
  }
}

netherwood_crafting_table.json



{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "##",
    "##"
  ],
  "key": {
    "#": {
      "item": "morecraft:netherwood_planks"
    }
  },
  "result": {
    "item": "morecraft:netherwood_crafting_table"
  }
}

Snippet from MoreCraft.java



    public static void oreRegistration()
    {
    	//|--| Register blocks to Ore Dictionary |--|\\
		OreDictionary.registerOre("blockGlass", MoreCraftBlocks.SOUL_GLASS);
		OreDictionary.registerOre("blockGlassColorless", MoreCraftBlocks.SOUL_GLASS);
		OreDictionary.registerOre("paneGlass", MoreCraftBlocks.SOUL_GLASS_PANE);
		OreDictionary.registerOre("paneGlassColorless", MoreCraftBlocks.SOUL_GLASS_PANE);
    	
		//Ruby ores and blocks
		OreDictionary.registerOre("oreRuby", MoreCraftBlocks.RUBY_ORE);
		OreDictionary.registerOre("blockRuby", MoreCraftBlocks.RUBY_BLOCK);
		
		//Netherwood
		OreDictionary.registerOre("treeWood", MoreCraftBlocks.NETHERWOOD_LOG);
		OreDictionary.registerOre("plankWood", MoreCraftBlocks.NETHERWOOD_PLANKS);
		OreDictionary.registerOre("stairWood", MoreCraftBlocks.NETHERWOOD_STAIRS);
		OreDictionary.registerOre("slabWood", MoreCraftBlocks.NETHERWOOD_SLAB);
		OreDictionary.registerOre("treeLeaves", MoreCraftBlocks.NETHERWOOD_LEAVES);
		OreDictionary.registerOre("treeSapling", MoreCraftBlocks.NETHERWOOD_SAPLING);
		
		//Blocks made from vanilla resources.
		OreDictionary.registerOre("blockFlesh", MoreCraftBlocks.FLESH_BLOCK);
		OreDictionary.registerOre("blockGunpowder", MoreCraftBlocks.GUNPOWDER_BLOCK);
		OreDictionary.registerOre("blockBlaze", MoreCraftBlocks.BLAZE_BLOCK);
		OreDictionary.registerOre("blockEnder", MoreCraftBlocks.ENDER_BLOCK);
		
		//|--| Register items to Ore Dictionary |--|\\
		OreDictionary.registerOre("gemRuby", MoreCraftItems.RUBY);
		OreDictionary.registerOre("boneWither", MoreCraftItems.WITHER_BONE);
		OreDictionary.registerOre("scaleEnder", MoreCraftItems.ENDERDRAGON_SCALES);
    }

 

Is there a solution to ensure that OreDict'ed ingredients are exempt from certain recipes? I've been trying to make everything done as simple as possible.

I think this may be solved in 1.13 with the vanilla tag system, which (I believe) will be used instead of OreDictionary

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

8 hours ago, Kitteh6660 said:

Is there a solution to ensure that OreDict'ed ingredients are exempt from certain recipes? I've been trying to make everything done as simple as possible.

What you are going to have to do, is after all your recipes have been added, you will need to remove and re-add the recipes to the registry.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

It took me a long while of searching and eventually giving up on that but I ended up having made a solution of my own. The only downside is the output graphic looks unaltered but you will receive the items.

I tried the removing and re-adding to no avail.

Spoiler

My workaround solution. Not perfect however. You can still mix Netherwood planks + vanilla planks and get vanilla chests and crafting table, but if you use all Netherwood planks, you get the Netherwood version. It also checks if you use Shift keys, and thus prevents the infinite items exploit.

I've registered and now everything works, other than the minor graphical issue on crafting.


package kittehmod.morecraft.crafting;

import org.lwjgl.input.Keyboard;

import kittehmod.morecraft.MoreCraftBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;

public class RecipeHelper {
	
	//It's ugly but it'll do for now.
	public static int countItemInGrid(InventoryCrafting matrix, Item item) {
		int amt = 0;
		for (int i = 0; i < 9; i++) {
			if (matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getItem() == item) { amt++; }
		}
		System.out.println(amt);
		return amt;
	}
	public static int decreaseItemsInGrid(InventoryCrafting matrix, int amount) {
		int amt = 0;
		for (int i = 0; i < 9; i++) {
			if (matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount() > 0) {
				matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).shrink(amount);
			}
		}
		System.out.println(amt);
		return amt;
	}
	public static int countMultiplesLowest(InventoryCrafting matrix, Item item) {
		int amt = 99;
		for (int i = 0; i < 9; i++) {
			if (matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount() > 0 && amt > matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount() && matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getItem() == item) {
				amt = matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount();
			}
		}
		return amt;
	}
	private static void deductItemsFromPlayer(EntityPlayer player, Item item, int amount) {
		InventoryPlayer inventory = player.inventory;
		for (int i = 0; i < 36; i++) {
			if (inventory.getStackInSlot(i).getItem() == item) {
				inventory.decrStackSize(i, amount);
				break;
			}
		}
	}
	
	public static void processCrafting(ItemCraftedEvent event, EntityPlayer player, InventoryCrafting matrix, Item origCraft, Item targetCraft, Item materialDeducted) {
		World world = player.getEntityWorld();
		int amt = 1;
		if (!world.isRemote) { //Server handler
			event.crafting.shrink(1);
			decreaseItemsInGrid(matrix, 1);
			event.player.addItemStackToInventory(new ItemStack(targetCraft, 1));
		}
		else { //Singleplayer handler
			if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
				event.crafting.shrink(1);
				amt = countMultiplesLowest(matrix, materialDeducted);
				decreaseItemsInGrid(matrix, amt);
				deductItemsFromPlayer(event.player, origCraft, 1);
				event.player.addItemStackToInventory(new ItemStack(targetCraft, amt));
			}
			else {
				event.crafting.shrink(1);
				decreaseItemsInGrid(matrix, 1);
				event.player.addItemStackToInventory(new ItemStack(targetCraft, 1));
			}
		}
	}
	
	//Hacky workaround for Netherwood chests and crafting tables.		
	@SubscribeEvent
	public void CraftEvent(ItemCraftedEvent event)
	{
		InventoryCrafting matrix = (InventoryCrafting)event.craftMatrix;
		RecipeHelper.countItemInGrid(matrix, Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS));
		if (event.crafting.getItem() == Item.getItemFromBlock(Blocks.CHEST) && countItemInGrid(matrix, Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS)) == 8) {
			processCrafting(event, event.player, matrix, Item.getItemFromBlock(Blocks.CHEST), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_CHEST), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS));
		}
		else if (event.crafting.getItem() == Item.getItemFromBlock(Blocks.CRAFTING_TABLE) && countItemInGrid(matrix, Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS)) == 4) {
			processCrafting(event, event.player, matrix, Item.getItemFromBlock(Blocks.CRAFTING_TABLE), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_CRAFTING_TABLE), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS));
		}
	}
}

 

While it works in Single Player, I'll have to figure out a way to process multiples at a time on the server.

Edited by Kitteh6660
Link to comment
Share on other sites

7 hours ago, Kitteh6660 said:

It took me a long while of searching and eventually giving up on that but I ended up having made a solution of my own. The only downside is the output graphic looks unaltered but you will receive the items.

I tried the removing and re-adding to no avail.

  Reveal hidden contents

My workaround solution. Not perfect however. You can still mix Netherwood planks + vanilla planks and get vanilla chests and crafting table, but if you use all Netherwood planks, you get the Netherwood version. It also checks if you use Shift keys, and thus prevents the infinite items exploit.

I've registered and now everything works, other than the minor graphical issue on crafting.



package kittehmod.morecraft.crafting;

import org.lwjgl.input.Keyboard;

import kittehmod.morecraft.MoreCraftBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;

public class RecipeHelper {
	
	//It's ugly but it'll do for now.
	public static int countItemInGrid(InventoryCrafting matrix, Item item) {
		int amt = 0;
		for (int i = 0; i < 9; i++) {
			if (matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getItem() == item) { amt++; }
		}
		System.out.println(amt);
		return amt;
	}
	public static int decreaseItemsInGrid(InventoryCrafting matrix, int amount) {
		int amt = 0;
		for (int i = 0; i < 9; i++) {
			if (matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount() > 0) {
				matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).shrink(amount);
			}
		}
		System.out.println(amt);
		return amt;
	}
	public static int countMultiplesLowest(InventoryCrafting matrix, Item item) {
		int amt = 99;
		for (int i = 0; i < 9; i++) {
			if (matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount() > 0 && amt > matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount() && matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getItem() == item) {
				amt = matrix.getStackInRowAndColumn(i % 3, (int)(i/3)).getCount();
			}
		}
		return amt;
	}
	private static void deductItemsFromPlayer(EntityPlayer player, Item item, int amount) {
		InventoryPlayer inventory = player.inventory;
		for (int i = 0; i < 36; i++) {
			if (inventory.getStackInSlot(i).getItem() == item) {
				inventory.decrStackSize(i, amount);
				break;
			}
		}
	}
	
	public static void processCrafting(ItemCraftedEvent event, EntityPlayer player, InventoryCrafting matrix, Item origCraft, Item targetCraft, Item materialDeducted) {
		World world = player.getEntityWorld();
		int amt = 1;
		if (!world.isRemote) { //Server handler
			event.crafting.shrink(1);
			decreaseItemsInGrid(matrix, 1);
			event.player.addItemStackToInventory(new ItemStack(targetCraft, 1));
		}
		else { //Singleplayer handler
			if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
				event.crafting.shrink(1);
				amt = countMultiplesLowest(matrix, materialDeducted);
				decreaseItemsInGrid(matrix, amt);
				deductItemsFromPlayer(event.player, origCraft, 1);
				event.player.addItemStackToInventory(new ItemStack(targetCraft, amt));
			}
			else {
				event.crafting.shrink(1);
				decreaseItemsInGrid(matrix, 1);
				event.player.addItemStackToInventory(new ItemStack(targetCraft, 1));
			}
		}
	}
	
	//Hacky workaround for Netherwood chests and crafting tables.		
	@SubscribeEvent
	public void CraftEvent(ItemCraftedEvent event)
	{
		InventoryCrafting matrix = (InventoryCrafting)event.craftMatrix;
		RecipeHelper.countItemInGrid(matrix, Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS));
		if (event.crafting.getItem() == Item.getItemFromBlock(Blocks.CHEST) && countItemInGrid(matrix, Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS)) == 8) {
			processCrafting(event, event.player, matrix, Item.getItemFromBlock(Blocks.CHEST), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_CHEST), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS));
		}
		else if (event.crafting.getItem() == Item.getItemFromBlock(Blocks.CRAFTING_TABLE) && countItemInGrid(matrix, Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS)) == 4) {
			processCrafting(event, event.player, matrix, Item.getItemFromBlock(Blocks.CRAFTING_TABLE), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_CRAFTING_TABLE), Item.getItemFromBlock(MoreCraftBlocks.NETHERWOOD_PLANKS));
		}
	}
}

 

While it works in Single Player, I'll have to figure out a way to process multiples at a time on the server.

If I remember correctly I never implemented this, but found a way to do it very easily.

I think that you can just modify your onCraftMatrixChanged method and use code from  net.minecraft.inventory#Container.slotChangedCraftingGrid and net.minecraft.item.crafting.CraftingManager.findMatchingRecipe.

 

Never mind, I forgot that you're using the vanilla crafting table. You just have to reshuffle the recipe registry so that your recipes are before the vanilla ones so that the for loop in net.minecraft.item.crafting.CraftingManager.findMatchingRecipe chooses your recipe and not the vanilla ones. 

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

How can I re-add? If I try to re-register the vanilla recipe, it crashes Minecraft with "already registered"

Here's the code. I looked through the dropdown and couldn't seem to find a reliable way to re-add the recipes.

Spoiler

	public static void fixCraftingRecipes() {
		IForgeRegistryModifiable<IRecipe> registry = (IForgeRegistryModifiable<IRecipe>) ForgeRegistries.RECIPES;
		if (!fixedNetherChest) {
			fixedNetherChest = true;
			IRecipe recipe = CraftingManager.getRecipe(new ResourceLocation("minecraft:chest"));
			registry.remove(recipe.getRegistryName());
			//Now how do I re-add the recipe? Register doesn't work as it crashes with "already registered"
		}
		if (!fixedNetherTable) {
			//This will be filled out
		}
	}

 

I could try the for loop, but I still feel a bit confused, and a bit of poking around to find it doesn't seem easy to have it skip over the vanilla recipes.

Link to comment
Share on other sites

1 hour ago, Kitteh6660 said:

I could try the for loop, but I still feel a bit confused, and a bit of poking around to find it doesn't seem easy to have it skip over the vanilla recipes.

Iterate over the registry for recipes. Then remove the recipes while storing them in a variable. Then add your recipes, then add the copies of the recipes you removed.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I tried the following code like you asked, but it doesn't work.

Spoiler

	//A wonky workaround to fixing Netherwood chest and crafting table recipes
	public static void fixCraftingRecipes() {
		IForgeRegistryModifiable<IRecipe> registry = (IForgeRegistryModifiable<IRecipe>) ForgeRegistries.RECIPES;
		ArrayList<IRecipe> recipes = Lists.newArrayList(registry.getValues());
		IRecipe recipeNether = CraftingManager.getRecipe(new ResourceLocation("morecraft:netherwood_chest"));
		IRecipe recipeCopy;
		for (IRecipe recipe : recipes) {
			if (recipe.getRecipeOutput().getItem() == Item.getItemFromBlock(Blocks.CHEST)) {
				recipeCopy = recipe;
				registry.remove(recipe.getRegistryName());
				registry.register(recipeNether);
				registry.register(recipeCopy);
				break;
			}
		}
	}

 

It then crashes with the following error output:

Spoiler

// Ouch. That hurt :(

Time: 8/30/18 8:16 AM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from MoreCraft (morecraft)
Caused by: java.lang.IllegalArgumentException: value already present: net.minecraft.item.crafting.ShapedRecipes@73a1a1b4
	at com.google.common.collect.HashBiMap.put(HashBiMap.java:287)
	at com.google.common.collect.HashBiMap.put(HashBiMap.java:262)
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:338)
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:285)
	at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:118)
	at kittehmod.morecraft.crafting.RecipeHelper.fixCraftingRecipes(RecipeHelper.java:121)
	at kittehmod.morecraft.MoreCraft.load(MoreCraft.java:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:629)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
	at com.google.common.eventbus.EventBus.post(EventBus.java:217)
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218)
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
	at com.google.common.eventbus.EventBus.post(EventBus.java:217)
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:744)
	at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:329)
	at net.minecraft.client.Minecraft.init(Minecraft.java:581)
	at net.minecraft.client.Minecraft.run(Minecraft.java:421)
	at net.minecraft.client.main.Main.main(Main.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:25)

 

I'm close to giving up on that.

Link to comment
Share on other sites

Have you tried something like (pseudo code)

 

ArrayList<> myRecipes = new ArrayList<>();

ArrayList otherRecipes = new ArrayList<>();

 

for(Recipe recipe : forgeRegistries.Recipes.allRecipesAsList()) {

if(recipeIsMine(recipe)) {

myRecipes.add(recipe);

}

else {

otherRecipes.add(recipe);

}

}

 

forgeRegistries.Recipes.allRecipesAsList().clear();

 

forgeRegistries.Recipes.allRecipesAsList().addAll(myRecipes);

 

forgeRegistries.Recipes.allRecipesAsList().addAll(otherRecipes);

 

 

sorry for the bad formatting, I wrote it on my phone

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

8 hours ago, Kitteh6660 said:

I'm close to giving up on that.

You never remove your recipe registry so why do you try to add it again?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.

Announcements



×
×
  • Create New...

Important Information

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