diff --git a/gradle.properties b/gradle.properties index 92b653f..c3bac03 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,5 +14,5 @@ org.gradle.jvmargs=-Xmx2G # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.17.2+build.396-1.16 + fabric_version=0.19.0+build.398-1.16 cca_version=2.5.0-nightly.1.16.2-rc2 diff --git a/src/main/java/com/flemmli97/flan/Flan.java b/src/main/java/com/flemmli97/flan/Flan.java index c468997..d8ba8c8 100644 --- a/src/main/java/com/flemmli97/flan/Flan.java +++ b/src/main/java/com/flemmli97/flan/Flan.java @@ -9,8 +9,8 @@ import com.flemmli97.flan.event.ItemInteractEvents; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.fabricmc.fabric.api.event.player.AttackBlockCallback; import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.fabricmc.fabric.api.event.player.UseEntityCallback; import net.fabricmc.fabric.api.event.player.UseItemCallback; @@ -19,7 +19,7 @@ public class Flan implements ModInitializer { @Override public void onInitialize() { - AttackBlockCallback.EVENT.register(BlockInteractEvents::breakBlocks); + PlayerBlockBreakEvents.BEFORE.register(BlockInteractEvents::breakBlocks); UseBlockCallback.EVENT.register(BlockInteractEvents::useBlocks); UseEntityCallback.EVENT.register(EntityInteractEvents::useAtEntity); AttackEntityCallback.EVENT.register(EntityInteractEvents::attackEntity); diff --git a/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java b/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java index 8e88565..2e2b371 100644 --- a/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java +++ b/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java @@ -32,19 +32,19 @@ import net.minecraft.world.World; public class BlockInteractEvents { - public static ActionResult breakBlocks(PlayerEntity p, World world, Hand hand, BlockPos pos, Direction dir) { + public static boolean breakBlocks(World world, PlayerEntity p, BlockPos pos, BlockState state, BlockEntity tile){ if (world.isClient || p.isSpectator()) - return ActionResult.PASS; + return true; ServerPlayerEntity player = (ServerPlayerEntity) p; ClaimStorage storage = ClaimStorage.get((ServerWorld) world); Claim claim = storage.getClaimAt(pos); if (claim != null) { if (!claim.canInteract(player, EnumPermission.BREAK, pos, true)) { PlayerClaimData.get(player).addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY()); - return ActionResult.SUCCESS; + return false; } } - return ActionResult.PASS; + return true; } //Right click block diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 80caa7a..40de398 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,7 +28,7 @@ "depends": { "fabricloader": ">=0.7.4", - "fabric": "*", + "fabric": ">=0.19.0", "minecraft": "1.16.x" }, "suggests": {