Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Commit 5da960f

Browse files
committed
Semi fix for default macro/pumpkin
I'll make a proper fix sometime later, I'm busy a bit, sorry...
1 parent 08e0b91 commit 5da960f

4 files changed

Lines changed: 23 additions & 13 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
44
mcVersion=1.8.9
55
modid=farmhelperv2
66
modName=FarmHelper
7-
version=2.8.9-pre1
7+
version=2.8.9-pre2
88
shouldRelease=true

src/main/java/com/jelly/farmhelperv2/macro/AbstractMacro.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public void onOverlayRender(RenderGameOverlayEvent.Post event) {
260260
}
261261

262262
public void onPacketReceived(ReceivePacketEvent event) {
263+
/*
263264
if (!(event.packet instanceof S08PacketPlayerPosLook)) return;
264265
if (!MacroHandler.getInstance().isTeleporting()) return;
265266
@@ -271,6 +272,7 @@ public void onPacketReceived(ReceivePacketEvent event) {
271272
if (diff > 5) {
272273
LogUtils.sendWarning("Your rotation hasn't been changed after rewarp! Disable any mod that blocks rotation packets or fix your /setspawn so look directly at the crops!");
273274
}
275+
*/
274276
}
275277

276278
public abstract void updateState();

src/main/java/com/jelly/farmhelperv2/macro/impl/SShapeMelonPumpkinDefaultMacro.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public void onEnable() {
3232
setYaw(AngleUtils.getClosestDiagonal());
3333
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
3434
}
35+
changeState(calculateDirection());
3536
float additionalRotation;
3637
switch (getCurrentState()) {
3738
case LEFT:

src/main/java/com/jelly/farmhelperv2/util/BlockUtils.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,7 @@ public static Block getBlock(BlockPos blockPos) {
8383
}
8484

8585
public static Block getRelativeBlock(float x, float y, float z) {
86-
return mc.theWorld.getBlockState(
87-
new BlockPos(
88-
mc.thePlayer.posX + getUnitX() * z + getUnitZ() * -1 * x,
89-
(mc.thePlayer.posY % 1 > 0.7 ? Math.ceil(mc.thePlayer.posY) : mc.thePlayer.posY) + y,
90-
mc.thePlayer.posZ + getUnitZ() * z + getUnitX() * x
91-
)).getBlock();
86+
return getBlock(getRelativeBlockPos(x, y, z));
9287
}
9388

9489
public static BlockPos getRelativeBlockPos(float x, float y, float z) {
@@ -99,6 +94,23 @@ public static BlockPos getRelativeBlockPos(float x, float y, float z) {
9994
);
10095
}
10196

97+
public static Block getRelativeBlock45Deg(float x, float y, float z, float yaw) {
98+
return getBlock(getRelativeBlockPos45Deg(x, y, z, yaw));
99+
}
100+
101+
public static BlockPos getRelativeBlockPos45Deg(float x, float y, float z, float yaw) {
102+
float roundedYaw = AngleUtils.getClosest45(yaw);
103+
double radians = Math.toRadians(roundedYaw);
104+
105+
double unitX = -Math.sin(radians);
106+
double unitZ = Math.cos(radians);
107+
108+
return new BlockPos(
109+
mc.thePlayer.posX + unitX * z - unitZ * x,
110+
(mc.thePlayer.posY % 1 > 0.7 ? Math.ceil(mc.thePlayer.posY) : mc.thePlayer.posY) + y,
111+
mc.thePlayer.posZ + unitZ * z + unitX * x
112+
);
113+
}
102114

103115
public static Block getRelativeFullBlock(float x, float y, float z) {
104116
return mc.theWorld.getBlockState(
@@ -118,12 +130,7 @@ public static BlockPos getRelativeFullBlockPos(float x, float y, float z) {
118130
}
119131

120132
public static Block getRelativeBlock(float x, float y, float z, float yaw) {
121-
return mc.theWorld.getBlockState(
122-
new BlockPos(
123-
mc.thePlayer.posX + getUnitX(yaw) * z + getUnitZ(yaw) * -1 * x,
124-
(mc.thePlayer.posY % 1 > 0.7 ? Math.ceil(mc.thePlayer.posY) : mc.thePlayer.posY) + y,
125-
mc.thePlayer.posZ + getUnitZ(yaw) * z + getUnitX(yaw) * x
126-
)).getBlock();
133+
return getBlock(getRelativeBlockPos(x, y, z, yaw));
127134
}
128135

129136
public static BlockPos getRelativeBlockPos(float x, float y, float z, float yaw) {

0 commit comments

Comments
 (0)