Skip to content

Commit

Permalink
Feature: Support for cocoa bean farms with trapdoors
Browse files Browse the repository at this point in the history
  • Loading branch information
onixiya1337 authored Jun 20, 2024
2 parents 98bf2a2 + e2758d5 commit 4aca509
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class FarmHelperConfig extends Config {
"S Shape - Cactus", // 5
"S Shape - Cactus SunTzu Black Cat", // 6
"S Shape - Cocoa Beans", // 7
"S Shape - Cocoa Beans (With Trapdoors)", // 7
"S Shape - Cocoa Beans (Left/Right)", // 8
"S Shape - Mushroom (45°)", // 9
"S Shape - Mushroom (30° with rotations)", // 10
Expand Down Expand Up @@ -2288,6 +2289,7 @@ public enum MacroEnum {
S_CACTUS,
S_CACTUS_SUNTZU,
S_COCOA_BEANS,
S_COCOA_BEANS_TRAPDOORS,
S_COCOA_BEANS_LEFT_RIGHT,
S_MUSHROOM,
S_MUSHROOM_ROTATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public <T extends AbstractMacro> T getMacro() {
case S_SUGAR_CANE:
return Macros.S_SHAPE_SUGARCANE_MACRO.getMacro();
case S_COCOA_BEANS:
case S_COCOA_BEANS_TRAPDOORS:
return Macros.S_SHAPE_COCOA_BEAN_MACRO.getMacro();
case S_MUSHROOM:
return Macros.S_SHAPE_MUSHROOM_MACRO.getMacro();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,26 @@ private boolean shouldHugWall() {
double z = mc.thePlayer.getPositionVector().zCoord % 1;
float yaw = AngleUtils.getClosest(mc.thePlayer.rotationYaw);
yaw = (yaw % 360 + 360) % 360;
if (yaw == 0) {
return (x > -0.9 && x < -0.35) || (x < 0.65 && x > 0.1);
} else if (yaw == 90) {
return (z > -0.9 && z < -0.35) || (z < 0.65 && z > 0.1);
} else if (yaw == 180) {
return (x > -0.65 && x < -0.1) || (x < 0.9 && x > 0.35);
} else if (yaw == 270) {
return (z > -0.65 && z < -0.1) || (z < 0.9 && z > 0.35);
if (FarmHelperConfig.getMacro() == FarmHelperConfig.MacroEnum.S_COCOA_BEANS_TRAPDOORS) {
if (yaw == 0) {
return (x > -0.9 && x < -0.5) || (x < 0.5 && x > 0.1);
} else if (yaw == 90) {
return (z > -0.9 && z < -0.5) || (z < 0.5 && z > 0.1);
} else if (yaw == 180) {
return (x > -0.5 && x < -0.1) || (x < 0.9 && x > 0.5);
} else if (yaw == 270) {
return (z > -0.5 && z < -0.1) || (z < 0.9 && z > 0.5);
}
} else {
if (yaw == 0) {
return (x > -0.9 && x < -0.35) || (x < 0.65 && x > 0.1);
} else if (yaw == 90) {
return (z > -0.9 && z < -0.35) || (z < 0.65 && z > 0.1);
} else if (yaw == 180) {
return (x > -0.65 && x < -0.1) || (x < 0.9 && x > 0.35);
} else if (yaw == 270) {
return (z > -0.65 && z < -0.1) || (z < 0.9 && z > 0.35);
}
}
}
return false;
Expand Down

0 comments on commit 4aca509

Please sign in to comment.