From 1a81aad3f96749f16e9bb780f218fedcf2456c67 Mon Sep 17 00:00:00 2001 From: Hikari_Nova <3044344887@qq.com> Date: Wed, 11 Sep 2024 01:19:01 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=96=B0=E5=A2=9E=20MrCrayFishFurniture=20?= =?UTF-8?q?=E6=A8=A1=E7=BB=84=E7=9A=84=E6=B4=97=E8=A1=A3=E6=9C=BA=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 +- .../common/config/StellarCoreConfig.java | 4 ++++ .../cfm/MixinTileEntityWashingMachine.java | 22 +++++++++++++++++++ .../resources/mixins.stellar_core_cfm.json | 3 ++- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/main/java/github/kasuminova/stellarcore/mixin/cfm/MixinTileEntityWashingMachine.java diff --git a/build.gradle.kts b/build.gradle.kts index d91fb70..7fb85ac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ plugins { // Project properties group = "github.kasuminova.stellarcore" -version = "1.3.4" +version = "1.3.5" // Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod java { diff --git a/src/main/java/github/kasuminova/stellarcore/common/config/StellarCoreConfig.java b/src/main/java/github/kasuminova/stellarcore/common/config/StellarCoreConfig.java index 8f33ec2..51dcefe 100644 --- a/src/main/java/github/kasuminova/stellarcore/common/config/StellarCoreConfig.java +++ b/src/main/java/github/kasuminova/stellarcore/common/config/StellarCoreConfig.java @@ -428,6 +428,10 @@ public static class MrCrayfishFurniture { @Config.Name("BlockFurnitureTileFixes") public boolean blockFurnitureTile = true; + @Config.Comment("Stopping washing machines from repairing non-repairable items.") + @Config.Name("WashingMachineDamageFixes") + public boolean washingMachine = true; + } public static class RPSIdeas { diff --git a/src/main/java/github/kasuminova/stellarcore/mixin/cfm/MixinTileEntityWashingMachine.java b/src/main/java/github/kasuminova/stellarcore/mixin/cfm/MixinTileEntityWashingMachine.java new file mode 100644 index 0000000..15a3b35 --- /dev/null +++ b/src/main/java/github/kasuminova/stellarcore/mixin/cfm/MixinTileEntityWashingMachine.java @@ -0,0 +1,22 @@ +package github.kasuminova.stellarcore.mixin.cfm; + +import com.mrcrayfish.furniture.tileentity.TileEntityWashingMachine; +import github.kasuminova.stellarcore.common.config.StellarCoreConfig; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SuppressWarnings("MethodMayBeStatic") +@Mixin(TileEntityWashingMachine.class) +public class MixinTileEntityWashingMachine { + + @Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isEmpty()Z", ordinal = 0)) + private boolean redirectUpdateIsEmpty(final ItemStack instance) { + if (!StellarCoreConfig.BUG_FIXES.mrCrayfishFurniture.washingMachine) { + return instance.isEmpty(); + } + return instance.isEmpty() || !instance.getItem().isRepairable(); + } + +} diff --git a/src/main/resources/mixins.stellar_core_cfm.json b/src/main/resources/mixins.stellar_core_cfm.json index 5619bfe..96416e4 100644 --- a/src/main/resources/mixins.stellar_core_cfm.json +++ b/src/main/resources/mixins.stellar_core_cfm.json @@ -12,7 +12,8 @@ "MixinTileEntityKitchenCounter", "MixinTileEntityKitchenCounterDrawer", "MixinTileEntitySyncClient", - "MixinTileEntityTVStand" + "MixinTileEntityTVStand", + "MixinTileEntityWashingMachine" ], "client": [ "MixinImageCache"