mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 13:09:59 +00:00
Add helper to RecipeType, and fix eclipse compiler error in test class.
This commit is contained in:
1 parent
2f9e726aea
commit
1ba9c34650
2 files changed
+18
-14
No files matched your search
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeType.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeType.java
|
||||
@@ -19,4 +_,14 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
+
|
||||
+ public static <T extends Recipe<?>> RecipeType<T> simple(final ResourceLocation name) {
|
||||
+ final String toString = name.toString();
|
||||
+ return new RecipeType<T>() {
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return toString;
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
}
|
||||
+1
-14
@@ -14,7 +14,6 @@ import net.minecraft.world.SimpleMenuProvider;
|
||||
import net.minecraft.world.inventory.ContainerLevelAccess;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.inventory.RecipeBookType;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -49,7 +48,7 @@ public class RecipeBookExtensionTest
|
||||
MENU_TYPE.register("test_recipe_menu", () -> IForgeMenuType.create(RecipeBookTestMenu::new));
|
||||
|
||||
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPE = DeferredRegister.create(ForgeRegistries.RECIPE_TYPES, MOD_ID);
|
||||
public static final RegistryObject<RecipeType<RecipeBookTestRecipe>> RECIPE_BOOK_TEST_RECIPE_TYPE = registerRecipeType("test_recipe");
|
||||
public static final RegistryObject<RecipeType<RecipeBookTestRecipe>> RECIPE_BOOK_TEST_RECIPE_TYPE = RECIPE_TYPE.register("test_recipe", () -> RecipeType.simple(getId("test_recipe")));
|
||||
|
||||
public RecipeBookExtensionTest()
|
||||
{
|
||||
@@ -77,18 +76,6 @@ public class RecipeBookExtensionTest
|
||||
return new ResourceLocation(MOD_ID, name);
|
||||
}
|
||||
|
||||
private static <T extends Recipe<?>> RegistryObject<RecipeType<T>> registerRecipeType(String name) {
|
||||
String id = getId(name).toString();
|
||||
return RECIPE_TYPE.register(name, () -> new RecipeType<>()
|
||||
{
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public static class ClientHandler
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user