Skip to content

Commit

Permalink
infinite dirt wand patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelly298 committed Jul 27, 2022
1 parent ce5ddc4 commit d903888
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@

import com.jelly.CaneBuilder.handlers.MacroHandler;
import com.jelly.CaneBuilder.utils.AngleUtils;
import com.jelly.CaneBuilder.utils.BlockUtils;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;


public class PlaceDirt1 extends ProcessModule {
@Override
public void onTick() {
mc.thePlayer.inventory.currentItem = 1;
mc.thePlayer.inventory.currentItem =
BlockUtils.getXZBlockDistanceBetweenTwoBlock(
BlockUtils.getPlayerLoc(), new BlockPos(BuilderState.corner1.getX(), BuilderState.corner1.getY(), BuilderState.corner1.getZ())) < 2 ? 7 : 0;

if (rotation.rotating) {
resetKeybindState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onTick() {
updateKeys(false, false, false, false, false, shouldPlace, true);
}
} else {
mc.thePlayer.inventory.currentItem = 1;
mc.thePlayer.inventory.currentItem = 0;
boolean shouldPlace = mc.objectMouseOver != null && mc.thePlayer.posY - mc.objectMouseOver.getBlockPos().getY() <= 1 && mc.objectMouseOver.sideHit != EnumFacing.UP;
boolean hasPlacedEnd = mc.objectMouseOver != null && mc.thePlayer.posY - mc.objectMouseOver.getBlockPos().getY() <= 1 && BuilderState.lookingAtParallel() == BuilderState.corner1.getParallel();

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/jelly/CaneBuilder/processes/PlaceDirt5.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void onTick() {
aote = false;
rotation.reset();
rotation.easeTo(AngleUtils.get360RotationYaw(), onSecondLayer ? 82 : 89, 500);
mc.thePlayer.inventory.currentItem = 1;
mc.thePlayer.inventory.currentItem = 0;
setKeyBindState(keybindUseItem, false);
}
return;
Expand Down Expand Up @@ -110,7 +110,7 @@ public void onTick() {
resetKeybindState();
return;
}
mc.thePlayer.inventory.currentItem = 1;
mc.thePlayer.inventory.currentItem = 0;
boolean shouldPlace = mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && mc.thePlayer.posY - mc.objectMouseOver.getBlockPos().getY() <= 1 && mc.objectMouseOver.sideHit != EnumFacing.UP;
boolean hasPlacedEnd = mc.objectMouseOver != null && mc.thePlayer.posY - mc.objectMouseOver.getBlockPos().getY() <= 1 && BuilderState.lookingAtParallel() == BuilderState.corner2.getParallel();

Expand All @@ -128,9 +128,9 @@ public void onTick() {
public void onEnable() {
Failsafe.pauseOnLeave = false;
setTP = false;
mc.thePlayer.inventory.currentItem = 1;
mc.thePlayer.inventory.currentItem = 0;
onSecondLayer = (int)mc.thePlayer.posY - BuilderState.corner1.getY() == 3;
mc.thePlayer.inventory.currentItem = 1;
mc.thePlayer.inventory.currentItem = 0;
mc.thePlayer.sendChatMessage("/hub");
currentState = State.TELEPORTING;
teleportWait.schedule(2000);
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/com/jelly/CaneBuilder/utils/BlockUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,22 @@ public static boolean isWalkable(Block block) {
return block == Blocks.air || block == Blocks.water || block == Blocks.flowing_water || block == Blocks.reeds;
}

// 0, 0 = initial block
public static Block getBlockAround(int rightOffset, int frontOffset) {
return getBlockAround(rightOffset, frontOffset, 0);
public static Block getBlock(BlockPos blockPos) {
return mc.theWorld.getBlockState(blockPos).getBlock();
}

public static Block getBlockAround(int rightOffset, int frontOffset, int upOffset) {
int X = (int) Math.round(Math.floor(mc.thePlayer.posX));
int Y = (int) Math.round(Math.floor(mc.thePlayer.posY));
int Z = (int) Math.round(Math.floor(mc.thePlayer.posZ));
return (mc.theWorld.getBlockState(
new BlockPos(getUnitZ() * -1 * rightOffset + getUnitX() * frontOffset + X, Y + upOffset,
getUnitX() * rightOffset + getUnitZ() * frontOffset + Z)).getBlock());
public static BlockPos getPlayerLoc() {
return getBlockPosAround(0, 0, 0);
}

public static Block getBlockAroundFrom(BlockPos from, int rightOffset, int frontOffset, int upOffset) {
int X = from.getX();
int Y = from.getY();
int Z = from.getZ();
return (mc.theWorld.getBlockState(
new BlockPos(getUnitZ() * -1 * rightOffset + getUnitX() * frontOffset + X, Y + upOffset,
getUnitX() * rightOffset + getUnitZ() * frontOffset + Z)).getBlock());
return (getBlock(new BlockPos(getUnitZ() * -1 * rightOffset + getUnitX() * frontOffset + X, Y + upOffset,
getUnitX() * rightOffset + getUnitZ() * frontOffset + Z)));
}

public static Block getBlockAround(int rightOffset, int frontOffset, int upOffset) {
return getBlock(getBlockPosAround(rightOffset, frontOffset, upOffset));
}

public static BlockPos getBlockPosAround(int rightOffset, int frontOffset, int upOffset) {
Expand Down Expand Up @@ -122,9 +117,14 @@ public static double getDistanceBetweenTwoBlock(BlockPos b1, BlockPos b2){
+ (b1.getY() - b2.getY()) * (b1.getY() - b2.getY())
+ (b1.getZ() - b2.getZ()) * (b1.getZ() - b2.getZ()));
}

public static int getBlockDistanceBetweenTwoBlock(BlockPos b1, BlockPos b2){
return Math.abs(b1.getX() - b2.getX())
+ Math.abs((b1.getY() - b2.getY()))
+ Math.abs((b1.getZ() - b2.getZ()));
}

public static int getXZBlockDistanceBetweenTwoBlock(BlockPos b1, BlockPos b2){
return Math.abs(b1.getX() - b2.getX()) + Math.abs((b1.getZ() - b2.getZ()));
}
}

0 comments on commit d903888

Please sign in to comment.