From 78dedd55393eb08920439d201169e95dde088a36 Mon Sep 17 00:00:00 2001 From: DauphalXir Date: Sat, 14 Sep 2024 10:18:16 +0800 Subject: [PATCH] add --- dependencies.gradle | 3 +++ .../common/events/EnhanceExUHealingAxe.java | 21 +++++++++++++++++ ...oad.java => GetModItemWhileWorldLoad.java} | 12 +++++++--- .../common/recipes/GTRecipes/GTRecipes.java | 10 ++++++++ .../com/xir/NHUtilities/config/Config.java | 15 ++++++++++++ .../xir/NHUtilities/loader/EventLoader.java | 11 ++++++--- .../com/xir/NHUtilities/mixins/Mixins.java | 8 +++++++ .../com/xir/NHUtilities/mixins/TargetMod.java | 5 +++- .../late/GregTech/DisableDebuff_Mixin.java | 23 +++++++++++++++++++ .../late/JABBA/DisableDollyDebuff_Mixin.java | 23 +++++++++++++++++++ .../late/WorldEditGtnh/ModifyWEWithExU.java | 5 ++-- 11 files changed, 127 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/xir/NHUtilities/common/events/EnhanceExUHealingAxe.java rename src/main/java/com/xir/NHUtilities/common/events/{WorldLoad.java => GetModItemWhileWorldLoad.java} (57%) create mode 100644 src/main/java/com/xir/NHUtilities/mixins/late/GregTech/DisableDebuff_Mixin.java create mode 100644 src/main/java/com/xir/NHUtilities/mixins/late/JABBA/DisableDollyDebuff_Mixin.java diff --git a/dependencies.gradle b/dependencies.gradle index a038a4d..f84d988 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -22,6 +22,9 @@ dependencies { // lunch box plus implementation("com.github.GTNewHorizons:SpiceOfLife:2.1.12-carrot:dev") + // jabba + implementation("com.github.GTNewHorizons:Jabba:1.3.5:dev") + // debug info & nbtEdit runtimeOnly("com.github.GTNewHorizons:ServerUtilities:2.0.66:dev") runtimeOnly files("libs/ForgeNBTEdit.jar") diff --git a/src/main/java/com/xir/NHUtilities/common/events/EnhanceExUHealingAxe.java b/src/main/java/com/xir/NHUtilities/common/events/EnhanceExUHealingAxe.java new file mode 100644 index 0000000..944741c --- /dev/null +++ b/src/main/java/com/xir/NHUtilities/common/events/EnhanceExUHealingAxe.java @@ -0,0 +1,21 @@ +package com.xir.NHUtilities.common.events; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.event.entity.player.PlayerEvent; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +@SuppressWarnings("unused") +public class EnhanceExUHealingAxe { + + @SubscribeEvent + public void onHeldHealingAxe(PlayerEvent event) { + EntityPlayer entityPlayer = event.entityPlayer; + if (entityPlayer.worldObj.getTotalWorldTime() % 40L == 0L && entityPlayer.getHeldItem() != null + && (entityPlayer.getHeldItem() + .getItem() == GetModItemWhileWorldLoad.getItemHealingAxe())) { + entityPlayer.getFoodStats() + .addStats(20, 5.0F); // ha.... + } + } +} diff --git a/src/main/java/com/xir/NHUtilities/common/events/WorldLoad.java b/src/main/java/com/xir/NHUtilities/common/events/GetModItemWhileWorldLoad.java similarity index 57% rename from src/main/java/com/xir/NHUtilities/common/events/WorldLoad.java rename to src/main/java/com/xir/NHUtilities/common/events/GetModItemWhileWorldLoad.java index fb7f83e..bf16981 100644 --- a/src/main/java/com/xir/NHUtilities/common/events/WorldLoad.java +++ b/src/main/java/com/xir/NHUtilities/common/events/GetModItemWhileWorldLoad.java @@ -7,16 +7,22 @@ import cpw.mods.fml.common.registry.GameRegistry; @SuppressWarnings("unused") -public class WorldLoad { +public class GetModItemWhileWorldLoad { - public static int healingAxe; + private static int healingAxe; + private static Item itemHealingAxe; @SubscribeEvent public void initHealingAxeIdOnWorldLoad(EntityJoinWorldEvent event) { - healingAxe = Item.getIdFromItem(GameRegistry.findItem("ExtraUtilities", "defoliageAxe")); + itemHealingAxe = GameRegistry.findItem("ExtraUtilities", "defoliageAxe"); + healingAxe = Item.getIdFromItem(itemHealingAxe); } public static int getHealingAxeID() { return healingAxe; } + + public static Item getItemHealingAxe() { + return itemHealingAxe; + } } diff --git a/src/main/java/com/xir/NHUtilities/common/recipes/GTRecipes/GTRecipes.java b/src/main/java/com/xir/NHUtilities/common/recipes/GTRecipes/GTRecipes.java index e448350..c3d1bfc 100644 --- a/src/main/java/com/xir/NHUtilities/common/recipes/GTRecipes/GTRecipes.java +++ b/src/main/java/com/xir/NHUtilities/common/recipes/GTRecipes/GTRecipes.java @@ -1,5 +1,6 @@ package com.xir.NHUtilities.common.recipes.GTRecipes; +import static com.github.technus.tectech.thing.CustomItemList.hatch_CreativeMaintenance; import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; import static gregtech.api.recipe.RecipeMaps.extractorRecipes; @@ -13,6 +14,7 @@ import goodgenerator.items.MyMaterial; import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TierEU; @@ -176,5 +178,13 @@ public static void registerNHUtilitiesGTRecipe() { .duration(100 * SECOND) .eut(TierEU.RECIPE_EV) .addTo(extractorRecipes); + + // for adding debug maintenance recipe + GT_Values.RA.stdBuilder() + .itemInputs(ItemList.Hull_EV.get(1), ItemList.Duct_Tape.get(1), GT_Utility.getIntegratedCircuit(16)) + .itemOutputs(hatch_CreativeMaintenance.get(1)) + .duration(25 * SECOND) + .eut(TierEU.RECIPE_HV) + .addTo(assemblerRecipes); } } diff --git a/src/main/java/com/xir/NHUtilities/config/Config.java b/src/main/java/com/xir/NHUtilities/config/Config.java index 0c1372b..ab16d3f 100644 --- a/src/main/java/com/xir/NHUtilities/config/Config.java +++ b/src/main/java/com/xir/NHUtilities/config/Config.java @@ -41,7 +41,10 @@ public class Config { public static boolean enableEnhancedTeleporterMKII = true; public static boolean enableModifyEnderIoCapBankIO = true; public static boolean enableWEToolWithExuHealingAxe = false; + public static boolean enableEnhancedExUHealingAxe = true; public static boolean enableAccelerateEnderIoMachine = true; + public static boolean disableSuperChestOrTankDebuff = true; + public static boolean disableDollyDebuff = true; public static boolean enableLunchBoxPlus = true; public static String[] listeningMods = new String[] { "NHUtilities", "TwistSpaceTechnology", "boxplusplus", "programmablehatches" }; @@ -166,6 +169,18 @@ static File minecraftHome() { "enable Accelerate EnderIO Machine"); enableLunchBoxPlus = configuration .getBoolean("enableLunchBoxPlus", CATEGORY_MIXIN_CONFIG, enableLunchBoxPlus, "enable Lunch Box Plus"); + enableEnhancedExUHealingAxe = configuration.getBoolean( + "enableEnhancedExUHealingAxe", + CATEGORY_MIXIN_CONFIG, + enableEnhancedExUHealingAxe, + "enable Enhanced ExU Healing Axe"); + disableSuperChestOrTankDebuff = configuration.getBoolean( + "disableSuperChestOrTankDebuff", + CATEGORY_MIXIN_CONFIG, + disableSuperChestOrTankDebuff, + "disable Super Chest Or Tank Debuff"); + disableDollyDebuff = configuration + .getBoolean("disableDollyDebuff", CATEGORY_MIXIN_CONFIG, disableDollyDebuff, "disable Dolly Debuff"); } diff --git a/src/main/java/com/xir/NHUtilities/loader/EventLoader.java b/src/main/java/com/xir/NHUtilities/loader/EventLoader.java index dd87ed9..41ae056 100644 --- a/src/main/java/com/xir/NHUtilities/loader/EventLoader.java +++ b/src/main/java/com/xir/NHUtilities/loader/EventLoader.java @@ -1,12 +1,14 @@ package com.xir.NHUtilities.loader; +import static com.xir.NHUtilities.config.Config.enableEnhancedExUHealingAxe; import static com.xir.NHUtilities.config.Config.enableGluttonyRingAndHungerRing; import static com.xir.NHUtilities.config.Config.enableWEToolWithExuHealingAxe; import net.minecraftforge.common.MinecraftForge; +import com.xir.NHUtilities.common.events.EnhanceExUHealingAxe; +import com.xir.NHUtilities.common.events.GetModItemWhileWorldLoad; import com.xir.NHUtilities.common.events.GluttonyRingEvent; -import com.xir.NHUtilities.common.events.WorldLoad; public class EventLoader { @@ -14,8 +16,11 @@ public static void registerNHUtilitiesEvents() { if (enableGluttonyRingAndHungerRing) { MinecraftForge.EVENT_BUS.register(new GluttonyRingEvent()); } - if (enableWEToolWithExuHealingAxe) { - MinecraftForge.EVENT_BUS.register(new WorldLoad()); + if (enableWEToolWithExuHealingAxe || enableEnhancedExUHealingAxe) { + MinecraftForge.EVENT_BUS.register(new GetModItemWhileWorldLoad()); + } + if (enableEnhancedExUHealingAxe) { + MinecraftForge.EVENT_BUS.register(new EnhanceExUHealingAxe()); } } } diff --git a/src/main/java/com/xir/NHUtilities/mixins/Mixins.java b/src/main/java/com/xir/NHUtilities/mixins/Mixins.java index 7ecfc9d..bb429b8 100644 --- a/src/main/java/com/xir/NHUtilities/mixins/Mixins.java +++ b/src/main/java/com/xir/NHUtilities/mixins/Mixins.java @@ -1,5 +1,7 @@ package com.xir.NHUtilities.mixins; +import static com.xir.NHUtilities.config.Config.disableDollyDebuff; +import static com.xir.NHUtilities.config.Config.disableSuperChestOrTankDebuff; import static com.xir.NHUtilities.config.Config.enableAccelerateEnderIoMachine; import static com.xir.NHUtilities.config.Config.enableAccelerateGregTechMachine; import static com.xir.NHUtilities.config.Config.enableEnhancedTeleporterMKII; @@ -40,6 +42,10 @@ public enum Mixins { "SpiceOfLife.GuiHandler_Server_Mixin", TargetMod.SpiceOfLife), SpiceOfLife_LunchBoxGuiHandlerClient(Category.LunchBoxPlus, Side.CLIENT, Phase.LATE, "SpiceOfLife.GuiHandler_Client_Mixin", TargetMod.SpiceOfLife), + DisableDebuff_Mixin(Category.DisableSuperTankOrChestDebuff, Side.BOTH, Phase.LATE, "GregTech.DisableDebuff_Mixin", + TargetMod.GregTech), + DisableDollyDebuff_Mixin(Category.DisableDollyDebuff, Side.BOTH, Phase.LATE, "JABBA.DisableDollyDebuff_Mixin", + TargetMod.JABBA), ; @@ -51,6 +57,8 @@ private enum Category { WEToolWithExuHealingAxe(enableWEToolWithExuHealingAxe), ToAccelerateEnderIoMachine(enableAccelerateEnderIoMachine), LunchBoxPlus(enableLunchBoxPlus), + DisableSuperTankOrChestDebuff(disableSuperChestOrTankDebuff), + DisableDollyDebuff(disableDollyDebuff), ; diff --git a/src/main/java/com/xir/NHUtilities/mixins/TargetMod.java b/src/main/java/com/xir/NHUtilities/mixins/TargetMod.java index aabe35d..0e18afa 100644 --- a/src/main/java/com/xir/NHUtilities/mixins/TargetMod.java +++ b/src/main/java/com/xir/NHUtilities/mixins/TargetMod.java @@ -9,7 +9,10 @@ public enum TargetMod { EnderIO("Ender IO", "EnderIO"), WorldEdit("WorldEdit", "worldedit"), ExtraUtilities("Extra Utilities", "ExtraUtilities"), - SpiceOfLife("SpiceOfLife", "SpiceOfLife"),; + SpiceOfLife("SpiceOfLife", "SpiceOfLife"), + JABBA("JABBA", "JABBA"), + + ; public final String modName; public final String modId; diff --git a/src/main/java/com/xir/NHUtilities/mixins/late/GregTech/DisableDebuff_Mixin.java b/src/main/java/com/xir/NHUtilities/mixins/late/GregTech/DisableDebuff_Mixin.java new file mode 100644 index 0000000..b045f53 --- /dev/null +++ b/src/main/java/com/xir/NHUtilities/mixins/late/GregTech/DisableDebuff_Mixin.java @@ -0,0 +1,23 @@ +package com.xir.NHUtilities.mixins.late.GregTech; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.PotionEffect; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import gregtech.common.blocks.GT_Item_Machines; + +@Mixin(value = GT_Item_Machines.class, remap = false) +public class DisableDebuff_Mixin { + + @Redirect( + method = "onUpdate", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/EntityLivingBase;addPotionEffect(Lnet/minecraft/potion/PotionEffect;)V")) + private void NHUtilities$disableDebuff(EntityLivingBase instance, PotionEffect p_70690_1_) { + // nothing + } +} diff --git a/src/main/java/com/xir/NHUtilities/mixins/late/JABBA/DisableDollyDebuff_Mixin.java b/src/main/java/com/xir/NHUtilities/mixins/late/JABBA/DisableDollyDebuff_Mixin.java new file mode 100644 index 0000000..7a915f4 --- /dev/null +++ b/src/main/java/com/xir/NHUtilities/mixins/late/JABBA/DisableDollyDebuff_Mixin.java @@ -0,0 +1,23 @@ +package com.xir.NHUtilities.mixins.late.JABBA; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.PotionEffect; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import mcp.mobius.betterbarrels.common.items.dolly.ItemBarrelMover; + +@Mixin(value = ItemBarrelMover.class, remap = false) +public class DisableDollyDebuff_Mixin { + + @Redirect( + method = "onUpdate", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/player/EntityPlayer;addPotionEffect(Lnet/minecraft/potion/PotionEffect;)V")) + private void NHUtilities$disableDebuff(EntityPlayer instance, PotionEffect potionEffect) { + // nothing + } +} diff --git a/src/main/java/com/xir/NHUtilities/mixins/late/WorldEditGtnh/ModifyWEWithExU.java b/src/main/java/com/xir/NHUtilities/mixins/late/WorldEditGtnh/ModifyWEWithExU.java index a0c68c9..15189b0 100644 --- a/src/main/java/com/xir/NHUtilities/mixins/late/WorldEditGtnh/ModifyWEWithExU.java +++ b/src/main/java/com/xir/NHUtilities/mixins/late/WorldEditGtnh/ModifyWEWithExU.java @@ -8,7 +8,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.PlatformManager; -import com.xir.NHUtilities.common.events.WorldLoad; +import com.xir.NHUtilities.common.events.GetModItemWhileWorldLoad; @Mixin(value = PlatformManager.class, remap = false) public class ModifyWEWithExU { @@ -35,7 +35,8 @@ public class ModifyWEWithExU { @Unique private int NHUtilities$check(@NotNull Player instance) { int itemInHand = instance.getItemInHand(); - return itemInHand == WorldLoad.getHealingAxeID() ? NHUtilities$pManager.getConfiguration().wandItem + return itemInHand == GetModItemWhileWorldLoad.getHealingAxeID() + ? NHUtilities$pManager.getConfiguration().wandItem : itemInHand; }