Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zly2006 committed Apr 13, 2024
1 parent 818e8dc commit b38ff11
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> 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<GameEvent> event, GameEvent.Emitter emitter, Vec3d emitterPos, CallbackInfoReturnable<Boolean> cir, @Local LivingEntity livingEntity) {
if (livingEntity.getWorld().isClient) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit b38ff11

Please sign in to comment.