From 92f136b458697b8de5b9562f38e039c568d2fe3f Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:59:31 -0400 Subject: [PATCH] Remove block entity parameter --- .../player/ClientPlayerBlockBreakEvents.java | 16 ++++++---------- .../ClientPlayerInteractionManagerMixin.java | 2 +- .../interaction/ClientPlayerBlockBreakTests.java | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/api/event/client/player/ClientPlayerBlockBreakEvents.java b/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/api/event/client/player/ClientPlayerBlockBreakEvents.java index b4759fbc7c7..0263520a362 100644 --- a/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/api/event/client/player/ClientPlayerBlockBreakEvents.java +++ b/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/api/event/client/player/ClientPlayerBlockBreakEvents.java @@ -16,10 +16,7 @@ package net.fabricmc.fabric.api.event.client.player; -import org.jetbrains.annotations.Nullable; - import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -39,9 +36,9 @@ public class ClientPlayerBlockBreakEvents { *

Only called client side. */ public static final Event AFTER = EventFactory.createArrayBacked(After.class, - (listeners) -> (world, player, pos, state, entity) -> { + (listeners) -> (world, player, pos, state) -> { for (After event : listeners) { - event.afterBlockBreak(world, player, pos, state, entity); + event.afterBlockBreak(world, player, pos, state); } } ); @@ -51,12 +48,11 @@ public interface After { /** * Called after a block is successfully broken. * - * @param world the world where the block was broken + * @param world the world where the block was broken * @param player the player who broke the block - * @param pos the position where the block was broken - * @param state the block state before the block was broken - * @param blockEntity the block entity of the broken block, can be {@code null} + * @param pos the position where the block was broken + * @param state the block state before the block was broken */ - void afterBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity); + void afterBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state); } } diff --git a/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/mixin/event/interaction/client/ClientPlayerInteractionManagerMixin.java b/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/mixin/event/interaction/client/ClientPlayerInteractionManagerMixin.java index e7701b8d1d6..a66beceac5e 100644 --- a/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/mixin/event/interaction/client/ClientPlayerInteractionManagerMixin.java +++ b/fabric-events-interaction-v0/src/client/java/net/fabricmc/fabric/mixin/event/interaction/client/ClientPlayerInteractionManagerMixin.java @@ -96,7 +96,7 @@ private void fabric_fireAttackBlockCallback(BlockPos pos, Direction direction, C @Inject(method = "breakBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;onBroken(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V"), locals = LocalCapture.CAPTURE_FAILHARD) private void fabric$onBlockBroken(BlockPos pos, CallbackInfoReturnable cir, World world, BlockState blockState) { - ClientPlayerBlockBreakEvents.AFTER.invoker().afterBlockBreak(world, this.client.player, pos, blockState, world.getBlockEntity(pos)); + ClientPlayerBlockBreakEvents.AFTER.invoker().afterBlockBreak(world, this.client.player, pos, blockState); } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V"), method = "interactBlock", cancellable = true) diff --git a/fabric-events-interaction-v0/src/testmodClient/java/net/fabricmc/fabric/test/client/event/interaction/ClientPlayerBlockBreakTests.java b/fabric-events-interaction-v0/src/testmodClient/java/net/fabricmc/fabric/test/client/event/interaction/ClientPlayerBlockBreakTests.java index e749dd5646a..c980e277935 100644 --- a/fabric-events-interaction-v0/src/testmodClient/java/net/fabricmc/fabric/test/client/event/interaction/ClientPlayerBlockBreakTests.java +++ b/fabric-events-interaction-v0/src/testmodClient/java/net/fabricmc/fabric/test/client/event/interaction/ClientPlayerBlockBreakTests.java @@ -27,6 +27,6 @@ public class ClientPlayerBlockBreakTests implements ClientModInitializer { @Override public void onInitializeClient() { - ClientPlayerBlockBreakEvents.AFTER.register(((world, player, pos, state, entity) -> LOGGER.info("Block broken at {}, {}, {} (client-side = {})", pos.getX(), pos.getY(), pos.getZ(), world.isClient()))); + ClientPlayerBlockBreakEvents.AFTER.register(((world, player, pos, state) -> LOGGER.info("Block broken at {}, {}, {} (client-side = {})", pos.getX(), pos.getY(), pos.getZ(), world.isClient()))); } }