-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add mineOnlyExposedOres setting #1995
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but why not have an integer setting since there are servers that hide ores except touches transparent block in a radius of two.
And, blocks like water, lava are see-through too and don't forget to include them.
Love you! |
converted to draft due to a bug in the latest commit. |
/** | ||
* When allowOnlyExposedOres is enabled this is the distance around to search. | ||
* <p> | ||
* I recommend keeping this value low as the amount of blocks that need to be scanned increases exponentially. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrase this to be like
- * I recommend keeping this value low as the amount of blocks that need to be scanned increases exponentially.
+ * It is recommended to keep this value low, as it exponentially increases calculation times.
@@ -409,6 +410,8 @@ private void addNearby() { | |||
// remove any that are implausible to mine (encased in bedrock, or touching lava) | |||
.filter(pos -> MineProcess.plausibleToBreak(ctx, pos)) | |||
|
|||
.filter(pos -> isNextToAir(ctx, pos)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this only calculate when the setting is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya
} | ||
|
||
public static boolean isTransparent(BlockPos pos, CalculationContext ctx) { | ||
IBlockState blockState = ctx.bsi.get0(pos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure get0
is the correct method here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you suggest to use instead. If you use just get() then you get illegal state exceptions due to running it on the wrong thread. This is also the same as in the method above where it sees if it is plausible to break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe get0
is correct in this case.
return blockState.getBlock() == Blocks.AIR || | ||
blockState.getBlock() == Blocks.FLOWING_LAVA || | ||
blockState.getBlock() == Blocks.FLOWING_WATER || | ||
blockState.getBlock() == Blocks.WATER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helper isTransparent
belongs in MovementHelper
. I believe there may already be something equivalent there, but I'm not certain.
@@ -452,4 +466,86 @@ public void mine(int quantity, BlockOptionalMetaLookup filter) { | |||
rescan(new ArrayList<>(), new CalculationContext(baritone)); | |||
} | |||
} | |||
|
|||
public static boolean makeSphere(BlockPos pos, double radius, CalculationContext ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is extreme cringe.
Literally everything about this function is cringe.
What is the use case for this? Ignore enteerman idk who that is.
Can't this be as simple as like:
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
for (int dz = -1; dz <= 1; dz++) {
if (MovementHelper.isTransparent(pos.add(dx,dy,dz))) {
return false;
}
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leij's example is how I was doing spheres and enteerman or someone made fun of it :clown:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enteerman is the real clown then?
this isn't intended to be a sphere, why would it be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😹
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it shouldn't be a sphere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am bad at english and sorry if i didnt explain it well. It wasn't intended to be a sphere. just on some servers that blocks that are two blocks from a transparent block are all legit. I think hypixel does that in UHC so you can check that out. You can ignore me, I don't care. I sketched this out and this is how is should work: https://imgur.com/0O7BkWt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know why this method is large but just take the 6 blocks that are adjacent to the block, and take adjacents of the adjacents, to check if it is air.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or use ur method idk i dont play the game anymore, ask someone else's opinion on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me @leijurv's method looks way better but it only checks the direct and diagonal neighbours. I'd rather use
for (int dx = -radius; dx <= radius; dx++) {
for (int dy = -radius; dy <= radius; dy++) {
for (int dz = -radius; dz <= radius; dz++) {
if (Math.abs(dx) + Math.abs(dy) + Math.abs(dz) <= radius
&& MovementHelper.isTransparent(pos.add(dx,dy,dz))) {
return true;
}
}
}
}
to check all blocks that have a manhattan distance of at most radius
(I think that is was @Enteerman wants to show with his image)
force pushing due to pushing the wrong commits earlier. |
32c8f70
to
75886b2
Compare
Signed-off-by: scorbett123 <[email protected]>
Signed-off-by: scorbett123 <[email protected]>
Signed-off-by: Sam Corbett <[email protected]>
75886b2
to
80e4852
Compare
/** | ||
* When allowOnlyExposedOres is enabled this is the distance around to search. | ||
* <p> | ||
* It is recommended to keep this value low, as it exponentially increases calculation times and also to keep the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sentence is incomplete and the amount of checked blocks does not increase exponentially but by (approximately) 1.3*r**3 + 2*r**2 + 2.6*r + 1
. That is cubically
Signed-off-by: Sam Corbett <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, fix formatting to match baritone style and i'll merge
@@ -562,4 +562,11 @@ static PlaceResult attemptToPlaceABlock(MovementState state, IBaritone baritone, | |||
enum PlaceResult { | |||
READY_TO_PLACE, ATTEMPTING, NO_OPTION; | |||
} | |||
public static boolean isTransparent(Block b) { | |||
|
|||
return b== Blocks.AIR || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space
@@ -409,6 +410,13 @@ private void addNearby() { | |||
// remove any that are implausible to mine (encased in bedrock, or touching lava) | |||
.filter(pos -> MineProcess.plausibleToBreak(ctx, pos)) | |||
|
|||
.filter(pos -> { | |||
if (Baritone.settings().allowOnlyExposedOres.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz use {
in the if
for (int dy = -radius; dy <= radius; dy++) { | ||
for (int dz = -radius; dz <= radius; dz++) { | ||
if (Math.abs(dx) + Math.abs(dy) + Math.abs(dz) <= radius | ||
&& MovementHelper.isTransparent(ctx.getBlock(pos.getX()+dx, pos.getY()+dy, pos.getZ()+dz))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run through autoformatter? put spaces before and after each +
@scorbett123 wait what, why did you rearrange those functions and classes? it makes the diff much bigger for no reason. can we leave the order the same and just add the new function? like how it was an hour ago? |
Sorry, didn't mean to, something went wrong when committing, I think it might have been my auto formatter. |
ohh yea, that's true intellij has this |
51177e1
to
f3837f5
Compare
is this better? |
almost haha just one thing can you add curly braces to the |
Signed-off-by: scorbett123 <[email protected]>
f3837f5
to
39cfebe
Compare
Sorry, in my fourth attempt to fix the formatting and failing with using git I obviously forgot about those. |
adds an exposed Ores only setting.
if there is air no air on any side then it removes it from the goal.
fixes #1168