From ea39d407b623e0aa64c3f0f5e6f0f62cdb17a33b Mon Sep 17 00:00:00 2001 From: Toad-Dev <748280+toad-dev@users.noreply.github.com> Date: Tue, 7 Jun 2022 20:48:42 -0700 Subject: [PATCH 1/2] Make monitors cull internal faces We turned off culling to support 3prm3's cool detailed computer models. That change shouldn't have applied to monitors, which should behave as opaque full blocks. This has a performance impact in really extreme cases. It's also a parity issue with CC: Tweaked. --- src/main/java/dan200/computercraft/shared/Registry.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/dan200/computercraft/shared/Registry.java b/src/main/java/dan200/computercraft/shared/Registry.java index 5aeaa9e3c..517bbcae0 100644 --- a/src/main/java/dan200/computercraft/shared/Registry.java +++ b/src/main/java/dan200/computercraft/shared/Registry.java @@ -98,10 +98,10 @@ public static T register( String id, T value ) } public static final BlockMonitor MONITOR_NORMAL = - register( "monitor_normal", new BlockMonitor( properties(), () -> ModBlockEntities.MONITOR_NORMAL ) ); + register( "monitor_normal", new BlockMonitor( monitorProperties(), () -> ModBlockEntities.MONITOR_NORMAL ) ); public static final BlockMonitor MONITOR_ADVANCED = - register( "monitor_advanced", new BlockMonitor( properties(), () -> ModBlockEntities.MONITOR_ADVANCED ) ); + register( "monitor_advanced", new BlockMonitor( monitorProperties(), () -> ModBlockEntities.MONITOR_ADVANCED ) ); public static final BlockComputer COMPUTER_NORMAL = register( "computer_normal", new BlockComputer<>( properties(), ComputerFamily.NORMAL, () -> ModBlockEntities.COMPUTER_NORMAL ) ); @@ -144,6 +144,11 @@ private static BlockBehaviour.Properties properties() return BlockBehaviour.Properties.of( Material.STONE ).strength( 2F ).noOcclusion(); } + private static BlockBehaviour.Properties monitorProperties() + { + return BlockBehaviour.Properties.of( Material.STONE ).strength( 2F ); + } + private static BlockBehaviour.Properties turtleProperties() { return BlockBehaviour.Properties.of( Material.STONE ).strength( 2.5f ); From c647706cb1ac13d962a2c69fb64a7832211251c9 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Fri, 10 Jun 2022 09:06:05 +0100 Subject: [PATCH 2/2] Don't send BE data to the client when unneeded We override getUpdateTag/getUpdatePacket in the relevant subclasses already. I think this was changed in CC:T a while back, but this part of the patch was dropped. --- .../shared/common/TileGeneric.java | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java index efaeb76b0..87ca38f40 100644 --- a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java +++ b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java @@ -6,10 +6,6 @@ package dan200.computercraft.shared.common; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; -import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -18,7 +14,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; -import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; @@ -78,25 +73,4 @@ public boolean isUsable( Player player ) return player.getCommandSenderWorld() == getLevel() && player.distanceToSqr( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 ) <= range * range; } - - @Override - public CompoundTag getUpdateTag() - { - return this.saveWithoutMetadata(); - } - - @Nullable - @Override - public Packet getUpdatePacket() - { - return ClientboundBlockEntityDataPacket.create( this ); - } - - protected void readDescription( @Nonnull CompoundTag nbt ) - { - } - - protected void writeDescription( @Nonnull CompoundTag nbt ) - { - } }