3.1.8 finished, ModuleConfig supports List<Item> values

This commit is contained in:
noil 2021-11-28 00:07:50 -05:00
parent eb7dd5cc15
commit 62cd66a9f0
4 changed files with 39 additions and 11 deletions

View File

@ -1,5 +1,6 @@
package me.rigamortis.seppuku.impl.config;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import me.rigamortis.seppuku.api.config.Configurable;
import me.rigamortis.seppuku.api.module.Module;
@ -7,9 +8,12 @@ import me.rigamortis.seppuku.api.util.FileUtil;
import me.rigamortis.seppuku.api.value.Regex;
import me.rigamortis.seppuku.api.value.Shader;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.item.Item;
import java.awt.*;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author noil
@ -73,6 +77,16 @@ public class ModuleConfig extends Configurable {
val.setValue(new Regex(entry.getValue().getAsString()));
} else if (val.getValue() instanceof Shader) {
val.setValue(new Shader(entry.getValue().getAsString()));
} else if (val.getValue() instanceof List) {
List<?> unknownList = (List<?>) val.getValue();
if (unknownList.stream().allMatch(o -> o instanceof Item)) {
List<Item> itemList = new ArrayList<>();
JsonArray unknownArray = (JsonArray) entry.getValue();
unknownArray.forEach(jsonElement -> {
itemList.add(Item.getItemById(jsonElement.getAsInt()));
});
val.setValue(itemList);
}
}
}
}
@ -109,6 +123,16 @@ public class ModuleConfig extends Configurable {
moduleJsonObject.addProperty(value.getName(), ((Regex) value.getValue()).getPatternString());
} else if (value.getValue() instanceof Shader) {
moduleJsonObject.addProperty(value.getName(), ((Shader) value.getValue()).getShaderID());
} else if (value.getValue() instanceof List) {
List<?> unknownList = (List<?>) value.getValue();
if (unknownList.stream().allMatch(o -> o instanceof Item)) {
List<Item> itemList = (List<Item>) unknownList;
JsonArray itemsJsonArray = new JsonArray();
itemList.forEach(item -> {
itemsJsonArray.add(Item.getIdFromItem(item));
});
moduleJsonObject.add(value.getName(), itemsJsonArray);
}
}
});
}

View File

@ -12,7 +12,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
@Mod(modid = "seppukumod", name = "Seppuku", version = SeppukuMod.VERSION, certificateFingerprint = "7979b1d0446af2675fcb5e888851a7f32637fdb9")
public final class SeppukuMod {
public static final String VERSION = "3.1.7";
public static final String VERSION = "3.1.8";
/**
* Our mods entry point

View File

@ -19,13 +19,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.util.Objects;
/**
* Author Seth
* 4/24/2019 @ 3:04 PM.
* @author Seth
* @author noil
*/
public final class AutoToolModule extends Module {
public final Value<Boolean> silent = new Value<Boolean>("Silent", new String[]{"Sil"}, "Hold any item and spoof your mining tool. (Best tool must be in inventory)", false);
public final Value<Boolean> silent = new Value<>("Silent", new String[]{"Sil"}, "Hold any item and spoof your mining tool. (Best tool must be in inventory)", false);
private boolean send;
@ -97,13 +99,13 @@ public final class AutoToolModule extends Module {
}
if (mc.player.isPotionActive(MobEffects.HASTE)) {
f *= 1.0F + (float) (mc.player.getActivePotionEffect(MobEffects.HASTE).getAmplifier() + 1) * 0.2F;
f *= 1.0F + (float) (Objects.requireNonNull(mc.player.getActivePotionEffect(MobEffects.HASTE)).getAmplifier() + 1) * 0.2F;
}
if (mc.player.isPotionActive(MobEffects.MINING_FATIGUE)) {
float f1;
switch (mc.player.getActivePotionEffect(MobEffects.MINING_FATIGUE).getAmplifier()) {
switch (Objects.requireNonNull(mc.player.getActivePotionEffect(MobEffects.MINING_FATIGUE)).getAmplifier()) {
case 0:
f1 = 0.3F;
break;
@ -199,7 +201,7 @@ public final class AutoToolModule extends Module {
for (int i = 9; i < 36; i++) {
final ItemStack stack = Minecraft.getMinecraft().player.inventoryContainer.getSlot(i).getStack();
if (stack != null && stack != ItemStack.EMPTY) {
if (stack != ItemStack.EMPTY) {
final float digSpeed = EnchantmentHelper.getEnchantmentLevel(Enchantments.EFFICIENCY, stack);
final float destroySpeed = stack.getDestroySpeed(Minecraft.getMinecraft().world.getBlockState(pos));
@ -220,7 +222,7 @@ public final class AutoToolModule extends Module {
for (int i = 0; i <= 9; i++) {
final ItemStack stack = Minecraft.getMinecraft().player.inventory.getStackInSlot(i);
if (stack != null && stack != ItemStack.EMPTY) {
if (stack != ItemStack.EMPTY) {
final float digSpeed = EnchantmentHelper.getEnchantmentLevel(Enchantments.EFFICIENCY, stack);
final float destroySpeed = stack.getDestroySpeed(Minecraft.getMinecraft().world.getBlockState(pos));

View File

@ -23,8 +23,10 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.awt.*;
/**
* Author Seth
* 4/24/2019 @ 12:16 PM.
* @author Seth (riga)
* @author noil
* @author hav0x1014
* @author b2h990
*/
public final class SpeedMineModule extends Module {
@ -42,7 +44,7 @@ public final class SpeedMineModule extends Module {
public final Value<Boolean> reset = new Value<Boolean>("Reset", new String[]{"Res"}, "Stops current block destroy damage from resetting if enabled", true);
public final Value<Boolean> doubleBreak = new Value<Boolean>("DoubleBreak", new String[]{"DoubleBreak", "Double", "DB"}, "Mining a block will also mine the block above it, if enabled", false);
public final Value<Boolean> auto = new Value<Boolean>("Auto", new String[]{}, "When enabled, allows for multi-mining blocks", false);
public final Value<Boolean> auto = new Value<Boolean>("Auto", new String[]{"MultiMine", "MM"}, "When enabled, allows for multi-mining blocks", false);
public SpeedMineModule() {
super("SpeedMine", new String[]{"FastMine"}, "Allows you to break blocks faster", "NONE", -1, ModuleType.WORLD);