Skip to content

Commit

Permalink
= Fixed weird bug with slabs walkables
Browse files Browse the repository at this point in the history
= Fixed detect of suffocating
= Custom's yaw fixes, dunno if works (does anyone use custom yaw anyway??)
  • Loading branch information
May2Beez committed Dec 9, 2023
1 parent 61b96ed commit 9326c88
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
mcVersion=1.8.9
modid=farmhelperv2
modName=FarmHelper
version=2.1.18
version=2.1.19
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ private void manipulateHeight(Entity entity, double distance, double distanceWit

private void flyAwayFromStructures() {
if (mc.thePlayer.posY < 77 && !hasBlockAboveThePlayer()) {
LogUtils.sendDebug("Has block above the player");
if (!GameStateHandler.getInstance().isRightWalkable() && GameStateHandler.getInstance().isLeftWalkable()) {
KeyBindUtils.holdThese(mc.gameSettings.keyBindLeft, mc.thePlayer.capabilities.isFlying ? mc.gameSettings.keyBindJump : null);
} else if (!GameStateHandler.getInstance().isLeftWalkable() && GameStateHandler.getInstance().isRightWalkable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public boolean hasPassedSinceStopped() {
}

public boolean notMoving() {
return (dx < 0.01 && dz < 0.01 && dyIsRest() && mc.currentScreen == null) || (!holdingKeybindIsWalkable() && mc.thePlayer != null && (playerIsInFlowingWater(0) || playerIsInFlowingWater(1)) && mc.thePlayer.isInWater()) || RotationHandler.getInstance().isRotating();
return (dx < 0.01 && dz < 0.01 && dyIsRest() && mc.currentScreen == null) || (!holdingKeybindIsWalkable() && mc.thePlayer != null && (playerIsInFlowingWater(0) || playerIsInFlowingWater(1)) && mc.thePlayer.isInWater());
}

private boolean dyIsRest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void onEnable() {
changeState(calculateDirection());
}
if (!closest90Deg.isPresent())
setClosest90Deg(Optional.of(AngleUtils.getClosest()));
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
setEnabled(true);
setLayerY(mc.thePlayer.getPosition().getY());
analyticsClock.schedule(60_000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.jelly.farmhelperv2.util.helper.RotationConfiguration;
import net.minecraft.init.Blocks;

import java.util.Optional;

public class SShapeCocoaBeanMacro extends AbstractMacro {

@Override
Expand All @@ -22,6 +24,7 @@ public void onEnable() {
}
if (!FarmHelperConfig.customYaw && !isRestoredState()) {
setYaw(AngleUtils.getClosest());
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
}
if (MacroHandler.getInstance().isTeleporting()) return;
setRestoredState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ public void onEnable() {
super.onEnable();
if (!FarmHelperConfig.customPitch && !isRestoredState())
setPitch(50 + (float) (Math.random() * 6 - 3)); // -3 - 3
if (!FarmHelperConfig.customYaw && !isRestoredState())
if (!FarmHelperConfig.customYaw && !isRestoredState()) {
setYaw(AngleUtils.getClosestDiagonal());
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
}
float additionalRotation;
switch (getCurrentState()) {
case LEFT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public void onEnable() {
}
if (!FarmHelperConfig.customYaw && !isRestoredState()) {
setYaw(AngleUtils.getClosestDiagonal());
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
}
if (MacroHandler.getInstance().isTeleporting()) return;
setRestoredState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void onEnable() {
}
if (!FarmHelperConfig.customYaw && !isRestoredState()) {
setYaw(AngleUtils.getClosest());
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
}
if (MacroHandler.getInstance().isTeleporting()) return;
setRestoredState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public void onEnable() {
}
if (!FarmHelperConfig.customYaw && !isRestoredState()) {
setYaw(AngleUtils.getClosestDiagonal());
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
}
rowStartX = mc.thePlayer.posX;
rowStartZ = mc.thePlayer.posZ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public void onEnable() {
}
if (!FarmHelperConfig.customYaw && !isRestoredState()) {
setYaw(AngleUtils.getClosest());
setClosest90Deg(Optional.of(AngleUtils.getClosest(getYaw())));
}
setRestoredState(false);
if (MacroHandler.getInstance().isTeleporting()) return;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jelly/farmhelperv2/util/BlockUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private static boolean canWalkThroughBottom(BlockPos blockPos, Direction directi
return state.getValue(BlockFenceGate.OPEN);

if (block instanceof BlockTrapDoor) {
return state.getValue(BlockTrapDoor.OPEN);
return state.getValue(BlockTrapDoor.OPEN) || state.getValue(BlockTrapDoor.HALF) == BlockTrapDoor.DoorHalf.BOTTOM;
}

if (block instanceof BlockSnow)
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,9 @@ public static Entity getEntityCuttingOtherEntity(Entity e, boolean armorStand) {
}

public static boolean isPlayerSuffocating() {
BlockPos playerFeet = BlockUtils.getRelativeBlockPos(0, 0, 0);
BlockPos playerHead = BlockUtils.getRelativeBlockPos(0, mc.thePlayer.eyeHeight, 0);
AxisAlignedBB playerBB = mc.thePlayer.getEntityBoundingBox().expand(-0.1, -0.1, -0.1);
AxisAlignedBB playerFeetBB = new AxisAlignedBB(playerFeet.getX(), playerFeet.getY(), playerFeet.getZ(), playerFeet.getX() + 1, playerFeet.getY() + 1, playerFeet.getZ() + 1);
AxisAlignedBB playerHeadBB = new AxisAlignedBB(playerHead.getX(), playerHead.getY(), playerHead.getZ(), playerHead.getX() + 1, playerHead.getY() + 1, playerHead.getZ() + 1);
return mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, playerBB).stream().anyMatch(bb -> bb != playerFeetBB && bb != playerHeadBB);
List<AxisAlignedBB> collidingBoxes = mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, playerBB);
return !collidingBoxes.isEmpty();
}

public static EnumFacing getHorizontalFacing(float yaw) {
Expand Down

0 comments on commit 9326c88

Please sign in to comment.