Skip to content

Commit

Permalink
Fix portable scanner behaviour being wrong in negative chunks (#1688)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungOnionMC authored Aug 11, 2024
1 parent 62788ca commit 9a1b6ee
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,19 +386,19 @@ else if (machine instanceof IDataInfoProvider)
if (level instanceof ServerLevel serverLevel) {
list.add(Component.translatable("behavior.portable_scanner.divider"));
var veinData = BedrockFluidVeinSavedData.getOrCreate(serverLevel);
Fluid fluid = veinData.getFluidInChunk(pos.getX() / 16, pos.getZ() / 16);
Fluid fluid = veinData.getFluidInChunk(pos.getX() >> 4, pos.getZ() >> 4);

if (fluid != null) {
FluidStack stack = new FluidStack(fluid,
veinData.getOperationsRemaining(pos.getX() / 16, pos.getZ() / 16));
veinData.getOperationsRemaining(pos.getX() >> 4, pos.getZ() >> 4));
double fluidPercent = stack.getAmount() * 100.0 / BedrockFluidVeinSavedData.MAXIMUM_VEIN_OPERATIONS;

if (player.isCreative()) {
list.add(Component.translatable("behavior.portable_scanner.bedrock_fluid.amount",
Component.translatable(stack.getTranslationKey())
.withStyle(ChatFormatting.GOLD),
Component.translatable(String.valueOf(
veinData.getFluidYield(pos.getX() / 16, pos.getZ() / 16)))
veinData.getFluidYield(pos.getX() >> 4, pos.getZ() >> 4)))
.withStyle(ChatFormatting.GOLD),
Component.translatable(String.valueOf(fluidPercent))
.withStyle(ChatFormatting.YELLOW)));
Expand Down

0 comments on commit 9a1b6ee

Please sign in to comment.