Skip to content

Commit

Permalink
Halve the required getBlockState calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Emirlol committed Oct 31, 2024
1 parent fd54cb5 commit ebb8bfa
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ public void tick(MinecraftClient client) {
private boolean checkForCarpet(BlockPos blockPos) {
@SuppressWarnings("DataFlowIssue") // Null check is already done in the run method
BlockState actualBlock = MinecraftClient.getInstance().world.getBlockState(blockPos);
if (!actualBlock.isOf(Blocks.GRAY_CARPET)) return false;
BlockState blockBelow = MinecraftClient.getInstance().world.getBlockState(blockPos.down());
return actualBlock.isOf(Blocks.GRAY_CARPET) && blockBelow.isOf(Blocks.SEA_LANTERN);
return blockBelow.isOf(Blocks.SEA_LANTERN);
}

/**
Expand Down

0 comments on commit ebb8bfa

Please sign in to comment.