fix reach calculation in Fill module
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m16s

This commit is contained in:
Daniella / Tove 2024-06-19 19:15:42 +02:00
parent a9f1d8f6c0
commit 8bb116a1fe
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -35,10 +35,10 @@ public class Fill extends Feature {
@Range("1..5") @Range("1..5")
public int iterations = 1; public int iterations = 1;
@Config("Range") @Config("Range offset")
@Description("How far a block can be to be until it will be considered unreachable") @Description("§l!! ADVANCED§rHow far out of minecraft's normal reach a block can be to be until it will be considered actually unreachable")
@Range("1..6@0.25") @Range("-4..4@0.25")
public float range = 3; public float range = 0;
@Config("Rotate") @Config("Rotate")
@Description("Faces the block that is being acted on.") @Description("Faces the block that is being acted on.")
@ -75,8 +75,8 @@ public class Fill extends Feature {
// loop through intersection of box around player and the selection // loop through intersection of box around player and the selection
Vec3d eyePos = mc.player.getPositionEyes(1); Vec3d eyePos = mc.player.getPositionEyes(1);
BlockPos pBoxMin = new BlockPos(eyePos.add(-range, -range, -range)); BlockPos pBoxMin = new BlockPos(eyePos.add(-5 - range, -5 - range, -5 - range));
BlockPos pBoxMax = new BlockPos(eyePos.add(range, range, range)); BlockPos pBoxMax = new BlockPos(eyePos.add(5 + range, 5 + range, 5 + range));
BlockPos selectMin = Select.selection.pos1; BlockPos selectMin = Select.selection.pos1;
BlockPos selectMax = Select.selection.pos2; BlockPos selectMax = Select.selection.pos2;
int minX = Math.max(pBoxMin.getX(), selectMin.getX()), maxX = Math.min(pBoxMax.getX(), selectMax.getX()); int minX = Math.max(pBoxMin.getX(), selectMin.getX()), maxX = Math.min(pBoxMax.getX(), selectMax.getX());
@ -86,6 +86,8 @@ public class Fill extends Feature {
for (int y = minY; y <= maxY; y++) { for (int y = minY; y <= maxY; y++) {
for (int x = minX; x <= maxX; x++) { for (int x = minX; x <= maxX; x++) {
for (int z = minZ; z <= maxZ; z++) { for (int z = minZ; z <= maxZ; z++) {
if(eyePos.distanceTo(new Vec3d(x + 0.5, y + 0.5, z + 0.5)) > mc.playerController.getBlockReachDistance() + range)
continue;
if (doBlock(x, y, z)) if (doBlock(x, y, z))
return; return;
} }