Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public <CONTAINER extends AbstractContainerMenu> ContainerTypeRegistryObject<CON

private static <BE extends BlockEntity> BE getBlockEntityFromBuf(FriendlyByteBuf buf, Class<BE> type) {
if (buf == null) {
net.minecraft.world.phys.HitResult hit = Minecraft.getInstance().hitResult;
if (hit instanceof net.minecraft.world.phys.BlockHitResult blockHit) {
BlockPos pos = blockHit.getBlockPos();
BE blockEntity = WorldHelper.getBlockEntity(type, Minecraft.getInstance().level, pos);
if (blockEntity != null) {
return blockEntity;
}
}
throw new IllegalArgumentException("Null packet buffer");
} else if (FMLEnvironment.dist.isDedicatedServer()) {
throw new UnsupportedOperationException("This method is only supported on the client.");
Expand Down