From 412ceaf2b93cf008797463be91af9b508d4e60c0 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:02:37 -0700 Subject: [PATCH 1/2] Glass Bottle Consumes Water Source --- README.md | 1 + .../config/UTConfigTweaks.java | 5 ++++ .../universaltweaks/core/UTLoadingPlugin.java | 1 + .../bottle/mixin/UTItemGlassBottleMixin.java | 27 +++++++++++++++++++ .../resources/mixins.tweaks.items.bottle.json | 7 +++++ 5 files changed, 41 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/items/bottle/mixin/UTItemGlassBottleMixin.java create mode 100644 src/main/resources/mixins.tweaks.items.bottle.json diff --git a/README.md b/README.md index 12862efd..d573bbc9 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ All changes are toggleable via config files. * **Fence/Wall Jump:** Allows the player to jump over fences and walls * **Finite Water:** Prevents creation of infinite water sources outside of ocean and river biomes * **First Person Burning Overlay:** Sets the offset for the fire overlay in first person when the player is burning +* **Glass Bottle Consumes Water Source:** Causes Glass Bottles to consume the source block of water * **Growth Size:** Configurable growth height/length for sugar cane, cacti and vines * **Hardcore Buckets:** Prevents placing of liquid source blocks in the world * **Hide Personal Effect Particles:** Disables potion effect particles emitting from yourself diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 4d1b9559..3e089dc2 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1063,6 +1063,11 @@ public static class ItemsCategory @Config.Comment("Disables dragon's breath from being a container item and leaving off empty bottles when a stack is brewed with") public boolean utLeftoverBreathBottleToggle = true; + @Config.RequiresMcRestart + @Config.Name("Glass Bottle Consumes Water Source") + @Config.Comment("Causes Glass Bottles to consume the source block of water") + public boolean utGlassBottlesConsumeWaterSource = false; + @Config.Name("Custom Rarity") @Config.Comment ({ diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 35f49f84..87bbe69c 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -117,6 +117,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.entities.trading.json", () -> UTConfigTweaks.ENTITIES.utVillagerTradeLevelingToggle || UTConfigTweaks.ENTITIES.utVillagerTradeRestockToggle); put("mixins.tweaks.entities.voidteleport.json", () -> UTConfigTweaks.ENTITIES.VOID_TELEPORT.utVoidTeleportToggle); put("mixins.tweaks.items.attackcooldown.server.json", () -> UTConfigTweaks.ITEMS.ATTACK_COOLDOWN.utAttackCooldownToggle); + put("mixins.tweaks.items.bottle.json", () -> UTConfigTweaks.ITEMS.utGlassBottlesConsumeWaterSource); put("mixins.tweaks.items.bucket.json", () -> UTConfigTweaks.ITEMS.utPreventBucketPlacingInPortal); put("mixins.tweaks.items.eating.json", () -> UTConfigTweaks.ITEMS.utAlwaysEatToggle); put("mixins.tweaks.items.hardcorebuckets.json", () -> UTConfigTweaks.ITEMS.utHardcoreBucketsToggle); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/items/bottle/mixin/UTItemGlassBottleMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/items/bottle/mixin/UTItemGlassBottleMixin.java new file mode 100644 index 00000000..e23703de --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/items/bottle/mixin/UTItemGlassBottleMixin.java @@ -0,0 +1,27 @@ +package mod.acgaming.universaltweaks.tweaks.items.bottle.mixin; + +import net.minecraft.item.ItemGlassBottle; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import com.llamalad7.mixinextras.sugar.Local; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; + +// Courtesy of WaitingIdly +@Mixin(ItemGlassBottle.class) +public abstract class UTItemGlassBottleMixin +{ + @Inject(method = "onItemRightClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(Lnet/minecraft/entity/player/EntityPlayer;DDDLnet/minecraft/util/SoundEvent;Lnet/minecraft/util/SoundCategory;FF)V", ordinal = 1, shift = At.Shift.AFTER)) + private void utConsumeWaterSourceBlock(CallbackInfoReturnable> cir, @Local(argsOnly = true) World world, @Local BlockPos blockpos) + { + if (!UTConfigTweaks.ITEMS.utGlassBottlesConsumeWaterSource) return; + world.setBlockToAir(blockpos); + } +} diff --git a/src/main/resources/mixins.tweaks.items.bottle.json b/src/main/resources/mixins.tweaks.items.bottle.json new file mode 100644 index 00000000..dc33950d --- /dev/null +++ b/src/main/resources/mixins.tweaks.items.bottle.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.items.bottle.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTItemGlassBottleMixin"] +} \ No newline at end of file From 86e6c8d72aa0e1cafd498c1129cdfea5e2b39b61 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:26:39 -0700 Subject: [PATCH 2/2] mark multiple mods as obsolete --- .../universaltweaks/util/compat/UTObsoleteModsHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java index e186b874..adc8d888 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -36,6 +36,7 @@ public class UTObsoleteModsHandler put("blockdispenser", () -> UTConfigTweaks.BLOCKS.BLOCK_DISPENSER.utBlockDispenserToggle); put("blockfire", () -> UTConfigBugfixes.ENTITIES.utBlockFireToggle); put("blockoverlayfix", () -> UTConfigBugfixes.BLOCKS.BLOCK_OVERLAY.utBlockOverlayToggle); + put("bottlefix", () -> UTConfigTweaks.ITEMS.utGlassBottlesConsumeWaterSource); put("bottomsugarcanharvest", () -> UTConfigTweaks.BLOCKS.utSugarCaneSize != 3); put("bowinfinityfix", () -> UTConfigTweaks.ITEMS.INFINITY.utBowInfinityToggle); put("breedablekillerrabbit", () -> UTConfigTweaks.ENTITIES.utRabbitKillerChance > 0.0D); @@ -117,12 +118,14 @@ public class UTObsoleteModsHandler put("savemystronghold", () -> UTConfigTweaks.WORLD.utStrongholdToggle); put("sleepsooner", () -> UTConfigTweaks.ENTITIES.SLEEPING.utSleepingTime != -1); put("smooth-scrolling-everywhere", () -> UTConfigTweaks.MISC.SMOOTH_SCROLLING.utSmoothScrollingToggle); + put("sourcebottles", () -> UTConfigTweaks.ITEMS.utGlassBottlesConsumeWaterSource); put("steamworldpatcher", () -> UTConfigMods.STEAMWORLD.utSkyOfOldFixToggle); put("stepupfix", () -> UTConfigTweaks.ENTITIES.utAutoJumpToggle); put("stg", () -> UTConfigTweaks.MISC.SWING_THROUGH_GRASS.utSwingThroughGrassToggle); put("superhot", () -> UTConfigTweaks.ITEMS.utSuperHotTorchToggle); put("surge", () -> true); put("tconfixes", () -> true); + put("thirstybottles", () -> UTConfigTweaks.ITEMS.utGlassBottlesConsumeWaterSource); put("tidychunk", () -> UTConfigTweaks.WORLD.utTidyChunkToggle); put("tinkersoredictcache", () -> UTConfigMods.TINKERS_CONSTRUCT.utTConOreDictCacheToggle); put("toastcontrol", () -> UTConfigTweaks.MISC.TOAST_CONTROL.utToastControlToggle);