don't create a new bsi for every selection box every tick

This commit is contained in:
Leijurv 2019-01-23 21:25:38 -08:00
parent 314f280400
commit 863471b5f1
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -216,8 +216,9 @@ public final class PathRenderer implements Helper {
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks; double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
BlockStateInterface bsi = new BlockStateInterface(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext()); // TODO this assumes same dimension between primary baritone and render view? is this safe?
positions.forEach(pos -> { positions.forEach(pos -> {
IBlockState state = BlockStateInterface.get(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext(), pos); IBlockState state = bsi.get0(pos);
AxisAlignedBB toDraw; AxisAlignedBB toDraw;
if (state.getBlock().equals(Blocks.AIR)) { if (state.getBlock().equals(Blocks.AIR)) {
toDraw = Blocks.DIRT.getDefaultState().getSelectedBoundingBox(player.world, pos); toDraw = Blocks.DIRT.getDefaultState().getSelectedBoundingBox(player.world, pos);