Fix several BE render bounds

- Monitors were one block taller/wider than they should be.
 - Lecterns are higher than one block, so got cut off if just looking at
   the top.
This commit is contained in:
Jonathan Coates
2026-07-21 11:59:02 +01:00
parent 6f16cd6b0e
commit e83fdd2d5d
2 changed files with 9 additions and 1 deletions
@@ -4,6 +4,7 @@
package dan200.computercraft.shared.lectern;
import dan200.computercraft.annotations.ForgeOverride;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.core.computer.ComputerSide;
import dan200.computercraft.shared.ModRegistry;
@@ -35,6 +36,7 @@ import net.minecraft.world.level.block.LecternBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.LecternBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import org.jspecify.annotations.Nullable;
import java.util.AbstractList;
@@ -181,6 +183,12 @@ public final class CustomLecternBlockEntity extends BlockEntity {
}
}
@ForgeOverride
public AABB getRenderBoundingBox() {
var pos = getBlockPos();
return new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1.0, pos.getY() + 1.5, pos.getZ() + 1.0);
}
/**
* A read-only container storing the lectern's contents.
*/
@@ -524,7 +524,7 @@ public class MonitorBlockEntity extends BlockEntity {
bbHeight = height;
var startPos = toWorldPos(0, 0);
var endPos = toWorldPos(width, height);
var endPos = toWorldPos(width - 1, height - 1);
return boundingBox = new AABB(
Math.min(startPos.getX(), endPos.getX()),
Math.min(startPos.getY(), endPos.getY()),