Skip to content

Commit

Permalink
Improve AnchorAura (MeteorDevelopment#3677)
Browse files Browse the repository at this point in the history
  • Loading branch information
misten1 authored Aug 13, 2023
1 parent a3e1271 commit b74432e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ private BlockPos findPlacePos(BlockPos targetPlacePos) {
if (isValidPlace(targetPlacePos.down())) return targetPlacePos.down();
else if (isValidPlace(targetPlacePos.up(2))) return targetPlacePos.up(2);
break;
case Around:
if (isValidPlace(targetPlacePos.north())) return targetPlacePos.north();
else if (isValidPlace(targetPlacePos.east())) return targetPlacePos.east();
else if (isValidPlace(targetPlacePos.west())) return targetPlacePos.west();
else if (isValidPlace(targetPlacePos.south())) return targetPlacePos.south();
break;
}
return null;
}
Expand Down Expand Up @@ -349,7 +355,7 @@ private boolean getDamageBreak(BlockPos pos) {
}

private boolean isValidPlace(BlockPos pos) {
return (mc.world.getBlockState(pos).isAir() || mc.world.getBlockState(pos).getFluidState().getFluid() instanceof FlowableFluid) && Math.sqrt(mc.player.getBlockPos().getSquaredDistance(pos)) <= placeRange.get() && getDamagePlace(pos);
return Math.sqrt(mc.player.getBlockPos().getSquaredDistance(pos)) <= placeRange.get() && getDamagePlace(pos) && BlockUtils.canPlace(pos, true);
}

private boolean isValidBreak(BlockPos pos) {
Expand Down Expand Up @@ -385,6 +391,7 @@ public String getInfoString() {

public enum PlaceMode {
Above,
Around,
AboveAndBelow,
All
}
Expand Down

0 comments on commit b74432e

Please sign in to comment.