mirror of
https://github.com/GTNewHorizons/JustEnoughCalculation.git
synced 2026-11-27 15:23:04 +00:00
feat: add manifest, export and import record
This commit is contained in:
1 parent
fa3ba7542c
commit
0e7c1b4f73
39 files changed
+922
-263
No files matched your search
+5
-4
@@ -47,14 +47,15 @@ archivesBaseName = "jecalculation"
|
||||
|
||||
minecraft {
|
||||
version = '1.7.10-10.13.4.1614-1.7.10'
|
||||
runDir = "eclipse"
|
||||
replace '@VERSION@', project.version
|
||||
}
|
||||
|
||||
def commonManifest = {
|
||||
attributes 'FMLAT': 'nei_at.cfg'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLAT': 'accessTransformer.cfg'
|
||||
}
|
||||
manifest commonManifest
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -11,7 +11,13 @@ import java.io.File;
|
||||
public class JecaConfig {
|
||||
public static File configDir = new File(Loader.instance().getConfigDir(), "JustEnoughCalculation/");
|
||||
public static final File configFile = new File(configDir, "main.cfg");
|
||||
public static final File recordFile = new File(configDir, "record.data");
|
||||
public static final File recordFile = new File(configDir, "record.json");
|
||||
public static final File defaultFile = new File(configDir, "default.json");
|
||||
|
||||
public static final File dataDir = new File(configDir, "data/");
|
||||
public static File getDataFile(String group) {
|
||||
return new File(dataDir, group + ".json");
|
||||
}
|
||||
|
||||
public static boolean initialized = false;
|
||||
public static Configuration config;
|
||||
|
||||
@@ -31,7 +31,6 @@ public class JustEnoughCalculation {
|
||||
public static ClientHandler handler = new ClientHandler();
|
||||
|
||||
public static Logger logger = LogManager.getLogger(Reference.MODID);
|
||||
public static enumSide side = enumSide.CLIENT;
|
||||
|
||||
@Mod.EventHandler
|
||||
public static void initPre(FMLPreInitializationEvent event) {
|
||||
@@ -55,11 +54,4 @@ public class JustEnoughCalculation {
|
||||
public static final String MODNAME = "Just Enough Calculation";
|
||||
public static final String VERSION = "@VERSION@";
|
||||
}
|
||||
|
||||
// Only to use at client side
|
||||
public enum enumSide {
|
||||
CLIENT, // Running at client side and server not installed
|
||||
BOTH, // Running at client side and both installed
|
||||
UNDEFINED // Default unknown
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,6 @@ public interface ISubCommand {
|
||||
}
|
||||
|
||||
default String getKey(String key) {
|
||||
return "jecharacters.command." + getName() + '.' + key;
|
||||
return "jecalculation.command." + getName() + '.' + key;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,6 @@ public class CState implements ISubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(ICommandSender sender, String[] args) {
|
||||
sender.addChatMessage(new ChatComponentTranslation(getKey("desc"), JustEnoughCalculation.side.toString()));
|
||||
sender.addChatMessage(new ChatComponentTranslation(getKey("desc"), "inactive"));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package me.towdium.jecalculation.data;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import me.towdium.jecalculation.JecaConfig;
|
||||
@@ -8,9 +7,9 @@ import me.towdium.jecalculation.data.label.ILabel;
|
||||
import me.towdium.jecalculation.data.structure.Recents;
|
||||
import me.towdium.jecalculation.data.structure.Recipe;
|
||||
import me.towdium.jecalculation.data.structure.Recipes;
|
||||
import me.towdium.jecalculation.utils.wrappers.Triple;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import me.towdium.jecalculation.utils.Utilities;
|
||||
import me.towdium.jecalculation.utils.wrappers.Pair;
|
||||
import me.towdium.jecalculation.utils.wrappers.Trio;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -19,10 +18,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -33,8 +29,10 @@ import java.util.stream.Collectors;
|
||||
public class Controller {
|
||||
public static final String KEY_RECIPES = "recipes";
|
||||
public static final String KEY_RECENTS = "recents";
|
||||
public static final String KEY_AMOUNT = "amount";
|
||||
static Recipes recipesClient;
|
||||
static Recents recentsClient;
|
||||
static String amountClient;
|
||||
|
||||
static Recipes getRecord() {
|
||||
return recipesClient;
|
||||
@@ -44,12 +42,40 @@ public class Controller {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
// file, recipes
|
||||
public static List<Pair<String, Recipes>> discover() {
|
||||
File dir = JecaConfig.dataDir;
|
||||
File[] fs = dir.listFiles();
|
||||
if (fs == null) return new ArrayList<>();
|
||||
return Arrays.stream(fs)
|
||||
.map(i -> new Pair<>(i.getName(), new Recipes(Utilities.Json.read(i))))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static void inport(Recipes recipes, String group) {
|
||||
ArrayList<Recipe> buffer = new ArrayList<>();
|
||||
recipes.flatStream(group).forEach(i ->
|
||||
getRecord().flatStream(group).filter(j -> j.one.equals(i.one)).findAny().orElseGet(() -> {
|
||||
buffer.add(i.one);
|
||||
return null;
|
||||
}));
|
||||
for (Recipe r : buffer) addRecipe(group, r);
|
||||
}
|
||||
|
||||
public static File export(String group) {
|
||||
File f = JecaConfig.getDataFile(group);
|
||||
Utilities.Json.write(getRecord().serialize(Collections.singleton(group)), f);
|
||||
return f;
|
||||
}
|
||||
|
||||
public static File export() {
|
||||
File f = JecaConfig.getDataFile("groups");
|
||||
Utilities.Json.write(getRecord().serialize(), f);
|
||||
return f;
|
||||
}
|
||||
|
||||
public static List<String> getGroups() {
|
||||
Recipes user = getRecord();
|
||||
if (user.size() != 0)
|
||||
return user.stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||
else
|
||||
return new ArrayList<>();
|
||||
return getRecord().getGroups();
|
||||
}
|
||||
|
||||
public static void addRecipe(String group, Recipe recipe) {
|
||||
@@ -71,11 +97,11 @@ public class Controller {
|
||||
return getRecord().getRecipe(group, index);
|
||||
}
|
||||
|
||||
public static List<Triple<Recipe, String, Integer>> getRecipes() {
|
||||
public static List<Trio<Recipe, String, Integer>> getRecipes() {
|
||||
return getRecord().getRecipes();
|
||||
}
|
||||
|
||||
public static List<Triple<Recipe, String, Integer>> getRecipes(String group) {
|
||||
public static List<Trio<Recipe, String, Integer>> getRecipes(String group) {
|
||||
return getRecord().getRecipes(group);
|
||||
}
|
||||
|
||||
@@ -83,6 +109,15 @@ public class Controller {
|
||||
return getRecord().getRecipe(label);
|
||||
}
|
||||
|
||||
public static String getAmount() {
|
||||
return amountClient;
|
||||
}
|
||||
|
||||
public static void setAmount(String amount) {
|
||||
amountClient = amount;
|
||||
}
|
||||
|
||||
|
||||
public static List<ILabel> getRecent() {
|
||||
return recentsClient.getRecords();
|
||||
}
|
||||
@@ -93,29 +128,29 @@ public class Controller {
|
||||
}
|
||||
|
||||
public static void loadFromLocal() {
|
||||
try {
|
||||
File file = JecaConfig.recordFile;
|
||||
FileInputStream stream = new FileInputStream(file);
|
||||
NBTTagCompound nbt = CompressedStreamTools.readCompressed(stream);
|
||||
recipesClient = nbt.hasKey(KEY_RECIPES) ? new Recipes(nbt.getTagList(KEY_RECIPES, 10)) : new Recipes();
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
JecaConfig.dataDir.mkdirs();
|
||||
File file = JecaConfig.recordFile;
|
||||
NBTTagCompound nbt = Utilities.Json.read(file);
|
||||
if (nbt != null) {
|
||||
recipesClient = nbt.hasKey(KEY_RECIPES) ? new Recipes(nbt.getCompoundTag(KEY_RECIPES)) : new Recipes();
|
||||
recentsClient = nbt.hasKey(KEY_RECENTS) ? new Recents(nbt.getTagList(KEY_RECENTS, 10)) : new Recents();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
recipesClient = new Recipes();
|
||||
recentsClient = new Recents();
|
||||
amountClient = nbt.hasKey(KEY_AMOUNT) ? nbt.getString(KEY_AMOUNT) : "";
|
||||
return;
|
||||
}
|
||||
file = JecaConfig.defaultFile;
|
||||
nbt = Utilities.Json.read(file);
|
||||
recipesClient = nbt == null ? new Recipes() : new Recipes(nbt);
|
||||
recentsClient = new Recents();
|
||||
amountClient = "";
|
||||
}
|
||||
|
||||
public static void writeToLocal() {
|
||||
try {
|
||||
File file = JecaConfig.recordFile;
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setTag(KEY_RECENTS, recentsClient.serialize());
|
||||
nbt.setTag(KEY_RECIPES, recipesClient.serialize());
|
||||
FileOutputStream stream = new FileOutputStream(file);
|
||||
CompressedStreamTools.writeCompressed(nbt, stream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
File file = JecaConfig.recordFile;
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setTag(KEY_RECENTS, recentsClient.serialize());
|
||||
nbt.setTag(KEY_RECIPES, recipesClient.serialize());
|
||||
nbt.setString(KEY_AMOUNT, amountClient);
|
||||
Utilities.Json.write(nbt, file);
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public interface ILabel {
|
||||
|
||||
ILabel copy();
|
||||
|
||||
NBTTagCompound toNBTTagCompound();
|
||||
NBTTagCompound toNBT();
|
||||
|
||||
String getIdentifier();
|
||||
|
||||
@@ -176,7 +176,7 @@ public interface ILabel {
|
||||
* For {@link ILabel} operations, see {@link Merger}
|
||||
*/
|
||||
class Serializer {
|
||||
public static final String KEY_IDENTIFIER = "identifier";
|
||||
public static final String KEY_IDENTIFIER = "type";
|
||||
public static final String KEY_CONTENT = "content";
|
||||
|
||||
private HashMap<String, Function<NBTTagCompound, ILabel>> idToData = new HashMap<>();
|
||||
@@ -215,7 +215,7 @@ public interface ILabel {
|
||||
public NBTTagCompound serialize(ILabel label) {
|
||||
NBTTagCompound ret = new NBTTagCompound();
|
||||
ret.setString(KEY_IDENTIFIER, label.getIdentifier());
|
||||
ret.setTag(KEY_CONTENT, label.toNBTTagCompound());
|
||||
ret.setTag(KEY_CONTENT, label.toNBT());
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -362,7 +362,7 @@ public interface ILabel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound toNBTTagCompound() {
|
||||
public NBTTagCompound toNBT() {
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
|
||||
@@ -473,10 +473,10 @@ public interface ILabel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound toNBTTagCompound() {
|
||||
public NBTTagCompound toNBT() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setInteger(KEY_AMOUNT, amount);
|
||||
nbt.setBoolean(KEY_PERCENT, percent);
|
||||
nbt.setBoolean(KEY_PERCENT, true);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ public class LFluidStack extends ILabel.Impl {
|
||||
NBTTagCompound nbt;
|
||||
FluidStack temp;
|
||||
|
||||
|
||||
@Override
|
||||
public FluidStack getRepresentation() {
|
||||
return temp;
|
||||
@@ -51,16 +50,21 @@ public class LFluidStack extends ILabel.Impl {
|
||||
|
||||
public LFluidStack(int amount, Fluid fluid, @Nullable NBTTagCompound nbt) {
|
||||
super(amount, false);
|
||||
this.fluid = fluid;
|
||||
this.nbt = nbt;
|
||||
temp = new FluidStack(fluid, amount, nbt);
|
||||
init(fluid, nbt);
|
||||
}
|
||||
|
||||
public LFluidStack(NBTTagCompound nbt) {
|
||||
this(nbt.getInteger(KEY_AMOUNT), Objects.requireNonNull(FluidRegistry.getFluid(nbt.getString(KEY_FLUID))),
|
||||
super(nbt);
|
||||
init(FluidRegistry.getFluid(nbt.getString(KEY_FLUID)),
|
||||
nbt.hasKey(KEY_NBT) ? nbt.getCompoundTag(KEY_NBT) : null);
|
||||
}
|
||||
|
||||
private void init(Fluid fluid, @Nullable NBTTagCompound nbt) {
|
||||
this.fluid = fluid;
|
||||
this.nbt = nbt;
|
||||
temp = new FluidStack(fluid, amount, nbt);
|
||||
}
|
||||
|
||||
public LFluidStack(LFluidStack lfs) {
|
||||
super(lfs);
|
||||
fluid = lfs.fluid;
|
||||
@@ -105,8 +109,8 @@ public class LFluidStack extends ILabel.Impl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound toNBTTagCompound() {
|
||||
NBTTagCompound ret = super.toNBTTagCompound();
|
||||
public NBTTagCompound toNBT() {
|
||||
NBTTagCompound ret = super.toNBT();
|
||||
ret.setString(KEY_FLUID, FluidRegistry.getFluidName(fluid));
|
||||
if (nbt != null) ret.setTag(KEY_NBT, nbt);
|
||||
return ret;
|
||||
|
||||
@@ -14,7 +14,6 @@ import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE;
|
||||
|
||||
@@ -28,10 +27,9 @@ public class LItemStack extends ILabel.Impl {
|
||||
public static final String KEY_ITEM = "item";
|
||||
public static final String KEY_META = "meta";
|
||||
public static final String KEY_NBT = "nbt";
|
||||
public static final String KEY_FUZZY = "fuzzy";
|
||||
public static final byte FUZZY_META = 0x1;
|
||||
public static final byte FUZZY_CAP = 0x2;
|
||||
public static final byte FUZZY_NBT = 0x4;
|
||||
public static final String KEY_F_META = "fMeta";
|
||||
public static final String KEY_F_CAP = "fCap";
|
||||
public static final String KEY_F_NBT = "fNbt";
|
||||
|
||||
Item item;
|
||||
int meta;
|
||||
@@ -43,29 +41,20 @@ public class LItemStack extends ILabel.Impl {
|
||||
|
||||
public LItemStack(int amount, Item item, int meta, @Nullable NBTTagCompound nbt, boolean percent) {
|
||||
super(amount, percent);
|
||||
this.item = item;
|
||||
this.meta = meta;
|
||||
this.nbt = nbt == null ? null : (NBTTagCompound) nbt.copy();
|
||||
temp = new ItemStack(item, 1, meta);
|
||||
temp.setTagCompound(nbt);
|
||||
init(item, meta, nbt, false, false, false);
|
||||
}
|
||||
|
||||
// Convert from itemStack
|
||||
public LItemStack(ItemStack is) {
|
||||
this(is.stackSize, is.getItem(), is.getItemDamage(), is.getTagCompound(), false);
|
||||
super(is.stackSize, false);
|
||||
init(is.getItem(), is.getItemDamage(), is.getTagCompound(), false, false, false);
|
||||
}
|
||||
|
||||
public LItemStack(NBTTagCompound tag) {
|
||||
super(tag);
|
||||
item = Item.getItemById(tag.getInteger(KEY_ITEM));
|
||||
meta = tag.getInteger(KEY_META);
|
||||
nbt = tag.hasKey(KEY_NBT) ? tag.getCompoundTag(KEY_NBT) : null;
|
||||
byte fuzzy = tag.getByte(KEY_FUZZY);
|
||||
fMeta = (fuzzy & FUZZY_META) != 0;
|
||||
fCap = (fuzzy & FUZZY_CAP) != 0;
|
||||
fNbt = (fuzzy & FUZZY_NBT) != 0;
|
||||
temp = new ItemStack(item, 1, meta);
|
||||
temp.setTagCompound(tag);
|
||||
init(Item.getItemById(tag.getInteger(KEY_ITEM)), tag.getInteger(KEY_META),
|
||||
tag.hasKey(KEY_NBT) ? tag.getCompoundTag(KEY_NBT) : null, tag.getBoolean(KEY_F_META),
|
||||
tag.getBoolean(KEY_F_CAP), tag.getBoolean(KEY_F_NBT));
|
||||
}
|
||||
|
||||
private LItemStack(LItemStack lis) {
|
||||
@@ -76,6 +65,22 @@ public class LItemStack extends ILabel.Impl {
|
||||
fMeta = lis.fMeta;
|
||||
fNbt = lis.fNbt;
|
||||
fCap = lis.fCap;
|
||||
temp = lis.temp;
|
||||
}
|
||||
|
||||
private void init(@Nullable Item item,
|
||||
int meta,
|
||||
@Nullable NBTTagCompound nbt,
|
||||
boolean fMeta,
|
||||
boolean fCap,
|
||||
boolean fNbt) {
|
||||
Objects.requireNonNull(item);
|
||||
this.item = item;
|
||||
this.meta = meta;
|
||||
this.nbt = nbt;
|
||||
this.fMeta = fMeta;
|
||||
this.fCap = fCap;
|
||||
this.fNbt = fNbt;
|
||||
temp = new ItemStack(item, 1, meta);
|
||||
temp.setTagCompound(nbt);
|
||||
}
|
||||
@@ -85,15 +90,20 @@ public class LItemStack extends ILabel.Impl {
|
||||
if (a instanceof LItemStack && b instanceof LItemStack) {
|
||||
LItemStack lisA = (LItemStack) a;
|
||||
LItemStack lisB = (LItemStack) b;
|
||||
if (lisA.meta != WILDCARD_VALUE && lisB.meta == WILDCARD_VALUE) return false;
|
||||
if (!lisA.fMeta && lisA.meta != WILDCARD_VALUE && lisA.meta != lisB.meta)
|
||||
return false;
|
||||
if (!lisA.fNbt) {
|
||||
if (lisB.fNbt) return false;
|
||||
if (lisB.fNbt)
|
||||
return false;
|
||||
else if (lisA.nbt == null) {
|
||||
if (lisB.nbt != null) return false;
|
||||
} else if (lisB.nbt == null || !lisA.nbt.equals(lisB.nbt)) return false;
|
||||
if (lisB.nbt != null)
|
||||
return false;
|
||||
} else if (lisB.nbt == null || !lisA.nbt.equals(lisB.nbt))
|
||||
return false;
|
||||
}
|
||||
if (!lisA.fCap) {
|
||||
if (lisB.fCap) return false;
|
||||
if (lisB.fCap)
|
||||
return false;
|
||||
}
|
||||
return lisA.item == lisB.item;
|
||||
}
|
||||
@@ -146,9 +156,8 @@ public class LItemStack extends ILabel.Impl {
|
||||
public boolean matches(Object l) {
|
||||
if (l instanceof LItemStack) {
|
||||
LItemStack lis = (LItemStack) l;
|
||||
return (Objects.equals(nbt, lis.nbt)) && meta == lis.meta && item == lis.item
|
||||
&& fNbt == lis.fNbt && super.matches(l)
|
||||
&& fCap == lis.fCap && fMeta == lis.fMeta;
|
||||
return (Objects.equals(nbt, lis.nbt)) && meta == lis.meta && item == lis.item && fNbt == lis.fNbt &&
|
||||
super.matches(l) && fCap == lis.fCap && fMeta == lis.fMeta;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
@@ -159,17 +168,22 @@ public class LItemStack extends ILabel.Impl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound toNBTTagCompound() {
|
||||
public NBTTagCompound toNBT() {
|
||||
if (item == null)
|
||||
return ILabel.EMPTY.toNBTTagCompound();
|
||||
return ILabel.EMPTY.toNBT();
|
||||
int id = Item.getIdFromItem(item);
|
||||
NBTTagCompound ret = super.toNBTTagCompound();
|
||||
ret.setInteger(KEY_META, meta);
|
||||
NBTTagCompound ret = super.toNBT();
|
||||
if (meta != 0)
|
||||
ret.setInteger(KEY_META, meta);
|
||||
ret.setInteger(KEY_ITEM, id);
|
||||
if (nbt != null)
|
||||
ret.setTag(KEY_NBT, nbt);
|
||||
int fuzzy = (fMeta ? FUZZY_META : 0) | (fCap ? FUZZY_CAP : 0) | (fNbt ? FUZZY_NBT : 0);
|
||||
ret.setByte(KEY_FUZZY, (byte) fuzzy);
|
||||
if (fMeta)
|
||||
ret.setBoolean(KEY_F_META, true);
|
||||
if (fNbt)
|
||||
ret.setBoolean(KEY_F_NBT, true);
|
||||
if (fCap)
|
||||
ret.setBoolean(KEY_F_CAP, true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -177,10 +191,14 @@ public class LItemStack extends ILabel.Impl {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawLabel(JecaGui gui) {
|
||||
gui.drawItemStack(0, 0, temp, false);
|
||||
if (fCap || fNbt || fMeta) gui.drawResource(Resource.LBL_FRAME, 0, 0);
|
||||
if (fCap) gui.drawResource(Resource.LBL_FR_LL, 0, 0);
|
||||
if (fNbt) gui.drawResource(Resource.LBL_FR_UL, 0, 0);
|
||||
if (fMeta) gui.drawResource(Resource.LBL_FR_UR, 0, 0);
|
||||
if (fCap || fNbt || fMeta)
|
||||
gui.drawResource(Resource.LBL_FRAME, 0, 0);
|
||||
if (fCap)
|
||||
gui.drawResource(Resource.LBL_FR_LL, 0, 0);
|
||||
if (fNbt)
|
||||
gui.drawResource(Resource.LBL_FR_UL, 0, 0);
|
||||
if (fMeta)
|
||||
gui.drawResource(Resource.LBL_FR_UR, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import me.towdium.jecalculation.data.label.ILabel;
|
||||
import me.towdium.jecalculation.gui.JecaGui;
|
||||
import me.towdium.jecalculation.gui.Resource;
|
||||
import me.towdium.jecalculation.polyfill.mc.util.NonNullList;
|
||||
import me.towdium.jecalculation.utils.ItemStackHelper;
|
||||
import me.towdium.jecalculation.utils.Utilities;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -53,6 +54,10 @@ public class LOreDict extends ILabel.Impl {
|
||||
name = nbt.getString(KEY_NAME);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return OreDictionary.getOres(name).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getRepresentation() {
|
||||
@@ -63,6 +68,7 @@ public class LOreDict extends ILabel.Impl {
|
||||
} else
|
||||
list.add(is);
|
||||
});
|
||||
if (list.isEmpty()) return ItemStackHelper.EMPTY_ITEM_STACK;
|
||||
long index = System.currentTimeMillis() / 1500;
|
||||
return list.get((int) (index % list.size()));
|
||||
}
|
||||
@@ -180,10 +186,9 @@ public class LOreDict extends ILabel.Impl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound toNBTTagCompound() {
|
||||
NBTTagCompound ret = new NBTTagCompound();
|
||||
public NBTTagCompound toNBT() {
|
||||
NBTTagCompound ret = super.toNBT();
|
||||
ret.setString(KEY_NAME, name);
|
||||
ret.setInteger(KEY_AMOUNT, amount);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,13 +61,12 @@ public class LPlaceholder extends ILabel.Impl {
|
||||
}
|
||||
|
||||
private static Utilities.Recent<LPlaceholder> getRecord() {
|
||||
return JustEnoughCalculation.side == JustEnoughCalculation.enumSide.CLIENT
|
||||
? recentClient : recentServer;
|
||||
return recentClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound toNBTTagCompound() {
|
||||
NBTTagCompound nbt = super.toNBTTagCompound();
|
||||
public NBTTagCompound toNBT() {
|
||||
NBTTagCompound nbt = super.toNBT();
|
||||
nbt.setString(KEY_NAME, name);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package me.towdium.jecalculation.data.structure;
|
||||
import me.towdium.jecalculation.data.Controller;
|
||||
import me.towdium.jecalculation.data.label.ILabel;
|
||||
import me.towdium.jecalculation.utils.wrappers.Pair;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -119,6 +121,7 @@ public class CostList {
|
||||
HashSet<CostList> set = new HashSet<>();
|
||||
set.add(CostList.this);
|
||||
Pair<Recipe, Integer> next = find(true);
|
||||
int count = 0;
|
||||
while (next != null) {
|
||||
CostList original = getCurrent();
|
||||
CostList difference = new CostList(next.one);
|
||||
@@ -132,6 +135,11 @@ public class CostList {
|
||||
addCatalyst(next.one.getLabel(Recipe.enumIoType.CATALYST));
|
||||
next = find(true);
|
||||
}
|
||||
if (count++ > 1000) {
|
||||
Minecraft
|
||||
.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("jecalculation.chat.max_loop"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public class Recents {
|
||||
public static final String IDENTIFIER = "recent";
|
||||
Utilities.Recent<ILabel> record = new Utilities.Recent<>((a, b) -> a == ILabel.EMPTY || a.equals(b), 9);
|
||||
|
||||
public Recents(NBTTagList nbt) {
|
||||
|
||||
@@ -3,14 +3,17 @@ package me.towdium.jecalculation.data.structure;
|
||||
import me.towdium.jecalculation.data.label.ILabel;
|
||||
import me.towdium.jecalculation.polyfill.NBTHelper;
|
||||
import me.towdium.jecalculation.utils.IllegalPositionException;
|
||||
import me.towdium.jecalculation.utils.Utilities;
|
||||
import me.towdium.jecalculation.utils.wrappers.Wrapper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -73,6 +76,19 @@ public class Recipe {
|
||||
return hashcode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || hashcode != obj.hashCode() || !(obj instanceof Recipe)) return false;
|
||||
Recipe r = (Recipe) obj;
|
||||
BiPredicate<ILabel[], ILabel[]> p = (i, j) -> {
|
||||
if (i.length != j.length) return false;
|
||||
for (int k = 0; k < i.length; k++)
|
||||
if (!i[k].equals(j[k])) return false;
|
||||
return true;
|
||||
};
|
||||
return p.test(input, r.input) && p.test(catalyst, r.catalyst) && p.test(output, r.output);
|
||||
}
|
||||
|
||||
public ILabel[] getLabel(enumIoType type) {
|
||||
switch (type) {
|
||||
case INPUT:
|
||||
@@ -95,8 +111,18 @@ public class Recipe {
|
||||
public NBTTagCompound serialize() {
|
||||
NBTTagCompound ret = new NBTTagCompound();
|
||||
Function<ILabel[], NBTTagList> convert = (ls) -> {
|
||||
ArrayList<ILabel> labels = new ArrayList<>();
|
||||
boolean start = false;
|
||||
for (int i = ls.length - 1; i >= 0; i--) {
|
||||
if (start || ls[i] != ILabel.EMPTY) {
|
||||
labels.add(ls[i]);
|
||||
start = true;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagList r = new NBTTagList();
|
||||
Arrays.stream(ls).forEach(l -> r.appendTag(ILabel.SERIALIZER.serialize(l)));
|
||||
new Utilities.ReversedIterator<>(labels).stream()
|
||||
.forEach(l -> r.appendTag(ILabel.SERIALIZER.serialize(l)));
|
||||
return r;
|
||||
};
|
||||
ret.setTag(KEY_INPUT, convert.apply(input));
|
||||
|
||||
@@ -2,39 +2,35 @@ package me.towdium.jecalculation.data.structure;
|
||||
|
||||
import me.towdium.jecalculation.data.label.ILabel;
|
||||
import me.towdium.jecalculation.polyfill.NBTHelper;
|
||||
import me.towdium.jecalculation.utils.wrappers.Triple;
|
||||
import me.towdium.jecalculation.utils.wrappers.Trio;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public class Recipes {
|
||||
public static final String KEY_NAME = "name";
|
||||
public static final String KEY_CONTENT = "content";
|
||||
|
||||
LinkedHashMap<String, List<Recipe>> records = new LinkedHashMap<>();
|
||||
|
||||
public Recipes() {
|
||||
}
|
||||
|
||||
public Recipes(NBTTagList nbt) {
|
||||
public Recipes(NBTTagCompound nbt) {
|
||||
deserialize(nbt);
|
||||
}
|
||||
|
||||
public void deserialize(NBTTagList nbt) {
|
||||
StreamSupport.stream(NBTHelper.spliterator(nbt), false).filter(g -> g instanceof NBTTagCompound).forEach(g -> {
|
||||
NBTTagCompound group = (NBTTagCompound) g;
|
||||
String name = group.getString(KEY_NAME);
|
||||
NBTTagList recipes = group.getTagList(KEY_CONTENT, 10);
|
||||
StreamSupport.stream(NBTHelper.spliterator(recipes), false).filter(r -> r instanceof NBTTagCompound)
|
||||
.map(r -> (NBTTagCompound) r).forEach(r -> add(name, new Recipe(r)));
|
||||
public void deserialize(NBTTagCompound nbt) {
|
||||
Set<String> keySet = (Set<String>) nbt.func_150296_c();
|
||||
keySet.stream().sorted().forEach(i -> {
|
||||
NBTTagList group = nbt.getTagList(i, 10);
|
||||
StreamSupport.stream(NBTHelper.spliterator(group), false)
|
||||
.filter(r -> r instanceof NBTTagCompound)
|
||||
.forEach(r -> add(i, new Recipe((NBTTagCompound) r)));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -66,15 +62,15 @@ public class Recipes {
|
||||
return records.entrySet().stream();
|
||||
}
|
||||
|
||||
public Stream<Triple<Recipe, String, Integer>> flatStream() {
|
||||
public Stream<Trio<Recipe, String, Integer>> flatStream() {
|
||||
return records.entrySet().stream().flatMap(i ->
|
||||
IntStream.range(0, i.getValue().size()).mapToObj(j ->
|
||||
new Triple<>(i.getValue().get(j), i.getKey(), j)));
|
||||
new Trio<>(i.getValue().get(j), i.getKey(), j)));
|
||||
}
|
||||
|
||||
public Stream<Triple<Recipe, String, Integer>> flatStream(String group) {
|
||||
public Stream<Trio<Recipe, String, Integer>> flatStream(String group) {
|
||||
List<Recipe> l = records.get(group);
|
||||
return IntStream.range(0, l.size()).mapToObj(j -> new Triple<>(l.get(j), group, j));
|
||||
return IntStream.range(0, l.size()).mapToObj(j -> new Trio<>(l.get(j), group, j));
|
||||
}
|
||||
|
||||
public void remove(String group, int index) {
|
||||
@@ -87,11 +83,11 @@ public class Recipes {
|
||||
return getGroup(group).get(index);
|
||||
}
|
||||
|
||||
public List<Triple<Recipe, String, Integer>> getRecipes() {
|
||||
public List<Trio<Recipe, String, Integer>> getRecipes() {
|
||||
return flatStream().collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
public List<Triple<Recipe, String, Integer>> getRecipes(String group) {
|
||||
public List<Trio<Recipe, String, Integer>> getRecipes(String group) {
|
||||
return flatStream(group).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
@@ -106,16 +102,22 @@ public class Recipes {
|
||||
return records.get(group);
|
||||
}
|
||||
|
||||
public NBTTagList serialize() {
|
||||
NBTTagList ret = new NBTTagList();
|
||||
forEach((n, rs) -> {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString(KEY_NAME, n);
|
||||
public NBTTagCompound serialize(Collection<String> groups) {
|
||||
NBTTagCompound ret = new NBTTagCompound();
|
||||
groups.stream().sorted().forEach(i -> {
|
||||
NBTTagList l = new NBTTagList();
|
||||
rs.forEach(r -> l.appendTag(r.serialize()));
|
||||
nbt.setTag(KEY_CONTENT, l);
|
||||
ret.appendTag(nbt);
|
||||
getGroup(i).forEach(r -> l.appendTag(r.serialize()));
|
||||
ret.setTag(i, l);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getGroups() {
|
||||
return records.keySet().stream().sorted().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public NBTTagCompound serialize() {
|
||||
return serialize(records.keySet());
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,7 @@ public class FMLBusEventHandler {
|
||||
@SubscribeEvent(receiveCanceled = true)
|
||||
public void onKey(InputEvent.KeyInputEvent event) {
|
||||
if (ClientHandler.keyOpenGui.isPressed()) {
|
||||
if (JustEnoughCalculation.side == JustEnoughCalculation.enumSide.CLIENT)
|
||||
JecaGui.displayGui(true, true, new GuiCalculator());
|
||||
else
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("chat.server_mode"));
|
||||
JecaGui.displayGui(true, true, new GuiCalculator());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -254,6 +254,10 @@ public class JecaGui extends GuiContainer {
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
public int getStringWidth(String s) {
|
||||
return fontRendererObj.getStringWidth(s);
|
||||
}
|
||||
|
||||
public void drawSplitText(float xPos, float yPos, Font f, String s) {
|
||||
drawSplitText(xPos, yPos, Integer.MAX_VALUE, f, s);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,9 @@ public class Resource {
|
||||
public static final Resource WGT_BUTTON_N = new Resource(40, 232, 20, 20);
|
||||
public static final Resource WGT_BUTTON_F = new Resource(60, 232, 20, 20);
|
||||
public static final Resource WGT_BUTTON_D = new Resource(80, 232, 20, 20);
|
||||
public static final Resource WGT_BUTTON_S_N = new Resource(0, 212, 20, 20);
|
||||
public static final Resource WGT_BUTTON_S_F = new Resource(20, 212, 20, 20);
|
||||
public static final Resource WGT_BUTTON_S_D = new Resource(40, 212, 20, 20);
|
||||
public static final Resource WGT_SLOT = new Resource(20, 232, 20, 20);
|
||||
public static final Resource WGT_LINE = new Resource(0, 252, 163, 4);
|
||||
public static final Resource WGT_PANEL_F = new Resource(0, 232, 20, 20);
|
||||
|
||||
@@ -44,13 +44,17 @@ public class GuiCalculator extends WContainer implements IGui {
|
||||
WTextField amount = new WTextField(60, 7, 65);
|
||||
|
||||
public GuiCalculator() {
|
||||
amount.setText(Controller.getAmount());
|
||||
label.setLsnrUpdate(() -> {
|
||||
Controller.setRecent(label.label);
|
||||
refreshRecent();
|
||||
refreshCalculator();
|
||||
});
|
||||
recent.setLsnrUpdate(l -> JecaGui.getCurrent().hand = recent.getLabelAt(l));
|
||||
amount.setLsnrText(s -> refreshCalculator());
|
||||
amount.setLsnrText(s -> {
|
||||
Controller.setAmount(s);
|
||||
refreshCalculator();
|
||||
});
|
||||
add(new WHelp("calculator"));
|
||||
add(new WPanel());
|
||||
add(new WButtonIcon(7, 7, 20, 20, Resource.BTN_LABEL, "calculator.label")
|
||||
@@ -85,9 +89,9 @@ public class GuiCalculator extends WContainer implements IGui {
|
||||
}
|
||||
|
||||
void refreshRecent() {
|
||||
List<ILabel> recent = Controller.getRecent();
|
||||
if (!recent.isEmpty()) label.setLabel(recent.get(0));
|
||||
if (recent.size() > 1) this.recent.setLabel(recent.subList(1, recent.size()), 0);
|
||||
List<ILabel> labels = Controller.getRecent();
|
||||
label.setLabel(labels.isEmpty() ? ILabel.EMPTY : labels.get(0));
|
||||
recent.setLabel(labels.isEmpty() ? new ArrayList<>() : labels.subList(1, labels.size()), 0);
|
||||
}
|
||||
|
||||
void refreshCalculator() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import me.towdium.jecalculation.data.label.ILabel;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Author: towdium
|
||||
@@ -27,16 +28,13 @@ public class GuiDisambiguation extends IPicker.Impl implements IGui {
|
||||
lsUp = new WLabelScroll(25, 48, 7, 3, WLabel.enumMode.PICKER, true);
|
||||
lsDown = new WLabelScroll(25, 105, 7, 3, WLabel.enumMode.PICKER, true);
|
||||
switcher = new WSwitcher(7, 7, 162, this.record.size()).setListener(() -> setPage(switcher.getIndex()));
|
||||
WTextField tf = new WTextField(25, 24, 90);
|
||||
Consumer<ILabel> consumer = i -> callback.accept(i.copy().multiply(-1));
|
||||
|
||||
add(new WPanel());
|
||||
add(switcher);
|
||||
add(new WIcon(7, 48, 18, 54, Resource.ICN_LIST, "disambiguation.list"));
|
||||
add(new WIcon(7, 105, 18, 54, Resource.ICN_LABEL, "disambiguation.label"));
|
||||
add(new WSearch(i -> {
|
||||
if (callback != null) callback.accept(i.copy().multiply(-1));
|
||||
}, tf, lsUp, lsDown));
|
||||
|
||||
add(new WSearch(25, 24, 90, lsUp.setLsnrUpdate(consumer), lsDown.setLsnrUpdate(consumer)));
|
||||
addAll(switcher, lsUp, lsDown);
|
||||
setPage(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package me.towdium.jecalculation.gui.guis;
|
||||
|
||||
import me.towdium.jecalculation.data.Controller;
|
||||
import me.towdium.jecalculation.data.structure.Recipes;
|
||||
import me.towdium.jecalculation.gui.JecaGui;
|
||||
import me.towdium.jecalculation.gui.Resource;
|
||||
import me.towdium.jecalculation.gui.widgets.*;
|
||||
import me.towdium.jecalculation.utils.wrappers.Pair;
|
||||
import me.towdium.jecalculation.utils.wrappers.Quad;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static me.towdium.jecalculation.utils.Utilities.I18n.contains;
|
||||
|
||||
/**
|
||||
* Author: Towdium
|
||||
* Date: 18-12-6
|
||||
*/
|
||||
@ParametersAreNonnullByDefault
|
||||
public class GuiImport extends WContainer implements IGui, ISearchable {
|
||||
List<Quad<Boolean, String, String, Recipes>> data; // selected, file, group, recipes
|
||||
List<Quad<Boolean, String, String, Recipes>> filtered;
|
||||
WSearch search = new WSearch(25, 25, 90, this);
|
||||
WSwitcher page;
|
||||
WButton confirm = new WButtonIcon(149, 25, 20, 20, Resource.BTN_YES, "common.confirm").setDisabled(true)
|
||||
.setLsnrLeft(() -> {
|
||||
data.stream().filter(i -> i.one).forEach(i -> Controller.inport(i.four, i.three));
|
||||
JecaGui.displayParent();
|
||||
});
|
||||
List<Pair<WTick, WText>> content = new ArrayList<>();
|
||||
|
||||
public GuiImport() {
|
||||
add(new WPanel());
|
||||
add(new WIcon(7, 25, 20, 20, Resource.ICN_TEXT, "common.search"));
|
||||
addAll(search, confirm);
|
||||
IntStream.range(0, 7).forEach(i -> {
|
||||
WTick tick = new WTick(7, 49 + 16 * i, 13, 13, "import.tick").setDisabled(true)
|
||||
.setListener(j -> {
|
||||
filtered.get(page.getIndex() * 7 + i).one = j;
|
||||
confirm.setDisabled(data.stream().noneMatch(k -> k.one));
|
||||
});
|
||||
WText text = new WTextExpand(49 + 16 * i, "");
|
||||
addAll(tick, text);
|
||||
content.add(new Pair<>(tick, text));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisible(JecaGui gui) {
|
||||
data = Controller.discover().stream()
|
||||
.flatMap(i -> i.two.stream().map(j -> new Quad<>(false, i.one, j.getKey(), i.two)))
|
||||
.collect(Collectors.toList());
|
||||
search.refresh();
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
Pair<WTick, WText> pair = content.get(i);
|
||||
int index = i + 7 * page.getIndex();
|
||||
if (index >= filtered.size()) {
|
||||
pair.one.setSelected(false).setDisabled(true);
|
||||
pair.two.key = "";
|
||||
} else {
|
||||
Quad<Boolean, String, String, Recipes> quad = filtered.get(index);
|
||||
pair.one.setSelected(quad.one).setDisabled(false);
|
||||
pair.two.key = quad.two + " -> " + quad.three;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setFilter(String s) {
|
||||
if (s.isEmpty()) filtered = new ArrayList<>(data);
|
||||
else filtered = data.stream()
|
||||
.filter(i -> contains(i.two, s) || contains(i.three, s))
|
||||
.collect(Collectors.toList());
|
||||
remove(page);
|
||||
page = new WSwitcher(7, 7, 162, (filtered.size() + 6) / 7).setListener(this::refresh);
|
||||
add(page);
|
||||
refresh();
|
||||
return !filtered.isEmpty();
|
||||
}
|
||||
|
||||
private static class WTextExpand extends WText {
|
||||
boolean expand = false;
|
||||
|
||||
public WTextExpand(int yPos, String key) {
|
||||
super(25, yPos + 2, 140, JecaGui.Font.SHADOW, key, false);
|
||||
}
|
||||
|
||||
//WRectangle rect = new WRectangle(22, 49 + 16 * i, 146, 13, JecaGui.COLOR_GUI_GREY);
|
||||
@Override
|
||||
public void onDraw(JecaGui gui, int xMouse, int yMouse) {
|
||||
gui.drawRectangle(22, yPos - 2, 146, 13, JecaGui.COLOR_GUI_GREY);
|
||||
super.onDraw(gui, xMouse, yMouse);
|
||||
if (expand) {
|
||||
if (JecaGui.mouseIn(22, yPos - 2, gui.getStringWidth(key) + 6, 13, xMouse, yMouse)) {
|
||||
gui.drawRectangle(22, yPos - 2, gui.getStringWidth(key) + 6, 13, JecaGui.COLOR_GUI_GREY);
|
||||
gui.drawText(25, yPos, JecaGui.Font.SHADOW, key);
|
||||
} else expand = false;
|
||||
} else if (JecaGui.mouseIn(22, yPos - 2, 146, 13, xMouse, yMouse) && gui.getStringWidth(key) > 140) {
|
||||
gui.drawRectangle(22, yPos - 2, gui.getStringWidth(key) + 6, 13, JecaGui.COLOR_GUI_GREY);
|
||||
gui.drawText(25, yPos, JecaGui.Font.SHADOW, key);
|
||||
expand = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTooltip(JecaGui gui, int xMouse, int yMouse, List<String> tooltip) {
|
||||
return JecaGui.mouseIn(22, yPos - 2, expand ? gui.getStringWidth(key) + 6 : 146, 13, xMouse, yMouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import me.towdium.jecalculation.gui.widgets.*;
|
||||
import me.towdium.jecalculation.nei.NEIPlugin;
|
||||
import me.towdium.jecalculation.utils.Utilities;
|
||||
import me.towdium.jecalculation.utils.wrappers.Pair;
|
||||
import me.towdium.jecalculation.utils.wrappers.Triple;
|
||||
import me.towdium.jecalculation.utils.wrappers.Trio;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
@@ -124,8 +124,8 @@ public class GuiRecipe extends WContainer implements IGui {
|
||||
|
||||
public void transfer(IRecipeHandler recipe, int recipeIndex) {
|
||||
// item disamb raw
|
||||
ArrayList<Triple<ILabel, CostList, CostList>> input = new ArrayList<>();
|
||||
ArrayList<Triple<ILabel, CostList, CostList>> output = new ArrayList<>();
|
||||
ArrayList<Trio<ILabel, CostList, CostList>> input = new ArrayList<>();
|
||||
ArrayList<Trio<ILabel, CostList, CostList>> output = new ArrayList<>();
|
||||
disambiguation = new HashMap<>();
|
||||
|
||||
// input
|
||||
@@ -147,7 +147,7 @@ public class GuiRecipe extends WContainer implements IGui {
|
||||
refresh();
|
||||
}
|
||||
|
||||
private void merge(ArrayList<Triple<ILabel, CostList, CostList>> dst, List<ILabel> list) {
|
||||
private void merge(ArrayList<Trio<ILabel, CostList, CostList>> dst, List<ILabel> list) {
|
||||
if (list.isEmpty())
|
||||
return;
|
||||
dst.stream().filter(p -> {
|
||||
@@ -159,17 +159,17 @@ public class GuiRecipe extends WContainer implements IGui {
|
||||
} else
|
||||
return false;
|
||||
}).findAny().orElseGet(() -> {
|
||||
Triple<ILabel, CostList, CostList> ret = new Triple<>(ILabel.CONVERTER.first(list), new CostList(list),
|
||||
new CostList(list));
|
||||
Trio<ILabel, CostList, CostList> ret = new Trio<>(ILabel.CONVERTER.first(list), new CostList(list),
|
||||
new CostList(list));
|
||||
dst.add(ret);
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
|
||||
private ArrayList<ILabel> sort(ArrayList<Triple<ILabel, CostList, CostList>> src, int offset, boolean guess) {
|
||||
private ArrayList<ILabel> sort(ArrayList<Trio<ILabel, CostList, CostList>> src, int offset, boolean guess) {
|
||||
ArrayList<ILabel> ret = new ArrayList<>();
|
||||
for (int i = 0; i < src.size(); i++) {
|
||||
Triple<ILabel, CostList, CostList> p = src.get(i);
|
||||
Trio<ILabel, CostList, CostList> p = src.get(i);
|
||||
ret.add(p.one);
|
||||
if (guess && !ILabel.CONVERTER.guess(p.three.getLabels()).isEmpty())
|
||||
disambiguation.put(i + offset, p.two.getLabels());
|
||||
|
||||
@@ -6,45 +6,71 @@ import me.towdium.jecalculation.gui.JecaGui;
|
||||
import me.towdium.jecalculation.gui.Resource;
|
||||
import me.towdium.jecalculation.gui.widgets.*;
|
||||
import me.towdium.jecalculation.utils.Utilities;
|
||||
import me.towdium.jecalculation.utils.wrappers.Triple;
|
||||
import me.towdium.jecalculation.utils.wrappers.Trio;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GuiSearch extends WContainer implements IGui {
|
||||
List<Triple<Recipe, String, Integer>> content;
|
||||
WSwitcher switcherGroup;
|
||||
WLabelScroll labelScroll;
|
||||
List<Trio<Recipe, String, Integer>> content;
|
||||
WSwitcher group;
|
||||
WLabelScroll labels;
|
||||
WButton export;
|
||||
|
||||
public GuiSearch() {
|
||||
labelScroll = new WLabelScroll(7, 51, 8, 6, WLabel.enumMode.PICKER, true);
|
||||
labels = new WLabelScroll(7, 51, 8, 6, WLabel.enumMode.PICKER, true);
|
||||
labels.setLsnrUpdate(i -> content.stream()
|
||||
.filter(j -> j.one.getRep() == i)
|
||||
.findFirst()
|
||||
.ifPresent(j -> JecaGui.displayGui(true, true, new GuiRecipe(j.two, j.three))));
|
||||
add(new WPanel());
|
||||
add(new WSearch(i -> content.stream().filter(j -> j.one.getRep() == i).findFirst()
|
||||
.ifPresent(j -> JecaGui.displayGui(true, true, new GuiRecipe(j.two, j.three))),
|
||||
new WTextField(25, 27, 90), labelScroll));
|
||||
add(new WIcon(7, 27, 20, 20, Resource.ICN_TEXT, "search.text"));
|
||||
add(new WSearch(25, 25, 90, labels));
|
||||
add(new WIcon(7, 25, 20, 20, Resource.ICN_TEXT, "common.search"));
|
||||
add(new WButtonIcon(131, 25, 20, 20, Resource.BTN_IN, "search.import")
|
||||
.setLsnrLeft(() -> JecaGui.displayGui(new GuiImport())));
|
||||
add(labels);
|
||||
}
|
||||
|
||||
|
||||
public void refresh() {
|
||||
int iGroup = switcherGroup.getIndex();
|
||||
content = iGroup == 0 ? Controller.getRecipes() : Controller.getRecipes(switcherGroup.getText());
|
||||
labelScroll
|
||||
.setLabels(content.stream().map(i -> i.one.getRep()).collect(Collectors.toCollection(ArrayList::new)));
|
||||
int iGroup = group.getIndex();
|
||||
content = iGroup == 0 ? Controller.getRecipes() : Controller.getRecipes(group.getText());
|
||||
labels.setLabels(content.stream().map(i -> i.one.getRep()).collect(Collectors.toCollection(ArrayList::new)));
|
||||
remove(export);
|
||||
String tooltip, name;
|
||||
List<Trio<Recipe, String, Integer>> recipes;
|
||||
if (iGroup == 0) {
|
||||
tooltip = "search.export_all";
|
||||
name = null;
|
||||
recipes = Controller.getRecipes();
|
||||
} else {
|
||||
tooltip = "search.export_group";
|
||||
name = Controller.getGroups().get(iGroup - 1);
|
||||
recipes = Controller.getRecipes(name);
|
||||
}
|
||||
export = new WButtonIcon(149, 25, 20, 20, Resource.BTN_OUT, tooltip).setLsnrLeft(() -> {
|
||||
File f = iGroup == 0 ? Controller.export() : Controller.export(name);
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(
|
||||
"jecalculation.chat.export", f.getAbsolutePath()));
|
||||
}).setDisabled(recipes.size() == 0);
|
||||
add(export);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisible(JecaGui gui) {
|
||||
remove(switcherGroup);
|
||||
removeAll(group);
|
||||
ArrayList<String> groups = new ArrayList<>();
|
||||
groups.add(Utilities.I18n.format("gui.search.all"));
|
||||
groups.addAll(Controller.getGroups());
|
||||
int index = switcherGroup == null ? 0 : switcherGroup.getIndex();
|
||||
if (index >= groups.size())
|
||||
index = groups.size() - 1;
|
||||
switcherGroup = new WSwitcher(7, 7, 162, groups).setListener(this::refresh);
|
||||
switcherGroup.setIndex(index);
|
||||
add(switcherGroup);
|
||||
int index = group == null ? 0 : group.getIndex();
|
||||
if (index >= groups.size()) index = groups.size() - 1;
|
||||
group = new WSwitcher(7, 7, 162, groups).setListener(this::refresh);
|
||||
group.setIndex(index);
|
||||
addAll(group);
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
@@ -19,17 +19,16 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
||||
public class PickerPlaceholder extends IPicker.Impl implements IGui {
|
||||
public PickerPlaceholder() {
|
||||
WLabelScroll scroll = new WLabelScroll(7, 69, 8, 5, WLabel.enumMode.PICKER, true)
|
||||
.setLabels(LPlaceholder.getRecent());
|
||||
WTextField search = new WTextField(26, 45, 90);
|
||||
.setLabels(LPlaceholder.getRecent()).setLsnrUpdate(callback);
|
||||
WTextField create = new WTextField(26, 7, 69);
|
||||
create.setLsnrText(s -> create.setColor(s.equals("") ? JecaGui.COLOR_TEXT_RED : JecaGui.COLOR_TEXT_WHITE));
|
||||
add(new WSearch(l -> callback.accept(l), search, scroll));
|
||||
add(new WSearch(26, 45, 90, scroll));
|
||||
add(new WIcon(7, 45, 20, 20, Resource.ICN_TEXT, "picker_placeholder.text_search"));
|
||||
add(new WIcon(7, 7, 20, 20, Resource.ICN_TEXT, "picker_placeholder.text_create"));
|
||||
add(new WLine(36));
|
||||
add(new WButtonIcon(95, 7, 20, 20, Resource.BTN_YES).setLsnrLeft(() -> {
|
||||
if (!create.getText().equals("")) callback.accept(new LPlaceholder(create.getText(), 1));
|
||||
}));
|
||||
add(create);
|
||||
addAll(scroll, create);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -29,10 +30,11 @@ public class PickerSimple extends IPicker.Impl implements IGui {
|
||||
* entire key should be "gui.l18nKey.help.tooltip"
|
||||
*/
|
||||
public PickerSimple(List<ILabel> labels, String l18nKey) {
|
||||
WLabelScroll ls = new WLabelScroll(7, 33, 8, 7, WLabel.enumMode.PICKER, true).setLabels(labels);
|
||||
WTextField tf = new WTextField(26, 7, 90);
|
||||
add(new WSearch(l -> callback.accept(l), tf, ls));
|
||||
WLabelScroll ls = new WLabelScroll(7, 33, 8, 7, WLabel.enumMode.PICKER, true)
|
||||
.setLabels(labels).setLsnrUpdate(callback);
|
||||
add(new WSearch(26, 7, 90, ls));
|
||||
add(new WIcon(7, 7, 20, 20, Resource.ICN_TEXT, l18nKey + ".text"));
|
||||
add(ls);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +48,15 @@ public class PickerSimple extends IPicker.Impl implements IGui {
|
||||
|
||||
public static class OreDict extends PickerSimple {
|
||||
public OreDict() {
|
||||
super(Arrays.stream(OreDictionary.getOreNames()).map(LOreDict::new).collect(Collectors.toList()),
|
||||
"picker_ore_dict");
|
||||
super(generate(), "picker_ore_dict");
|
||||
}
|
||||
|
||||
static List<ILabel> generate() {
|
||||
List<ILabel> present = new ArrayList<>();
|
||||
List<ILabel> empty = new ArrayList<>();
|
||||
Arrays.stream(OreDictionary.getOreNames()).map(LOreDict::new).forEach(i -> (i.isEmpty() ? empty : present).add(i));
|
||||
present.addAll(empty);
|
||||
return present;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package me.towdium.jecalculation.gui.widgets;
|
||||
|
||||
/**
|
||||
* Author: Towdium
|
||||
* Date: 18-12-7
|
||||
*/
|
||||
public interface ISearchable extends IWidget {
|
||||
boolean setFilter(String s);
|
||||
}
|
||||
@@ -43,12 +43,24 @@ public abstract class WButton extends WTooltip {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Resource getDisabled() {
|
||||
return Resource.WGT_BUTTON_D;
|
||||
}
|
||||
|
||||
protected Resource getNormal() {
|
||||
return Resource.WGT_BUTTON_N;
|
||||
}
|
||||
|
||||
protected Resource getFocused() {
|
||||
return Resource.WGT_BUTTON_F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(JecaGui gui, int xMouse, int yMouse) {
|
||||
super.onDraw(gui, xMouse, yMouse);
|
||||
boolean hovered = JecaGui.mouseIn(xPos + 1, yPos + 1, xSize - 2, ySize - 2, xMouse, yMouse);
|
||||
gui.drawResourceContinuous(disabled ? Resource.WGT_BUTTON_D :
|
||||
(hovered ? Resource.WGT_BUTTON_F : Resource.WGT_BUTTON_N), xPos, yPos, xSize, ySize, 3, 3, 3, 3);
|
||||
gui.drawResourceContinuous(disabled ? getDisabled() : (hovered ? getFocused() : getNormal()), xPos, yPos, xSize,
|
||||
ySize, 5, 5, 5, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -194,7 +194,7 @@ public class WLabel implements IWidget {
|
||||
}
|
||||
|
||||
private void update() {
|
||||
label = wl.getLabel();
|
||||
label = wl.label;
|
||||
bAmount.setDisabled(!wl.label.acceptPercent());
|
||||
setPercent(label.isPercent());
|
||||
}
|
||||
@@ -207,8 +207,8 @@ public class WLabel implements IWidget {
|
||||
remove(bPercent);
|
||||
add(bAmount);
|
||||
}
|
||||
wl.label.setPercent(b);
|
||||
wtf.setText(Integer.toString(wl.label.getAmount()));
|
||||
if (label.acceptPercent()) label.setPercent(b);
|
||||
wtf.setText(Integer.toString(label.getAmount()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,14 +18,14 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@ParametersAreNonnullByDefault
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WLabelScroll extends WContainer {
|
||||
public class WLabelScroll extends WContainer implements ISearchable {
|
||||
protected List<ILabel> labels = new ArrayList<>();
|
||||
protected List<ILabel> filtered = new ArrayList<>();
|
||||
protected WLabelGroup labelGroup;
|
||||
protected WScroll scroll;
|
||||
protected int xPos, yPos, column, row, current;
|
||||
protected String filter = "";
|
||||
protected Consumer<Integer> lsnrUpdate;
|
||||
protected Consumer<ILabel> lsnrUpdate;
|
||||
|
||||
public WLabelScroll(int xPos, int yPos, int column, int row, WLabel.enumMode mode, boolean drawConnection) {
|
||||
this.xPos = xPos;
|
||||
@@ -34,7 +34,7 @@ public class WLabelScroll extends WContainer {
|
||||
this.row = row;
|
||||
labelGroup = new WLabelGroup(xPos, yPos, column, row, mode)
|
||||
.setLsnrUpdate(i -> {
|
||||
if (lsnrUpdate != null) lsnrUpdate.accept(i + current * column);
|
||||
if (lsnrUpdate != null) lsnrUpdate.accept(labels.get(i + current * column));
|
||||
});
|
||||
scroll = new WScroll(xPos + column * 18 + 4, yPos, row * 18).setLsnrScroll(this::update);
|
||||
add(labelGroup);
|
||||
@@ -82,7 +82,7 @@ public class WLabelScroll extends WContainer {
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public WLabelScroll setLsnrUpdate(Consumer<Integer> lsnr) {
|
||||
public WLabelScroll setLsnrUpdate(Consumer<ILabel> lsnr) {
|
||||
lsnrUpdate = lsnr;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -14,21 +14,23 @@ import java.util.function.Consumer;
|
||||
*/
|
||||
@ParametersAreNonnullByDefault
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WSearch extends WContainer {
|
||||
Consumer<ILabel> clbk;
|
||||
public class WSearch extends WTextField {
|
||||
ISearchable[] lss;
|
||||
|
||||
public WSearch(Consumer<ILabel> callback, WTextField tf, WLabelScroll... lss) {
|
||||
clbk = callback;
|
||||
tf.setLsnrText(s -> {
|
||||
boolean b = false;
|
||||
for (WLabelScroll i : lss) if (i.setFilter(s)) b = true;
|
||||
tf.setColor(b ? JecaGui.COLOR_TEXT_WHITE : JecaGui.COLOR_TEXT_RED);
|
||||
});
|
||||
add(tf);
|
||||
addAll(lss);
|
||||
for (WLabelScroll i : lss)
|
||||
i.setLsnrUpdate(j -> {
|
||||
if (clbk != null) clbk.accept(i.getLabelAt(j));
|
||||
});
|
||||
public WSearch(int xPos, int yPos, int xSize, ISearchable... lss) {
|
||||
super(xPos, yPos, xSize);
|
||||
this.lss = lss;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void notifyLsnr() {
|
||||
super.notifyLsnr();
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
boolean b = false;
|
||||
for (ISearchable i : lss) if (i.setFilter(textField.getText())) b = true;
|
||||
setColor(b ? JecaGui.COLOR_TEXT_WHITE : JecaGui.COLOR_TEXT_RED);
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class WTextField implements IWidget {
|
||||
return this;
|
||||
}
|
||||
|
||||
void notifyLsnr() {
|
||||
protected void notifyLsnr() {
|
||||
if (lsnrText != null) lsnrText.accept(textField.getText());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package me.towdium.jecalculation.gui.widgets;
|
||||
|
||||
import me.towdium.jecalculation.gui.Resource;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Author: Towdium
|
||||
* Date: 18-12-7
|
||||
*/
|
||||
@ParametersAreNonnullByDefault
|
||||
public class WTick extends WContainer {
|
||||
WButton button;
|
||||
int xPos, yPos, xSize, ySize;
|
||||
String name;
|
||||
boolean disabled;
|
||||
Consumer<Boolean> lsnr;
|
||||
|
||||
public WTick(int xPos, int yPos, int xSize, int ySize, @Nullable String name) {
|
||||
this.xPos = xPos;
|
||||
this.yPos = yPos;
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.name = name;
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
public WTick setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
button.setDisabled(disabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public WTick setListener(Consumer<Boolean> listener) {
|
||||
lsnr = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean selected() {
|
||||
return !(button instanceof Normal);
|
||||
}
|
||||
|
||||
public WTick setSelected(boolean selected) {
|
||||
if (selected == selected()) return this;
|
||||
remove(button);
|
||||
if (selected) button = new Selected(xPos, yPos, xSize, ySize, name);
|
||||
else button = new Normal(xPos, yPos, xSize, ySize, name);
|
||||
add(button);
|
||||
return this;
|
||||
}
|
||||
|
||||
private class Normal extends WButton {
|
||||
public Normal(int xPos, int yPos, int xSize, int ySize, @Nullable String name) {
|
||||
super(xPos, yPos, xSize, ySize, name + ".normal");
|
||||
lsnrLeft = () -> {
|
||||
setSelected(true);
|
||||
lsnr.accept(true);
|
||||
};
|
||||
disabled = WTick.this.disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getSuffix() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
private class Selected extends WButton {
|
||||
public Selected(int xPos, int yPos, int xSize, int ySize, @Nullable String name) {
|
||||
super(xPos, yPos, xSize, ySize, name + ".selected");
|
||||
lsnrLeft = () -> {
|
||||
setSelected(false);
|
||||
lsnr.accept(false);
|
||||
};
|
||||
disabled = WTick.this.disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Resource getDisabled() {
|
||||
return Resource.WGT_BUTTON_S_D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Resource getNormal() {
|
||||
return Resource.WGT_BUTTON_S_N;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Resource getFocused() {
|
||||
return Resource.WGT_BUTTON_S_F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getSuffix() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import net.minecraftforge.client.ClientCommandHandler;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ClientHandler {
|
||||
public static final KeyBinding keyOpenGui = new KeyBinding("key.open_gui", Keyboard.KEY_NONE, "key.category");
|
||||
public static final KeyBinding keyOpenGui = new KeyBinding("jecalculation.key.open_gui", Keyboard.KEY_NONE, "jecalculation.key.category");
|
||||
|
||||
public void initPre() {
|
||||
Handlers.register();
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package me.towdium.jecalculation.utils;
|
||||
|
||||
import com.google.gson.*;
|
||||
import net.minecraft.nbt.*;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class NBTJson {
|
||||
private static final Pattern numberPattern = Pattern.compile("^([-+]?[\\d]+\\.?[0-9]*)([bBsSlLfFdD]?)$");
|
||||
private static final JsonParser parser = new JsonParser();
|
||||
private static final Gson gson = new GsonBuilder().create();
|
||||
|
||||
public static String toJson(NBTTagCompound tag) {
|
||||
final String jsonString = toJsonObject(tag).toString();
|
||||
return gson.toJson(parser.parse(jsonString));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static JsonElement toJsonObject(NBTBase nbt) {
|
||||
if (nbt instanceof NBTTagCompound) {
|
||||
// NBTTagCompound
|
||||
final NBTTagCompound nbtTagCompound = (NBTTagCompound) nbt;
|
||||
final Map<String, NBTBase> tagMap = (Map<String, NBTBase>)nbtTagCompound.tagMap;
|
||||
|
||||
JsonObject root = new JsonObject();
|
||||
for (Map.Entry<String, NBTBase> nbtEntry : tagMap.entrySet() ) {
|
||||
root.add(nbtEntry.getKey(), toJsonObject(nbtEntry.getValue()));
|
||||
}
|
||||
return root;
|
||||
} else if (nbt instanceof NBTBase.NBTPrimitive) {
|
||||
// Number
|
||||
return new JsonPrimitive(((NBTBase.NBTPrimitive) nbt).func_150286_g());
|
||||
} else if (nbt instanceof NBTTagString) {
|
||||
// String
|
||||
return new JsonPrimitive(((NBTTagString) nbt).func_150285_a_());
|
||||
} else if (nbt instanceof NBTTagList) {
|
||||
// Tag List
|
||||
JsonArray arr = new JsonArray();
|
||||
((NBTTagList) nbt).tagList.forEach(c -> arr.add(toJsonObject((NBTBase) c)));
|
||||
return arr;
|
||||
} else if (nbt instanceof NBTTagIntArray) {
|
||||
// Int Array
|
||||
JsonArray arr = new JsonArray();
|
||||
for(int i : ((NBTTagIntArray) nbt).func_150302_c()) {
|
||||
arr.add(new JsonPrimitive(i));
|
||||
}
|
||||
return arr;
|
||||
} else if (nbt instanceof NBTTagByteArray) {
|
||||
// Byte Array
|
||||
JsonArray arr = new JsonArray();
|
||||
for(int i : ((NBTTagByteArray) nbt).func_150292_c()) {
|
||||
arr.add(new JsonPrimitive(i));
|
||||
}
|
||||
return arr;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported NBT Tag: " + NBTBase.NBTTypes[nbt.getId()] + " - " + nbt);
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTBase toNbt(JsonElement jsonElement) {
|
||||
if (jsonElement instanceof JsonPrimitive) {
|
||||
// Number or String
|
||||
final JsonPrimitive jsonPrimitive = (JsonPrimitive) jsonElement;
|
||||
final String jsonString = jsonPrimitive.getAsString();
|
||||
final Matcher m = numberPattern.matcher(jsonString);
|
||||
if(m.find()) {
|
||||
// Number
|
||||
final String numberString = m.group(1);
|
||||
if (m.groupCount() == 2 && m.group(2).length() > 0) {
|
||||
final char numberType = m.group(2).charAt(0);
|
||||
switch(numberType) {
|
||||
case 'b':
|
||||
case 'B':
|
||||
return new NBTTagByte(Byte.parseByte(numberString));
|
||||
case 's':
|
||||
case 'S':
|
||||
return new NBTTagShort(Short.parseShort(numberString));
|
||||
case 'l':
|
||||
case 'L':
|
||||
return new NBTTagLong(Long.parseLong(numberString));
|
||||
case 'f':
|
||||
case 'F':
|
||||
return new NBTTagFloat(Float.parseFloat(numberString));
|
||||
case 'd':
|
||||
case 'D':
|
||||
return new NBTTagDouble(Double.parseDouble(numberString));
|
||||
}
|
||||
} else {
|
||||
if (numberString.contains("."))
|
||||
return new NBTTagDouble(Double.parseDouble(numberString));
|
||||
else
|
||||
return new NBTTagInt(Integer.parseInt(numberString));
|
||||
}
|
||||
} else {
|
||||
// String
|
||||
return new NBTTagString(jsonString);
|
||||
}
|
||||
} else if (jsonElement instanceof JsonArray) {
|
||||
// NBTTagIntArray or NBTTagList
|
||||
final JsonArray jsonArray = (JsonArray) jsonElement;
|
||||
final List<NBTBase> nbtList = new ArrayList<>();
|
||||
|
||||
for (JsonElement element : jsonArray) {
|
||||
nbtList.add(toNbt(element));
|
||||
}
|
||||
|
||||
if (nbtList.stream().allMatch(n -> n instanceof NBTTagInt)) {
|
||||
return new NBTTagIntArray(nbtList.stream().mapToInt(i -> ((NBTTagInt)i).func_150287_d() ).toArray());
|
||||
} else if (nbtList.stream().allMatch(n -> n instanceof NBTTagByte)) {
|
||||
return new NBTTagByteArray(toByteArray(nbtList.stream().mapToInt(i -> ((NBTTagInt)i).func_150287_d() )));
|
||||
} else {
|
||||
NBTTagList nbtTagList = new NBTTagList();
|
||||
nbtList.forEach(nbtTagList::appendTag);
|
||||
|
||||
return nbtTagList;
|
||||
|
||||
}
|
||||
} else if (jsonElement instanceof JsonObject) {
|
||||
// NBTTagCompound
|
||||
final JsonObject jsonObject = (JsonObject) jsonElement;
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
for (Map.Entry<String, JsonElement> jsonEntry : jsonObject.entrySet()) {
|
||||
nbtTagCompound.setTag(jsonEntry.getKey(), toNbt(jsonEntry.getValue()));
|
||||
}
|
||||
return nbtTagCompound;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Unhandled element " + jsonElement);
|
||||
}
|
||||
public static byte[] toByteArray(IntStream stream) {
|
||||
return stream.collect(ByteArrayOutputStream::new, (baos, i) -> baos.write((byte) i), (baos1, baos2) -> baos1.write(baos2.toByteArray(), 0, baos2.size()))
|
||||
.toByteArray();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package me.towdium.jecalculation.utils;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -7,17 +10,22 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import me.towdium.jecalculation.JustEnoughCalculation;
|
||||
import me.towdium.jecalculation.polyfill.NBTHelper;
|
||||
import me.towdium.jecalculation.utils.wrappers.Pair;
|
||||
import me.towdium.jecalculation.utils.wrappers.Wrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.BreakIterator;
|
||||
import java.util.*;
|
||||
import java.util.function.BiFunction;
|
||||
@@ -185,7 +193,7 @@ public class Utilities {
|
||||
|
||||
public static Pair<String, Boolean> search(String translateKey, Object... parameters) {
|
||||
Pair<String, Boolean> ret = new Pair<>(null, null);
|
||||
translateKey = "jecharacters." + translateKey;
|
||||
translateKey = "jecalculation." + translateKey;
|
||||
String buffer = net.minecraft.client.resources.I18n.format(translateKey, parameters);
|
||||
ret.two = !buffer.equals(translateKey);
|
||||
buffer = StringEscapeUtils.unescapeJava(buffer);
|
||||
@@ -198,8 +206,9 @@ public class Utilities {
|
||||
}
|
||||
|
||||
public static List<String> wrap(String s, int width) {
|
||||
return new TextWrapper().wrap(s, Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode(),
|
||||
i -> TextWrapper.renderer.getCharWidth(i), width);
|
||||
return new TextWrapper()
|
||||
.wrap(s, Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode(),
|
||||
i -> TextWrapper.renderer.getCharWidth(i), width);
|
||||
}
|
||||
|
||||
static class TextWrapper {
|
||||
@@ -213,9 +222,11 @@ public class Utilities {
|
||||
|
||||
private void cut() {
|
||||
char c = str.charAt(cursor);
|
||||
if (c == '\f') cursor++;
|
||||
if (c == '\f')
|
||||
cursor++;
|
||||
temp.add(str.substring(start, cursor));
|
||||
if (c == ' ' || c == ' ' || c == '\n') cursor++;
|
||||
if (c == ' ' || c == ' ' || c == '\n')
|
||||
cursor++;
|
||||
start = cursor;
|
||||
end = cursor;
|
||||
space = width;
|
||||
@@ -244,10 +255,13 @@ public class Utilities {
|
||||
for (cursor = end; cursor < i; cursor++) {
|
||||
char ch = str.charAt(cursor);
|
||||
section += func.apply(str.charAt(cursor));
|
||||
if (ch == '\n' || ch == '\f') cut();
|
||||
if (ch == '\n' || ch == '\f')
|
||||
cut();
|
||||
else if (section > space) {
|
||||
if (start == end) cut();
|
||||
else move();
|
||||
if (start == end)
|
||||
cut();
|
||||
else
|
||||
move();
|
||||
}
|
||||
}
|
||||
space -= section;
|
||||
@@ -291,12 +305,132 @@ public class Utilities {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Json {
|
||||
@Nullable
|
||||
public static NBTTagCompound read(File f) {
|
||||
try {
|
||||
String s = FileUtils.readFileToString(f, "UTF-8");
|
||||
return read(s);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static NBTTagCompound read(String s) {
|
||||
JsonParser parser = new JsonParser();
|
||||
try {
|
||||
JsonElement element = parser.parse(s);
|
||||
return (NBTTagCompound) NBTJson.toNbt(element);
|
||||
} catch (IllegalArgumentException | JsonSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
JustEnoughCalculation.logger.error("Failed to load json to nbt");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(NBTTagCompound nbt, File f) {
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
fos = new FileOutputStream(f);
|
||||
fos.write(write(nbt).getBytes(StandardCharsets.UTF_8));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String write(NBTTagCompound nbt) {
|
||||
Writer w = new Writer();
|
||||
write(nbt, w);
|
||||
w.enter();
|
||||
return w.build();
|
||||
}
|
||||
|
||||
private static void write(NBTBase nbt, Writer w) {
|
||||
if (nbt instanceof NBTTagCompound) {
|
||||
NBTTagCompound tags = (NBTTagCompound) nbt;
|
||||
//noinspection unchecked
|
||||
Set<String> keySet = tags.func_150296_c();
|
||||
boolean wrap = keySet.size() > 1;
|
||||
boolean first = true;
|
||||
w.sb.append('{');
|
||||
if (wrap)
|
||||
w.indent++;
|
||||
for (String i : keySet) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
w.sb.append(',');
|
||||
if (wrap)
|
||||
w.enter();
|
||||
w.sb.append('"');
|
||||
w.sb.append(i);
|
||||
w.sb.append("\": ");
|
||||
write(tags.getTag(i), w);
|
||||
}
|
||||
if (wrap) {
|
||||
w.indent--;
|
||||
w.enter();
|
||||
}
|
||||
w.sb.append('}');
|
||||
} else if (nbt instanceof NBTTagList) {
|
||||
NBTTagList tags = (NBTTagList) nbt;
|
||||
boolean wrap = tags.tagCount() > 1;
|
||||
boolean first = true;
|
||||
w.sb.append('[');
|
||||
if (wrap)
|
||||
w.indent++;
|
||||
for (NBTBase i : (List<NBTBase>) tags.tagList) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
w.sb.append(',');
|
||||
if (wrap)
|
||||
w.enter();
|
||||
write(i, w);
|
||||
}
|
||||
if (wrap) {
|
||||
w.indent--;
|
||||
w.enter();
|
||||
}
|
||||
w.sb.append(']');
|
||||
} else
|
||||
w.sb.append(nbt);
|
||||
}
|
||||
|
||||
private static class Writer {
|
||||
public int indent = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
public void enter() {
|
||||
sb.append('\n');
|
||||
char[] tmp = new char[4 * indent];
|
||||
Arrays.fill(tmp, ' ');
|
||||
sb.append(tmp);
|
||||
}
|
||||
|
||||
public String build() {
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Locale getLocaleFromString(String languageCode) {
|
||||
String[] parts = languageCode.split("_", -1);
|
||||
if (parts.length == 1) return new Locale(parts[0]);
|
||||
else if (parts.length == 2
|
||||
|| (parts.length == 3 && parts[2].startsWith("#")))
|
||||
if (parts.length == 1)
|
||||
return new Locale(parts[0]);
|
||||
else if (parts.length == 2 || (parts.length == 3 && parts[2].startsWith("#")))
|
||||
return new Locale(parts[0], parts[1]);
|
||||
else return new Locale(parts[0], parts[1], parts[2]);
|
||||
else
|
||||
return new Locale(parts[0], parts[1], parts[2]);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -4,12 +4,12 @@ package me.towdium.jecalculation.utils.wrappers;
|
||||
* Author: Towdium
|
||||
* Date: 2016/7/1.
|
||||
*/
|
||||
public class Triple<T, U, V> {
|
||||
public class Trio<T, U, V> {
|
||||
public T one;
|
||||
public U two;
|
||||
public V three;
|
||||
|
||||
public Triple(T one, U two, V three) {
|
||||
public Trio(T one, U two, V three) {
|
||||
this.one = one;
|
||||
this.two = two;
|
||||
this.three = three;
|
||||
@@ -1,34 +1,38 @@
|
||||
jecharacters.command.help.list=Here is the list of all commands available:
|
||||
jecharacters.command.state.desc=The mod is working on state: %s
|
||||
jecharacters.command.reload.done=Reloading finished
|
||||
jecharacters.chat.server_mode=The mod is not working in client mode. Key binding will not work.
|
||||
jecharacters.gui.calculator.recipe.active=New recipe
|
||||
jecharacters.gui.calculator.help=Welcome to the main interface of the mod. The first thing suggested to do is to use the two button at upper right to input the recipes, which allows you to create and edit recipes. All the calculation requires recipes to be recorded.\fTo calculate the cost of item, simply pick an item from JEI item list then put to the slot at upper left of the interface with all the recipes to use recorded. The result will then be displayed in lower slots in the interface. The four button provide options to display input, output, catalyst and crafting steps.\fThe button in upper left allows you to to edit and get a lable. Labels are very important part of the mod. They are basiclly things can be put into a slot, including ItemStack, FluidStack, OreDict entry, or simply a placeholder. Lables are used in the calculation process. Most of time they are quite clever as long as you config them properly.
|
||||
jecharacters.gui.calculator.title=Crafting Calculator
|
||||
jecharacters.gui.recipe.save.active=Save
|
||||
jecharacters.gui.recipe.copy.active=Save as new recipe
|
||||
jecharacters.gui.recipe.copy.disabled=Cannot save as new recipe\nbecause you are not editing a recipe
|
||||
jecharacters.gui.recipe.clear.active=Clear grid
|
||||
jecharacters.gui.recipe.label.active=Add label
|
||||
jecharacters.gui.recipe.disamb.active=Open disambiguate settings
|
||||
jecharacters.gui.recipe.disamb.disabled=Disambiguate settings not available\nbecause of no ambiguous element
|
||||
jecharacters.gui.recipe.new.active=New group
|
||||
jecharacters.gui.recipe.cancel.active=Cancel
|
||||
jecharacters.gui.recipe.confirm.active=Confirm
|
||||
jecharacters.gui.recipe.title=Recipe Editing
|
||||
jecharacters.gui.recipe.help=This interface allows you to create or edit recipes. To create one recipe, you can pick items from JEI item list, then put into slots. When finished, simply click save button. You can also fast transer recipes from JEI by clicking "+" when openning recipe view.\fTo edit one label, you can simply click it, then a toolbar will pop up to help you, where you can switch between amount and percentage mode, type the amount, or remove the label. In addition, you can use mouse scroll to quickly change the amount. Clicking "Clear" button will remove all the labels.\fUsing recipe fast transfer, some labels will automatically setup for you, like oreDict labels. If you do not want this behavoir, simply use "Disambiguous" button to select manually. You can also add labels by ckicking "Add label" button. By the way, normally you shouldn't put fuzzy labels as output.\fYou can easily manage recipes using groups. Click "New group" button, type the group name and hit the tick, you are done. The new group name will show in the top bar. If you already have groups set up and you want to use an existing one, you can use arrows to select between them.\fWhen you are editing an existing recipe, you will have two extra buttons, "Save as" and "Delete". "Save as" allows you to save the current recipe as a new recipe, without changing the existing one. "Delete" simply allows you to delete the recipe.
|
||||
jecharacters.gui.label.title=Label Editing
|
||||
jecharacters.gui.label.help=This interface allows you to create labels. This mod provides 4 types of labels: fluid, oreDict, placeholder and item. To create fluid and oreDict label, you can just search and pick. Item labels represent an item stack, but with fuzzy options for meta, nbt and capalibity.\fAs is indicated by name, Placeholder labels do not hold any content. It is just a string to connect recipes. You can use it for anything, like structure or event energy. To create one, simply type in the name, then hit the tick. You can also search and pick existing ones.
|
||||
jecharacters.gui.search.all=All
|
||||
jecharacters.gui.search.input=Input
|
||||
jecharacters.gui.search.output=Output
|
||||
jecharacters.gui.search.catalyst=Catalyst
|
||||
jecharacters.gui.common.label.ore=OreDict
|
||||
jecharacters.gui.common.label.fluid=Fluid
|
||||
jecharacters.gui.common.label.placeholder=Placeholder
|
||||
jecharacters.gui.common.label.item=Item
|
||||
jecharacters.config.force_client=Force Client
|
||||
jecharacters.label.ore_dict.name=Ore: %s
|
||||
jecharacters.label.placeholder.name=Placeholder: %s
|
||||
jecharacters.label.common.tooltip.amount=Amount: %s
|
||||
jecharacters.common.default=Default
|
||||
jecalculation.key.category=Just Enough Calculation
|
||||
jecalculation.key.open_gui=Open GUI
|
||||
jecalculation.command.help.list=Here is the list of all commands available:
|
||||
jecalculation.command.state.desc=Server %s.
|
||||
jecalculation.command.reload.done=Reloading finished
|
||||
jecalculation.chat.max_loop=Process terminated when exceeding max loop count to avoid freezing.
|
||||
jecalculation.chat.server_mode=The mod is not working in client mode. Key binding will not work.
|
||||
jecalculation.chat.export=Selected recipes has been exported to "%s".
|
||||
jecalculation.gui.calculator.recipe.active=New recipe
|
||||
jecalculation.gui.calculator.help=Welcome to the main interface of the mod. The first thing suggested to do is to use the two buttons in the upper right to input the recipes, which allows you to create and edit recipes. All of the calculations require recipes to be recorded.\fTo calculate the cost of an item, simply pick the item from JEIs item list then put it in the slot in the upper left of the interface with all of the recipes to use recorded. The result will then be displayed in the lower slots of the interface. The four buttons provide options to display input, output, catalyst and crafting steps.\fThe button in the upper left allows you to edit and get a label. Labels are a very important part of the mod. They are basically things that can be put into a slot, including ItemStack, FluidStack, OreDict entry, or simply a placeholder. Lables are used in the calculation process. Most of time they are quite clever as long as you configure them properly.
|
||||
jecalculation.gui.calculator.title=Crafting Calculator
|
||||
jecalculation.gui.recipe.save.active=Save
|
||||
jecalculation.gui.recipe.copy.active=Save as new recipe
|
||||
jecalculation.gui.recipe.copy.disabled=Cannot save as new recipe\nbecause you are not editing a recipe
|
||||
jecalculation.gui.recipe.clear.active=Clear grid
|
||||
jecalculation.gui.recipe.label.active=Add label
|
||||
jecalculation.gui.recipe.disamb.active=Open disambiguate settings
|
||||
jecalculation.gui.recipe.disamb.disabled=Disambiguate settings not available\nbecause of no ambiguous element
|
||||
jecalculation.gui.recipe.new.active=New group
|
||||
jecalculation.gui.recipe.cancel.active=Cancel
|
||||
jecalculation.gui.recipe.confirm.active=Confirm
|
||||
jecalculation.gui.recipe.title=Recipe Editing
|
||||
jecalculation.gui.recipe.help=This interface allows you to create or edit recipes. To create one recipe, you can pick items from the JEI item list, then put it into the slots. When finished, simply click the save button. You can also fast transer recipes from JEI by clicking "+" when openning recipe view.\fTo edit one label, you can simply click it, then a toolbar will pop up to help you, where you can switch between amount and percentage mode, type the amount, or remove the label. In addition, you can use mouse scroll to quickly change the amount. Clicking the "Clear" button will remove all of the labels.\fUsing recipe fast transfer, some labels will automatically setup for you, like oreDict labels. If you do not want this behavoir, simply use "Disambiguous" button to select manually. You can also add labels by ckicking the "Add label" button. By the way, normally you shouldn't put fuzzy labels as output.\fYou can easily manage recipes using groups. Click the "New group" button, type the group name and hit the tick, you are done. The new group name will show in the top bar. If you already have groups set up and you want to use an existing one, you can use the arrows to select between them.\fWhen you are editing an existing recipe, you will have two extra buttons, "Save as" and "Delete". "Save as" allows you to save the current recipe as a new recipe, without changing the existing one. "Delete" simply allows you to delete the recipe.
|
||||
jecalculation.gui.label.title=Label Editing
|
||||
jecalculation.gui.label.help=This interface allows you to create labels. This mod provides 4 types of labels: fluid, oreDict, placeholder and item. To create fluid and oreDict label, you can just search and pick. Item labels represent an item stack, but with fuzzy options for meta, nbt and capalibity.\fAs is indicated by the name, Placeholder labels do not hold any content. It is just a string to connect recipes. You can use it for anything, like structure or event energy. To create one, simply type in the name, then hit the tick. You can also search and pick from existing ones.
|
||||
jecalculation.gui.search.all=All
|
||||
jecalculation.gui.search.input=Input
|
||||
jecalculation.gui.search.output=Output
|
||||
jecalculation.gui.search.catalyst=Catalyst
|
||||
jecalculation.gui.common.label.ore=OreDict
|
||||
jecalculation.gui.common.label.fluid=Fluid
|
||||
jecalculation.gui.common.label.placeholder=Placeholder
|
||||
jecalculation.gui.common.label.item=Item
|
||||
jecalculation.config.force_client=Force Client
|
||||
jecalculation.label.ore_dict.name=Ore: %s
|
||||
jecalculation.label.placeholder.name=Placeholder: %s
|
||||
jecalculation.label.common.tooltip.amount=Amount: %s
|
||||
jecalculation.common.default=Default
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,3 @@
|
||||
# NEI Access Transformer configuration file
|
||||
public net.minecraft.nbt.NBTTagCompound field_74784_a #tagMap
|
||||
public net.minecraft.nbt.NBTTagList field_74747_a #taglist
|
||||
Reference in new issue
Block a user