From 51cb30a9c472f901058c0b8b195ff5352eb6921a Mon Sep 17 00:00:00 2001 From: ishland Date: Tue, 19 Sep 2023 12:36:59 +0800 Subject: [PATCH] fix: send block updates when chunk post-processing Fixes #222 --- .../c2me/notickvd/mixin/MixinWorldChunk.java | 20 +++++++++++++++++++ .../main/resources/c2me-notickvd.mixins.json | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/mixin/MixinWorldChunk.java diff --git a/c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/mixin/MixinWorldChunk.java b/c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/mixin/MixinWorldChunk.java new file mode 100644 index 000000000..b5935febd --- /dev/null +++ b/c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/mixin/MixinWorldChunk.java @@ -0,0 +1,20 @@ +package com.ishland.c2me.notickvd.mixin; + +import net.minecraft.block.Block; +import net.minecraft.world.chunk.WorldChunk; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(WorldChunk.class) +public class MixinWorldChunk { + + @ModifyArg(method = "runPostProcessing", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) + private int notifyListenersWhenPostProcessing(int flags) { +// if (true) return flags; + flags &= ~Block.NO_REDRAW; // clear NO_REDRAW + flags |= Block.NOTIFY_LISTENERS; // set NOTIFY_LISTENERS + return flags; + } + +} diff --git a/c2me-notickvd/src/main/resources/c2me-notickvd.mixins.json b/c2me-notickvd/src/main/resources/c2me-notickvd.mixins.json index d2812ff22..5d358e9b5 100644 --- a/c2me-notickvd/src/main/resources/c2me-notickvd.mixins.json +++ b/c2me-notickvd/src/main/resources/c2me-notickvd.mixins.json @@ -9,6 +9,7 @@ "MixinPlayerManager", "MixinServerChunkManager", "MixinThreadedAnvilChunkStorage", - "MixinWorld" + "MixinWorld", + "MixinWorldChunk" ] }