From 27a72a5fa22e58cd325ac19e505b4c04f9d19a2f Mon Sep 17 00:00:00 2001 From: DauphalXir <3013875189@qq.com> Date: Tue, 13 Aug 2024 18:49:45 +0800 Subject: [PATCH] add recipe and update --- README.md | 3 ++- .../xir/NHUtilities/common/CommonProxy.java | 5 +++- .../nhutilies/events/GluttonyRingEvent.java | 4 +--- .../nhutilies/items/NHUtilitiesItems.java | 7 ++++++ .../xir/NHUtilities/loader/ItemLoader.java | 7 +++--- .../NHUtilities/loader/NHUtilitiesRecipe.java | 23 +++++++++++++++++++ 6 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/xir/NHUtilities/common/nhutilies/items/NHUtilitiesItems.java create mode 100644 src/main/java/com/xir/NHUtilities/loader/NHUtilitiesRecipe.java diff --git a/README.md b/README.md index 31bf591..46a6a70 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,5 @@ 即你的安装包的lang文件扒过去 > 即 GregTech.lang 文件 > 即 GregTech_zh_CN.lang 文件 - - × 等待新想法中.. \ No newline at end of file + - ✔ 移植类似高版本暴食魔符 -> 暴食指环 以及 饥饿指环(大雾/。。) + - × 等待新想法中.. diff --git a/src/main/java/com/xir/NHUtilities/common/CommonProxy.java b/src/main/java/com/xir/NHUtilities/common/CommonProxy.java index b25454b..e8e705c 100644 --- a/src/main/java/com/xir/NHUtilities/common/CommonProxy.java +++ b/src/main/java/com/xir/NHUtilities/common/CommonProxy.java @@ -4,6 +4,7 @@ import com.xir.NHUtilities.common.nhutilies.events.GluttonyRingEvent; import com.xir.NHUtilities.loader.ItemLoader; +import com.xir.NHUtilities.loader.NHUtilitiesRecipe; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -17,7 +18,9 @@ public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new GluttonyRingEvent()); } - public void init(FMLInitializationEvent event) {} + public void init(FMLInitializationEvent event) { + NHUtilitiesRecipe.init(); + } public void postInit(FMLPostInitializationEvent event) {} diff --git a/src/main/java/com/xir/NHUtilities/common/nhutilies/events/GluttonyRingEvent.java b/src/main/java/com/xir/NHUtilities/common/nhutilies/events/GluttonyRingEvent.java index bce33fd..2e0c042 100644 --- a/src/main/java/com/xir/NHUtilities/common/nhutilies/events/GluttonyRingEvent.java +++ b/src/main/java/com/xir/NHUtilities/common/nhutilies/events/GluttonyRingEvent.java @@ -20,9 +20,7 @@ public void onGluttonyRingEating(PlayerUseItemEvent.Start event) { if (entityPlayer.getHeldItem() == null) return; Optional baublesItem = InventoryUtils .getItemInPlayerBaublesInventory(entityPlayer, GluttonyRing.class); - if (baublesItem.isPresent() && (event.item.getItemUseAction() == EnumAction.eat) - && entityPlayer.getFoodStats() - .getFoodLevel() < 20) { + if (baublesItem.isPresent() && (event.item.getItemUseAction() == EnumAction.eat)) { event.duration = 2; } } diff --git a/src/main/java/com/xir/NHUtilities/common/nhutilies/items/NHUtilitiesItems.java b/src/main/java/com/xir/NHUtilities/common/nhutilies/items/NHUtilitiesItems.java new file mode 100644 index 0000000..6664232 --- /dev/null +++ b/src/main/java/com/xir/NHUtilities/common/nhutilies/items/NHUtilitiesItems.java @@ -0,0 +1,7 @@ +package com.xir.NHUtilities.common.nhutilies.items; + +public class NHUtilitiesItems { + + public static final ItemBasic gluttonyRing = new GluttonyRing(); + public static final ItemBasic hungerRing = new HungerRing(); +} diff --git a/src/main/java/com/xir/NHUtilities/loader/ItemLoader.java b/src/main/java/com/xir/NHUtilities/loader/ItemLoader.java index 3269929..26fd01c 100644 --- a/src/main/java/com/xir/NHUtilities/loader/ItemLoader.java +++ b/src/main/java/com/xir/NHUtilities/loader/ItemLoader.java @@ -1,14 +1,13 @@ package com.xir.NHUtilities.loader; -import com.xir.NHUtilities.common.nhutilies.items.GluttonyRing; -import com.xir.NHUtilities.common.nhutilies.items.HungerRing; +import com.xir.NHUtilities.common.nhutilies.items.NHUtilitiesItems; import cpw.mods.fml.common.registry.GameRegistry; public class ItemLoader { public static void registerNHUtilitiesItems() { - GameRegistry.registerItem(new GluttonyRing(), "GluttonyRing"); - GameRegistry.registerItem(new HungerRing(), "HungerRing"); + GameRegistry.registerItem(NHUtilitiesItems.gluttonyRing, "GluttonyRing"); + GameRegistry.registerItem(NHUtilitiesItems.hungerRing, "HungerRing"); } } diff --git a/src/main/java/com/xir/NHUtilities/loader/NHUtilitiesRecipe.java b/src/main/java/com/xir/NHUtilities/loader/NHUtilitiesRecipe.java new file mode 100644 index 0000000..407f718 --- /dev/null +++ b/src/main/java/com/xir/NHUtilities/loader/NHUtilitiesRecipe.java @@ -0,0 +1,23 @@ +package com.xir.NHUtilities.loader; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +import com.xir.NHUtilities.common.nhutilies.items.NHUtilitiesItems; + +import cpw.mods.fml.common.registry.GameRegistry; + +public class NHUtilitiesRecipe { + + public static void init() { + GameRegistry.addShapedRecipe( + new ItemStack(NHUtilitiesItems.gluttonyRing), + new Object[] { "SIS", "IAI", "SIS", 'A', Items.apple, 'S', Items.string, 'I', Items.iron_ingot }); + GameRegistry.addShapelessRecipe( + new ItemStack(NHUtilitiesItems.hungerRing), + new ItemStack(NHUtilitiesItems.gluttonyRing)); + GameRegistry.addShapelessRecipe( + new ItemStack(NHUtilitiesItems.gluttonyRing), + new ItemStack(NHUtilitiesItems.hungerRing)); + } +}