Send block entity update packet along with regular block update packet ()

* Send block entity update packet along with regular block update packet

* Fix style
This commit is contained in:
Potatoboy99999 2021-08-31 06:00:06 -07:00 committed by GitHub
parent 49e84ad51a
commit 3fb13e467a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,6 +27,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
@ -61,6 +62,15 @@ public class MixinServerPlayerInteractionManager {
if (result != ActionResult.PASS) {
// The client might have broken the block on its side, so make sure to let it know.
this.player.networkHandler.sendPacket(new BlockUpdateS2CPacket(world, pos));
if (world.getBlockState(pos).hasBlockEntity()) {
BlockEntityUpdateS2CPacket updatePacket = world.getBlockEntity(pos).toUpdatePacket();
if (updatePacket != null) {
this.player.networkHandler.sendPacket(updatePacket);
}
}
info.cancel();
}
}