Skip to content

Commit 2b780c7

Browse files
committed
infinite dirt wand patch
1 parent d903888 commit 2b780c7

16 files changed

Lines changed: 183 additions & 107 deletions

build.gradle

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
1-
plugins {
2-
id "net.minecraftforge.gradle.forge" version "8708bf3e0"
3-
id "com.github.johnrengelman.shadow" version "6.1.0"
4-
id "org.spongepowered.mixin" version "d5f9873"
5-
id "java"
1+
buildscript {
2+
ext.kotlin_version = "1.6.10"
3+
4+
repositories {
5+
jcenter()
6+
maven {
7+
name = "forge"
8+
url = "https://files.minecraftforge.net/maven"
9+
}
10+
maven {
11+
url "https://jitpack.io"
12+
}
13+
maven {
14+
url "https://repo.spongepowered.org/repository/maven-public/"
15+
}
16+
}
17+
dependencies {
18+
classpath "com.github.debuggingss:ForgeGradle:FG_2.1-SNAPSHOT"
19+
classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0"
20+
classpath "com.github.debuggingss:MixinGradle:0.6-SNAPSHOT"
21+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
22+
}
623
}
724

8-
version = "1.0"
9-
group = "com.jelly.CaneBuilder"
25+
apply plugin: 'kotlin'
26+
apply plugin: "net.minecraftforge.gradle.forge"
27+
apply plugin: "com.github.johnrengelman.shadow"
28+
apply plugin: "org.spongepowered.mixin"
29+
30+
31+
version = 1.0
32+
33+
34+
group = "com.jelly.canebuilder"
1035
archivesBaseName = "CaneBuilder"
1136

12-
sourceCompatibility = targetCompatibility = 1.8
1337
compileJava.options.encoding = 'UTF-8'
14-
15-
sourceSets {
16-
main {
17-
ext.refMap = "mixins.canebuilder.refmap.json"
18-
output.resourcesDir = file("${buildDir}/classes/java/main")
19-
}
20-
}
38+
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
2139

2240
minecraft {
2341
version = "1.8.9-11.15.1.2318-1.8.9"
@@ -29,35 +47,50 @@ minecraft {
2947
clientRunArgs += '--tweakClass gg.essential.loader.stage0.EssentialSetupTweaker'
3048
}
3149

50+
3251
configurations {
3352
include
3453
implementation.extendsFrom(include)
3554
}
3655

3756
repositories {
57+
maven {
58+
url = "https://repo.sk1er.club/repository/maven-public"
59+
}
60+
maven {
61+
url = "https://jitpack.io/"
62+
}
63+
maven {
64+
url = "https://repo.spongepowered.org/repository/maven-public/"
65+
}
3866
mavenCentral()
39-
maven { url = "https://repo.sk1er.club/repository/maven-public/" }
40-
maven { url = "https://jitpack.io/" }
41-
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
4267
}
4368

4469
dependencies {
45-
include('gg.essential:loader-launchwrapper:1.1.3')
46-
implementation('gg.essential:essential-1.8.9-forge:1813')
47-
48-
implementation('org.projectlombok:lombok:1.18.24')
49-
annotationProcessor('org.projectlombok:lombok:1.18.22')
70+
compileOnly "gg.essential:essential-1.8.9-forge:1725"
71+
include "gg.essential:loader-launchwrapper:1.1.3"
5072

51-
implementation('org.spongepowered:mixin:0.8.5-SNAPSHOT')
73+
implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT')
5274
annotationProcessor('org.spongepowered:mixin:0.7.11-SNAPSHOT')
5375

76+
include('com.github.RewisServer:brigadier:master-SNAPSHOT')
77+
include('com.github.ronmamo:reflections:master-SNAPSHOT')
78+
include("org.java-websocket:Java-WebSocket:1.5.3")
79+
5480
include('com.googlecode.json-simple:json-simple:1.1.1')
5581
implementation('com.googlecode.json-simple:json-simple:1.1.1')
82+
83+
include('org.apache.commons:commons-collections4:4.4')
84+
implementation('org.apache.commons:commons-collections4:4.4')
85+
86+
implementation('org.projectlombok:lombok:1.18.24')
87+
annotationProcessor('org.projectlombok:lombok:1.18.24')
5688
}
5789

5890
mixin {
5991
add sourceSets.main, "mixins.canebuilder.refmap.json"
6092
defaultObfuscationEnv searge
93+
6194
}
6295

6396
jar {
@@ -67,12 +100,15 @@ jar {
67100
"TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker",
68101
"TweakOrder": "0",
69102
'MixinConfigs': "mixins.canebuilder.json",
103+
"modversion": version,
104+
70105
)
71106
enabled = false
72107
}
73108

74109
sourceJar {
75110
enabled = false
111+
76112
}
77113

78114
shadowJar {
@@ -119,5 +155,4 @@ processResources {
119155
"mcversion": project.minecraft.version
120156
)
121157
}
122-
rename '(.+_at.cfg)', 'META-INF/$1'
123158
}

src/main/java/com/jelly/CaneBuilder/handlers/KeyBindHandler.java

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public class KeyBindHandler {
1616
static Minecraft mc = Minecraft.getMinecraft();
1717
static KeyBinding[] customKeyBinds = new KeyBinding[4];
1818
static int setmode = 0;
19-
public static int keybindA = mc.gameSettings.keyBindLeft.getKeyCode();
20-
public static int keybindD = mc.gameSettings.keyBindRight.getKeyCode();
21-
public static int keybindW = mc.gameSettings.keyBindForward.getKeyCode();
22-
public static int keybindS = mc.gameSettings.keyBindBack.getKeyCode();
23-
public static int keybindAttack = mc.gameSettings.keyBindAttack.getKeyCode();
24-
public static int keybindUseItem = mc.gameSettings.keyBindUseItem.getKeyCode();
25-
public static int keyBindSpace = mc.gameSettings.keyBindJump.getKeyCode();
26-
public static int keyBindShift = mc.gameSettings.keyBindSneak.getKeyCode();
27-
public static int keyBindJump = mc.gameSettings.keyBindJump.getKeyCode();
19+
public static KeyBinding keybindA = mc.gameSettings.keyBindLeft;
20+
public static KeyBinding keybindD = mc.gameSettings.keyBindRight;
21+
public static KeyBinding keybindW = mc.gameSettings.keyBindForward;
22+
public static KeyBinding keybindS = mc.gameSettings.keyBindBack;
23+
public static KeyBinding keybindAttack = mc.gameSettings.keyBindAttack;
24+
public static KeyBinding keybindUseItem = mc.gameSettings.keyBindUseItem;
25+
public static KeyBinding keyBindShift = mc.gameSettings.keyBindSneak;
26+
public static KeyBinding keyBindJump = mc.gameSettings.keyBindJump;
27+
2828

2929

3030
public static void initializeCustomKeybindings() {
@@ -83,51 +83,69 @@ public void onKeyPress(InputEvent.KeyInputEvent event) {
8383

8484

8585

86-
public static void setKeyBindState(int keyCode, boolean pressed) {
86+
public static void setKeyBindState(KeyBinding key, boolean pressed) {
8787
if (pressed) {
8888
if (mc.currentScreen != null) {
89-
LogUtils.addCustomLog("In GUI, pausing");
90-
KeyBinding.setKeyBindState(keyCode, false);
89+
realSetKeyBindState(key, false);
9190
return;
9291
}
9392
}
94-
KeyBinding.setKeyBindState(keyCode, pressed);
93+
realSetKeyBindState(key, pressed);
9594
}
9695

9796
public static void updateKeys(boolean wBool, boolean sBool, boolean aBool, boolean dBool, boolean atkBool, boolean useBool, boolean shiftBool) {
9897
if (mc.currentScreen != null) {
9998
resetKeybindState();
10099
return;
101100
}
102-
KeyBinding.setKeyBindState(keybindW, wBool);
103-
KeyBinding.setKeyBindState(keybindS, sBool);
104-
KeyBinding.setKeyBindState(keybindA, aBool);
105-
KeyBinding.setKeyBindState(keybindD, dBool);
106-
KeyBinding.setKeyBindState(keybindAttack, atkBool);
107-
KeyBinding.setKeyBindState(keybindUseItem, useBool);
108-
KeyBinding.setKeyBindState(keyBindShift, shiftBool);
101+
realSetKeyBindState(keybindW, wBool);
102+
realSetKeyBindState(keybindS, sBool);
103+
realSetKeyBindState(keybindA, aBool);
104+
realSetKeyBindState(keybindD, dBool);
105+
realSetKeyBindState(keybindAttack, atkBool);
106+
realSetKeyBindState(keybindUseItem, useBool);
107+
realSetKeyBindState(keyBindShift, shiftBool);
109108
}
110109

111110
public static void updateKeys(boolean wBool, boolean sBool, boolean aBool, boolean dBool, boolean atkBool) {
112111
if (mc.currentScreen != null) {
113112
resetKeybindState();
114113
return;
115114
}
116-
KeyBinding.setKeyBindState(keybindW, wBool);
117-
KeyBinding.setKeyBindState(keybindS, sBool);
118-
KeyBinding.setKeyBindState(keybindA, aBool);
119-
KeyBinding.setKeyBindState(keybindD, dBool);
120-
KeyBinding.setKeyBindState(keybindAttack, atkBool);
115+
realSetKeyBindState(keybindW, wBool);
116+
realSetKeyBindState(keybindS, sBool);
117+
realSetKeyBindState(keybindA, aBool);
118+
realSetKeyBindState(keybindD, dBool);
119+
realSetKeyBindState(keybindAttack, atkBool);
120+
}
121+
122+
public static void onTick(KeyBinding key) {
123+
if (mc.currentScreen == null) {
124+
KeyBinding.onTick(key.getKeyCode());
125+
}
121126
}
122127

123128
public static void resetKeybindState() {
124-
KeyBinding.setKeyBindState(keybindA, false);
125-
KeyBinding.setKeyBindState(keybindS, false);
126-
KeyBinding.setKeyBindState(keybindW, false);
127-
KeyBinding.setKeyBindState(keybindD, false);
128-
KeyBinding.setKeyBindState(keyBindShift, false);
129-
KeyBinding.setKeyBindState(keyBindJump, false);
130-
KeyBinding.setKeyBindState(keybindAttack, false);
131-
KeyBinding.setKeyBindState(keybindUseItem, false);
129+
realSetKeyBindState(keybindA, false);
130+
realSetKeyBindState(keybindS, false);
131+
realSetKeyBindState(keybindW, false);
132+
realSetKeyBindState(keybindD, false);
133+
realSetKeyBindState(keyBindShift, false);
134+
realSetKeyBindState(keyBindJump, false);
135+
realSetKeyBindState(keybindAttack, false);
136+
realSetKeyBindState(keybindUseItem, false);
137+
}
138+
139+
private static void realSetKeyBindState(KeyBinding key, boolean pressed){
140+
if(pressed){
141+
if(!key.isKeyDown()){
142+
KeyBinding.onTick(key.getKeyCode());
143+
}
144+
KeyBinding.setKeyBindState(key.getKeyCode(), true);
145+
146+
} else {
147+
KeyBinding.setKeyBindState(key.getKeyCode(), false);
148+
}
149+
132150
}
133151
}

src/main/java/com/jelly/CaneBuilder/handlers/MacroHandler.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.jelly.CaneBuilder.structures.Coord;
88
import com.jelly.CaneBuilder.utils.*;
99
import net.minecraft.client.Minecraft;
10+
import net.minecraft.inventory.Slot;
1011
import net.minecraft.util.EnumChatFormatting;
1112
import net.minecraftforge.client.event.RenderWorldLastEvent;
1213
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -124,6 +125,14 @@ public static void startScript(ProcessModule processModule){
124125
return;
125126
}
126127
}
128+
if(!(processModule instanceof PlaceSC)) {
129+
for (String s : requiredSlotsName) {
130+
if (!InventoryUtils.hasItemInInventory(s)) {
131+
LogUtils.addCustomMessage("Not enough tools! Read how-to-use!");
132+
return;
133+
}
134+
}
135+
}
127136
if(processModule instanceof PlaceDirt1) {
128137
if (Math.floor(mc.thePlayer.posX) == BuilderState.corner1.getX() && Math.floor(mc.thePlayer.posZ) != BuilderState.corner1.getZ()) {
129138
LogUtils.addCustomMessage("Stand on 1st corner to start! " + BuilderState.corner1);
@@ -140,6 +149,7 @@ public static void startScript(ProcessModule processModule){
140149
return;
141150
}
142151
}
152+
143153
ThreadHandler.executeThread(new Thread(() -> {
144154
try {
145155
if(!(processModule instanceof PlaceSC)) {
@@ -151,6 +161,7 @@ public static void startScript(ProcessModule processModule){
151161

152162
InventoryUtils.openInventory();
153163
Thread.sleep(500);
164+
154165
for (int i = 0; i < requiredSlotsName.length; i++) {
155166
LogUtils.addCustomLog("Slot for " + requiredSlotsName[i] + " : " + InventoryUtils.getSlotNumberByDisplayName(requiredSlotsName[i]));
156167

0 commit comments

Comments
 (0)