add BookFill
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m43s

This commit is contained in:
Daniella / Tove 2024-10-03 23:57:25 +02:00
parent b2a4e89b49
commit 3a5a361f01
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 39 additions and 0 deletions

View file

@ -39,6 +39,7 @@ public class Setup {
new AutoSignText(),
new Baritone(),
new Bind(),
new BookFill(),
new Bright(),
new ChatAppend(),
new ChatCrypt(),

View file

@ -0,0 +1,38 @@
package de.com.baseband.client.feature.modules.ingame;
import de.com.baseband.client.BaseBand;
import de.com.baseband.client.feature.Feature;
import de.com.baseband.client.feature.category.Ingame;
import de.com.baseband.client.registry.annotation.Description;
import de.com.baseband.client.util.adapt.FieldFinder;
import net.minecraft.client.gui.GuiScreenBook;
import java.lang.reflect.InvocationTargetException;
@Ingame
@Description("Automatically fills books you open with random characters.")
public class BookFill extends Feature {
@Override
public String toString() {
return "BookFill";
}
@Override
public void onTick() {
if(mc.currentScreen instanceof GuiScreenBook) {
try {
FieldFinder.findUnmarkedMethod(GuiScreenBook.class, 1, String.class).invoke(mc.currentScreen, randomString());
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}
private String randomString() {
StringBuilder builder = new StringBuilder(255);
for (int i = 0; i < 256; i++) {
builder.append((char) (BaseBand.RANDOM.nextInt(Character.MAX_VALUE - 256) + 256));
}
return builder.toString();
}
}