Skip to content

Commit

Permalink
add recipe and update
Browse files Browse the repository at this point in the history
  • Loading branch information
Keriils committed Aug 13, 2024
1 parent 6b9725a commit 27a72a5
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
即你的安装包的lang文件扒过去
> 即 GregTech.lang 文件
> 即 GregTech_zh_CN.lang 文件
- × 等待新想法中..
- ✔ 移植类似高版本暴食魔符 -> 暴食指环 以及 饥饿指环(大雾/。。)
- × 等待新想法中..
5 changes: 4 additions & 1 deletion src/main/java/com/xir/NHUtilities/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public void onGluttonyRingEating(PlayerUseItemEvent.Start event) {
if (entityPlayer.getHeldItem() == null) return;
Optional<ItemStack> 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;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
7 changes: 3 additions & 4 deletions src/main/java/com/xir/NHUtilities/loader/ItemLoader.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
23 changes: 23 additions & 0 deletions src/main/java/com/xir/NHUtilities/loader/NHUtilitiesRecipe.java
Original file line number Diff line number Diff line change
@@ -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));
}
}

0 comments on commit 27a72a5

Please sign in to comment.