add englishy mode to bookfill
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m41s

This commit is contained in:
Daniella / Tove 2024-10-04 00:12:19 +02:00
parent 3a5a361f01
commit b6a881d51f
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -3,6 +3,7 @@ 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.Config;
import de.com.baseband.client.registry.annotation.Description;
import de.com.baseband.client.util.adapt.FieldFinder;
import net.minecraft.client.gui.GuiScreenBook;
@ -12,6 +13,11 @@ import java.lang.reflect.InvocationTargetException;
@Ingame
@Description("Automatically fills books you open with random characters.")
public class BookFill extends Feature {
@Config("English")
@Description("Make the books english-y instead of all-unicode")
public boolean alphanumeric = false;
@Override
public String toString() {
return "BookFill";
@ -28,9 +34,14 @@ public class BookFill extends Feature {
}
}
private static final char[] ENGLISH = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.-!+#?\"/%&()*'<>".toCharArray();
private String randomString() {
StringBuilder builder = new StringBuilder(255);
for (int i = 0; i < 256; i++) {
if(alphanumeric) {
builder.append(ENGLISH[BaseBand.RANDOM.nextInt(ENGLISH.length)]);
} else
builder.append((char) (BaseBand.RANDOM.nextInt(Character.MAX_VALUE - 256) + 256));
}
return builder.toString();