From b38ff1133d1d25536f6076adac884a95aceef0a9 Mon Sep 17 00:00:00 2001 From: Liyan Zhao Date: Sat, 13 Apr 2024 17:15:43 +0800 Subject: [PATCH] fix --- build.gradle | 1 + .../mixin/MixinSculkCatalystBlockEntity.java | 15 ++++----------- .../enclosure/mixin/MixinSculkVeinBlock.java | 3 ++- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index a7e810d..90d9c00 100644 --- a/build.gradle +++ b/build.gradle @@ -92,6 +92,7 @@ loom { dependencies { modRuntimeOnly "maven.modrinth:luckperms:v5.4.83-fabric" + modImplementation("net.fabricmc:fabric-loader:${loader_version}") // SnakeYAML. To convert the old config include(modImplementation("org.yaml:snakeyaml:1.33")) diff --git a/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkCatalystBlockEntity.java b/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkCatalystBlockEntity.java index f41b2ae..4ff6f4b 100644 --- a/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkCatalystBlockEntity.java +++ b/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkCatalystBlockEntity.java @@ -3,31 +3,24 @@ import com.github.zly2006.enclosure.EnclosureArea; import com.github.zly2006.enclosure.ServerMain; import com.github.zly2006.enclosure.utils.Permission; +import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.block.entity.SculkCatalystBlockEntity; -import net.minecraft.block.entity.SculkSpreadManager; import net.minecraft.entity.LivingEntity; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import net.minecraft.world.event.GameEvent; -import net.minecraft.world.event.PositionSource; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(SculkCatalystBlockEntity.Listener.class) public class MixinSculkCatalystBlockEntity { - @Shadow @Final SculkSpreadManager spreadManager; - - @Shadow @Final private PositionSource positionSource; - - @Inject(method = "listen", locals = LocalCapture.CAPTURE_FAILSOFT, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/SculkSpreadManager;spread(Lnet/minecraft/util/math/BlockPos;I)V"), cancellable = true) - private void spread(ServerWorld world, GameEvent event, GameEvent.Emitter emitter, Vec3d emitterPos, CallbackInfoReturnable cir, LivingEntity livingEntity, int i) { + @Inject(method = "listen", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/SculkSpreadManager;spread(Lnet/minecraft/util/math/BlockPos;I)V"), cancellable = true) + private void spread(ServerWorld world, RegistryEntry event, GameEvent.Emitter emitter, Vec3d emitterPos, CallbackInfoReturnable cir, @Local LivingEntity livingEntity) { if (livingEntity.getWorld().isClient) { return; } diff --git a/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkVeinBlock.java b/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkVeinBlock.java index 9f80f1d..9a003e4 100644 --- a/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkVeinBlock.java +++ b/src/main/java/com/github/zly2006/enclosure/mixin/MixinSculkVeinBlock.java @@ -13,6 +13,7 @@ import net.minecraft.util.math.random.Random; import net.minecraft.world.WorldAccess; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -22,7 +23,7 @@ @Mixin(SculkVeinBlock.class) public class MixinSculkVeinBlock { - private static boolean disallow(WorldAccess world, BlockPos pos) { + @Unique private static boolean disallow(WorldAccess world, BlockPos pos) { if (world instanceof ServerWorld serverWorld) { EnclosureList list = ServerMain.INSTANCE.getAllEnclosures(serverWorld); EnclosureArea area = list.getArea(pos);