Skip to content

Commit

Permalink
Merge pull request #5 from Keriils/fix-bug-and-add-config-key
Browse files Browse the repository at this point in the history
fix bug and add config key
  • Loading branch information
Keriils authored Aug 13, 2024
2 parents 27a72a5 + 8b20c64 commit 4da8930
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
// api("com.github.GTNewHorizons:GT5-Unofficial:5.09.48.66:dev")
compileOnly ('org.jetbrains:annotations:24.1.0')
api("com.github.GTNewHorizons:Draconic-Evolution:1.3.5-GTNH:dev")
implementation('com.github.GTNewHorizons:Baubles:1.0.4:dev')
implementation("com.github.GTNewHorizons:Botania:1.11.3-GTNH:dev")
implementation("com.github.GTNewHorizons:Baubles:1.0.4:dev")
implementation("com.github.GTNewHorizons:ae2stuff:0.8.2-GTNH:dev")
}
7 changes: 5 additions & 2 deletions src/main/java/com/xir/NHUtilities/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraftforge.common.MinecraftForge;

import com.xir.NHUtilities.common.nhutilies.events.GluttonyRingEvent;
import com.xir.NHUtilities.config.Config;
import com.xir.NHUtilities.loader.ItemLoader;
import com.xir.NHUtilities.loader.NHUtilitiesRecipe;

Expand All @@ -14,8 +15,10 @@
public class CommonProxy {

public void preInit(FMLPreInitializationEvent event) {
ItemLoader.registerNHUtilitiesItems();
MinecraftForge.EVENT_BUS.register(new GluttonyRingEvent());
if (Config.enableGluttonyRingAndHungerRing) {
ItemLoader.registerNHUtilitiesItems();
MinecraftForge.EVENT_BUS.register(new GluttonyRingEvent());
}
}

public void init(FMLInitializationEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import com.xir.NHUtilities.common.nhutilies.items.GluttonyRing;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import vazkii.botania.common.item.ModItems;

public class GluttonyRingEvent {

@SubscribeEvent
public void onGluttonyRingEating(PlayerUseItemEvent.Start event) {
EntityPlayer entityPlayer = event.entityPlayer;
if (entityPlayer.getHeldItem() == null) return;
if (entityPlayer.getHeldItem() == null || entityPlayer.getHeldItem()
.getItem() == ModItems.infiniteFruit) return;
Optional<ItemStack> baublesItem = InventoryUtils
.getItemInPlayerBaublesInventory(entityPlayer, GluttonyRing.class);
if (baublesItem.isPresent() && (event.item.getItemUseAction() == EnumAction.eat)) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/xir/NHUtilities/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class Config {

static final Logger ConfigLog = LogManager.getLogger(NHUtilities.MODID + "_Config");

// region register massItems key !!!
public static boolean enableGluttonyRingAndHungerRing = true;
// endregion

// region register mixinModule key region
public static boolean enableEnhancedTeleporterMKII = true;
public static String[] listeningMods = new String[] { "NHUtilities", "TwistSpaceTechnology", "boxplusplus",
Expand All @@ -27,6 +31,7 @@ public class Config {
// region category
private static final String CATEGORY_MIXIN_CONFIG = "Mixin_Config";
private static final String CATEGORY_Manager = "Lang_Manger";
private static final String CATEGORY_MASS = "Mass_Config";
// endregion

// region cfgFile
Expand All @@ -52,6 +57,11 @@ public class Config {
CATEGORY_Manager,
listeningMods,
"List the mod IDs here to manage your GTNH language files");
enableGluttonyRingAndHungerRing = configuration.getBoolean(
"enableGluttonyRingAndHungerRing",
CATEGORY_MASS,
enableGluttonyRingAndHungerRing,
"enable GluttonyRing & AndHungerRing");
}

try {
Expand All @@ -71,5 +81,6 @@ private static void categoryInit() {
configuration.addCustomCategoryComment(
CATEGORY_Manager,
"List the mod IDs here to manage your GTNH language files.\nIf you don't know the mod ID, please write a different name instead.");
configuration.addCustomCategoryComment(CATEGORY_MASS, "A config region to Mass!./I need!!");
}
}

0 comments on commit 4da8930

Please sign in to comment.