In-progress Registry system enhancement.

Needs cpw to take a look at enabling removing/overriding in the registry stuff.
But in theory it loads json recipes for mods now.
This commit is contained in:
LexManos committed 2017-06-14 10:14:56 -07:00
1 parent 54d26cb4cc
commit a8659a1613
37 files changed
+1476 -208

No files matched your search

@@ -0,0 +1,46 @@
package net.minecraftforge.debug;
import com.google.gson.JsonObject;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.common.crafting.IIngredientFactory;
import net.minecraftforge.common.crafting.IRecipeFactory;
import net.minecraftforge.common.crafting.JsonContext;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod(modid = CraftingSystemTest.MOD_ID, name = "CraftingTestMod", version = "1.0", acceptableRemoteVersions = "*")
@Mod.EventBusSubscriber
public class CraftingSystemTest
{
static final String MOD_ID = "crafting_system_test";
static final boolean ENABLED = false;
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event)
{
FMLLog.info("Registering Test Recipes:");
}
public static class IngredientFactory implements IIngredientFactory
{
@Override
public Ingredient parse(JsonContext context, JsonObject json)
{
return null;
}
}
public static class RecipeFactory implements IRecipeFactory
{
@Override
public IRecipe parse(JsonContext context, JsonObject json)
{
return null;
}
}
}
@@ -42,9 +42,9 @@ public class FreezingTests
{
Loader.instance();
System.setProperty("fml.queryResult", "confirm");
registry = PersistentRegistryManager.createRegistry(resloc, RTest.class, null, 0, 255, false, null, null, null, null);
PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, null, 0, 255, false, null, null, null, null);
PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, 0, 255, false, null, null, null, null);
registry = new RegistryBuilder<RTest>().setName(resloc).setType(RTest.class).setIDRange(0, 255).create();
new RegistryBuilder<Block>().setName(PersistentRegistryManager.BLOCKS).setType(Block.class).setIDRange(0, 255).create();
new RegistryBuilder<Item>().setName(PersistentRegistryManager.ITEMS).setType(Item.class).setIDRange(0, 255).create();
r1 = new RTest("test1");
r2 = new RTest("test2");
r3 = new RTest("test3");
@@ -61,9 +61,9 @@ public class FreezingTests
ss.entries.put(resloc, new PersistentRegistryManager.GameDataSnapshot.Entry(PersistentRegistryManager.PersistentRegistry.ACTIVE.getRegistry(RTest.class)));
PersistentRegistryManager.PersistentRegistry.ACTIVE.clean();
PersistentRegistryManager.PersistentRegistry.FROZEN.clean();
registry = PersistentRegistryManager.createRegistry(resloc, RTest.class, null, 0, 255, false, null, null, null, null);
PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, null, 0, 255, false, null, null, null, null);
PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, 0, 255, false, null, null, null, null);
registry = new RegistryBuilder<RTest>().setName(resloc).setType(RTest.class).setIDRange(0, 255).create();
new RegistryBuilder<Block>().setName(PersistentRegistryManager.BLOCKS).setType(Block.class).setIDRange(0, 255).create();
new RegistryBuilder<Item>().setName(PersistentRegistryManager.ITEMS).setType(Item.class).setIDRange(0, 255).create();
}
@Test