├── .travis.yml ├── README.md ├── .gitignore ├── src └── main │ ├── resources │ ├── assets │ │ └── omniocular │ │ │ ├── config │ │ │ ├── CarpentersBlocks.xml │ │ │ ├── OmniOcular.xml │ │ │ ├── ReactorCraft.xml │ │ │ ├── ChickenChunks.xml │ │ │ ├── ThermalDynamics.xml │ │ │ ├── appliedenergistics2.xml │ │ │ ├── witchery.xml │ │ │ ├── TConstruct.xml │ │ │ ├── minecraft.xml │ │ │ ├── Torcherino.xml │ │ │ ├── ProjectE.xml │ │ │ ├── RotaryCraft.xml │ │ │ ├── Steamcraft.xml │ │ │ ├── ElectriCraft.xml │ │ │ ├── AdvancedSolarPanel.xml │ │ │ ├── Botania.xml │ │ │ ├── AWWayofTime.xml │ │ │ ├── EnderIO.xml │ │ │ ├── ImmerisiveEngineering.xml │ │ │ ├── factorization.xml │ │ │ ├── ThermalExpansion.xml │ │ │ ├── AdvancedMachines.xml │ │ │ ├── GregTech6.xml │ │ │ ├── GregTech5.xml │ │ │ ├── Thaumcraft.xml │ │ │ ├── Railcraft.xml │ │ │ ├── EMT.xml │ │ │ ├── Forestry.xml │ │ │ ├── BuildCraftCore.xml │ │ │ ├── GalacticraftCore.xml │ │ │ ├── GregTech5U.xml │ │ │ ├── LogisticsPipes.xml │ │ │ ├── Mystcraft.xml │ │ │ ├── TechReborn.xml │ │ │ ├── MineFactoryReloaded.xml │ │ │ └── Mekanism.xml │ │ │ └── lang │ │ │ ├── zh_CN.lang │ │ │ └── en_US.lang │ ├── META-INF │ │ └── OmniOcular_at.cfg │ └── mcmod.info │ └── java │ └── me │ └── exz │ └── omniocular │ ├── util │ ├── ListHelper.java │ ├── LogHelper.java │ ├── NBTHelper.java │ └── NBTSerializer.java │ ├── reference │ └── Reference.java │ ├── proxy │ ├── IProxy.java │ ├── ServerProxy.java │ ├── CommonProxy.java │ └── ClientProxy.java │ ├── handler │ ├── FMPHandler.java │ ├── TooltipHandler.java │ ├── EntityHandler.java │ ├── TileEntityHandler.java │ ├── ConfigHandler.java │ └── JSHandler.java │ ├── network │ ├── ConfigMessage.java │ ├── ConfigMessageHandler.java │ └── NetworkHelper.java │ ├── asm │ ├── Core.java │ ├── CoreContainer.java │ └── Transformer.java │ ├── event │ └── ConfigEvent.java │ ├── command │ ├── CommandItemName.java │ ├── CommandReloadConfig.java │ └── CommandEntityName.java │ └── OmniOcular.java ├── LICENSE └── flow.svg /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | script: gradle setupCIWorkspace build -i 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OmniOcular 2 | ========== 3 | Not completed documentation: http://blog.exz.me/omni-ocular/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | eclipse 3 | build.gradle2 4 | json2xml.tsv 5 | nei_at.cfg 6 | OmniOcular.ipr 7 | OmniOcular.iml 8 | gradlew.bat 9 | setup.bat 10 | OmniOcular.iws 11 | test 12 | cauldron 13 | forgeserver 14 | .idea -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/CarpentersBlocks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | return name(nbt['cbAttrList'][0]) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/OmniOcular.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | "DISPLAYNAME" + TAB + ALIGNRIGHT + WHITE+ "RETURN" 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/ReactorCraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | if(nbt['chg']!=0) 7 | return translate('hud.msg.ReactorCraft.chg')+": "+nbt['chg']+"kV" 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/OmniOcular_at.cfg: -------------------------------------------------------------------------------- 1 | public net.minecraft.entity.player.InventoryPlayer func_146029_c(Lnet/minecraft/item/Item;)I #getPosOfItem 2 | public net.minecraft.nbt.NBTTagCompound field_74784_a #tagMap of NBTTagCompound 3 | public net.minecraft.nbt.NBTTagList field_74747_a #tagList of NBTTagList 4 | public net.minecraft.tileentity.TileEntity field_145855_i #nameToClassMap 5 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/util/ListHelper.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.util; 2 | 3 | import java.util.List; 4 | 5 | public class ListHelper { 6 | public static void AddToList(List tips, String tip) { 7 | for (String exist : tips) { 8 | if (exist.equals(tip)) { 9 | return; 10 | } 11 | } 12 | tips.add(tip); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/ChickenChunks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return nbt['radius'] 8 | 9 | 10 | return nbt['owner'] 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/ThermalDynamics.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | function gttdFluid(td){ 6 | if(nbt['FluidName']!=undefined)return fluidName(td['FluidName'])+" : "+td['Amount']+" / "+(td['ConnFluid']['Amount'])+" mB" 7 | } 8 | 9 | 10 | 11 | gttdFluid(nbt) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "OmniOcular", 4 | "name": "Omni Ocular", 5 | "description": "Omni Ocular", 6 | "version": "${version}", 7 | "mcversion": "1.7.10", 8 | "logoFile": "", 9 | "url": "http://exz.me", 10 | "updateUrl": "", 11 | "authorList": ["Epix"], 12 | "credits": "", 13 | "parent": "", 14 | "screenshots": [], 15 | "dependencies": [] 16 | } 17 | ] -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/reference/Reference.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.reference; 2 | 3 | @SuppressWarnings("unused") 4 | public class Reference { 5 | public static final String MOD_ID = "OmniOcular"; 6 | public static final String MOD_NAME = "Omni Ocular"; 7 | public static final String VERSION = "@VERSION@"; 8 | public static final String CLIENT_PROXY_CLASS = "me.exz.omniocular.proxy.ClientProxy"; 9 | public static final String SERVER_PROXY_CLASS = "me.exz.omniocular.proxy.ServerProxy"; 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/appliedenergistics2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return translate(gui.appliedenergistics2.Priority')+nbt['priority'] 8 | 9 | 10 | 11 | 12 | return translate(gui.appliedenergistics2.Priority')+nbt['priority'] 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/witchery.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | return nbt['Power'].toFixed(0)+" / "+nbt['MaxPower']*nbt['PowerScale']+" (x"+nbt['PowerScale']+")" 7 | 8 | 9 | 10 | 11 | return translate('hud.msg.witchery.Owner')+" : "+nbt['WITCPlayers'][0]['Player'] 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/TConstruct.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | if(nbt['ValidStructure']!=0){ 8 | return translate('hud.msg.TConstruct.Layer')+": "+nbt['Layers']} 9 | 10 | 11 | if(nbt['ValidStructure']!=0){ 12 | return translate('hud.msg.TConstruct.Capacity')+": "+nbt['MaxLiquid']+" mB"} 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/proxy/IProxy.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.proxy; 2 | 3 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 4 | import cpw.mods.fml.common.event.FMLServerStartingEvent; 5 | 6 | public interface IProxy { 7 | void registerEvent(); 8 | 9 | void registerClientCommand(); 10 | 11 | void registerServerCommand(FMLServerStartingEvent event); 12 | 13 | void registerWaila(); 14 | 15 | void registerNEI(); 16 | 17 | void registerNetwork(); 18 | 19 | void initConfig(FMLPreInitializationEvent event); 20 | 21 | void prepareConfigFiles(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/minecraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | function tick2second(n){return parseInt(n/20)} 7 | 8 | 9 | 10 | return tick2second(nbt['BurnTime']) 11 | 12 | 13 | 14 | 15 | tick2second(nbt['InLove']) 16 | 17 | 18 | 19 | 20 | return nbt['SkullOwner'] 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/handler/FMPHandler.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.handler; 2 | 3 | import mcp.mobius.waila.api.IWailaFMPAccessor; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | 6 | import java.util.List; 7 | 8 | public class FMPHandler { 9 | 10 | @SuppressWarnings("UnusedDeclaration") 11 | public static List getWailaBody(List currenttip, IWailaFMPAccessor accessor) { 12 | NBTTagCompound n = accessor.getNBTData(); 13 | //accessor.getTileEntity().writeToNBT(n); 14 | if (n != null) { 15 | currenttip.addAll(JSHandler.getBody(ConfigHandler.tileEntityPattern, n, n.getString("id"), accessor.getPlayer())); 16 | } 17 | return currenttip; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/network/ConfigMessage.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.network; 2 | 3 | import cpw.mods.fml.common.network.ByteBufUtils; 4 | import cpw.mods.fml.common.network.simpleimpl.IMessage; 5 | import io.netty.buffer.ByteBuf; 6 | 7 | 8 | public class ConfigMessage implements IMessage { 9 | String text; 10 | 11 | @SuppressWarnings("UnusedDeclaration") 12 | public ConfigMessage() { 13 | } 14 | 15 | ConfigMessage(String text) { 16 | this.text = text; 17 | } 18 | 19 | @Override 20 | public void fromBytes(ByteBuf buf) { 21 | text = ByteBufUtils.readUTF8String(buf); 22 | } 23 | 24 | @Override 25 | public void toBytes(ByteBuf buf) { 26 | ByteBufUtils.writeUTF8String(buf, text); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/proxy/ServerProxy.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.proxy; 2 | 3 | import cpw.mods.fml.common.event.FMLInterModComms; 4 | import me.exz.omniocular.handler.ConfigHandler; 5 | 6 | @SuppressWarnings("UnusedDeclaration") 7 | public class ServerProxy extends CommonProxy { 8 | 9 | @Override 10 | public void registerClientCommand() { 11 | 12 | } 13 | 14 | @Override 15 | public void registerWaila() { 16 | FMLInterModComms.sendMessage("Waila", "register", "me.exz.omniocular.handler.EntityHandler.callbackRegister"); 17 | FMLInterModComms.sendMessage("Waila", "register", "me.exz.omniocular.handler.TileEntityHandler.callbackRegister"); 18 | } 19 | 20 | @Override 21 | public void registerNEI() { 22 | 23 | } 24 | 25 | @Override 26 | public void prepareConfigFiles() { 27 | ConfigHandler.mergeConfig(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/asm/Core.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.asm; 2 | 3 | import cpw.mods.fml.relauncher.IFMLLoadingPlugin; 4 | 5 | import java.util.Map; 6 | 7 | @IFMLLoadingPlugin.MCVersion("1.7.10") 8 | public class Core implements IFMLLoadingPlugin { 9 | @Override 10 | public String[] getASMTransformerClass() { 11 | //LogHelper.info("getASMTransformerClass"); 12 | return new String[]{Transformer.class.getName()}; 13 | } 14 | 15 | @Override 16 | public String getModContainerClass() { 17 | return CoreContainer.class.getName(); 18 | } 19 | 20 | @Override 21 | public String getSetupClass() { 22 | return null; 23 | } 24 | 25 | @Override 26 | public void injectData(Map data) { 27 | 28 | } 29 | 30 | @Override 31 | public String getAccessTransformerClass() { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/event/ConfigEvent.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.event; 2 | 3 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 4 | import cpw.mods.fml.common.gameevent.PlayerEvent; 5 | import me.exz.omniocular.handler.ConfigHandler; 6 | import me.exz.omniocular.network.NetworkHelper; 7 | 8 | public class ConfigEvent { 9 | @SubscribeEvent 10 | public void PlayerLoggedInEvent(PlayerEvent.PlayerLoggedInEvent event) { 11 | //ConfigMessageHandler.network.sendTo(new ConfigMessage(ConfigHandler.mergedConfig), (net.minecraft.entity.player.EntityPlayerMP) event.player); 12 | NetworkHelper.sendConfigString(ConfigHandler.mergedConfig, (net.minecraft.entity.player.EntityPlayerMP) event.player); 13 | 14 | // LogHelper.info("PlayerLoggedInEvent"); 15 | // MinecraftServer.getServer().isDedicatedServer(); 16 | // MinecraftServer.getServer().isSinglePlayer(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/network/ConfigMessageHandler.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.network; 2 | 3 | import cpw.mods.fml.common.network.NetworkRegistry; 4 | import cpw.mods.fml.common.network.simpleimpl.IMessage; 5 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; 6 | import cpw.mods.fml.common.network.simpleimpl.MessageContext; 7 | import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; 8 | import me.exz.omniocular.reference.Reference; 9 | 10 | public class ConfigMessageHandler implements IMessageHandler { 11 | public static final SimpleNetworkWrapper network = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MOD_ID); 12 | 13 | @Override 14 | public IMessage onMessage(ConfigMessage message, MessageContext ctx) { 15 | //LogHelper.info("Config Received: "+ message.text); 16 | NetworkHelper.recvConfigString(message.text); 17 | return null; 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Torcherino.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | switch(nbt['Mode']){ 8 | case 0: 9 | break; 10 | case 1: 11 | return "3x3x3"; 12 | break; 13 | case 2: 14 | return "5x3x5"; 15 | break; 16 | case 3: 17 | return "7x3x7"; 18 | break; 19 | case 4: 20 | return "9x3x9"; 21 | break; 22 | } 23 | 24 | 25 | switch(nbt['Speed']){ 26 | case 0: 27 | break; 28 | case 1: 29 | return "100%"; 30 | break; 31 | case 2: 32 | return "200%"; 33 | break; 34 | case 3: 35 | return "300%"; 36 | break; 37 | case 4: 38 | return "400%"; 39 | break; 40 | } 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/ProjectE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | return "EMC : "+WHITE+nbt['EMC'].toFixed(0) 7 | 8 | 9 | 10 | 11 | return "EMC : "+WHITE+nbt['EMC'].toFixed(0) 12 | 13 | 14 | 15 | 16 | return "EMC : "+WHITE+nbt['EMC'].toFixed(0) 17 | 18 | 19 | 20 | 21 | return "EMC : "+WHITE+nbt['EMC'].toFixed(0) 22 | 23 | 24 | 25 | 26 | return "EMC : "+WHITE+nbt['EMC'].toFixed(0) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/asm/CoreContainer.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.asm; 2 | 3 | import com.google.common.eventbus.EventBus; 4 | import cpw.mods.fml.common.DummyModContainer; 5 | import cpw.mods.fml.common.LoadController; 6 | import cpw.mods.fml.common.ModMetadata; 7 | 8 | import java.util.Arrays; 9 | 10 | public class CoreContainer extends DummyModContainer { 11 | public CoreContainer() { 12 | super(new ModMetadata()); 13 | ModMetadata meta = getMetadata(); 14 | meta.modId = "OmniOcularCore"; 15 | meta.name = "Omni Ocular Core"; 16 | meta.version = "1.0"; 17 | meta.authorList = Arrays.asList("Epix"); 18 | meta.description = "A CoreMod to inject into Waila method"; 19 | meta.url = "http://exz.me"; 20 | } 21 | 22 | @Override 23 | public boolean registerBus(EventBus bus, LoadController controller) { 24 | bus.register(this); 25 | return true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/RotaryCraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | if(nbt['power']!=0){if(nbt['power']!=undefined){ 7 | return translate('hud.msg.RotaryCraft.Power')+": "+(nbt['power']/1000).toFixed(3)+"kW"}} 8 | 9 | 10 | if(nbt['torque']!=0){if(nbt['torque']!=undefined){ 11 | return translate('hud.msg.RotaryCraft.Torque')+": "+nbt['torque']+" Nm"}} 12 | 13 | 14 | if(nbt['omega']!=0){if(nbt['omega']!=undefined){ 15 | return translate('hud.msg.RotaryCraft.Speed')+": "+nbt['omega']+" rad/s"}} 16 | 17 | 18 | 19 | 20 | if(nbt['power']==0){ 21 | return translate('hud.msg.RotaryCraft.Power')+": "+"0W"} 22 | 23 | 24 | if(nbt['torque']==0){ 25 | return translate('hud.msg.RotaryCraft.Torque')+": "+"0 Nm"} 26 | 27 | 28 | if(nbt['omega']==0){ 29 | return translate('hud.msg.RotaryCraft.Speed')+": "+"0 rad/s"} 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Steamcraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | if(nbt['xT']!=0)if(nbt['zT']!=0) 8 | return nbt['xT']+", "+nbt['zT'] 9 | 10 | 11 | 12 | 13 | if(nbt['xT']==0){return"No target"} 14 | 15 | 16 | 17 | 18 | if(nbt['water']!=undefined)if(nbt['id']!=steamcraft:flashBoiler) 19 | return nbt['water']+GRAY+" / "+WHITE+"10000 mB" 20 | 21 | 22 | if(nbt['steam']!=undefined) 23 | return nbt['steam']+" SU" 24 | 25 | 26 | 27 | 28 | return nbt['range']+" blocks" 29 | 30 | 31 | 32 | 33 | return nbt['range']+" blocks" 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/util/LogHelper.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.util; 2 | 3 | import cpw.mods.fml.common.FMLLog; 4 | import me.exz.omniocular.reference.Reference; 5 | import org.apache.logging.log4j.Level; 6 | 7 | @SuppressWarnings("UnusedDeclaration") 8 | public class LogHelper { 9 | private static void log(Level logLevel, Object object) { 10 | FMLLog.log(Reference.MOD_NAME, logLevel, "%s", String.valueOf(object)); 11 | } 12 | 13 | public static void all(Object object) { 14 | log(Level.ALL, object); 15 | } 16 | 17 | public static void debug(Object object) { 18 | log(Level.DEBUG, object); 19 | } 20 | 21 | public static void error(Object object) { 22 | log(Level.ERROR, object); 23 | } 24 | 25 | public static void fatal(Object object) { 26 | log(Level.FATAL, object); 27 | } 28 | 29 | public static void info(Object object) { 30 | log(Level.INFO, object); 31 | } 32 | 33 | public static void off(Object object) { 34 | log(Level.OFF, object); 35 | } 36 | 37 | public static void trace(Object object) { 38 | log(Level.TRACE, object); 39 | } 40 | 41 | public static void warn(Object object) { 42 | log(Level.WARN, object); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/command/CommandItemName.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.command; 2 | 3 | import net.minecraft.command.CommandBase; 4 | import net.minecraft.command.ICommandSender; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.item.Item; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.ChatComponentText; 9 | import net.minecraft.util.ChatComponentTranslation; 10 | 11 | public class CommandItemName extends CommandBase { 12 | @Override 13 | public String getCommandName() { 14 | return "ooi"; 15 | } 16 | 17 | @Override 18 | public boolean canCommandSenderUseCommand(ICommandSender sender) { 19 | return true; 20 | } 21 | 22 | @Override 23 | public String getCommandUsage(ICommandSender sender) { 24 | return "/ooi"; 25 | } 26 | 27 | @Override 28 | public void processCommand(ICommandSender sender, String[] array) { 29 | EntityPlayer player = (EntityPlayer) sender; 30 | ItemStack holdItem = player.getHeldItem(); 31 | if (holdItem == null) { 32 | player.addChatComponentMessage(new ChatComponentTranslation("omniocular.info.NotHolding")); 33 | return; 34 | } 35 | player.addChatComponentMessage(new ChatComponentText(Item.itemRegistry.getNameForObject(holdItem.getItem()))); 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/ElectriCraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | if(nbt['pwr']!=0) {if(nbt['pwr']!=undefined) { 7 | return translate('hud.msg.RotaryCraft.Power')+": "+(nbt['pwr']/1000).toFixed(3)+"kW"}} 8 | 9 | 10 | if(nbt['tq']!=0) {if(nbt['tq']!=undefined) { 11 | return translate('hud.msg.RotaryCraft.Torque')+": "+nbt['tq']+" Nm"}} 12 | 13 | 14 | if(nbt['omg']!=0) {if(nbt['omg']!=undefined) { 15 | return translate('hud.msg.RotaryCraft.Speed')+": "+nbt['omg']+" rad/s"}} 16 | 17 | 18 | 19 | 20 | if(nbt['pwr']==0) { 21 | return translate('hud.msg.RotaryCraft.Power')+": "+"0W"} 22 | 23 | 24 | if(nbt['tq']==0) { 25 | return translate('hud.msg.RotaryCraft.Torque')+": "+"0 Nm"} 26 | 27 | 28 | if(nbt['omg']==0) { 29 | return translate('hud.msg.RotaryCraft.Speed')+": "+"0 rad/s"} 30 | 31 | 32 | 33 | 34 | if(nbt['v']!=0) { 35 | return "Point Voltage: "+nbt['v']} 36 | 37 | 38 | if(nbt['a']!=0) { 39 | return "Point Current: "+nbt['a']} 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/proxy/CommonProxy.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.proxy; 2 | 3 | import cpw.mods.fml.common.FMLCommonHandler; 4 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 5 | import cpw.mods.fml.common.event.FMLServerStartingEvent; 6 | import cpw.mods.fml.relauncher.Side; 7 | import me.exz.omniocular.command.CommandReloadConfig; 8 | import me.exz.omniocular.event.ConfigEvent; 9 | import me.exz.omniocular.handler.ConfigHandler; 10 | import me.exz.omniocular.network.ConfigMessage; 11 | import me.exz.omniocular.network.ConfigMessageHandler; 12 | 13 | public abstract class CommonProxy implements IProxy { 14 | @Override 15 | public void registerServerCommand(FMLServerStartingEvent event) { 16 | event.registerServerCommand(new CommandReloadConfig()); 17 | } 18 | 19 | @Override 20 | public void registerEvent() { 21 | FMLCommonHandler.instance().bus().register(new ConfigEvent()); 22 | } 23 | 24 | @Override 25 | public void registerNetwork() { 26 | ConfigMessageHandler.network.registerMessage(ConfigMessageHandler.class, ConfigMessage.class, 0, Side.CLIENT); 27 | 28 | } 29 | 30 | @Override 31 | public void initConfig(FMLPreInitializationEvent event) { 32 | ConfigHandler.minecraftConfigDirectory = event.getModConfigurationDirectory(); 33 | ConfigHandler.initConfigFiles(); 34 | //JSHandler.initEngine(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/network/NetworkHelper.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.network; 2 | 3 | import me.exz.omniocular.handler.ConfigHandler; 4 | import me.exz.omniocular.util.LogHelper; 5 | import net.minecraft.entity.player.EntityPlayerMP; 6 | 7 | public class NetworkHelper { 8 | 9 | private static void sendString(String string, EntityPlayerMP player) { 10 | ConfigMessageHandler.network.sendTo(new ConfigMessage(string), player); 11 | } 12 | 13 | public static void sendConfigString(String string, EntityPlayerMP player) { 14 | sendString("__START__", player); 15 | int size = 10240; 16 | while (string.length() > size) { 17 | sendString(string.substring(0, size), player); 18 | string = string.substring(size); 19 | } 20 | sendString(string, player); 21 | sendString("__END__", player); 22 | } 23 | 24 | static void recvConfigString(String string) { 25 | switch (string) { 26 | case "__START__": 27 | ConfigHandler.mergedConfig = ""; 28 | break; 29 | case "__END__": 30 | LogHelper.info("received config: " + ConfigHandler.mergedConfig); 31 | ConfigHandler.parseConfigFiles(); 32 | break; 33 | default: 34 | ConfigHandler.mergedConfig += string; 35 | break; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/handler/TooltipHandler.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.handler; 2 | 3 | import codechicken.nei.guihook.GuiContainerManager; 4 | import codechicken.nei.guihook.IContainerTooltipHandler; 5 | import net.minecraft.client.gui.inventory.GuiContainer; 6 | import net.minecraft.item.Item; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.nbt.NBTTagCompound; 9 | 10 | import java.util.List; 11 | 12 | public class TooltipHandler implements IContainerTooltipHandler { 13 | 14 | @Override 15 | public List handleTooltip(GuiContainer guiContainer, int i, int i2, List strings) { 16 | return strings; 17 | } 18 | 19 | @Override 20 | public List handleItemDisplayName(GuiContainer guiContainer, ItemStack itemStack, List strings) { 21 | 22 | return strings; 23 | } 24 | 25 | @Override 26 | public List handleItemTooltip(GuiContainer guiContainer, ItemStack itemStack, int i, int i2, List currenttip) { 27 | if (guiContainer != null && GuiContainerManager.shouldShowTooltip(guiContainer) && itemStack != null) { 28 | NBTTagCompound n = itemStack.getTagCompound(); 29 | 30 | //accessor.getTileEntity().writeToNBT(n); 31 | if (n != null) { 32 | currenttip.addAll(1, JSHandler.getBody(ConfigHandler.tooltipPattern, n, Item.itemRegistry.getNameForObject(itemStack.getItem()), guiContainer.mc.thePlayer)); 33 | 34 | } 35 | } 36 | return currenttip; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/AdvancedSolarPanel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return translate('gui.AdvancedSolarPanel.storage')+": "+WHITE+nbt['storage']+GRAY+" / "+WHITE+"32000 EU" 8 | 9 | 10 | 11 | 12 | return translate('gui.AdvancedSolarPanel.storage')+": "+WHITE+nbt['storage']+GRAY+" / "+WHITE+"100000 EU" 13 | 14 | 15 | 16 | 17 | return translate('gui.AdvancedSolarPanel.storage')+": "+WHITE+nbt['storage']+GRAY+" / "+WHITE+"1000000 EU" 18 | 19 | 20 | 21 | 22 | return translate('gui.AdvancedSolarPanel.storage')+": "+WHITE+nbt['storage']+GRAY+" / "+WHITE+"10000000 EU" 23 | 24 | 25 | 26 | 27 | return translate('gui.QuantumGenerator.power')+": "+WHITE+nbt['production']+" "+translate('gui.AdvancedSolarPanel.energyPerTick') 28 | 29 | 30 | 31 | 32 | return translate('gui.MolecularTransformer.energyPerOperation')+": "+WHITE+nbt['lastRecipeEnergyUsed']+GRAY+" / "+WHITE+nbt['lastRecipeEnergyPerOperation']+" EU" 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/command/CommandReloadConfig.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.command; 2 | 3 | import me.exz.omniocular.handler.ConfigHandler; 4 | import me.exz.omniocular.network.NetworkHelper; 5 | import me.exz.omniocular.util.LogHelper; 6 | import net.minecraft.command.CommandBase; 7 | import net.minecraft.command.ICommandSender; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.server.MinecraftServer; 10 | 11 | import java.util.List; 12 | 13 | public class CommandReloadConfig extends CommandBase { 14 | @Override 15 | public String getCommandName() { 16 | return "oor"; 17 | } 18 | 19 | @Override 20 | public int getRequiredPermissionLevel() { 21 | return 3; 22 | } 23 | 24 | @Override 25 | public boolean canCommandSenderUseCommand(ICommandSender sender) { 26 | return MinecraftServer.getServer().isSinglePlayer() || super.canCommandSenderUseCommand(sender); 27 | } 28 | 29 | @Override 30 | public String getCommandUsage(ICommandSender iCommandSender) { 31 | return "/oor"; 32 | } 33 | 34 | @Override 35 | public void processCommand(ICommandSender sender, String[] array) { 36 | ConfigHandler.mergeConfig(); 37 | List playerList = MinecraftServer.getServer().getConfigurationManager().playerEntityList; 38 | for (Object player : playerList) { 39 | //ConfigMessageHandler.network.sendTo(new ConfigMessage(ConfigHandler.mergedConfig), (EntityPlayerMP) player); 40 | NetworkHelper.sendConfigString(ConfigHandler.mergedConfig, (EntityPlayerMP) player); 41 | } 42 | LogHelper.info(sender.getCommandSenderName() + " commit a config reload."); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/proxy/ClientProxy.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.proxy; 2 | 3 | import codechicken.nei.guihook.GuiContainerManager; 4 | import cpw.mods.fml.common.event.FMLInterModComms; 5 | import me.exz.omniocular.OmniOcular; 6 | import me.exz.omniocular.command.CommandEntityName; 7 | import me.exz.omniocular.command.CommandItemName; 8 | import me.exz.omniocular.handler.ConfigHandler; 9 | import me.exz.omniocular.handler.TooltipHandler; 10 | import me.exz.omniocular.util.LogHelper; 11 | import net.minecraftforge.client.ClientCommandHandler; 12 | 13 | 14 | @SuppressWarnings("UnusedDeclaration") 15 | public class ClientProxy extends CommonProxy { 16 | 17 | 18 | @Override 19 | public void registerClientCommand() { 20 | ClientCommandHandler.instance.registerCommand(new CommandItemName()); 21 | ClientCommandHandler.instance.registerCommand(new CommandEntityName()); 22 | } 23 | 24 | 25 | @Override 26 | public void registerWaila() { 27 | FMLInterModComms.sendMessage("Waila", "register", "me.exz.omniocular.handler.EntityHandler.callbackRegister"); 28 | FMLInterModComms.sendMessage("Waila", "register", "me.exz.omniocular.handler.TileEntityHandler.callbackRegister"); 29 | } 30 | 31 | @Override 32 | public void registerNEI() { 33 | GuiContainerManager.addTooltipHandler(new TooltipHandler()); 34 | } 35 | 36 | @Override 37 | public void prepareConfigFiles() { 38 | try { 39 | ConfigHandler.releasePreConfigFiles(); 40 | } catch (Exception e) { 41 | LogHelper.error("Can't release pre-config files"); 42 | e.printStackTrace(); 43 | } 44 | ConfigHandler.mergeConfig(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/command/CommandEntityName.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.command; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.command.CommandBase; 5 | import net.minecraft.command.ICommandSender; 6 | import net.minecraft.entity.EntityList; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.util.ChatComponentText; 9 | import net.minecraft.util.ChatComponentTranslation; 10 | import net.minecraft.util.MovingObjectPosition; 11 | 12 | public class CommandEntityName extends CommandBase { 13 | @Override 14 | public String getCommandName() { 15 | return "ooe"; 16 | } 17 | 18 | @Override 19 | public boolean canCommandSenderUseCommand(ICommandSender sender) { 20 | return true; 21 | } 22 | 23 | @Override 24 | public String getCommandUsage(ICommandSender sender) { 25 | return "/ooe"; 26 | } 27 | 28 | @Override 29 | public void processCommand(ICommandSender sender, String[] array) { 30 | EntityPlayer player = (EntityPlayer) sender; 31 | Minecraft minecraft = Minecraft.getMinecraft(); 32 | MovingObjectPosition objectMouseOver = minecraft.objectMouseOver; 33 | if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { 34 | Class pointEntityClass = objectMouseOver.entityHit.getClass(); 35 | if (EntityList.classToStringMapping.containsKey(pointEntityClass)) { 36 | player.addChatComponentMessage(new ChatComponentText(EntityList.getEntityString(objectMouseOver.entityHit))); 37 | } 38 | } else { 39 | player.addChatComponentMessage(new ChatComponentTranslation("omniocular.info.NotPointing")); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/util/NBTHelper.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.util; 2 | 3 | import com.google.common.cache.CacheBuilder; 4 | import com.google.common.cache.CacheLoader; 5 | import com.google.common.cache.LoadingCache; 6 | import com.google.gson.Gson; 7 | import com.google.gson.GsonBuilder; 8 | import net.minecraft.nbt.NBTBase; 9 | import net.minecraft.nbt.NBTTagCompound; 10 | 11 | import java.security.MessageDigest; 12 | import java.security.NoSuchAlgorithmException; 13 | 14 | @SuppressWarnings({"unchecked", "CanBeFinal"}) 15 | public class NBTHelper { 16 | public static LoadingCache NBTCache = CacheBuilder.newBuilder().maximumSize(1000).build( 17 | new CacheLoader() { 18 | @Override 19 | public NBTTagCompound load(Integer key) throws Exception { 20 | return new NBTTagCompound(); 21 | } 22 | } 23 | ); 24 | static Gson gson = new GsonBuilder().registerTypeHierarchyAdapter(NBTBase.class, new NBTSerializer()).create(); 25 | 26 | public static String NBT2json(NBTBase n) { 27 | try { 28 | return gson.toJson(n); 29 | } catch (Exception e) { 30 | e.printStackTrace(); 31 | } 32 | return "__ERROR__"; 33 | } 34 | 35 | 36 | public static String MD5(String string) { 37 | try { 38 | MessageDigest md = MessageDigest.getInstance("MD5"); 39 | md.update(string.getBytes()); 40 | byte[] digest = md.digest(); 41 | StringBuilder sb = new StringBuilder(); 42 | for (byte b : digest) { 43 | sb.append(String.format("%02x", b & 0xff)); 44 | } 45 | return sb.toString(); 46 | } catch (NoSuchAlgorithmException e) { 47 | e.printStackTrace(); 48 | } 49 | return null; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Botania.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return nbt['mana']+GRAY+" / "+WHITE+nbt['manaCap'] 8 | 9 | 10 | switch(nbt['outputting']) { 11 | case 0:return translate('hud.msg.Botania.output.0'); 12 | break; 13 | case 1:return translate('hud.msg.Botania.output.1'); 14 | break; 15 | } 16 | 17 | 18 | 19 | 20 | return nbt['mana'] 21 | 22 | 23 | 24 | 25 | return nbt['mana']+GRAY+" / "+WHITE+nbt['manaToGet'] 26 | 27 | 28 | 29 | 30 | return nbt['mana']+GRAY+" / "+WHITE+nbt['manaRequired'] 31 | 32 | 33 | 34 | 35 | return nbt['subTileCmp']['mana'] 36 | 37 | 38 | 39 | 40 | return nbt['mana']+GRAY+" / "+WHITE+"1280 ("+nbt['mana']*10+" RF)" 41 | 42 | 43 | 44 | 45 | return nbt['mana']+GRAY+" / "+WHITE+"160" 46 | 47 | 48 | 49 | 50 | return nbt['mana']+GRAY+" / "+WHITE+"1000000" 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/OmniOcular.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular; 2 | 3 | import cpw.mods.fml.common.Mod; 4 | import cpw.mods.fml.common.SidedProxy; 5 | import cpw.mods.fml.common.event.FMLInitializationEvent; 6 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 7 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 8 | import cpw.mods.fml.common.event.FMLServerStartingEvent; 9 | import cpw.mods.fml.common.network.NetworkCheckHandler; 10 | import cpw.mods.fml.relauncher.Side; 11 | import me.exz.omniocular.proxy.IProxy; 12 | import me.exz.omniocular.reference.Reference; 13 | 14 | import java.util.Map; 15 | 16 | @SuppressWarnings({"UnusedParameters", "UnusedDeclaration"}) 17 | @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, dependencies = "required-after:Waila;required-after:NotEnoughItems") 18 | 19 | public class OmniOcular { 20 | @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) 21 | private static IProxy proxy; 22 | 23 | @Mod.EventHandler 24 | public void preInit(FMLPreInitializationEvent event) { 25 | proxy.initConfig(event); 26 | proxy.registerNetwork(); 27 | } 28 | 29 | @Mod.EventHandler 30 | public void init(FMLInitializationEvent event) { 31 | proxy.registerWaila(); 32 | proxy.registerClientCommand(); 33 | proxy.registerEvent(); 34 | proxy.prepareConfigFiles(); 35 | } 36 | 37 | @Mod.EventHandler 38 | public void postInit(FMLPostInitializationEvent event) { 39 | proxy.registerNEI(); 40 | } 41 | 42 | @Mod.EventHandler 43 | void onServerStart(FMLServerStartingEvent event) { 44 | // LogHelper.info("FMLServerStartingEvent"); 45 | proxy.registerServerCommand(event); 46 | } 47 | 48 | @NetworkCheckHandler 49 | public static boolean check(Map remote, Side side) { 50 | return !(side == Side.SERVER && !remote.isEmpty() && !remote.containsKey(Reference.MOD_ID)); 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/AWWayofTime.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return nbt['Amount'] 8 | 9 | 10 | return nbt['capacity'] 11 | 12 | 13 | return nbt['progress']+" / "+nbt['liquidRequired'] 14 | 15 | 16 | return nbt['upgradeLevel'] 17 | 18 | 19 | return (nbt['consumptionMultiplier']+1)*100+" %" 20 | 21 | 22 | return (nbt['dislocationMultiplier']*20).toFixed(0)+" mB/t" 23 | 24 | 25 | return nbt['orbCapacityMultiplier']*100+" %" 26 | 27 | 28 | return ((nbt['sacrificeEfficiencyMultiplier']+1)*100).toFixed(0)+" %" 29 | 30 | 31 | return ((nbt['selfSacrificeEfficiencyMultiplier']+1)*100).toFixed(0)+" %" 32 | 33 | 34 | 35 | 36 | return nbt['currentRitualString'] 37 | 38 | 39 | return nbt['owner'] 40 | 41 | 42 | 43 | 44 | return nbt['amountUsed']*100+" LP" 45 | 46 | 47 | return nbt['progress']+" %" 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/handler/EntityHandler.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.handler; 2 | 3 | import mcp.mobius.waila.api.IWailaConfigHandler; 4 | import mcp.mobius.waila.api.IWailaEntityAccessor; 5 | import mcp.mobius.waila.api.IWailaEntityProvider; 6 | import mcp.mobius.waila.api.IWailaRegistrar; 7 | import net.minecraft.entity.Entity; 8 | import net.minecraft.entity.EntityList; 9 | import net.minecraft.entity.player.EntityPlayerMP; 10 | import net.minecraft.nbt.NBTTagCompound; 11 | import net.minecraft.world.World; 12 | 13 | import java.util.List; 14 | 15 | public class EntityHandler implements IWailaEntityProvider { 16 | @SuppressWarnings("UnusedDeclaration") 17 | public static void callbackRegister(IWailaRegistrar registrar) { 18 | EntityHandler instance = new EntityHandler(); 19 | // registrar.registerSyncedNBTKey("*", Entity.class); 20 | registrar.registerBodyProvider(instance, Entity.class); 21 | registrar.registerNBTProvider(instance, Entity.class); 22 | 23 | } 24 | 25 | @Override 26 | public Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config) { 27 | return null; 28 | } 29 | 30 | @Override 31 | public List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) { 32 | return currenttip; 33 | } 34 | 35 | @Override 36 | public List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) { 37 | NBTTagCompound n = accessor.getNBTData(); 38 | if (n != null) { 39 | currenttip.addAll(JSHandler.getBody(ConfigHandler.entityPattern, n, EntityList.getEntityString(accessor.getEntity()), accessor.getPlayer())); 40 | } 41 | return currenttip; 42 | } 43 | 44 | @Override 45 | public List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) { 46 | return currenttip; 47 | } 48 | 49 | @Override 50 | public NBTTagCompound getNBTData(EntityPlayerMP player, Entity ent, NBTTagCompound tag, World world) { 51 | if (ent != null) 52 | ent.writeToNBT(tag); 53 | return tag; 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/EnderIO.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | function gteioftFluid(eio,cap){ 6 | if(nbt['fuelTank']['FluidName']!=undefined) 7 | {return YELLOW+"Fuel: "+GRAY+fluidName(eio['fuelTank']['FluidName'])+" "+(WHITE+eio['fuelTank']['Amount'])+GRAY+" / "+WHITE+cap+GRAY+" mB"} 8 | } 9 | 10 | 11 | function gteioctFluid(eio,cap){ 12 | if(nbt['coolantTank']['FluidName']!=undefined) 13 | {return YELLOW+"Coolant: "+GRAY+fluidName(eio['coolantTank']['FluidName'])+" "+(WHITE+eio['coolantTank']['Amount'])+GRAY+" / "+WHITE+cap+GRAY+" mB"} 14 | } 15 | 16 | 17 | function gteioitFluid(eio,cap){ 18 | if(nbt['inputTank']['FluidName']!=undefined) 19 | {return YELLOW+"Input Tank: "+GRAY+fluidName(eio['inputTank']['FluidName'])+" "+(WHITE+eio['inputTank']['Amount'])+GRAY+" / "+WHITE+cap+GRAY+" mB"} 20 | } 21 | 22 | 23 | function gteiootFluid(eio,cap){ 24 | if(nbt['outputTank']['FluidName']!=undefined) 25 | {return YELLOW+"Output Tank: "+GRAY+fluidName(eio['outputTank']['FluidName'])+" "+(WHITE+eio['outputTank']['Amount'])+GRAY+" / "+WHITE+cap+GRAY+" mB"} 26 | } 27 | 28 | 29 | 30 | gteioctFluid(nbt,5000) 31 | 32 | 33 | gteioftFluid(nbt,5000) 34 | 35 | 36 | 37 | 38 | gteioitFluid(nbt,8000) 39 | 40 | 41 | gteiootFluid(nbt,8000) 42 | 43 | 44 | 45 | 46 | return YELLOW+"XP Level: "+WHITE+nbt['experienceLevel'] 47 | 48 | 49 | return YELLOW+"XP Total: "+WHITE+nbt['experienceTotal'] 50 | 51 | 52 | 53 | 54 | return YELLOW+"XP Level: "+WHITE+nbt['experienceLevel'] 55 | 56 | 57 | return YELLOW+"XP Total: "+WHITE+nbt['experienceTotal'] 58 | 59 | 60 | 61 | 62 | return YELLOW+"Nutrient Distillation: "+WHITE+nbt['fuelTank']['Amount'] 63 | 64 | 65 | return YELLOW+"XP Level: "+WHITE+nbt['experienceLevel'] 66 | 67 | 68 | return YELLOW+"XP Total: "+WHITE+nbt['experienceTotal'] 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/ImmerisiveEngineering.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | if(nbt['tank']['Amount']!=undefined){ 8 | return nbt['tank']['Amount']+BLUE+" mB"} 9 | 10 | 11 | if(nbt['processMax']!=0){ 12 | return Math.floor(nbt['processMax'] /20 -(nbt['process']/ 20)) +"/"+nbt['processMax'] / 20 +BLUE+" s"} 13 | 14 | 15 | 16 | 17 | if(nbt['burnTime']!=0){ 18 | return parseInt(nbt['burnTime'] / 20)+"/"+nbt['lastBurnTime'] / 20+BLUE+" s"} 19 | 20 | 21 | if(nbt['processMax']!=0){ 22 | return Math.floor(nbt['processMax'] /20 -(nbt['process']/ 20)) +"/"+nbt['processMax'] / 20 +BLUE+" s"} 23 | 24 | 25 | 26 | 27 | if(nbt['burnTime']!=0 && nbt['burnTime']!=-2){ 28 | return Math.floor((nbt['burnTime'] / nbt['lastBurnTime']) * 100)+BLUE+"%"} 29 | 30 | 31 | if(nbt['processMax']!=0){ 32 | return Math.floor((1-(nbt['process'] / nbt['processMax'])) * 100)+BLUE+"%"} 33 | 34 | 35 | 36 | 37 | if(nbt['inputs']['0']['id']!=0){ 38 | return nbt['inputs']['0']['Count']+BLUE+"个 "+RED+name(nbt['inputs']['0'])} 39 | 40 | 41 | 42 | 43 | if(nbt['active']!=0) 44 | if(nbt['tank']['Amount']!=undefined){ 45 | return RED+translate("hud.msg.on")} 46 | 47 | 48 | if(nbt['active']==0) 49 | if(nbt['tank']['Amount']!=undefined){ 50 | return RED+translate("hud.msg.off")} 51 | 52 | 53 | if(nbt['tank']['Amount']!=undefined){ 54 | return nbt['tank']['Amount']+BLUE+"mB "+RED+nbt['tank']['FluidName']} 55 | 56 | 57 | 58 | 59 | if(nbt['active']==1){ 60 | return GREEN+translate("hud.msg.switch.on")} 61 | else{ 62 | return RED+translate("hud.msg.switch.off")} 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/factorization.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return name(nbt['item']) 8 | 9 | 10 | return nbt['count'] 11 | 12 | 13 | 14 | 15 | return (nbt['burnTime']/20).toFixed(0)+' '+ translate('hud.msg.vanilla.Seconds') 16 | 17 | 18 | 19 | 20 | return nbt['charge'] 21 | 22 | 23 | return nbt['steam']['Amount']+' mB' 24 | 25 | 26 | return nbt['fan'] 27 | 28 | 29 | 30 | 31 | if(nbt['digest']>0){return (nbt['digest']/20).toFixed(0)+' '+translate('hud.msg.vanilla.Seconds');}else{return "__ERROR__"} 32 | 33 | 34 | 35 | 36 | return nbt['water']['Amount']+' mB' 37 | 38 | 39 | return nbt['steam']['Amount']+' mB' 40 | 41 | 42 | 43 | 44 | return nbt['storage']+' CG' 45 | 46 | 47 | 48 | 49 | return nbt['store']+' CG' 50 | 51 | 52 | 53 | 54 | return nbt['charge'] 55 | 56 | 57 | 58 | 59 | return (nbt['progress']/60).toFixed(0)+" %" 60 | 61 | 62 | 63 | 64 | return (nbt['progress']/2.5).toFixed(0)+" %" 65 | 66 | 67 | 68 | 69 | return nbt['chargecharge'] 70 | 71 | 72 | return (nbt['spd']/2).toFixed(0)+' %' 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/util/NBTSerializer.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.util; 2 | 3 | import com.google.gson.*; 4 | import net.minecraft.nbt.*; 5 | 6 | import java.lang.reflect.Type; 7 | import java.util.Map; 8 | 9 | import static me.exz.omniocular.util.NBTHelper.NBTCache; 10 | import static me.exz.omniocular.util.NBTHelper.gson; 11 | 12 | class NBTSerializer implements JsonSerializer { 13 | @Override 14 | public JsonElement serialize(NBTBase src, Type typeOfSrc, JsonSerializationContext context) { 15 | switch (src.getId()) { 16 | case 0: 17 | return JsonNull.INSTANCE; 18 | case 1: 19 | return new JsonPrimitive(((NBTTagByte) src).func_150290_f()); 20 | case 2: 21 | return new JsonPrimitive(((NBTTagShort) src).func_150289_e()); 22 | case 3: 23 | return new JsonPrimitive(((NBTTagInt) src).func_150287_d()); 24 | case 4: 25 | return new JsonPrimitive(((NBTTagLong) src).func_150291_c()); 26 | case 5: 27 | return new JsonPrimitive(((NBTTagFloat) src).func_150288_h()); 28 | case 6: 29 | return new JsonPrimitive(((NBTTagDouble) src).func_150286_g()); 30 | case 7: 31 | JsonArray jsonArrayByte = new JsonArray(); 32 | for (byte b : ((NBTTagByteArray) src).func_150292_c()) { 33 | jsonArrayByte.add(new JsonPrimitive(b)); 34 | } 35 | return jsonArrayByte; 36 | case 8: 37 | return new JsonPrimitive(((NBTTagString) src).func_150285_a_()); 38 | case 9: 39 | JsonArray jsonArrayList = new JsonArray(); 40 | for (Object nbtListItem : ((NBTTagList) src).tagList) { 41 | jsonArrayList.add(gson.toJsonTree(nbtListItem)); 42 | } 43 | return jsonArrayList; 44 | case 10: 45 | JsonObject jsonObject = new JsonObject(); 46 | NBTTagCompound nbtTagCompound = (NBTTagCompound) src; 47 | int hashCode = nbtTagCompound.hashCode(); 48 | NBTCache.put(hashCode, nbtTagCompound); 49 | jsonObject.add("hashCode", new JsonPrimitive(hashCode)); 50 | //noinspection unchecked 51 | Map tagMap = nbtTagCompound.tagMap; 52 | for (Map.Entry entry : tagMap.entrySet()) { 53 | jsonObject.add(entry.getKey(), gson.toJsonTree(entry.getValue())); 54 | } 55 | return jsonObject; 56 | case 11: 57 | JsonArray jsonArrayInt = new JsonArray(); 58 | for (int i : ((NBTTagIntArray) src).func_150302_c()) { 59 | jsonArrayInt.add(new JsonPrimitive(i)); 60 | } 61 | return jsonArrayInt; 62 | default: 63 | return null; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/lang/zh_CN.lang: -------------------------------------------------------------------------------- 1 | omniocular.info.NotHolding=使用该指令必须手持一件物品. 2 | omniocular.info.NotPointing=使用该指令必须对准一个实体. 3 | 4 | hud.msg.common.LiquidAmount=流体存量 5 | hud.msg.common.StorageFluid=流体种类 6 | hud.msg.common.BurnTime=燃烧时间 7 | 8 | hud.msg.AWWayofTime.Capacity=Capacity 9 | hud.msg.AWWayofTime.Process=Process 10 | hud.msg.AWWayofTime.ProcessSpeed=Process Speed 11 | hud.msg.AWWayofTime.IOSpeed=IO Speed 12 | hud.msg.AWWayofTime.OrbCapacity=Orb Capacity 13 | hud.msg.AWWayofTime.Sacrifice=Sacrifice 14 | hud.msg.AWWayofTime.SelfSacrifice=Self-Sacrifice 15 | hud.msg.AWWayofTime.RitualID=Ritual ID 16 | hud.msg.AWWayofTime.RitualOwner=Ritual Owner 17 | hud.msg.AWWayofTime.Require=Require 18 | 19 | hud.msg.Botania.Mana=Mana 20 | hud.msg.Botania.output.0=Accepting Mana from Items 21 | hud.msg.Botania.output.1=Sparing Mana to Items 22 | 23 | hud.msg.BuildCraftCore.MaxEnergyReceive=最大可接收能源 24 | hud.msg.BuildCraftCore.Recipe=Recipe 25 | hud.msg.BuildCraftCore.Pattern=Pattern 26 | 27 | hud.msg.EnderIO.Experience=Experience 28 | 29 | hud.msg.factorization.Count=Count 30 | hud.msg.factorization.Fan=Fan 31 | hud.msg.factorization.Charge=Charge 32 | hud.msg.factorization.Digest=Digest 33 | hud.msg.factorization.Process=Process 34 | hud.msg.factorization.Speed=Speed 35 | 36 | hud.msg.GalacticraftCore.AirStored=Air Stored 37 | hud.msg.GalacticraftCore.GenerateRate=Generate Rate 38 | hud.msg.GalacticraftCore.CookTime=Cook Time 39 | hud.msg.GalacticraftCore.GasAmount=Gas Amount 40 | hud.msg.GalacticraftCore.LiquidAmount=Liquid Amount 41 | hud.msg.GalacticraftCore.TimeUntilLaunch=Time Until Launch 42 | 43 | hud.msg.vanilla.BurnTime=剩余燃烧时间 44 | hud.msg.vanilla.Seconds=Seconds 45 | 46 | hud.msg.witchery.Owner=主人 47 | 48 | hud.msg.Thaumcraft.Instability=注魔不稳定度 49 | hud.msg.Thaumcraft.VisAmount=源质总量 50 | hud.msg.Thaumcraft.BorePick=物品 51 | hud.msg.Thaumcraft.NodeType=节点类型 52 | hud.msg.Thaumcraft.GolemCore=傀儡核心 53 | 54 | hud.msg.RotaryCraft.Power=功率 55 | hud.msg.RotaryCraft.Torque=扭矩 56 | hud.msg.RotaryCraft.Speed=转速 57 | 58 | hud.msg.TConstruct.Layer=层数 59 | hud.msg.TConstruct.Capacity=容量 60 | 61 | hudmsg.IC2.LavaAmount=岩浆储量 62 | hudmsg.IC2.Charging=充能 63 | hudmsg.IC2.Discharging=电池 64 | 65 | hud.msg.logisticspipes.off=禁止 66 | hud.msg.logisticspipes.on=允许 67 | 68 | hud.msg.Mystcraft.position=生成于 69 | hud.msg.Mystcraft.flags=效果 70 | hud.msg.Mystcraft.author=拥有者 71 | 72 | hud.msg.ReactorCraft.chg=Charge 73 | 74 | hud.msg.progress=工作进程 75 | hud.msg.temperature=温度 76 | hud.msg.storedsteam=蒸汽存量 77 | hud.msg.storedcreosote=杂酚油量 78 | hud.msg.fuel=剩余燃料 79 | hud.msg.switch.on=闭合 80 | hud.msg.switch.off=断开 81 | hud.msg.state=运转情况 82 | hud.msg.state2=通断情况 83 | hud.msg.energy=能量 84 | hud.msg.currentTickTime=加工进度 85 | hud.msg.TR.energyOutput=输出电压 86 | 87 | hud.msg.immersiveengineering.state.on=运转 88 | hud.msg.immersiveengineering.state.off=停止 89 | 90 | hud.msg.greg.power=功率 91 | hud.msg.greg.power.unfix=功率(设备未修好) 92 | hud.msg.greg.requiredsteam=蒸汽需求 93 | hud.msg.greg.output=正在生产 94 | hud.msg.greg.output2=副产物 95 | hud.msg.greg.multifurnaceoutput=熔炼物(1-6) 96 | hud.msg.greg.multifurnaceoutput2=熔炼物(7-12) 97 | hud.msg.greg.multifurnaceoutput3=熔炼物(13-18) 98 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/handler/TileEntityHandler.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.handler; 2 | 3 | import mcp.mobius.waila.api.IWailaConfigHandler; 4 | import mcp.mobius.waila.api.IWailaDataAccessor; 5 | import mcp.mobius.waila.api.IWailaDataProvider; 6 | import mcp.mobius.waila.api.IWailaRegistrar; 7 | import me.exz.omniocular.util.ListHelper; 8 | import net.minecraft.block.Block; 9 | import net.minecraft.entity.player.EntityPlayerMP; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.nbt.NBTTagCompound; 12 | import net.minecraft.tileentity.TileEntity; 13 | import net.minecraft.world.World; 14 | 15 | import java.util.List; 16 | 17 | public class TileEntityHandler implements IWailaDataProvider { 18 | 19 | @SuppressWarnings("UnusedDeclaration") 20 | public static void callbackRegister(IWailaRegistrar registrar) { 21 | TileEntityHandler instance = new TileEntityHandler(); 22 | registrar.registerBodyProvider(instance, Block.class); 23 | registrar.registerNBTProvider(instance, Block.class); 24 | // for (Object o : TileEntity.nameToClassMap.entrySet()) { 25 | // Map.Entry entry = (Map.Entry) o; 26 | // String key = (String) entry.getKey(); 27 | // Boolean isBlackListed = false; 28 | // for (String blackItem : Reference.blackList) { 29 | // if (key.equals(blackItem)) { 30 | // isBlackListed = true; 31 | // break; 32 | // } 33 | // } 34 | // if (!isBlackListed) { 35 | // registrar.registerBodyProvider(instance, (Class) entry.getValue()); 36 | // registrar.registerNBTProvider(instance, (Class) entry.getValue()); 37 | // } 38 | // } 39 | } 40 | 41 | @Override 42 | public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { 43 | return null; 44 | } 45 | 46 | @Override 47 | public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { 48 | return currenttip; 49 | } 50 | 51 | //TODO workaround for drops / support drops 52 | @Override 53 | public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { 54 | NBTTagCompound n = accessor.getNBTData(); 55 | if (n != null) { 56 | List tips = JSHandler.getBody(ConfigHandler.tileEntityPattern, n, n.getString("id"), accessor.getPlayer()); 57 | for (String tip : tips) { 58 | ListHelper.AddToList(currenttip, tip); 59 | } 60 | } 61 | return currenttip; 62 | } 63 | 64 | @Override 65 | public List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { 66 | return currenttip; 67 | } 68 | 69 | @Override 70 | public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) { 71 | if (te != null) 72 | te.writeToNBT(tag); 73 | return tag; 74 | } 75 | } -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/ThermalExpansion.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | function gtteUT(n, cap){ 7 | if(nbt['Empty']==undefined){ 8 | return fluidName(n['FluidName'])+TAB+WHITE+n['Amount']+" / "+cap+" mB"} 9 | } 10 | 11 | 12 | function gtteS(n, cap){ 13 | if(nbt['FluidName']!=undefined){ 14 | return fluidName(n['FluidName'])+TAB+WHITE+n['Amount']+" / "+cap+" mB"} 15 | } 16 | 17 | 18 | function gtteWT(n, cap){ 19 | if(nbt['WaterTank']['Empty']==undefined){ 20 | return fluidName(n['WaterTank']['FluidName'])+TAB+WHITE+n['WaterTank']['Amount']+" / "+cap+" mB"} 21 | } 22 | 23 | 24 | function gtteST(n, cap){ 25 | if(nbt['SteamTank']['Empty']==undefined){ 26 | return fluidName(n['SteamTank']['FluidName'])+TAB+WHITE+n['SteamTank']['Amount']+" / "+cap+" mB"} 27 | } 28 | 29 | 30 | function gtteFT(n, cap){ 31 | if(nbt['FuelTank']['Empty']==undefined){ 32 | return fluidName(n['FuelTank']['FluidName'])+TAB+WHITE+n['FuelTank']['Amount']+" / "+cap+" mB"} 33 | } 34 | 35 | 36 | function gtteCT(n, cap){ 37 | if(nbt['CoolantTank']['Empty']==undefined){ 38 | return fluidName(n['CoolantTank']['FluidName'])+TAB+WHITE+n['CoolantTank']['Amount']+" / "+cap+" mB"} 39 | } 40 | 41 | 42 | 43 | if(nbt['LeftClick']==0){return"Right Click"}else{return"Left Click"} 44 | 45 | 46 | if(nbt['Sneaking']==0){return"Not Sneaking"}else{return"Sneaking"} 47 | 48 | 49 | 50 | 51 | gtteUT(nbt, 80000) 52 | 53 | 54 | 55 | 56 | gtteUT(nbt, 80000) 57 | 58 | 59 | 60 | 61 | gtteUT(nbt, 80000) 62 | 63 | 64 | 65 | 66 | gtteUT(nbt, 32000) 67 | 68 | 69 | 70 | 71 | gtteWT(nbt, 4000) 72 | 73 | 74 | gtteST(nbt, 4000) 75 | 76 | 77 | 78 | 79 | gtteUT(nbt, 4000) 80 | 81 | 82 | 83 | 84 | gtteFT(nbt, 4000) 85 | 86 | 87 | gtteCT(nbt, 4000) 88 | 89 | 90 | 91 | 92 | gtteUT(nbt, 4000) 93 | 94 | 95 | 96 | 97 | gtteS(nbt, 10000) 98 | 99 | 100 | 101 | 102 | gtteS(nbt, 8000) 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | omniocular.info.NotHolding=NotHolding 2 | omniocular.info.NotPointing=NotPointing 3 | 4 | hud.msg.common.LiquidAmount=Liquid Amount 5 | hud.msg.common.StorageFluid=Storage Fluid 6 | hud.msg.common.BurnTime=Burn Time 7 | 8 | hud.msg.AWWayofTime.Capacity=Capacity 9 | hud.msg.AWWayofTime.Process=Process 10 | hud.msg.AWWayofTime.ProcessSpeed=Process Speed 11 | hud.msg.AWWayofTime.IOSpeed=IO Speed 12 | hud.msg.AWWayofTime.OrbCapacity=Orb Capacity 13 | hud.msg.AWWayofTime.Sacrifice=Sacrifice 14 | hud.msg.AWWayofTime.SelfSacrifice=Self-Sacrifice 15 | hud.msg.AWWayofTime.RitualID=Ritual ID 16 | hud.msg.AWWayofTime.RitualOwner=Ritual Owner 17 | hud.msg.AWWayofTime.Require=Require 18 | 19 | hud.msg.Botania.Mana=Mana 20 | hud.msg.Botania.output.0=Accepting Mana from Items 21 | hud.msg.Botania.output.1=Sparing Mana to Items 22 | 23 | hud.msg.BuildCraftCore.MaxEnergyReceive=Max Energy Receive 24 | hud.msg.BuildCraftCore.Recipe=Recipe 25 | hud.msg.BuildCraftCore.Pattern=Pattern 26 | 27 | hud.msg.EnderIO.Experience=Experience 28 | 29 | hud.msg.factorization.Count=Count 30 | hud.msg.factorization.Fan=Fan 31 | hud.msg.factorization.Charge=Charge 32 | hud.msg.factorization.Digest=Digest 33 | hud.msg.factorization.Process=Process 34 | hud.msg.factorization.Speed=Speed 35 | 36 | hud.msg.GalacticraftCore.AirStored=Air Stored 37 | hud.msg.GalacticraftCore.GenerateRate=Generate Rate 38 | hud.msg.GalacticraftCore.CookTime=Cook Time 39 | hud.msg.GalacticraftCore.GasAmount=Gas Amount 40 | hud.msg.GalacticraftCore.LiquidAmount=Liquid Amount 41 | hud.msg.GalacticraftCore.TimeUntilLaunch=Time Until Launch 42 | 43 | hud.msg.vanilla.BurnTime=Burn Time Left 44 | hud.msg.vanilla.Seconds=Seconds 45 | 46 | hud.msg.witchery.Owner=Owner 47 | 48 | hud.msg.Thaumcraft.Instability=Instability 49 | hud.msg.Thaumcraft.VisAmount=Vis Amount 50 | hud.msg.Thaumcraft.BorePick=Item 51 | hud.msg.Thaumcraft.NodeType=Node Type 52 | hud.msg.Thaumcraft.GolemCore=Core 53 | 54 | hud.msg.RotaryCraft.Power=Power 55 | hud.msg.RotaryCraft.Torque=Torque 56 | hud.msg.RotaryCraft.Speed=Speed 57 | 58 | hud.msg.TConstruct.Layer=Layer 59 | hud.msg.TConstruct.Capacity=Capacity 60 | 61 | hudmsg.IC2.LavaAmount=Lava Amount 62 | hudmsg.IC2.Charging=Charging 63 | hudmsg.IC2.Discharging=Discharging 64 | 65 | hud.msg.logisticspipes.off=Not allowed 66 | hud.msg.logisticspipes.on=Allowed 67 | 68 | hud.msg.Mystcraft.position=Spawn at 69 | hud.msg.Mystcraft.flags=Effect 70 | hud.msg.Mystcraft.author=Author 71 | 72 | hud.msg.ReactorCraft.chg=Charge 73 | 74 | hud.msg.progress=Progress 75 | hud.msg.temperature=Temperature 76 | hud.msg.storedsteam=Stored Steam 77 | hud.msg.storedcreosote=Stored Creosote 78 | hud.msg.fuel=Fuel 79 | hud.msg.switch.on=ON 80 | hud.msg.switch.off=OFF 81 | hud.msg.state=State 82 | hud.msg.state2=State 83 | hud.msg.energy=Energy 84 | hud.msg.currentTickTime=Progress Time 85 | hud.msg.TR.energyOutput=Energy Output 86 | 87 | hud.msg.immersiveengineering.state.on=ON 88 | hud.msg.immersiveengineering.state.off=OFF 89 | 90 | hud.msg.greg.power=Power 91 | hud.msg.greg.power.unfix=Power(need repair) 92 | hud.msg.greg.requiredsteam=Required Steam 93 | hud.msg.greg.output=Output 94 | hud.msg.greg.output2=Output2 95 | hud.msg.greg.multifurnaceoutput=Smelting(1-6) 96 | hud.msg.greg.multifurnaceoutput2=Smelting(7-12) 97 | hud.msg.greg.multifurnaceoutput3=Smelting(13-18) 98 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/AdvancedMachines.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 8 | 9 | 10 | return nbt['speed']+GRAY+" / "+WHITE+"10000 RPM" 11 | 12 | 13 | 14 | 15 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 16 | 17 | 18 | return nbt['speed']*9+GRAY+" / "+WHITE+"90000 Gibbl" 19 | 20 | 21 | 22 | 23 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 24 | 25 | 26 | return nbt['speed']+GRAY+" / "+WHITE+"10000 RPM" 27 | 28 | 29 | 30 | 31 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 32 | 33 | 34 | return (nbt['speed']/100).toFixed(0)+GRAY+" / "+WHITE+"100 cm/s" 35 | 36 | 37 | 38 | 39 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 40 | 41 | 42 | return (nbt['speed']/100).toFixed(0)+" %" 43 | 44 | 45 | return WHITE+nbt['water']+GRAY+" / "+WHITE+"8000 mB" 46 | 47 | 48 | 49 | 50 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 51 | 52 | 53 | return nbt['speed']*9+GRAY+" / "+WHITE+"90000 Gibbl" 54 | 55 | 56 | 57 | 58 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 59 | 60 | 61 | return (nbt['speed']/100).toFixed(0)+" %" 62 | 63 | 64 | 65 | 66 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 67 | 68 | 69 | return nbt['speed']+GRAY+" / "+WHITE+"10000 Gibbl" 70 | 71 | 72 | 73 | 74 | return nbt['energy']+GRAY+" / "+WHITE+"10112 EU" 75 | 76 | 77 | return nbt['speed']+GRAY+" / "+WHITE+"10000 Gibbl" 78 | 79 | 80 | return WHITE+nbt['water']+GRAY+" / "+WHITE+"8000 mB" 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/asm/Transformer.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.asm; 2 | 3 | import net.minecraft.launchwrapper.IClassTransformer; 4 | import org.objectweb.asm.ClassReader; 5 | import org.objectweb.asm.ClassWriter; 6 | import org.objectweb.asm.Opcodes; 7 | import org.objectweb.asm.tree.*; 8 | 9 | public class Transformer implements IClassTransformer { 10 | @Override 11 | public byte[] transform(String name, String transformedName, byte[] bytes) { 12 | if (name.equals("mcp.mobius.waila.handlers.HUDHandlerFMP")) { 13 | ClassReader cr = new ClassReader(bytes); 14 | ClassNode cn = new ClassNode(); 15 | cr.accept(cn, 0); 16 | for (MethodNode mn : cn.methods) { 17 | if (mn.name.equals("getWailaBody")) { 18 | AbstractInsnNode n = mn.instructions.getFirst(); 19 | while (n != null) { 20 | if (n.getOpcode() == Opcodes.ASTORE && ((VarInsnNode) n).var == 8) { 21 | n = n.getNext(); 22 | break; 23 | } 24 | n = n.getNext(); 25 | } 26 | //TODO better fmp support 27 | if (n != null) { 28 | mn.instructions.insertBefore(n, new FieldInsnNode(Opcodes.GETSTATIC, "mcp/mobius/waila/api/impl/DataAccessorFMP", "instance", "Lmcp/mobius/waila/api/impl/DataAccessorFMP;")); 29 | mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD, 3)); 30 | mn.instructions.insertBefore(n, new MethodInsnNode(Opcodes.INVOKEINTERFACE, "mcp/mobius/waila/api/IWailaDataAccessor", "getWorld", "()Lnet/minecraft/world/World;", true)); 31 | mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD, 3)); 32 | mn.instructions.insertBefore(n, new MethodInsnNode(Opcodes.INVOKEINTERFACE, "mcp/mobius/waila/api/IWailaDataAccessor", "getPlayer", "()Lnet/minecraft/entity/player/EntityPlayer;", true)); 33 | mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD, 3)); 34 | mn.instructions.insertBefore(n, new MethodInsnNode(Opcodes.INVOKEINTERFACE, "mcp/mobius/waila/api/IWailaDataAccessor", "getPosition", "()Lnet/minecraft/util/MovingObjectPosition;", true)); 35 | mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD, 7)); 36 | mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD, 8)); 37 | mn.instructions.insertBefore(n, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "mcp/mobius/waila/api/impl/DataAccessorFMP", "set", "(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/util/MovingObjectPosition;Lnet/minecraft/nbt/NBTTagCompound;Ljava/lang/String;)V", false)); 38 | mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD, 2)); 39 | mn.instructions.insertBefore(n, new FieldInsnNode(Opcodes.GETSTATIC, "mcp/mobius/waila/api/impl/DataAccessorFMP", "instance", "Lmcp/mobius/waila/api/impl/DataAccessorFMP;")); 40 | mn.instructions.insertBefore(n, new MethodInsnNode(Opcodes.INVOKESTATIC, "me/exz/omniocular/handler/FMPHandler", "getWailaBody", "(Ljava/util/List;Lmcp/mobius/waila/api/IWailaFMPAccessor;)Ljava/util/List;", false)); 41 | mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ASTORE, 2)); 42 | } 43 | // mn.instructions.clear(); 44 | // mn.instructions.add(new InsnNode(Opcodes.ICONST_1)); 45 | // mn.instructions.add(new InsnNode(Opcodes.IRETURN)); 46 | // mn.maxStack=1; 47 | } 48 | } 49 | ClassWriter cw = new ClassWriter(0); 50 | cn.accept(cw); 51 | //LogHelper.info("inject into waila"); 52 | return cw.toByteArray(); 53 | } else { 54 | return bytes; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/GregTech6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | return nbt['gt.temperature']+BLUE+" K" 9 | 10 | 11 | return nbt['gt.materials']['size']+BLUE+" 种" 12 | 13 | 14 | return nbt['gt.materials']['0']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['0']['i'] 15 | 16 | 17 | return nbt['gt.materials']['1']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['1']['i'] 18 | 19 | 20 | return nbt['gt.materials']['2']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['2']['i'] 21 | 22 | 23 | return nbt['gt.materials']['3']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['3']['i'] 24 | 25 | 26 | return nbt['gt.materials']['4']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['4']['i'] 27 | 28 | 29 | return nbt['gt.materials']['5']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['5']['i'] 30 | 31 | 32 | return nbt['gt.materials']['6']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['6']['i'] 33 | 34 | 35 | return nbt['gt.materials']['7']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['7']['i'] 36 | 37 | 38 | return nbt['gt.materials']['8']['a'] / 420076800+BLUE+"份 "+RED+nbt['gt.materials']['8']['i'] 39 | 40 | 41 | 42 | 43 | 44 | 45 | return nbt['gt.temperature']+BLUE+" K" 46 | 47 | 48 | return nbt['gt.materials']['m'] 49 | 50 | 51 | 52 | 53 | 54 | 55 | return fluidName(nbt['gt.tank.0']['FluidName']) 56 | 57 | 58 | return nbt['gt.tank.0']['Amount']+BLUE+"/4000"+BLUE+" L" 59 | 60 | 61 | return nbt['gt.tank.1']['Amount']+BLUE+" L" 62 | 63 | 64 | 65 | 66 | 67 | 68 | if(nbt['gt.energy']!=undefined){ 69 | return nbt['gt.energy']+BLUE+" KU"} 70 | 71 | 72 | return nbt['gt.tank.0']['Amount']+BLUE+" L" 73 | 74 | 75 | 76 | 77 | 78 | 79 | if(nbt['gt.tank.0']['Amount']!=undefined){ 80 | return fluidName(nbt['gt.tank.0']['FluidName'])+": "+GREEN+nbt['gt.tank.0']['Amount']+BLUE+" L"} 81 | 82 | 83 | 84 | 85 | 86 | 87 | if(nbt['gt.energy']!=undefined){ 88 | return nbt['gt.energy']+BLUE+" HU"} 89 | 90 | 91 | if(nbt['gt.invlist']['0']['Damage']!=8200) 92 | if(nbt['gt.invlist']['0']['Damage']!=8201){ 93 | return nbt['gt.invlist']['0']['Count']+BLUE+"个 "+RED+name(nbt['gt.invlist']['0'])} 94 | 95 | 96 | switch(nbt['gt.invlist']['0']['Damage']) { 97 | case 8200:return nbt['gt.invlist']['0']['Count']+BLUE+"个 "+RED+name(nbt['gt.invlist']['0']); 98 | break; 99 | case 8201:return nbt['gt.invlist']['0']['Count']+BLUE+"个 "+RED+name(nbt['gt.invlist']['0']); 100 | break;} 101 | 102 | 103 | return nbt['gt.invlist']['1']['Count']+BLUE+"个 "+RED+name(nbt['gt.invlist']['1']) 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/GregTech5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | function gtFluid(f){ 6 | return fluidName(f['FluidName'])+TAB+ALIGNRIGHT+WHITE+f['Amount']+" mB" 7 | } 8 | 9 | 10 | function gtIgnore(item, unit){ 11 | if(!(item==undefined || item==0)){ 12 | return item+' '+unit 13 | } 14 | } 15 | 16 | 17 | 18 | gtFluid(nbt['mFluid']) 19 | 20 | 21 | if(nbt['mSteam']['Amount']!=undefined){return nbt['mSteam']['Amount']+" mB"} 22 | 23 | 24 | if(nbt['mStoredSteam']!=0){return nbt['mStoredSteam']+" mB"} 25 | 26 | 27 | if(nbt['mID']==100)return nbt['mTemperature']+" / 500" 28 | 29 | 30 | if(nbt['mID']==105)return nbt['mTemperature']+" / 500" 31 | 32 | 33 | if(nbt['mID']==101)return nbt['mTemperature']+" / 1000" 34 | 35 | 36 | if(nbt['mID']==102)return nbt['mTemperature']+" / 1000" 37 | 38 | 39 | if(nbt['mStoredEnergy']!=0){return nbt['mStoredEnergy']+" EU"} 40 | 41 | 42 | if(nbt['mID']==103){return (nbt['mProgresstime']/2-28).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 43 | 44 | 45 | if(nbt['mID']==106){return (nbt['mProgresstime']/8).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 46 | 47 | 48 | if(nbt['mID']==109){return (nbt['mProgresstime']/8).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 49 | 50 | 51 | if(nbt['mID']==112){return (nbt['mProgresstime']*3+4).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 52 | 53 | 54 | if(nbt['mID']==115){return (nbt['mProgresstime']/8).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 55 | 56 | 57 | if(nbt['mID']==118){return (nbt['mProgresstime']/2-30).toFixed(0)+"%"+" * "+nbt['Inventory'][2]['Count']} 58 | 59 | 60 | if(nbt['mID']==104){return (nbt['mProgresstime']-28).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 61 | 62 | 63 | if(nbt['mID']==107){return (nbt['mProgresstime']/4).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 64 | 65 | 66 | if(nbt['mID']==110){return (nbt['mProgresstime']/4).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 67 | 68 | 69 | if(nbt['mID']==113){return (nbt['mProgresstime']/4).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 70 | 71 | 72 | if(nbt['mID']==116){return (nbt['mProgresstime']/4).toFixed(0)+"%"+" * "+nbt['Inventory'][1]['Count']} 73 | 74 | 75 | if(nbt['mID']==119){return (nbt['mProgresstime']-30).toFixed(0)+"%"+" * "+nbt['Inventory'][2]['Count']} 76 | 77 | 78 | if(nbt['mStoredSteam']==0)if(nbt['mMaxProgresstime']==400)if(nbt['mProgresstime']>0){return (nbt['mProgresstime']/4).toFixed(0)+"%"} 79 | 80 | 81 | if(nbt['mStoredSteam']==0)if(nbt['mMaxProgresstime']==10)if(nbt['mProgresstime']>0){return (nbt['mProgresstime']*10).toFixed(0)+"%"} 82 | 83 | 84 | if(nbt['mStoredSteam']==0)if(nbt['mMaxProgresstime']==78)if(nbt['mProgresstime']>0){return (nbt['mProgresstime']+22).toFixed(0)+"%"} 85 | 86 | 87 | if(nbt['mNeedsSteamVenting']==0)if(nbt['mActive']==0)if(nbt['mID']!=118)if(nbt['mID']!=119)if(nbt['Inventory'][0]['IntSlot']==5){return nbt['Inventory'][0]['Count']} 88 | 89 | 90 | if(nbt['mNeedsSteamVenting']==0)if(nbt['mActive']==0)if(nbt['mID']=118)if(nbt['mID']=119)if(nbt['Inventory'][0]['IntSlot']==4) {return nbt['Inventory'][1]['Count']} 91 | 92 | 93 | gtFluid(nbt['mFluidOut']) 94 | 95 | 96 | 97 | 98 | gtFluid(nbt['mFluid']) 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Thaumcraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | function up(word){ 7 | return word.substring(0,1).toUpperCase()+word.substring(1) 8 | } 9 | 10 | 11 | function getSlot(i, slot, slotName){ 12 | slotName=slotName||"Slot"; 13 | for (var index in i){ 14 | if (i[index][slotName]==slot){ 15 | return i[index]; 16 | } 17 | } 18 | } 19 | 20 | 21 | 22 | var Wand = getSlot(nbt['Inventory'], 10, 'Slot'); 23 | return name(Wand) 24 | 25 | 26 | var WandFocus = getSlot(nbt['Inventory'], 10, 'Slot'); 27 | return name(WandFocus['tag']['focus']) 28 | 29 | 30 | var TagVis = getSlot(nbt['Inventory'], 10, 'Slot'); 31 | return 32 | YELLOW+(TagVis['tag']['aer'] / 100).toFixed(1)+WHITE+" | "+ 33 | DGREEN+(TagVis['tag']['terra'] / 100).toFixed(1)+WHITE+" | "+ 34 | RED+(TagVis['tag']['ignis'] / 100).toFixed(1)+WHITE+" | "+ 35 | DAQUA+(TagVis['tag']['aqua'] / 100).toFixed(1)+WHITE+" | "+ 36 | GRAY+(TagVis['tag']['ordo'] / 100).toFixed(1)+WHITE+" | "+ 37 | DGRAY+(TagVis['tag']['perditio'] / 100).toFixed(1) 38 | 39 | 40 | 41 | 42 | if(nbt['crafting']!=0) 43 | return nbt['instability'].toFixed(0) 44 | 45 | 46 | 47 | 48 | return nbt['Vis']+GRAY+" / "+WHITE+"50" 49 | 50 | 51 | 52 | 53 | return WHITE+nbt['Amount']+GRAY+" / "+WHITE+"1000 mB" 54 | 55 | 56 | 57 | 58 | if(nbt['Inventory'][0]['Slot']!=0){ 59 | return translate('hud.msg.Thaumcraft.BorePick')+": "+name(nbt['Inventory'][0])} 60 | else{ 61 | return translate('hud.msg.Thaumcraft.BorePick')+": "+name(nbt['Inventory'][1])} 62 | 63 | 64 | 65 | 66 | return nbt['Items']['0']['Count'] 67 | 68 | 69 | if(nbt['FluidName']!=undefined) 70 | return WHITE+nbt['Amount']+GRAY+" / "+WHITE+"5000 mB" 71 | 72 | 73 | 74 | 75 | name(nbt['ItemsSynced'][0]) 76 | 77 | 78 | 79 | 80 | if(nbt['status']!=0) 81 | return GREEN+"Activated" 82 | 83 | 84 | 85 | 86 | if(nbt['power']!=0) 87 | return GREEN+"Activated" 88 | 89 | 90 | 91 | 92 | var result=""; 93 | switch(nbt['type']){ 94 | case 0:result= translate('nodetype.NORMAL.name'); 95 | break; 96 | case 1:result= translate('nodetype.UNSTABLE.name'); 97 | break; 98 | case 2:result= translate('nodetype.DARK.name'); 99 | break; 100 | case 3:result= translate('nodetype.TAINTED.name'); 101 | break; 102 | case 4:result= translate('nodetype.HUNGRY.name'); 103 | break; 104 | case 5:result= translate('nodetype.PURE.name'); 105 | break;} 106 | result+=""; 107 | switch(nbt['modifier']){ 108 | case 0:result+=", "+translate('nodemod.BRIGHT.name'); 109 | break; 110 | case 1:result+=", "+translate('nodemod.PALE.name'); 111 | break; 112 | case 2:result+=", "+translate('nodemod.FADING.name'); 113 | break;} 114 | return result; 115 | 116 | 117 | 118 | 119 | switch(nbt['Core']){ 120 | case 0:return translate('item.ItemGolemCore.0.name'); 121 | break; 122 | case 1:return translate('item.ItemGolemCore.1.name'); 123 | break; 124 | case 2:return translate('item.ItemGolemCore.2.name'); 125 | break; 126 | case 3:return translate('item.ItemGolemCore.3.name'); 127 | break; 128 | case 4:return translate('item.ItemGolemCore.4.name'); 129 | break; 130 | case 5:return translate('item.ItemGolemCore.5.name'); 131 | break; 132 | case 6:return translate('item.ItemGolemCore.6.name'); 133 | break; 134 | case 7:return translate('item.ItemGolemCore.7.name'); 135 | break; 136 | case 8:return translate('item.ItemGolemCore.8.name'); 137 | break; 138 | case 9:return translate('item.ItemGolemCore.9.name'); 139 | break; 140 | case 10:return translate('item.ItemGolemCore.10.name'); 141 | break; 142 | case 11:return translate('item.ItemGolemCore.11.name'); 143 | break; 144 | case 100:return translate('item.ItemGolemCore.100.name'); 145 | break;} 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Railcraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | return nbt['owner'] 5 | 6 | 7 | return nbt['cookTime'] 8 | 9 | 10 | 11 | 12 | return nbt['burnTime'] 13 | 14 | 15 | return nbt['cookTime'] 16 | 17 | 18 | return nbt['currentItemBurnTime'] 19 | 20 | 21 | return nbt['owner'] 22 | 23 | 24 | 25 | 26 | return nbt['cookTime'] 27 | 28 | 29 | return nbt['owner'] 30 | 31 | 32 | 33 | 34 | return nbt['powerProvider']['energyStored'] 35 | 36 | 37 | return nbt['owner'] 38 | 39 | 40 | 41 | 42 | return nbt['powerProvider']['energyStored'] 43 | 44 | 45 | return nbt['owner'] 46 | 47 | 48 | 49 | 50 | return nbt['fuel'] 51 | 52 | 53 | return nbt['owner'] 54 | 55 | 56 | 57 | 58 | return nbt['fuel'] 59 | 60 | 61 | return nbt['owner'] 62 | 63 | 64 | 65 | 66 | return nbt['energy'] 67 | 68 | 69 | return nbt['owner'] 70 | 71 | 72 | return nbt['output'] 73 | 74 | 75 | 76 | 77 | return nbt['energy'] 78 | 79 | 80 | return nbt['owner'] 81 | 82 | 83 | return nbt['currentoutput'] 84 | 85 | 86 | return nbt['heat'] 87 | 88 | 89 | return nbt['burnTime'] 90 | 91 | 92 | 93 | 94 | return nbt['energy'] 95 | 96 | 97 | return nbt['owner'] 98 | 99 | 100 | return nbt['currentoutput'] 101 | 102 | 103 | 104 | 105 | return nbt['energy'] 106 | 107 | 108 | return nbt['owner'] 109 | 110 | 111 | return nbt['currentoutput'] 112 | 113 | 114 | 115 | 116 | return nbt['owner'] 117 | 118 | 119 | return nbt['currentItemBurnTime'] 120 | 121 | 122 | return nbt['heat'] 123 | 124 | 125 | return nbt['burnTime'] 126 | 127 | 128 | 129 | 130 | return nbt['owner'] 131 | 132 | 133 | return nbt['currentItemBurnTime'] 134 | 135 | 136 | return nbt['heat'] 137 | 138 | 139 | return nbt['burnTime'] 140 | 141 | 142 | 143 | 144 | return nbt['energy'] 145 | 146 | 147 | return nbt['owner'] 148 | 149 | 150 | 151 | 152 | return nbt['energy'] 153 | 154 | 155 | return nbt['owner'] 156 | 157 | 158 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/EMT.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return nbt['IC2BasicSource']['energy'] 8 | 9 | 10 | 11 | 12 | return nbt['IC2BasicSource']['energy'] 13 | 14 | 15 | 16 | 17 | return nbt['IC2BasicSource']['energy'] 18 | 19 | 20 | 21 | 22 | return nbt['IC2BasicSource']['energy'] 23 | 24 | 25 | 26 | 27 | return nbt['IC2BasicSource']['energy'] 28 | 29 | 30 | 31 | 32 | return nbt['CookTime'] 33 | 34 | 35 | 36 | 37 | return nbt['IC2BasicSource']['energy'] 38 | 39 | 40 | 41 | 42 | return nbt['IC2BasicSource']['energy'] 43 | 44 | 45 | 46 | 47 | return nbt['IC2BasicSource']['energy'] 48 | 49 | 50 | 51 | 52 | return nbt['IC2BasicSource']['energy'] 53 | 54 | 55 | 56 | 57 | return nbt['IC2BasicSource']['energy'] 58 | 59 | 60 | 61 | 62 | return nbt['IC2BasicSource']['energy'] 63 | 64 | 65 | 66 | 67 | return nbt['IC2BasicSource']['energy'] 68 | 69 | 70 | 71 | 72 | return nbt['IC2BasicSource']['energy'] 73 | 74 | 75 | 76 | 77 | return nbt['IC2BasicSource']['energy'] 78 | 79 | 80 | 81 | 82 | return nbt['IC2BasicSource']['energy'] 83 | 84 | 85 | 86 | 87 | return nbt['IC2BasicSource']['energy'] 88 | 89 | 90 | 91 | 92 | return nbt['IC2BasicSource']['energy'] 93 | 94 | 95 | 96 | 97 | return nbt['IC2BasicSource']['energy'] 98 | 99 | 100 | 101 | 102 | return nbt['IC2BasicSource']['energy'] 103 | 104 | 105 | 106 | 107 | return nbt['IC2BasicSource']['energy'] 108 | 109 | 110 | 111 | 112 | return nbt['IC2BasicSource']['energy'] 113 | 114 | 115 | 116 | 117 | return nbt['IC2BasicSource']['energy'] 118 | 119 | 120 | 121 | 122 | return nbt['IC2BasicSource']['energy'] 123 | 124 | 125 | 126 | 127 | return nbt['IC2BasicSource']['energy'] 128 | 129 | 130 | 131 | 132 | return nbt['IC2BasicSource']['energy'] 133 | 134 | 135 | 136 | 137 | return nbt['IC2BasicSource']['energy'] 138 | 139 | 140 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Forestry.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return nbt['tanks'][0]['Amount']+" mB" 8 | 9 | 10 | 11 | 12 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 13 | 14 | 15 | return nbt['IC2BasicSink']['energy']+" EU" 16 | 17 | 18 | return nbt['EngineHeat']/10+20 19 | 20 | 21 | 22 | 23 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 24 | 25 | 26 | return (nbt['EngineBurnTime']/20).toFixed(0)+" / "+(nbt['EngineTotalTime']/20).toFixed(0)+" Seconds" 27 | 28 | 29 | return nbt['EngineHeat']/10+20 30 | 31 | 32 | 33 | 34 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 35 | 36 | 37 | return nbt['EngineHeat']/10+20 38 | 39 | 40 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 41 | 42 | 43 | return nbt['tanks'][1]['FluidName']+"("+nbt['tanks'][1]['Amount']+" mB)" 44 | 45 | 46 | 47 | 48 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 49 | 50 | 51 | return nbt['EngineHeat']/10+20 52 | 53 | 54 | 55 | 56 | return nbt['IC2BasicSource']['energy']+" EU" 57 | 58 | 59 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 60 | 61 | 62 | return nbt['tanks'][1]['FluidName']+"("+nbt['tanks'][1]['Amount']+" mB)" 63 | 64 | 65 | 66 | 67 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 68 | 69 | 70 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 71 | 72 | 73 | 74 | 75 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 76 | 77 | 78 | 79 | 80 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 81 | 82 | 83 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 84 | 85 | 86 | 87 | 88 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 89 | 90 | 91 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 92 | 93 | 94 | return nbt['tanks'][1]['FluidName']+"("+nbt['tanks'][1]['Amount']+" mB)" 95 | 96 | 97 | 98 | 99 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 100 | 101 | 102 | 103 | 104 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 105 | 106 | 107 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 108 | 109 | 110 | 111 | 112 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 113 | 114 | 115 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 116 | 117 | 118 | return nbt['tanks'][1]['FluidName']+"("+nbt['tanks'][1]['Amount']+" mB)" 119 | 120 | 121 | 122 | 123 | return nbt['tanks'][0]['FluidName']+"("+nbt['tanks'][0]['Amount']+" mB)" 124 | 125 | 126 | 127 | 128 | return nbt['EnergyManager']['EnergyStorage']['Energy']+" RF" 129 | 130 | 131 | return nbt['tanks'][0]['Amount']+" / 2000 mB" 132 | 133 | 134 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/BuildCraftCore.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | function getLiquid(t){ 7 | if (t['FluidName']!=undefined || t['Amount']!=undefined ){ 8 | return t['FluidName']+"("+t['Amount']+" mB)" 9 | } 10 | } 11 | 12 | 13 | 14 | return nbt['heat'] 15 | 16 | 17 | return nbt['energy'] 18 | 19 | 20 | 21 | 22 | return nbt['battery']['energy']+" / "+nbt['battery']['maxEnergy']+" RF" 23 | 24 | 25 | return nbt['battery']['maxReceive']+" RF" 26 | 27 | 28 | 29 | 30 | return nbt['energy']+" RF" 31 | 32 | 33 | return nbt['recipeId'] 34 | 35 | 36 | 37 | 38 | return nbt['battery']['energy']+" / "+nbt['battery']['maxEnergy']+" RF" 39 | 40 | 41 | return nbt['battery']['maxReceive']+" RF" 42 | 43 | 44 | return nbt['tank']['Amount'] 45 | 46 | 47 | var fluidName=nbt['tank']['FluidName']; 48 | return fluidName.charAt(0).toUpperCase()+fluidName.substring(1) 49 | 50 | 51 | var fluidName=nbt['tank']['acceptedFluid']; 52 | return fluidName.charAt(0).toUpperCase()+fluidName.substring(1) 53 | 54 | 55 | 56 | 57 | return nbt['energy'] +" / 5000 RF" 58 | 59 | 60 | 61 | 62 | return nbt['energy']+" RF" 63 | 64 | 65 | 66 | 67 | return nbt['heat'] 68 | 69 | 70 | return nbt['energy']+" RF" 71 | 72 | 73 | 74 | 75 | return nbt['heat'].toFixed(2) 76 | 77 | 78 | return nbt['energy']+" RF" 79 | 80 | 81 | return (nbt['burnTime']/20).toFixed(0)+' / '+(nbt['totalBurnTime']/20).toFixed(0) 82 | 83 | 84 | 85 | 86 | return nbt['heat'].toFixed(2) 87 | e 88 | 89 | return nbt['energy']+" RF" 90 | 91 | 92 | return getLiquid(nbt['tankCoolant']) 93 | 94 | 95 | return getLiquid(nbt['tankFuel']) 96 | 97 | 98 | 99 | 100 | return nbt['powered'] 101 | 102 | 103 | return getLiquid(nbt['tank']) 104 | 105 | 106 | 107 | 108 | return nbt['battery']['energy']+" / "+nbt['battery']['maxEnergy']+" RF" 109 | 110 | 111 | return nbt['battery']['maxReceive']+" RF" 112 | 113 | 114 | return nbt['pattern'] 115 | 116 | 117 | 118 | 119 | return nbt['battery']['energy']+" / "+nbt['battery']['maxEnergy']+" RF" 120 | 121 | 122 | return nbt['battery']['maxReceive']+" RF" 123 | 124 | 125 | 126 | 127 | return nbt['battery']['energy']+" / "+nbt['battery']['maxEnergy']+" RF" 128 | 129 | 130 | return nbt['battery']['maxReceive']+" RF" 131 | 132 | 133 | 134 | 135 | return nbt['battery']['energy']+" / "+nbt['battery']['maxEnergy']+" RF" 136 | 137 | 138 | return nbt['battery']['maxReceive']+" RF" 139 | 140 | 141 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/GalacticraftCore.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | return nbt['EnergyF']+"gJ" 8 | 9 | 10 | return nbt['storedOxygenF'] 11 | 12 | 13 | 14 | 15 | return nbt['EnergyF']+"gJ" 16 | 17 | 18 | return nbt['storedOxygenF'] 19 | 20 | 21 | 22 | 23 | return nbt['EnergyF']+"gJ" 24 | 25 | 26 | return nbt['storedOxygenF'] 27 | 28 | 29 | 30 | 31 | return nbt['EnergyF']+"gJ" 32 | 33 | 34 | return nbt['storedOxygenF'] 35 | 36 | 37 | 38 | 39 | return nbt['EnergyF']+"gJ" 40 | 41 | 42 | return nbt['storedOxygenF'] 43 | 44 | 45 | 46 | 47 | return nbt['EnergyF']+"gJ" 48 | 49 | 50 | return nbt['oilTank']['Amount'] 51 | 52 | 53 | return nbt['fuelTank']['Amount'] 54 | 55 | 56 | 57 | 58 | return nbt['EnergyF']+"gJ" 59 | 60 | 61 | return nbt['fuelTank']['Amount'] 62 | 63 | 64 | 65 | 66 | return nbt['EnergyF']+"gJ" 67 | 68 | 69 | 70 | 71 | return nbt['EnergyF']+"gJ" 72 | 73 | 74 | 75 | 76 | return nbt['EnergyF']+"gJ" 77 | 78 | 79 | return nbt['generateRate'] 80 | 81 | 82 | return nbt['itemCookTime'] 83 | 84 | 85 | 86 | 87 | return nbt['EnergyF']+"gJ" 88 | 89 | 90 | 91 | 92 | return nbt['EnergyF']+"gJ" 93 | 94 | 95 | 96 | 97 | return nbt['EnergyF']+"gJ" 98 | 99 | 100 | 101 | 102 | return nbt['EnergyF']+"gJ" 103 | 104 | 105 | 106 | 107 | return nbt['EnergyF']+"gJ" 108 | 109 | 110 | 111 | 112 | return nbt['EnergyF']+"gJ" 113 | 114 | 115 | return nbt['TargetFrequency'] 116 | 117 | 118 | return nbt['gasTank']['Amount'] 119 | 120 | 121 | return nbt['liquidTank']['Amount'] 122 | 123 | 124 | 125 | 126 | return nbt['EnergyF']+"gJ" 127 | 128 | 129 | return nbt['TargetFrequency'] 130 | 131 | 132 | return nbt['gasTank']['Amount'] 133 | 134 | 135 | return nbt['liquidTank']['Amount'] 136 | 137 | 138 | 139 | 140 | return nbt['timeUntilLaunch'] 141 | 142 | 143 | return nbt['fuelTank']['Amount'] 144 | 145 | 146 | 147 | 148 | return nbt['timeUntilLaunch'] 149 | 150 | 151 | return nbt['fuelTank']['Amount'] 152 | 153 | 154 | 155 | 156 | return nbt['timeUntilLaunch'] 157 | 158 | 159 | return nbt['fuelTank']['Amount'] 160 | 161 | 162 | 163 | 164 | return nbt['fuel'] 165 | 166 | 167 | return nbt['fuelTank']['Amount'] 168 | 169 | 170 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/GregTech5U.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | if(nbt['mFluid']['Amount']!=undefined){return GREEN+nbt['mFluid']['FluidName']+" : "+WHITE+nbt['mFluid']['Amount']+" mB"} 9 | 10 | 11 | if(nbt['mSteam']['Amount']!=undefined){return nbt['mSteam']['Amount']+" mB"} 12 | 13 | 14 | if(nbt['mStoredSteam']!=0){return nbt['mStoredSteam']+" mB"} 15 | 16 | 17 | if(nbt['mID']==100)return nbt['mTemperature']+" / 500" 18 | 19 | 20 | if(nbt['mID']==105)return nbt['mTemperature']+" / 500" 21 | 22 | 23 | if(nbt['mID']==101)return nbt['mTemperature']+" / 1000" 24 | 25 | 26 | if(nbt['mID']==102)return nbt['mTemperature']+" / 1000" 27 | 28 | 29 | if(nbt['mEUt']!=0) 30 | if(nbt['mEUt']!=undefined) 31 | if(nbt['mStoredSteam']==0) 32 | if(nbt['mSolderingTool']!=0){ 33 | return YELLOW+Math.abs(nbt['mEUt'])+WHITE+" EU/t"} 34 | 35 | 36 | if(nbt['mEUt']!=0) 37 | if(nbt['mEUt']!=undefined) 38 | if(nbt['mSolderingTool']==0){ 39 | return YELLOW+Math.abs(nbt['mEUt'])*1.1+WHITE+" EU/t"} 40 | 41 | 42 | if(nbt['mEUt']!=0) 43 | if(nbt['mEUt']!=undefined) 44 | if(nbt['mStoredSteam']!=0){ 45 | return YELLOW+Math.abs(nbt['mEUt']) * 2+WHITE+" mB/t"} 46 | 47 | 48 | if(nbt['mMaxProgresstime']!=0) 49 | if(nbt['mMaxProgresstime']!=undefined){ 50 | return YELLOW+(nbt['mProgresstime'] / 20).toFixed(0)+WHITE+"/"+nbt['mMaxProgresstime'] / 20+" s"} 51 | 52 | 53 | if(nbt['mActive']==1 &&nbt['mID']!=1003&&nbt['mID']!=108){ 54 | return YELLOW+nbt['mOutputItem0']['Count']+"个"+GREEN+name(nbt['mOutputItem0'])} 55 | if(nbt['mActive']==1 &&nbt['mID']==108){ 56 | return YELLOW+nbt['mOutputItem1']['Count']+"个"+GREEN+name(nbt['mOutputItem1'])} 57 | 58 | 59 | if(nbt['mActive']==1 &&nbt['mID']!=1003&&nbt['mID']!=108){ 60 | return YELLOW+nbt['mOutputItem1']['Count']+"个"+GREEN+name(nbt['mOutputItem1'])} 61 | if(nbt['mActive']==1 &&nbt['mID']==108){ 62 | return YELLOW+nbt['mOutputItem2']['Count']+"个"+GREEN+name(nbt['mOutputItem2'])} 63 | 64 | 65 | if(nbt['mActive']==1 &&nbt['mID']==1003){ 66 | return GREEN+name(nbt['mOutputItem0'])+WHITE+"/"+GREEN+name(nbt['mOutputItem1'])+WHITE+"/"+GREEN+name(nbt['mOutputItem2']) 67 | +WHITE+"/"+GREEN+name(nbt['mOutputItem3'])+WHITE+"/"+GREEN+name(nbt['mOutputItem4'])+WHITE+"/"+GREEN+name(nbt['mOutputItem5'])} 68 | 69 | 70 | if(nbt['mActive']==1 &&nbt['mID']==1003){ 71 | return GREEN+name(nbt['mOutputItem6'])+WHITE+"/"+GREEN+name(nbt['mOutputItem7'])+WHITE+"/"+GREEN+name(nbt['mOutputItem8']) 72 | +WHITE+"/"+GREEN+name(nbt['mOutputItem9'])+WHITE+"/"+GREEN+name(nbt['mOutputItem10'])+WHITE+"/"+GREEN+name(nbt['mOutputItem11'])} 73 | 74 | 75 | if(nbt['mActive']==1 &&nbt['mID']==1003){ 76 | return GREEN+name(nbt['mOutputItem12'])+WHITE+"/"+GREEN+name(nbt['mOutputItem13'])+WHITE+"/"+GREEN+name(nbt['mOutputItem14']) 77 | +WHITE+"/"+GREEN+name(nbt['mOutputItem15'])+WHITE+"/"+GREEN+name(nbt['mOutputItem16'])+WHITE+"/"+GREEN+name(nbt['mOutputItem17'])} 78 | 79 | 80 | for(i=0;i<=8;i++){ 81 | if(nbt['mID']==40+i||nbt['mID']==150+i||nbt['mID']==690+i){return GREEN+8*Math.pow(4,i)+GRAY+" EU/t"} 82 | } 83 | if(nbt['mID']==49||nbt['mID']==159||nbt['mID']==699){ 84 | return GREEN+"2147483647(MAX)"+GRAY+" EU/t" 85 | } 86 | for(i=0;i<=7;i++){ 87 | if(nbt['mID']==20+i){ 88 | if(nbt['mActive']==1){return GREEN+8*Math.pow(4,i+1)+GRAY+" EU/t"} 89 | return GREEN+8*Math.pow(4,i)+GRAY+" EU/t" 90 | } 91 | } 92 | if(nbt['mID']==28){ 93 | if(nbt['mActive']==1){return GREEN+"2147483647"+GRAY+" EU/t"} 94 | return GREEN+"524288"+GRAY+" EU/t" 95 | } 96 | 97 | 98 | for(i=0;i<=8;i++){ 99 | if(nbt['mID']==160+i||nbt['mID']==170+i||nbt['mID']==180+i||nbt['mID']==190+i||nbt['mID']==30+i||nbt['mID']==690+i){return GREEN+8*Math.pow(4,i)+GRAY+" EU/t"} 100 | } 101 | if(nbt['mID']==169||nbt['mID']==179||nbt['mID']==189||nbt['mID']==199||nbt['mID']==39||nbt['mID']==699){ 102 | return GREEN+"2147483647(MAX)"+GRAY+" EU/t" 103 | } 104 | for(i=0;i<=7;i++){ 105 | if(nbt['mID']==20+i){ 106 | if(nbt['mActive']==0){return GREEN+8*Math.pow(4,i+1)+GRAY+" EU/t"} 107 | return GREEN+8*Math.pow(4,i)+GRAY+" EU/t" 108 | } 109 | } 110 | if(nbt['mID']==28){ 111 | if(nbt['mActive']==0){return GREEN+"2147483647"+GRAY+" EU/t"} 112 | return GREEN+"524288"+GRAY+" EU/t" 113 | } 114 | 115 | 116 | a=0; 117 | b=0; 118 | for(i=0;i<=15;i++){ 119 | if(nbt['Inventory'][i]!=undefined){ 120 | b=b+1; 121 | if(nbt['Inventory'][i]['tag']!=undefined){ 122 | if(nbt['Inventory'][i]['tag']['GT.ItemCharge']!=undefined){ 123 | a=a+nbt['Inventory'][i]['tag']['GT.ItemCharge']; 124 | } 125 | } 126 | } 127 | } 128 | if(nbt['mStoredEnergy']!=0){return nbt['mStoredEnergy']+a+GRAY+" EU"} 129 | 130 | 131 | for (i=0;i<=39;i++){ 132 | if(nbt['mID']==160+i){return GREEN+b+GRAY+" A"} 133 | } 134 | for (i=0;i<=9;i++){ 135 | if(nbt['mID']==690+i){return GREEN+b+GRAY+" A"} 136 | } 137 | 138 | 139 | 140 | 141 | if(nbt['mFluid']['Amount']!=undefined){ 142 | return GREEN+nbt['mFluid']['FluidName']+" : "+YELLOW+nbt['mFluid']['Amount']+WHITE+" mb"} 143 | 144 | 145 | for (i=0;i<=90;i++){ 146 | if(nbt['mID']==1200+i){return GREEN+"32"+GRAY+" EU/t"} 147 | } 148 | for (i=0;i<=90;i++){ 149 | if(nbt['mID']==1300+i){return GREEN+"128"+GRAY+" EU/t"} 150 | } 151 | for (i=0;i<=90;i++){ 152 | if(nbt['mID']==1400+i){return GREEN+"512"+GRAY+" EU/t"} 153 | } 154 | for (i=0;i<=90;i++){ 155 | if(nbt['mID']==1500+i){return GREEN+"2048"+GRAY+" EU/t"} 156 | } 157 | for (i=0;i<=50;i++){ 158 | if(nbt['mID']==1600+i){return GREEN+"8192"+GRAY+" EU/t"} 159 | } 160 | for (i=0;i<=90;i++){ 161 | if(nbt['mID']==1700+i){return GREEN+"32768"+GRAY+" EU/t"} 162 | } 163 | for (i=0;i<=10;i++){ 164 | if(nbt['mID']==2000+i){return GREEN+"8"+GRAY+" EU/t"} 165 | } 166 | for (i=0;i<=5;i++){ 167 | if(nbt['mID']==2020+i){return GREEN+"2147483647"+GRAY+" EU/t"} 168 | } 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/LogisticsPipes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | function getSlot(i, slot, slotName){ 7 | slotName=slotName||"Slot"; 8 | for (var index in i){ 9 | if (i[index][slotName]==slot){ 10 | return i[index]; 11 | } 12 | } 13 | } 14 | 15 | 16 | 17 | var Iron = getSlot(nbt['items'], 9, 'index'); 18 | return Iron['Count'] 19 | 20 | 21 | var NanoHopper = getSlot(nbt['items'], 10, 'index'); 22 | return name(NanoHopper) 23 | 24 | 25 | 26 | 27 | return nbt['powerLevel']+' / 2000000 LP' 28 | 29 | 30 | 31 | 32 | if(nbt['allowAutoDestroy'] == 0){return translate("hud.msg.logisticspipes.off")} 33 | else{return translate("hud.msg.logisticspipes.on")} 34 | 35 | 36 | 37 | 38 | return nbt['internalStorage']+' / 10000000 RF' 39 | 40 | 41 | 42 | 43 | return nbt['internalStorage']+' / 40000000 EU' 44 | 45 | 46 | 47 | 48 | var disk = getSlot(nbt['diskInvitems'], 1, 'Count'); 49 | if(disk['Count'] == 1){return translate("gui.fluidsupplier.Yes")} 50 | 51 | 52 | switch(nbt['extractionMode']) 53 | { 54 | case 0: 55 | return translate("misc.extractionmode.Normal"); 56 | break; 57 | case 1: 58 | return translate("misc.extractionmode.LeaveFirst"); 59 | break; 60 | case 2: 61 | return translate("misc.extractionmode.LeaveLast"); 62 | break; 63 | case 3: 64 | return translate("misc.extractionmode.LeaveFirstAndLast"); 65 | break; 66 | case 4: 67 | return translate("misc.extractionmode.Leave1PerStack"); 68 | break; 69 | case 5: 70 | return translate("misc.extractionmode.Leave1PerType"); 71 | break; 72 | } 73 | 74 | 75 | switch(nbt['requestmode']) 76 | { 77 | case 2: 78 | return "Bulk50"; 79 | break; 80 | case 3: 81 | return "Bulk100"; 82 | break; 83 | case 4: 84 | return "Infinite"; 85 | break; 86 | case 0: 87 | return "Partial"; 88 | break; 89 | case 1: 90 | return "Full"; 91 | break; 92 | } 93 | 94 | 95 | var items=nbt['items']; 96 | if (items.length==0){return }; 97 | var ns=[]; 98 | for(var index in items){ 99 | ns.push(name(items[index])); 100 | } 101 | return ns.join('\n'+translate("gui.crafting.Inventory")+TAB+ALIGNRIGHT+WHITE); 102 | 103 | 104 | return nbt['satelliteid'] 105 | 106 | 107 | var output = getSlot(nbt['items'], 9, 'index'); 108 | return name(output) 109 | 110 | 111 | return nbt['priority'] 112 | 113 | 114 | var items=nbt['upgradeManager']['UpgradeInventory_items']; 115 | var ns=[]; 116 | for(var index in items){ 117 | ns.push(name(items[index]) + '↑'); 118 | } 119 | return ns.join('\n'); 120 | 121 | 122 | switch(nbt['extractMode']){ 123 | case 0: 124 | return "off"; 125 | break; 126 | case 1: 127 | return "on"; 128 | break; 129 | } 130 | 131 | 132 | return nbt['resistance'] 133 | 134 | 135 | switch(nbt['isBlocking']){ 136 | case 0: 137 | return translate("gui.firewall.Allowed"); 138 | break; 139 | case 1: 140 | return translate("gui.firewall.Blocked"); 141 | break; 142 | } 143 | 144 | 145 | switch(nbt['blockProvider']){ 146 | case 0: 147 | return translate("gui.firewall.Allowed"); 148 | break; 149 | case 1: 150 | return translate("gui.firewall.Blocked"); 151 | break; 152 | } 153 | 154 | 155 | switch(nbt['blockCrafer']){ 156 | case 0: 157 | return translate("gui.firewall.Allowed"); 158 | break; 159 | case 1: 160 | return translate("gui.firewall.Blocked"); 161 | break; 162 | } 163 | 164 | 165 | switch(nbt['blockSorting']){ 166 | case 0: 167 | return translate("gui.firewall.Allowed"); 168 | break; 169 | case 1: 170 | return translate("gui.firewall.Blocked"); 171 | break; 172 | } 173 | 174 | 175 | switch(nbt['blockPower']){ 176 | case 0: 177 | return translate("gui.firewall.Allowed"); 178 | break; 179 | case 1: 180 | return translate("gui.firewall.Blocked"); 181 | break; 182 | } 183 | 184 | 185 | var chassiitems=nbt['chassiitems']; 186 | var ns=[]; 187 | for(var index in chassiitems){ 188 | ns.push(name(chassiitems[index])); 189 | } 190 | return ns.join('\n'); 191 | 192 | 193 | return nbt['amount'] 194 | 195 | 196 | switch(nbt['requestpartials']){ 197 | case 0: 198 | return translate("gui.fluidsupplier.No"); 199 | break; 200 | case 1: 201 | return translate("gui.fluidsupplier.Yes"); 202 | break; 203 | } 204 | 205 | 206 | switch(nbt['_bucketMinimum']){ 207 | case 0: 208 | return "None"; 209 | break; 210 | case 1: 211 | return "1 Bucket"; 212 | break; 213 | case 2: 214 | return "2 Bucket"; 215 | break; 216 | case 3: 217 | return "5 Bucket"; 218 | break; 219 | } 220 | 221 | 222 | var authorize=nbt['upgradeManager']['SecurityInventory_items'][0]['index']; 223 | if(authorize == 0){return translate("gui.firewall.Firewall")+"√"} 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Mystcraft.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | if(nbt['Items'][0]['tag']['Dimension']!=undefined){ 7 | return nbt['Items'][0]['tag']['DisplayName']+" (DIM_MYST"+nbt['Items'][0]['tag']['Dimension']+")"} 8 | else{ 9 | return nbt['Items'][0]['tag']['DisplayName']} 10 | 11 | 12 | if(nbt['Items'][0]['tag']['Authors']!=undefined){ 13 | return translate('hud.msg.Mystcraft.author')+": "+nbt['Items'][0]['tag']['Authors'] 14 | } 15 | 16 | 17 | if(nbt['Items'][0]['tag']['Flags']['Intra Linking']==1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']==1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']==1){ 18 | return translate('hud.msg.Mystcraft.flags')+": Generate Platform, Intralinking, Maintain Momentum"} 19 | 20 | 21 | if(nbt['Items'][0]['tag']['Flags']['Disarm']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']==1){ 22 | return translate('hud.msg.Mystcraft.flags')+": Disarm, Intralinking"} 23 | 24 | 25 | if(nbt['Items'][0]['tag']['Flags']['Disarm']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']!=1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']!=1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']!=1){ 26 | return translate('hud.msg.Mystcraft.flags')+": Disarm"} 27 | 28 | 29 | if(nbt['Items'][0]['tag']['Flags']['Intra Linking']==1)if(nbt['Items'][0]['tag']['Flags']['Disarm']!=1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']!=1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']!=1){ 30 | return translate('hud.msg.Mystcraft.flags')+": Intralinking"} 31 | 32 | 33 | if(nbt['Items'][0]['tag']['Flags']['Generate Platform']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']!=1)if(nbt['Items'][0]['tag']['Flags']['Disarm']!=1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']!=1){ 34 | return translate('hud.msg.Mystcraft.flags')+": Generate Platform"} 35 | 36 | 37 | if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']!=1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']!=1)if(nbt['Items'][0]['tag']['Flags']['Disarm']!=1){ 38 | return translate('hud.msg.Mystcraft.flags')+": Maintain Momentum"} 39 | 40 | 41 | if(nbt['Items'][0]['tag']['SpawnX']!=undefined)if(nbt['Items'][0]['tag']['SpawnY']!=undefined)if(nbt['Items'][0]['tag']['SpawnZ']!=undefined){ 42 | return translate('hud.msg.Mystcraft.position')+" "+nbt['Items'][0]['tag']['SpawnX']+", "+nbt['Items'][0]['tag']['SpawnY']+", "+nbt['Items'][0]['tag']['SpawnZ']} 43 | 44 | 45 | 46 | 47 | if(nbt['Items'][0]['tag']['DisplayName']!=undefined)if(nbt['Items'][0]['tag']['Dimension']!=undefined){ 48 | return nbt['Items'][0]['tag']['DisplayName']+" (DIM_MYST"+nbt['Items'][0]['tag']['Dimension']+")"} 49 | else{ 50 | return nbt['Items'][0]['tag']['DisplayName']} 51 | 52 | 53 | if(nbt['Items'][0]['tag']['Authors']!=undefined){ 54 | return translate('hud.msg.Mystcraft.author')+": "+nbt['Items'][0]['tag']['Authors'] 55 | } 56 | 57 | 58 | if(nbt['Items'][0]['tag']['Flags']['Intra Linking']==1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']==1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']==1){ 59 | return translate('hud.msg.Mystcraft.flags')+": Generate Platform, Intra-linking, Maintain Momentum"} 60 | 61 | 62 | if(nbt['Items'][0]['tag']['Flags']['Disarm']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']==1){ 63 | return translate('hud.msg.Mystcraft.flags')+": Disarm, Intra-linking"} 64 | 65 | 66 | if(nbt['Items'][0]['tag']['Flags']['Disarm']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']!=1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']!=1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']!=1){ 67 | return translate('hud.msg.Mystcraft.flags')+": Disarm"} 68 | 69 | 70 | if(nbt['Items'][0]['tag']['Flags']['Intra Linking']==1)if(nbt['Items'][0]['tag']['Flags']['Disarm']!=1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']!=1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']!=1){ 71 | return translate('hud.msg.Mystcraft.flags')+": Intralinking"} 72 | 73 | 74 | if(nbt['Items'][0]['tag']['Flags']['Generate Platform']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']!=1)if(nbt['Items'][0]['tag']['Flags']['Disarm']!=1)if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']!=1){ 75 | return translate('hud.msg.Mystcraft.flags')+": Generate Platform"} 76 | 77 | 78 | if(nbt['Items'][0]['tag']['Flags']['Maintain Momentum']==1)if(nbt['Items'][0]['tag']['Flags']['Intra Linking']!=1)if(nbt['Items'][0]['tag']['Flags']['Generate Platform']!=1)if(nbt['Items'][0]['tag']['Flags']['Disarm']!=1){ 79 | return translate('hud.msg.Mystcraft.flags')+": Maintain Momentum"} 80 | 81 | 82 | if(nbt['Items'][0]['tag']['SpawnX']!=undefined)if(nbt['Items'][0]['tag']['SpawnY']!=undefined)if(nbt['Items'][0]['tag']['SpawnZ']!=undefined){ 83 | return translate('hud.msg.Mystcraft.position')+" "+nbt['Items'][0]['tag']['SpawnX']+", "+nbt['Items'][0]['tag']['SpawnY']+", "+nbt['Items'][0]['tag']['SpawnZ']} 84 | 85 | 86 | 87 | 88 | if(nbt['Item']['tag']['Dimension']!=undefined){ 89 | return nbt['Item']['tag']['DisplayName']+" (DIM_MYST"+nbt['Item']['tag']['Dimension']+")"} 90 | else{ 91 | return nbt['Item']['tag']['DisplayName']} 92 | 93 | 94 | if(nbt['Item']['tag']['Authors']!=undefined){ 95 | return translate('hud.msg.Mystcraft.author')+": "+nbt['Item']['tag']['Authors'] 96 | } 97 | 98 | 99 | if(nbt['Item']['tag']['Flags']['Intra Linking']==1)if(nbt['Item']['tag']['Flags']['Maintain Momentum']==1)if(nbt['Item']['tag']['Flags']['Generate Platform']==1){ 100 | return translate('hud.msg.Mystcraft.flags')+": Generate Platform, Intra-linking, Maintain Momentum"} 101 | 102 | 103 | if(nbt['Item']['tag']['Flags']['Disarm']==1)if(nbt['Item']['tag']['Flags']['Intra Linking']==1){ 104 | return translate('hud.msg.Mystcraft.flags')+": Disarm, Intra-linking"} 105 | 106 | 107 | if(nbt['Item']['tag']['Flags']['Disarm']==1)if(nbt['Item']['tag']['Flags']['Intra Linking']!=1)if(nbt['Item']['tag']['Flags']['Generate Platform']!=1)if(nbt['Item']['tag']['Flags']['Maintain Momentum']!=1){ 108 | return translate('hud.msg.Mystcraft.flags')+": Disarm"} 109 | 110 | 111 | if(nbt['Item']['tag']['Flags']['Intra Linking']==1)if(nbt['Item']['tag']['Flags']['Disarm']!=1)if(nbt['Item']['tag']['Flags']['Generate Platform']!=1)if(nbt['Item']['tag']['Flags']['Maintain Momentum']!=1){ 112 | return translate('hud.msg.Mystcraft.flags')+": Intralinking"} 113 | 114 | 115 | if(nbt['Item']['tag']['Flags']['Generate Platform']==1)if(nbt['Item']['tag']['Flags']['Intra Linking']!=1)if(nbt['Item']['tag']['Flags']['Disarm']!=1)if(nbt['Item']['tag']['Flags']['Maintain Momentum']!=1){ 116 | return translate('hud.msg.Mystcraft.flags')+": Generate Platform"} 117 | 118 | 119 | if(nbt['Item']['tag']['Flags']['Maintain Momentum']==1)if(nbt['Item']['tag']['Flags']['Intra Linking']!=1)if(nbt['Item']['tag']['Flags']['Generate Platform']!=1)if(nbt['Item']['tag']['Flags']['Disarm']!=1){ 120 | return translate('hud.msg.Mystcraft.flags')+": Maintain Momentum"} 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/TechReborn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 8 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 9 | 10 | 11 | if(nbt['tickTime']!=undefined) 12 | if(nbt['tickTime']!=-1){ 13 | return nbt['tickTime']/20+"/"+"12.5"+GREEN+" s"} 14 | 15 | 16 | 17 | 18 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 19 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 20 | 21 | 22 | 23 | 24 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 25 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 26 | 27 | 28 | if(nbt['TileThermalGenerator']['Amount']!=undefined){ 29 | return Math.floor(nbt['TileThermalGenerator']['Amount'])+GREEN+" mB"} 30 | 31 | 32 | 33 | 34 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 35 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 36 | 37 | 38 | if(nbt['TileDieselGenerator']['Amount']!=undefined){ 39 | return Math.floor(nbt['TileDieselGenerator']['Amount'])+GREEN+"mB"+RED+" "+nbt['TileDieselGenerator']['FluidName']} 40 | 41 | 42 | 43 | 44 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 45 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 46 | 47 | 48 | if(nbt['TileGasTurbine']['Amount']!=undefined){ 49 | return Math.floor(nbt['TileGasTurbine']['Amount'])+GREEN+"mB"+RED+" "+nbt['TileGasTurbine']['FluidName']} 50 | 51 | 52 | 53 | 54 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 55 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 56 | 57 | 58 | if(nbt['Crater']['currentTickTime']!=0){ 59 | return Math.floor(nbt['Crater']['currentTickTime']/20)+GREEN+" s"} 60 | 61 | 62 | 63 | 64 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 65 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 66 | 67 | 68 | if(nbt['Crater']['currentTickTime']!=0){ 69 | return Math.floor(nbt['Crater']['currentTickTime']/20)+GREEN+" s"} 70 | 71 | 72 | 73 | 74 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 75 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 76 | 77 | 78 | if(nbt['Crater']['currentTickTime']!=0){ 79 | return Math.floor(nbt['Crater']['currentTickTime']/20)+"/5"+GREEN+" s"} 80 | 81 | 82 | if(nbt['TileGrinder']['Amount']!=undefined){ 83 | return Math.floor(nbt['TileGrinder']['Amount'])+GREEN+"mB"+RED+" "+nbt['TileGrinder']['FluidName']} 84 | 85 | 86 | 87 | 88 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 89 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 90 | 91 | 92 | if(nbt['Crater']['currentTickTime']!=0){ 93 | return Math.floor(nbt['Crater']['currentTickTime']/20)+"/10"+GREEN+" s"} 94 | 95 | 96 | if(nbt['TileSawmill']['Amount']!=undefined){ 97 | return Math.floor(nbt['TileSawmill']['Amount'])+GREEN+"mB"+RED+" "+nbt['TileSawmill']['FluidName']} 98 | 99 | 100 | 101 | 102 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 103 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 104 | 105 | 106 | if(nbt['Crater']['currentTickTime']!=0){ 107 | return Math.floor(nbt['Crater']['currentTickTime']/20)+GREEN+" s"} 108 | 109 | 110 | 111 | 112 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 113 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 114 | 115 | 116 | if(nbt['Crater']['currentTickTime']!=0){ 117 | return Math.floor(nbt['Crater']['currentTickTime']/20)+"/10"+GREEN+" s"} 118 | 119 | 120 | 121 | 122 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 123 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 124 | 125 | 126 | if(nbt['Crater']['currentTickTime']!=0){ 127 | return nbt['Crater']['currentTickTime']/20+GREEN+" s"} 128 | 129 | 130 | 131 | 132 | if(nbt['storedQuantity']!=undefined){ 133 | return nbt['storedQuantity']+GREEN+" 个"} 134 | 135 | 136 | 137 | 138 | if(nbt['storedQuantity']!=undefined){ 139 | return nbt['storedQuantity']+GREEN+" 个"} 140 | 141 | 142 | 143 | 144 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 145 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 146 | 147 | 148 | 149 | 150 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 151 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 152 | 153 | 154 | 155 | 156 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 157 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 158 | 159 | 160 | 161 | 162 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 163 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 164 | 165 | 166 | 167 | 168 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 169 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 170 | 171 | 172 | return nbt['output']+GREEN+" EU" 173 | 174 | 175 | 176 | 177 | if(nbt['TilePowerAcceptor']['energy']!=undefined){ 178 | return Math.floor(nbt['TilePowerAcceptor']['energy'])+GREEN+" EU"} 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/MineFactoryReloaded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | return nbt['energyStored']+' / 1000000 RF' 5 | 6 | 7 | return (nbt['workDone']/3).toFixed(0)+' %' 8 | 9 | 10 | 11 | 12 | return nbt['energyStored']+' / 96000 RF' 13 | 14 | 15 | 16 | 17 | return nbt['energyStored']+' / 16000 RF' 18 | 19 | 20 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 21 | 22 | 23 | return nbt['harvesterSettings']['harvestSmallMushrooms'] 24 | 25 | 26 | return nbt['harvesterSettings']['silkTouch'] 27 | 28 | 29 | 30 | 31 | return nbt['energyStored']+' / 8000 RF' 32 | 33 | 34 | 35 | 36 | return nbt['energyStored']+' / 10000 RF' 37 | 38 | 39 | return nbt['Tanks']['0']['Amount']+' / 8000 mB' 40 | 41 | 42 | 43 | 44 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 45 | 46 | 47 | 48 | 49 | return nbt['buffer']+' / 10000 RF' 50 | 51 | 52 | return nbt['Tanks']['0']['Amount']+' / 4000 mB 53 | 54 | 55 | 56 | 57 | return nbt['energyStored']+' / 32000 RF' 58 | 59 | 60 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 61 | 62 | 63 | 64 | 65 | return nbt['energyStored']+' / 16000 RF' 66 | 67 | 68 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 69 | 70 | 71 | 72 | 73 | return nbt['energyStored']+' / 16000 RF' 74 | 75 | 76 | 77 | 78 | return nbt['energyStored']+' / 16000 RF' 79 | 80 | 81 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 82 | 83 | 84 | 85 | 86 | return nbt['energyStored']+' / 16000 RF' 87 | 88 | 89 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 90 | 91 | 92 | 93 | 94 | return nbt['energyStored']+' / 16000 RF' 95 | 96 | 97 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 98 | 99 | 100 | 101 | 102 | return nbt['energyStored']+' / 16000 RF' 103 | 104 | 105 | 106 | 107 | return nbt['energyStored']+' / 16000 RF' 108 | 109 | 110 | 111 | 112 | return nbt['energyStored']+' / 16000 RF' 113 | 114 | 115 | 116 | 117 | return nbt['energyStored']+' / 2147483647 RF' 118 | 119 | 120 | 121 | 122 | return nbt['energyStored']+' / 32000 RF' 123 | 124 | 125 | 126 | 127 | return nbt['energyStored']+' / 16000 RF' 128 | 129 | 130 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 131 | 132 | 133 | 134 | 135 | return nbt['energyStored']+' / 16000 RF' 136 | 137 | 138 | 139 | 140 | return nbt['energyStored']+' / 32000 RF' 141 | 142 | 143 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 144 | 145 | 146 | 147 | 148 | return nbt['energyStored']+' / 16000 RF' 149 | 150 | 151 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 152 | 153 | 154 | 155 | 156 | return nbt['energyStored']+' / 16000 RF' 157 | 158 | 159 | return nbt['Tanks']['0']['Amount']+' / 1000 mB' 160 | 161 | 162 | 163 | 164 | return nbt['Tanks']['1']['Amount']+' / 16000 mB' 165 | 166 | 167 | return nbt['Tanks']['0']['Amount']+' / 32000 mB 168 | 169 | 170 | 171 | 172 | return nbt['energyStored']+' / 16000 RF' 173 | 174 | 175 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 176 | 177 | 178 | 179 | 180 | return nbt['energyStored']+' / 32000 RF' 181 | 182 | 183 | 184 | 185 | return nbt['energyStored']+' / 32000 RF' 186 | 187 | 188 | 189 | 190 | return nbt['energyStored']+' / 16000 RF' 191 | 192 | 193 | return nbt['Tanks']['0']['Amount']+' / 4000 mB' 194 | 195 | 196 | 197 | 198 | return nbt['Tanks']['0']['Amount']+' / 1000 mB' 199 | 200 | 201 | 202 | 203 | return nbt['energyStored']+' / 16000 RF' 204 | 205 | 206 | 207 | 208 | return nbt['storedQuantity'] 209 | 210 | 211 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/handler/ConfigHandler.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.handler; 2 | 3 | import cpw.mods.fml.common.Loader; 4 | import me.exz.omniocular.OmniOcular; 5 | import me.exz.omniocular.reference.Reference; 6 | import me.exz.omniocular.util.LogHelper; 7 | import org.apache.commons.io.FileUtils; 8 | import org.apache.commons.lang3.StringUtils; 9 | import org.w3c.dom.Document; 10 | import org.w3c.dom.Element; 11 | import org.w3c.dom.Node; 12 | import org.w3c.dom.NodeList; 13 | import org.xml.sax.InputSource; 14 | 15 | import javax.xml.parsers.DocumentBuilder; 16 | import javax.xml.parsers.DocumentBuilderFactory; 17 | import java.io.File; 18 | import java.io.IOException; 19 | import java.io.InputStream; 20 | import java.io.StringReader; 21 | import java.net.URISyntaxException; 22 | import java.net.URLDecoder; 23 | import java.nio.charset.Charset; 24 | import java.nio.file.Files; 25 | import java.util.*; 26 | import java.util.jar.JarEntry; 27 | import java.util.jar.JarFile; 28 | import java.util.regex.Matcher; 29 | import java.util.regex.Pattern; 30 | 31 | @SuppressWarnings("CanBeFinal") 32 | public class ConfigHandler { 33 | public static File minecraftConfigDirectory; 34 | public static String mergedConfig = ""; 35 | static Map entityPattern = new HashMap<>(); 36 | static Map tileEntityPattern = new HashMap<>(); 37 | static Map tooltipPattern = new HashMap<>(); 38 | static Map settingList = new HashMap<>(); 39 | private static File configDir; 40 | 41 | public static void initConfigFiles() { 42 | configDir = new File(minecraftConfigDirectory, Reference.MOD_ID); 43 | if (!configDir.exists()) { 44 | if (!configDir.mkdir()) { 45 | LogHelper.fatal("Can't create config folder"); 46 | } else { 47 | LogHelper.info("Config folder created"); 48 | } 49 | } 50 | 51 | } 52 | 53 | public static void releasePreConfigFiles() throws IOException, URISyntaxException { 54 | final String assetConfigPath = "assets/omniocular/config/"; 55 | final String xmlExt = ".xml"; 56 | Set configList = new HashSet<>(); 57 | Pattern p = Pattern.compile("[\\\\/:*?\"<>|]"); 58 | String classPath = OmniOcular.class.getProtectionDomain().getCodeSource().getLocation().getFile(); 59 | String classFileName = "!/" + OmniOcular.class.getName().replace(".", "/") + ".class"; 60 | String jarPath = StringUtils.removeStart(StringUtils.removeEnd(classPath, classFileName), "file:/"); 61 | if (jarPath.endsWith(".class")) { 62 | File xmlDirectory = new File(OmniOcular.class.getResource("/" + assetConfigPath).toURI()); 63 | for (String xmlFilename : xmlDirectory.list()) { 64 | configList.add(StringUtils.removeEnd(xmlFilename, xmlExt)); 65 | } 66 | 67 | } else { 68 | if (!(System.getProperty("os.name").startsWith("Windows"))) 69 | jarPath = "/" + jarPath; 70 | File jar = new File(URLDecoder.decode(jarPath, "utf8")); 71 | JarFile jarFile = new JarFile(jar); 72 | final Enumeration entries = jarFile.entries(); //gives ALL entries in jar 73 | while (entries.hasMoreElements()) { 74 | final String name = entries.nextElement().getName(); 75 | if (name.startsWith(assetConfigPath) && name.endsWith(xmlExt)) { //filter according to the path 76 | configList.add(StringUtils.removeStart(StringUtils.removeEnd(name, xmlExt), assetConfigPath)); 77 | } 78 | } 79 | } 80 | Set modList = Loader.instance().getIndexedModList().keySet(); 81 | 82 | for (String configName : configList) { 83 | for (String modID : modList) { 84 | Matcher m = p.matcher(modID); 85 | if (configName.equals(m.replaceAll("")) || configName.equals("minecraft")) { 86 | File targetFile = new File(configDir, configName + xmlExt); 87 | if (!targetFile.exists()) { 88 | InputStream resource = OmniOcular.class.getClassLoader().getResourceAsStream(assetConfigPath + configName + xmlExt); 89 | FileUtils.copyInputStreamToFile(resource, targetFile); 90 | LogHelper.info("Release pre-config file : " + configName); 91 | } 92 | } 93 | } 94 | } 95 | } 96 | 97 | public static void mergeConfig() { 98 | mergedConfig = ""; 99 | File configDir = new File(minecraftConfigDirectory, Reference.MOD_ID); 100 | File[] configFiles = configDir.listFiles(); 101 | if (configFiles != null) { 102 | for (File configFile : configFiles) { 103 | if (configFile.isFile()) { 104 | try { 105 | List lines = Files.readAllLines(configFile.toPath(), Charset.forName("UTF-8")); 106 | for (String line : lines) { 107 | mergedConfig += line; 108 | } 109 | } catch (Exception e) { 110 | e.printStackTrace(); 111 | } 112 | } 113 | } 114 | } 115 | mergedConfig = "" + mergedConfig + ""; 116 | 117 | final String[][] quoteChars = { 118 | {"&", "&"}, 119 | {"<", "<"}, 120 | {">", ">"}, 121 | // {"\"", """}, 122 | // {"'", "'"} 123 | }; 124 | 125 | StringBuffer quotedBuffer = new StringBuffer(); 126 | Pattern tagSelectorRegex = Pattern.compile("(?<=<(init|line)[^>]*>).*?(?=)"); 127 | Matcher tagSelectorMatcher = tagSelectorRegex.matcher(mergedConfig); 128 | while (tagSelectorMatcher.find()) { 129 | String quotedString = tagSelectorMatcher.group(); 130 | for (String[] quoteCharPair : quoteChars) { 131 | quotedString = quotedString.replace(quoteCharPair[0], quoteCharPair[1]); 132 | } 133 | tagSelectorMatcher.appendReplacement(quotedBuffer, quotedString); 134 | } 135 | tagSelectorMatcher.appendTail(quotedBuffer); 136 | mergedConfig = quotedBuffer.toString(); 137 | } 138 | 139 | public static void parseConfigFiles() { 140 | // System.out.println(mergedConfig); 141 | try { 142 | JSHandler.initEngine(); 143 | entityPattern.clear(); 144 | tileEntityPattern.clear(); 145 | tooltipPattern.clear(); 146 | settingList.clear(); 147 | JSHandler.scriptSet.clear(); 148 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 149 | DocumentBuilder builder = factory.newDocumentBuilder(); 150 | Document doc = builder.parse(new InputSource(new StringReader(mergedConfig))); 151 | doc.getDocumentElement().normalize(); 152 | Element root = doc.getDocumentElement(); 153 | NodeList ooList = root.getElementsByTagName("oo"); 154 | for (int i = 0; i < ooList.getLength(); i++) { 155 | NodeList entityList = ((Element) ooList.item(i)).getElementsByTagName("entity"); 156 | for (int j = 0; j < entityList.getLength(); j++) { 157 | Node node = entityList.item(j); 158 | entityPattern.put(Pattern.compile(node.getAttributes().getNamedItem("id").getTextContent()), node); 159 | } 160 | NodeList tileEntityList = ((Element) ooList.item(i)).getElementsByTagName("tileentity"); 161 | for (int j = 0; j < tileEntityList.getLength(); j++) { 162 | Node node = tileEntityList.item(j); 163 | tileEntityPattern.put(Pattern.compile(node.getAttributes().getNamedItem("id").getTextContent()), node); 164 | } 165 | NodeList tooltipList = ((Element) ooList.item(i)).getElementsByTagName("tooltip"); 166 | for (int j = 0; j < tooltipList.getLength(); j++) { 167 | Node node = tooltipList.item(j); 168 | tooltipPattern.put(Pattern.compile(node.getAttributes().getNamedItem("id").getTextContent()), node); 169 | } 170 | NodeList initList = ((Element) ooList.item(i)).getElementsByTagName("init"); 171 | for (int j = 0; j < initList.getLength(); j++) { 172 | Node node = initList.item(j); 173 | JSHandler.engine.eval(node.getTextContent()); 174 | } 175 | NodeList configList = ((Element) ooList.item(i)).getElementsByTagName("setting"); 176 | for (int j = 0; j < configList.getLength(); j++) { 177 | Node node = configList.item(j); 178 | String settingText = node.getTextContent(); 179 | try { 180 | String settingResult = JSHandler.engine.eval(settingText.trim()).toString(); 181 | settingList.put(node.getAttributes().getNamedItem("id").getTextContent(), settingResult); 182 | } catch (Exception e) { 183 | e.printStackTrace(); 184 | } 185 | } 186 | } 187 | } catch (Exception e) { 188 | e.printStackTrace(); 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /src/main/resources/assets/omniocular/config/Mekanism.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | return nbt['electricityStored'] 5 | 6 | 7 | return nbt['operatingTicks'] 8 | 9 | 10 | return nbt['lavaTank']['Amount'] 11 | 12 | 13 | 14 | 15 | return nbt['electricityStored'] 16 | 17 | 18 | 19 | 20 | return nbt['electricityStored'] 21 | 22 | 23 | return nbt['fuelTank']['stored']['amount'] 24 | 25 | 26 | 27 | 28 | return nbt['electricityStored'] 29 | 30 | 31 | return nbt['bioFuelStored'] 32 | 33 | 34 | 35 | 36 | return nbt['electricityStored'] 37 | 38 | 39 | 40 | 41 | return nbt['electricityStored'] 42 | 43 | 44 | 45 | 46 | return nbt['electricityStored'] 47 | 48 | 49 | return nbt['operatingTicks'] 50 | 51 | 52 | 53 | 54 | return nbt['electricityStored'] 55 | 56 | 57 | return nbt['operatingTicks'] 58 | 59 | 60 | 61 | 62 | return nbt['electricityStored'] 63 | 64 | 65 | return nbt['operatingTicks'] 66 | 67 | 68 | 69 | 70 | return nbt['electricityStored'] 71 | 72 | 73 | return nbt['operatingTicks'] 74 | 75 | 76 | 77 | 78 | return nbt['electricityStored'] 79 | 80 | 81 | return nbt['operatingTicks'] 82 | 83 | 84 | 85 | 86 | return nbt['electricityStored'] 87 | 88 | 89 | 90 | 91 | return nbt['electricityStored'] 92 | 93 | 94 | 95 | 96 | return nbt['electricityStored'] 97 | 98 | 99 | return nbt['operatingTicks'] 100 | 101 | 102 | 103 | 104 | return nbt['electricityStored'] 105 | 106 | 107 | return nbt['operatingTicks'] 108 | 109 | 110 | 111 | 112 | return nbt['electricityStored'] 113 | 114 | 115 | return nbt['operatingTicks'] 116 | 117 | 118 | 119 | 120 | return nbt['electricityStored'] 121 | 122 | 123 | 124 | 125 | return nbt['electricityStored'] 126 | 127 | 128 | return nbt['fluidTank']['Amount'] 129 | 130 | 131 | 132 | 133 | return nbt['electricityStored'] 134 | 135 | 136 | 137 | 138 | return nbt['electricityStored'] 139 | 140 | 141 | 142 | 143 | return nbt['electricityStored'] 144 | 145 | 146 | 147 | 148 | return nbt['electricityStored'] 149 | 150 | 151 | 152 | 153 | return nbt['temperature'] 154 | 155 | 156 | return nbt['operatingTicks'] 157 | 158 | 159 | return nbt['brineTank']['Amount'] 160 | 161 | 162 | return nbt['waterTank']['Amount'] 163 | 164 | 165 | 166 | 167 | return nbt['electricityStored'] 168 | 169 | 170 | return nbt['operatingTicks'] 171 | 172 | 173 | return nbt['gasTank']['Amount'] 174 | 175 | 176 | 177 | 178 | return nbt['electricityStored'] 179 | 180 | 181 | return nbt['operatingTicks'] 182 | 183 | 184 | return nbt['gasTank']['stored']['amount'] 185 | 186 | 187 | 188 | 189 | return nbt['electricityStored'] 190 | 191 | 192 | return nbt['operatingTicks'] 193 | 194 | 195 | return nbt['leftTank']['stored']['amount'] 196 | 197 | 198 | return nbt['rightTank']['stored']['amount'] 199 | 200 | 201 | return nbt['centerTank']['stored']['amount'] 202 | 203 | 204 | 205 | 206 | return nbt['electricityStored'] 207 | 208 | 209 | return nbt['operatingTicks'] 210 | 211 | 212 | 213 | 214 | return nbt['electricityStored'] 215 | 216 | 217 | return nbt['operatingTicks'] 218 | 219 | 220 | return nbt['fluidTank']['Amount'] 221 | 222 | 223 | return nbt['leftTank']['stored']['amount'] 224 | 225 | 226 | return nbt['rightTank']['stored']['amount'] 227 | 228 | 229 | 230 | 231 | return nbt['electricityStored'] 232 | 233 | 234 | return nbt['operatingTicks'] 235 | 236 | 237 | 238 | 239 | return nbt['electricityStored'] 240 | 241 | 242 | return nbt['operatingTicks'] 243 | 244 | 245 | return nbt['gasTank']['stored']['amount'] 246 | 247 | 248 | return nbt['injectTank']['stored']['amount'] 249 | 250 | 251 | 252 | 253 | return nbt['electricityStored'] 254 | 255 | 256 | return nbt['leftTank']['Amount'] 257 | 258 | 259 | return nbt['centerTank']['stored']['amount'] 260 | 261 | 262 | return nbt['rightTank']['stored']['amount'] 263 | 264 | 265 | 266 | 267 | return nbt['electricityStored'] 268 | 269 | 270 | return nbt['operatingTicks'] 271 | 272 | 273 | return nbt['rightTank']['stored']['amount'] 274 | 275 | 276 | 277 | 278 | return nbt['electricityStored'] 279 | 280 | 281 | 282 | 283 | return nbt['electricityStored'] 284 | 285 | 286 | return nbt['operatingTicks'] 287 | 288 | 289 | return nbt['inputFluidTank']['Amount'] 290 | 291 | 292 | return nbt['inputGasTank']['Amount'] 293 | 294 | 295 | return nbt['outputGasTank']['Amount'] 296 | 297 | 298 | 299 | 300 | return nbt['fluidTank']['Amount'] 301 | 302 | 303 | 304 | 305 | return nbt['fluidTank']['Amount'] 306 | 307 | 308 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /src/main/java/me/exz/omniocular/handler/JSHandler.java: -------------------------------------------------------------------------------- 1 | package me.exz.omniocular.handler; 2 | 3 | import me.exz.omniocular.util.LogHelper; 4 | import me.exz.omniocular.util.NBTHelper; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.item.Item; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.nbt.NBTTagCompound; 9 | import net.minecraft.util.StatCollector; 10 | import net.minecraftforge.fluids.Fluid; 11 | import net.minecraftforge.fluids.FluidRegistry; 12 | import net.minecraftforge.fluids.FluidStack; 13 | import org.w3c.dom.Element; 14 | import org.w3c.dom.Node; 15 | import org.w3c.dom.NodeList; 16 | 17 | import javax.script.*; 18 | import java.util.*; 19 | import java.util.function.Predicate; 20 | import java.util.regex.Matcher; 21 | import java.util.regex.Pattern; 22 | 23 | import static me.exz.omniocular.util.NBTHelper.NBTCache; 24 | 25 | @SuppressWarnings({"CanBeFinal", "UnusedDeclaration"}) 26 | public class JSHandler { 27 | static ScriptEngine engine; 28 | static HashSet scriptSet = new HashSet<>(); 29 | private static List lastTips = new ArrayList<>(); 30 | private static int lastHash; 31 | private static Map fluidList = new HashMap<>(); 32 | private static Map displayNameList = new HashMap<>(); 33 | private static EntityPlayer entityPlayer; 34 | 35 | static List getBody(Map patternMap, NBTTagCompound n, String id, EntityPlayer player) { 36 | entityPlayer = player; 37 | if (n.hashCode() != lastHash || player.worldObj.getTotalWorldTime() % 10 == 0) { 38 | lastHash = n.hashCode(); 39 | lastTips.clear(); 40 | //LogHelper.info(NBTHelper.NBT2json(n)); 41 | try { 42 | String json = "var nbt=" + NBTHelper.NBT2json(n) + ";"; 43 | JSHandler.engine.eval(json); 44 | } catch (ScriptException e) { 45 | e.printStackTrace(); 46 | } 47 | for (Map.Entry entry : patternMap.entrySet()) { 48 | Matcher matcher = entry.getKey().matcher(id); 49 | if (matcher.matches()) { 50 | Element item = (Element) entry.getValue(); 51 | // if (item.getElementsByTagName("head").getLength() > 0) { 52 | // Node head = item.getElementsByTagName("head").item(0); 53 | // } 54 | if (item.getElementsByTagName("line").getLength() > 0) { 55 | String tip; 56 | NodeList lines = item.getElementsByTagName("line"); 57 | for (int i = 0; i < lines.getLength(); i++) { 58 | Node line = lines.item(i); 59 | String displayname = ""; 60 | if (line.getAttributes().getNamedItem("displayname") != null && !line.getAttributes().getNamedItem("displayname").getTextContent().trim().isEmpty()) { 61 | displayname = StatCollector.translateToLocal(line.getAttributes().getNamedItem("displayname").getTextContent()); 62 | } 63 | String functionContent = line.getTextContent(); 64 | String hash = "S" + NBTHelper.MD5(functionContent); 65 | if (!JSHandler.scriptSet.contains(hash)) { 66 | JSHandler.scriptSet.add(hash); 67 | if (!functionContent.contains("return")) { 68 | functionContent = "return " + functionContent.trim(); 69 | } 70 | String script = "function " + hash + "()" + "{" + functionContent + "}"; 71 | try { 72 | JSHandler.engine.eval(script); 73 | } catch (Exception e) { 74 | e.printStackTrace(); 75 | } 76 | } 77 | Invocable invoke = (Invocable) JSHandler.engine; 78 | try { 79 | String result = String.valueOf(invoke.invokeFunction(hash, "")); 80 | if (result.equals("__ERROR__") || result.equals("null") || result.equals("undefined") 81 | || result.equals("NaN")) { 82 | continue; 83 | } 84 | if (patternMap == ConfigHandler.tooltipPattern) { 85 | tip = "\u00A77" + displayname + ": \u00A7f"; 86 | } else { 87 | tip = ConfigHandler.settingList.get("displaynameTileentity") 88 | .replace("DISPLAYNAME", displayname) 89 | .replace("RETURN", result); 90 | } 91 | } catch (Exception e) { 92 | continue; 93 | //e.printStackTrace(); 94 | } 95 | if (tip.equals("__ERROR__")) { 96 | continue; 97 | } 98 | lastTips.addAll(Arrays.asList(tip.split("\n"))); 99 | } 100 | } 101 | } 102 | } 103 | } 104 | return lastTips; 105 | } 106 | 107 | //todo provide an function to detect player keyboard action. (hold shift, etc.) 108 | static void initEngine() { 109 | // List engines = (new ScriptEngineManager()).getEngineFactories(); 110 | // for (ScriptEngineFactory f: engines) { 111 | // System.out.println(f.getLanguageName()+" "+f.getEngineName()+" "+f.getNames().toString()); 112 | // } 113 | ScriptEngineManager manager = new ScriptEngineManager(); 114 | engine = manager.getEngineByName("graal.js"); 115 | Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE); 116 | bindings.put("polyglot.js.allowHostAccess", true); 117 | bindings.put("polyglot.js.allowHostClassLookup", (Predicate) s -> true); 118 | // engine= GraalJSScriptEngine.create(null, 119 | // Context.newBuilder("js") 120 | // .allowHostAccess(HostAccess.ALL) 121 | // .allowHostClassLookup(s -> true) 122 | //// .option("js.ecmascript-version","2022") 123 | // ); 124 | if (engine==null){ 125 | LogHelper.fatal("no javascript engine"); 126 | } 127 | setSpecialChar(); 128 | /* java 8 work around */ 129 | try { 130 | engine.eval("load(\"nashorn:mozilla_compat.js\");"); 131 | } catch (ScriptException e) { 132 | //e.printStackTrace(); 133 | } 134 | try { 135 | engine.eval("var _JSHandler = Java.type('me.exz.omniocular.handler.JSHandler');"); 136 | engine.eval("function translate(t){return _JSHandler.translate(t)}"); 137 | engine.eval("function translateFormatted(t,obj){return _JSHanlder.translateFormatted(t,obj)}"); 138 | engine.eval("function name(n){return _JSHandler.getDisplayName(n.hashCode)}"); 139 | engine.eval("function fluidName(n){return _JSHandler.getFluidName(n)}"); 140 | engine.eval("function holding(){return _JSHandler.playerHolding()}"); 141 | engine.eval("function armor(i){return _JSHandler.playerArmor(i)}"); 142 | engine.eval("function isInHotbar(n){return _JSHandler.haveItemInHotbar(n)}"); 143 | engine.eval("function isInInv(n){return _JSHandler.haveItemInInventory(n)}"); 144 | } catch (ScriptException e) { 145 | e.printStackTrace(); 146 | } 147 | } 148 | 149 | private static void setSpecialChar() { 150 | String MCStyle = "\u00A7"; 151 | engine.put("BLACK", MCStyle + "0"); 152 | engine.put("DBLUE", MCStyle + "1"); 153 | engine.put("DGREEN", MCStyle + "2"); 154 | engine.put("DAQUA", MCStyle + "3"); 155 | engine.put("DRED", MCStyle + "4"); 156 | engine.put("DPURPLE", MCStyle + "5"); 157 | engine.put("GOLD", MCStyle + "6"); 158 | engine.put("GRAY", MCStyle + "7"); 159 | engine.put("DGRAY", MCStyle + "8"); 160 | engine.put("BLUE", MCStyle + "9"); 161 | engine.put("GREEN", MCStyle + "a"); 162 | engine.put("AQUA", MCStyle + "b"); 163 | engine.put("RED", MCStyle + "c"); 164 | engine.put("LPURPLE", MCStyle + "d"); 165 | engine.put("YELLOW", MCStyle + "e"); 166 | engine.put("WHITE", MCStyle + "f"); 167 | 168 | engine.put("OBF", MCStyle + "k"); 169 | engine.put("BOLD", MCStyle + "l"); 170 | engine.put("STRIKE", MCStyle + "m"); 171 | engine.put("UNDER", MCStyle + "n"); 172 | engine.put("ITALIC", MCStyle + "o"); 173 | engine.put("RESET", MCStyle + "r"); 174 | String WailaStyle = "\u00A4"; 175 | String WailaIcon = "\u00A5"; 176 | engine.put("TAB", WailaStyle + WailaStyle + "a"); 177 | engine.put("ALIGNRIGHT", WailaStyle + WailaStyle + "b"); 178 | engine.put("ALIGNCENTER", WailaStyle + WailaStyle + "c"); 179 | engine.put("HEART", WailaStyle + WailaIcon + "a"); 180 | engine.put("HHEART", WailaStyle + WailaIcon + "b"); 181 | engine.put("EHEART", WailaStyle + WailaIcon + "c"); 182 | // LogHelper.info("Special Char loaded"); 183 | } 184 | 185 | public static String translate(String t) { 186 | return StatCollector.translateToLocal(t); 187 | } 188 | 189 | public static String translateFormatted(String t, Object[] format) { 190 | return StatCollector.translateToLocalFormatted(t, format); 191 | } 192 | 193 | public static String playerHolding() { 194 | ItemStack is = entityPlayer.getHeldItem(); 195 | if (is == null) { 196 | return ""; 197 | } 198 | return Item.itemRegistry.getNameForObject(is.getItem()); 199 | } 200 | 201 | public static String playerArmor(int i) { 202 | if (i < 0 || i > 3) { 203 | return null; 204 | } 205 | ItemStack is = entityPlayer.inventory.armorInventory[i]; 206 | if (is == null) { 207 | return ""; 208 | } 209 | return Item.itemRegistry.getNameForObject(is.getItem()); 210 | } 211 | 212 | public static Boolean haveItemInHotbar(String n) { 213 | int s = entityPlayer.inventory.func_146029_c((Item) Item.itemRegistry.getObject(n)); 214 | return s > -1 && s < 9; 215 | } 216 | 217 | public static Boolean haveItemInInventory(String n) { 218 | return entityPlayer.inventory.func_146029_c((Item) Item.itemRegistry.getObject(n)) != -1; 219 | } 220 | 221 | public static String getDisplayName(String hashCode) { 222 | try { 223 | NBTTagCompound nc = NBTCache.get(Integer.valueOf(hashCode)); 224 | ItemStack is = ItemStack.loadItemStackFromNBT(nc); 225 | return is.getDisplayName(); 226 | } catch (Exception e) { 227 | return "__ERROR__"; 228 | } 229 | } 230 | 231 | public static String getFluidName(String uName) { 232 | if (fluidList.containsKey(uName)) { 233 | return fluidList.get(uName); 234 | } else { 235 | try { 236 | Fluid f = FluidRegistry.getFluid(uName.toLowerCase()); 237 | FluidStack fs = new FluidStack(f, 1); 238 | String lName = fs.getLocalizedName(); 239 | fluidList.put(uName, lName); 240 | return lName; 241 | } catch (Exception e) { 242 | return "__ERROR__"; 243 | } 244 | } 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /flow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 页-1 44 | 45 | CFF 容器 46 | 47 | 工作表.2 48 | 49 | 50 | 51 | 工作表.3 52 | 53 | 54 | 55 | 56 | 泳道列表 57 | 58 | 59 | 60 | 61 | 泳道 62 | 63 | 工作表.7 64 | 65 | 66 | 67 | 工作表.8 68 | client 69 | 70 | client 71 | 72 | 73 | 泳道.9 74 | 75 | 工作表.10 76 | 77 | 78 | 79 | 工作表.11 80 | server 81 | 82 | server 83 | 84 | 85 | 泳道.15 86 | 87 | 工作表.16 88 | 89 | 90 | 91 | 工作表.17 92 | common 93 | 94 | common 95 | 96 | 97 | 阶段列表 98 | 99 | 100 | 101 | 分隔符 102 | 103 | 工作表.13 104 | 105 | 106 | 工作表.14 107 | 108 | 109 | 110 | 111 | 分隔符.18 112 | 113 | 工作表.19 114 | 115 | 116 | 117 | 工作表.20 118 | preInit 119 | 120 | preInit 121 | 122 | 123 | 分隔符.21 124 | 125 | 工作表.22 126 | 127 | 128 | 129 | 工作表.23 130 | init 131 | 132 | init 133 | 134 | 135 | 分隔符.24 136 | 137 | 工作表.25 138 | 139 | 140 | 141 | 工作表.26 142 | postInit 143 | 144 | postInit 145 | 146 | 147 | 分隔符.38 148 | 149 | 工作表.39 150 | 151 | 152 | 153 | 工作表.40 154 | ServerStarting 155 | 156 | ServerStarting 157 | 158 | 159 | 分隔符.42 160 | 161 | 工作表.43 162 | 163 | 164 | 165 | 工作表.44 166 | PlayerLoggedIn 167 | 168 | PlayerLoggedIn 169 | 170 | 171 | 分隔符.45 172 | 173 | 工作表.46 174 | 175 | 176 | 177 | 工作表.47 178 | ReloadCommand 179 | 180 | ReloadCommand 181 | 182 | 183 | 184 | 185 | 工作表.51 186 | 187 | 工作表.52 188 | 189 | 190 | 192 | 193 | 194 | 195 | 工作表.53 196 | initConfig 197 | 198 | 工作表.54 199 | 200 | 201 | 203 | initConfig 204 | 205 | 206 | 207 | 带.70 208 | 209 | 工作表.71 210 | 211 | 工作表.72 212 | 213 | 214 | 216 | 217 | 218 | 219 | 工作表.73 220 | prepareConfigFiles 221 | 222 | 工作表.74 223 | 224 | 225 | 227 | prepareConfigFiles 228 | 229 | 230 | 231 | 流程 232 | get config dir 233 | 234 | get config dir 235 | 236 | 流程.56 237 | initConfigFiles 238 | 239 | initConfigFiles 240 | 241 | 流程.57 242 | initEngine 243 | 244 | initEngine 245 | 246 | 流程.65 247 | registerNetwork 248 | 249 | registerNetwork 250 | 251 | 流程.66 252 | registerWaila 253 | 254 | registerWaila 255 | 256 | 流程.67 257 | registerEvent 258 | 259 | registerEvent 260 | 261 | 流程.69 262 | registerClientCommand 263 | 264 | registerClientCommand 265 | 266 | 流程.75 267 | releasePreConfigFiles 268 | 269 | releasePreConfigFiles 270 | 271 | 流程.76 272 | mergeConfig 273 | 274 | mergeConfig 275 | 276 | 流程.77 277 | registerNEI 278 | 279 | registerNEI 280 | 281 | 流程.78 282 | registerServerCommand 283 | 284 | registerServerCommand 285 | 286 | 流程.80 287 | sendConfigString 288 | 289 | sendConfigString 290 | 291 | 流程.84 292 | parseConfigFiles 293 | 294 | parseConfigFiles 295 | 296 | 动态连接线 297 | 298 | 299 | 300 | 动态连接线.89 301 | 302 | 303 | 304 | 动态连接线.90 305 | 306 | 307 | 308 | 动态连接线.93 309 | 310 | 311 | 312 | 动态连接线.96 313 | 314 | 315 | 316 | 动态连接线.99 317 | 318 | 319 | 320 | 动态连接线.100 321 | 322 | 323 | 324 | 动态连接线.101 325 | 326 | 327 | 328 | 动态连接线.102 329 | 330 | 331 | 332 | 动态连接线.103 333 | 334 | 335 | 336 | 动态连接线.104 337 | 338 | 339 | 340 | 动态连接线.105 341 | 342 | 343 | 344 | 动态连接线.106 345 | 346 | 347 | 348 | 流程.107 349 | mergeConfig 350 | 351 | mergeConfig 352 | 353 | 动态连接线.108 354 | 355 | 356 | 357 | 358 | --------------------------------------------------------------------------------