diff --git a/README.md b/README.md index 07ebf8c7..caec9554 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ New tweaks: - tweakmAutoFillContainer (Tweak toggles) - netherPortalSoundChance (Generic) - disableLightUpdates (Disable) +- disableRedstoneWireParticle (Disable) - handRestockListType (List) - handRestockWhiteList (List) - handRestockBlackList (List) diff --git a/src/main/java/me/fallenbreath/tweakermore/config/TweakerMoreConfigs.java b/src/main/java/me/fallenbreath/tweakermore/config/TweakerMoreConfigs.java index e7aa48d0..c33722be 100644 --- a/src/main/java/me/fallenbreath/tweakermore/config/TweakerMoreConfigs.java +++ b/src/main/java/me/fallenbreath/tweakermore/config/TweakerMoreConfigs.java @@ -33,6 +33,8 @@ public class TweakerMoreConfigs @DisableConfig public static final ConfigBooleanHotkeyed DISABLE_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableLightUpdates", false, "", "disableLightUpdates.comment", "Disable Light Updates"); + @DisableConfig + public static final ConfigBooleanHotkeyed DISABLE_REDSTONE_WIRE_PARTICLE = new ConfigBooleanHotkeyed("disableRedstoneWireParticle", false, "", "disableRedstoneWireParticle.comment", "Disable particle of redstone wire"); private static String getItemId(Item item) { diff --git a/src/main/java/me/fallenbreath/tweakermore/mixins/tweaks/disableRedstoneWireParticle/RedstoneWireBlockMixin.java b/src/main/java/me/fallenbreath/tweakermore/mixins/tweaks/disableRedstoneWireParticle/RedstoneWireBlockMixin.java new file mode 100644 index 00000000..37e591fa --- /dev/null +++ b/src/main/java/me/fallenbreath/tweakermore/mixins/tweaks/disableRedstoneWireParticle/RedstoneWireBlockMixin.java @@ -0,0 +1,29 @@ +package me.fallenbreath.tweakermore.mixins.tweaks.disableRedstoneWireParticle; + +import me.fallenbreath.tweakermore.config.TweakerMoreConfigs; +import net.minecraft.block.RedstoneWireBlock; +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.CallbackInfo; + +@Mixin(RedstoneWireBlock.class) +public abstract class RedstoneWireBlockMixin +{ + // inject right before world.addParticle to avoid client RNG side effects + @Inject( + method = "randomDisplayTick", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V" + ), + cancellable = true + ) + private void disableRedstoneWireParticle(CallbackInfo ci) + { + if (TweakerMoreConfigs.DISABLE_REDSTONE_WIRE_PARTICLE.getBooleanValue()) + { + ci.cancel(); + } + } +} diff --git a/src/main/resources/assets/tweakermore/lang/en_us.json b/src/main/resources/assets/tweakermore/lang/en_us.json index 42cb9dbb..d62f1abe 100644 --- a/src/main/resources/assets/tweakermore/lang/en_us.json +++ b/src/main/resources/assets/tweakermore/lang/en_us.json @@ -13,6 +13,8 @@ "disableLightUpdates": "disableLightUpdates", "disableLightUpdates.comment": "Yeets client-side light updates", + "disableRedstoneWireParticle": "disableRedstoneWireParticle", + "disableRedstoneWireParticle.comment": "Disable particle of redstone wire", "tweakmAutoCleanContainer": "tweakmAutoCleanContainer", "tweakmAutoCleanContainer.comment": "Automatically drops everything in the opened container\nand then close the container", diff --git a/src/main/resources/assets/tweakermore/lang/zh_cn.json b/src/main/resources/assets/tweakermore/lang/zh_cn.json index 6e5e4ad2..b68a5f36 100644 --- a/src/main/resources/assets/tweakermore/lang/zh_cn.json +++ b/src/main/resources/assets/tweakermore/lang/zh_cn.json @@ -13,6 +13,8 @@ "disableLightUpdates": "disableLightUpdates | 禁用光照更新", "disableLightUpdates.comment": "禁用客户端光照更新", + "disableRedstoneWireParticle": "disableRedstoneWireParticle | 禁用红石粉粒子效果", + "disableRedstoneWireParticle.comment": "禁用红石粉发出的粒子效果", "tweakmAutoCleanContainer": "tweakmAutoCleanContainer | 自动清空容器", "tweakmAutoCleanContainer.comment": "打开后容器,自动将容器内的所有物品扔出\n然后关闭容器", diff --git a/src/main/resources/tweakermore.mixins.json b/src/main/resources/tweakermore.mixins.json index e76c2111..9f475196 100644 --- a/src/main/resources/tweakermore.mixins.json +++ b/src/main/resources/tweakermore.mixins.json @@ -11,6 +11,7 @@ "core.ListsConfigsMixin", "tweaks.disableLightUpdates.ClientChunkManagerMixin", "tweaks.disableLightUpdates.LightingProviderMixin", + "tweaks.disableRedstoneWireParticle.RedstoneWireBlockMixin", "tweaks.handRestoreRestriction.InventoryUtilsMixin", "tweaks.handRestoreRestriction.PlacementTweaksMixin", "tweaks.netherPortalSoundChance.NetherPortalBlockMixin",