From 63d5130b6e416e404d1a4144c7a31c9d41d5391f Mon Sep 17 00:00:00 2001 From: telontelvarost Date: Mon, 13 May 2024 00:29:59 -0400 Subject: [PATCH] UDOC-0 - Add ability to milk squids --- README.md | 1 + build.gradle | 3 ++ gradle.properties | 2 +- .../github/telvarost/betatweaks/Config.java | 5 +++ .../betatweaks/mixin/SquidMixin.java | 32 +++++++++++++++++++ src/main/resources/betatweaks.mixins.json | 1 + 6 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/github/telvarost/betatweaks/mixin/SquidMixin.java diff --git a/README.md b/README.md index 18845e1..daa81b8 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ All fixes are disabled by default. You will need ModMenu and GlassConfigAPI to e * Hide/Show Dead Shrubs * Hide/Show Long Grass * Hoe Grass For Seeds +* Milk Squids * Minecart Boosters * Have Pigs Drop Brown Mushrooms * Punch Sheep For Wool diff --git a/build.gradle b/build.gradle index 41efd46..15d64f8 100644 --- a/build.gradle +++ b/build.gradle @@ -75,6 +75,9 @@ dependencies { modImplementation "net.modificationstation:StationAPI:${project.stapi_version}" // Optional, but convenient mods for mod creators and users alike. + modImplementation("com.github.DanyGames2014:spawneggs:55a2b88f20") { + transitive false + } modImplementation("com.github.calmilamsy:ModMenu:${project.modmenu_version}") { transitive false } diff --git a/gradle.properties b/gradle.properties index 1b33241..9ba7743 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=b1.7.3-build.2 loader_version=0.14.24-babric.1 # Mod Properties -mod_version=2.1.0 +mod_version=2.2.0 maven_group=com.github.telvarost archives_base_name=BetaTweaks diff --git a/src/main/java/com/github/telvarost/betatweaks/Config.java b/src/main/java/com/github/telvarost/betatweaks/Config.java index 74d788f..8fdca4c 100644 --- a/src/main/java/com/github/telvarost/betatweaks/Config.java +++ b/src/main/java/com/github/telvarost/betatweaks/Config.java @@ -56,6 +56,11 @@ public static class ConfigFields { @ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) public Boolean hoeGrassForSeeds = false; + @ConfigName("Milk Squids") + @MultiplayerSynced + @ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) + public Boolean milkSquids = false; + @ConfigName("Minecart Boosters") @MultiplayerSynced @ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) diff --git a/src/main/java/com/github/telvarost/betatweaks/mixin/SquidMixin.java b/src/main/java/com/github/telvarost/betatweaks/mixin/SquidMixin.java new file mode 100644 index 0000000..cbcf700 --- /dev/null +++ b/src/main/java/com/github/telvarost/betatweaks/mixin/SquidMixin.java @@ -0,0 +1,32 @@ +package com.github.telvarost.betatweaks.mixin; + +import com.github.telvarost.betatweaks.Config; +import net.minecraft.entity.player.PlayerBase; +import net.minecraft.entity.swimming.Squid; +import net.minecraft.entity.swimming.SwimmingBase; +import net.minecraft.item.ItemBase; +import net.minecraft.item.ItemInstance; +import net.minecraft.level.Level; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(Squid.class) +public class SquidMixin extends SwimmingBase { + public SquidMixin(Level arg) { + super(arg); + } + + @Override + public boolean interact(PlayerBase arg) { + if (Config.config.milkSquids) { + ItemInstance var2 = arg.inventory.getHeldItem(); + if (var2 != null && var2.itemId == ItemBase.bucket.id) { + arg.inventory.setInventoryItem(arg.inventory.selectedHotbarSlot, new ItemInstance(ItemBase.milk)); + return true; + } else { + return false; + } + } else { + return false; + } + } +} diff --git a/src/main/resources/betatweaks.mixins.json b/src/main/resources/betatweaks.mixins.json index 311f8e3..a7c2815 100644 --- a/src/main/resources/betatweaks.mixins.json +++ b/src/main/resources/betatweaks.mixins.json @@ -14,6 +14,7 @@ "PlayerBaseMixin", "PlayerContainerMixin", "SheepMixin", + "SquidMixin", "TallGrassMixin", "TntMixin" ],