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 Sep 25, 2022
1 parent d903888 commit 2b780c7
Show file tree
Hide file tree
Showing 16 changed files with 183 additions and 107 deletions.
85 changes: 60 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
plugins {
id "net.minecraftforge.gradle.forge" version "8708bf3e0"
id "com.github.johnrengelman.shadow" version "6.1.0"
id "org.spongepowered.mixin" version "d5f9873"
id "java"
buildscript {
ext.kotlin_version = "1.6.10"

repositories {
jcenter()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
maven {
url "https://jitpack.io"
}
maven {
url "https://repo.spongepowered.org/repository/maven-public/"
}
}
dependencies {
classpath "com.github.debuggingss:ForgeGradle:FG_2.1-SNAPSHOT"
classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0"
classpath "com.github.debuggingss:MixinGradle:0.6-SNAPSHOT"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

version = "1.0"
group = "com.jelly.CaneBuilder"
apply plugin: 'kotlin'
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "org.spongepowered.mixin"


version = 1.0


group = "com.jelly.canebuilder"
archivesBaseName = "CaneBuilder"

sourceCompatibility = targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

sourceSets {
main {
ext.refMap = "mixins.canebuilder.refmap.json"
output.resourcesDir = file("${buildDir}/classes/java/main")
}
}
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'

minecraft {
version = "1.8.9-11.15.1.2318-1.8.9"
Expand All @@ -29,35 +47,50 @@ minecraft {
clientRunArgs += '--tweakClass gg.essential.loader.stage0.EssentialSetupTweaker'
}


configurations {
include
implementation.extendsFrom(include)
}

repositories {
maven {
url = "https://repo.sk1er.club/repository/maven-public"
}
maven {
url = "https://jitpack.io/"
}
maven {
url = "https://repo.spongepowered.org/repository/maven-public/"
}
mavenCentral()
maven { url = "https://repo.sk1er.club/repository/maven-public/" }
maven { url = "https://jitpack.io/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
}

dependencies {
include('gg.essential:loader-launchwrapper:1.1.3')
implementation('gg.essential:essential-1.8.9-forge:1813')

implementation('org.projectlombok:lombok:1.18.24')
annotationProcessor('org.projectlombok:lombok:1.18.22')
compileOnly "gg.essential:essential-1.8.9-forge:1725"
include "gg.essential:loader-launchwrapper:1.1.3"

implementation('org.spongepowered:mixin:0.8.5-SNAPSHOT')
implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT')
annotationProcessor('org.spongepowered:mixin:0.7.11-SNAPSHOT')

include('com.github.RewisServer:brigadier:master-SNAPSHOT')
include('com.github.ronmamo:reflections:master-SNAPSHOT')
include("org.java-websocket:Java-WebSocket:1.5.3")

include('com.googlecode.json-simple:json-simple:1.1.1')
implementation('com.googlecode.json-simple:json-simple:1.1.1')

include('org.apache.commons:commons-collections4:4.4')
implementation('org.apache.commons:commons-collections4:4.4')

implementation('org.projectlombok:lombok:1.18.24')
annotationProcessor('org.projectlombok:lombok:1.18.24')
}

mixin {
add sourceSets.main, "mixins.canebuilder.refmap.json"
defaultObfuscationEnv searge

}

jar {
Expand All @@ -67,12 +100,15 @@ jar {
"TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker",
"TweakOrder": "0",
'MixinConfigs': "mixins.canebuilder.json",
"modversion": version,

)
enabled = false
}

sourceJar {
enabled = false

}

shadowJar {
Expand Down Expand Up @@ -119,5 +155,4 @@ processResources {
"mcversion": project.minecraft.version
)
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
84 changes: 51 additions & 33 deletions src/main/java/com/jelly/CaneBuilder/handlers/KeyBindHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public class KeyBindHandler {
static Minecraft mc = Minecraft.getMinecraft();
static KeyBinding[] customKeyBinds = new KeyBinding[4];
static int setmode = 0;
public static int keybindA = mc.gameSettings.keyBindLeft.getKeyCode();
public static int keybindD = mc.gameSettings.keyBindRight.getKeyCode();
public static int keybindW = mc.gameSettings.keyBindForward.getKeyCode();
public static int keybindS = mc.gameSettings.keyBindBack.getKeyCode();
public static int keybindAttack = mc.gameSettings.keyBindAttack.getKeyCode();
public static int keybindUseItem = mc.gameSettings.keyBindUseItem.getKeyCode();
public static int keyBindSpace = mc.gameSettings.keyBindJump.getKeyCode();
public static int keyBindShift = mc.gameSettings.keyBindSneak.getKeyCode();
public static int keyBindJump = mc.gameSettings.keyBindJump.getKeyCode();
public static KeyBinding keybindA = mc.gameSettings.keyBindLeft;
public static KeyBinding keybindD = mc.gameSettings.keyBindRight;
public static KeyBinding keybindW = mc.gameSettings.keyBindForward;
public static KeyBinding keybindS = mc.gameSettings.keyBindBack;
public static KeyBinding keybindAttack = mc.gameSettings.keyBindAttack;
public static KeyBinding keybindUseItem = mc.gameSettings.keyBindUseItem;
public static KeyBinding keyBindShift = mc.gameSettings.keyBindSneak;
public static KeyBinding keyBindJump = mc.gameSettings.keyBindJump;



public static void initializeCustomKeybindings() {
Expand Down Expand Up @@ -83,51 +83,69 @@ public void onKeyPress(InputEvent.KeyInputEvent event) {



public static void setKeyBindState(int keyCode, boolean pressed) {
public static void setKeyBindState(KeyBinding key, boolean pressed) {
if (pressed) {
if (mc.currentScreen != null) {
LogUtils.addCustomLog("In GUI, pausing");
KeyBinding.setKeyBindState(keyCode, false);
realSetKeyBindState(key, false);
return;
}
}
KeyBinding.setKeyBindState(keyCode, pressed);
realSetKeyBindState(key, pressed);
}

public static void updateKeys(boolean wBool, boolean sBool, boolean aBool, boolean dBool, boolean atkBool, boolean useBool, boolean shiftBool) {
if (mc.currentScreen != null) {
resetKeybindState();
return;
}
KeyBinding.setKeyBindState(keybindW, wBool);
KeyBinding.setKeyBindState(keybindS, sBool);
KeyBinding.setKeyBindState(keybindA, aBool);
KeyBinding.setKeyBindState(keybindD, dBool);
KeyBinding.setKeyBindState(keybindAttack, atkBool);
KeyBinding.setKeyBindState(keybindUseItem, useBool);
KeyBinding.setKeyBindState(keyBindShift, shiftBool);
realSetKeyBindState(keybindW, wBool);
realSetKeyBindState(keybindS, sBool);
realSetKeyBindState(keybindA, aBool);
realSetKeyBindState(keybindD, dBool);
realSetKeyBindState(keybindAttack, atkBool);
realSetKeyBindState(keybindUseItem, useBool);
realSetKeyBindState(keyBindShift, shiftBool);
}

public static void updateKeys(boolean wBool, boolean sBool, boolean aBool, boolean dBool, boolean atkBool) {
if (mc.currentScreen != null) {
resetKeybindState();
return;
}
KeyBinding.setKeyBindState(keybindW, wBool);
KeyBinding.setKeyBindState(keybindS, sBool);
KeyBinding.setKeyBindState(keybindA, aBool);
KeyBinding.setKeyBindState(keybindD, dBool);
KeyBinding.setKeyBindState(keybindAttack, atkBool);
realSetKeyBindState(keybindW, wBool);
realSetKeyBindState(keybindS, sBool);
realSetKeyBindState(keybindA, aBool);
realSetKeyBindState(keybindD, dBool);
realSetKeyBindState(keybindAttack, atkBool);
}

public static void onTick(KeyBinding key) {
if (mc.currentScreen == null) {
KeyBinding.onTick(key.getKeyCode());
}
}

public static void resetKeybindState() {
KeyBinding.setKeyBindState(keybindA, false);
KeyBinding.setKeyBindState(keybindS, false);
KeyBinding.setKeyBindState(keybindW, false);
KeyBinding.setKeyBindState(keybindD, false);
KeyBinding.setKeyBindState(keyBindShift, false);
KeyBinding.setKeyBindState(keyBindJump, false);
KeyBinding.setKeyBindState(keybindAttack, false);
KeyBinding.setKeyBindState(keybindUseItem, false);
realSetKeyBindState(keybindA, false);
realSetKeyBindState(keybindS, false);
realSetKeyBindState(keybindW, false);
realSetKeyBindState(keybindD, false);
realSetKeyBindState(keyBindShift, false);
realSetKeyBindState(keyBindJump, false);
realSetKeyBindState(keybindAttack, false);
realSetKeyBindState(keybindUseItem, false);
}

private static void realSetKeyBindState(KeyBinding key, boolean pressed){
if(pressed){
if(!key.isKeyDown()){
KeyBinding.onTick(key.getKeyCode());
}
KeyBinding.setKeyBindState(key.getKeyCode(), true);

} else {
KeyBinding.setKeyBindState(key.getKeyCode(), false);
}

}
}
11 changes: 11 additions & 0 deletions src/main/java/com/jelly/CaneBuilder/handlers/MacroHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.jelly.CaneBuilder.structures.Coord;
import com.jelly.CaneBuilder.utils.*;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.Slot;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
Expand Down Expand Up @@ -124,6 +125,14 @@ public static void startScript(ProcessModule processModule){
return;
}
}
if(!(processModule instanceof PlaceSC)) {
for (String s : requiredSlotsName) {
if (!InventoryUtils.hasItemInInventory(s)) {
LogUtils.addCustomMessage("Not enough tools! Read how-to-use!");
return;
}
}
}
if(processModule instanceof PlaceDirt1) {
if (Math.floor(mc.thePlayer.posX) == BuilderState.corner1.getX() && Math.floor(mc.thePlayer.posZ) != BuilderState.corner1.getZ()) {
LogUtils.addCustomMessage("Stand on 1st corner to start! " + BuilderState.corner1);
Expand All @@ -140,6 +149,7 @@ public static void startScript(ProcessModule processModule){
return;
}
}

ThreadHandler.executeThread(new Thread(() -> {
try {
if(!(processModule instanceof PlaceSC)) {
Expand All @@ -151,6 +161,7 @@ public static void startScript(ProcessModule processModule){

InventoryUtils.openInventory();
Thread.sleep(500);

for (int i = 0; i < requiredSlotsName.length; i++) {
LogUtils.addCustomLog("Slot for " + requiredSlotsName[i] + " : " + InventoryUtils.getSlotNumberByDisplayName(requiredSlotsName[i]));

Expand Down
Loading

0 comments on commit 2b780c7

Please sign in to comment.