Compare commits

..
30 Commits
Author SHA1 Message Date
Dream Master c938ccf542 update 2025-10-13 14:42:49 +02:00
c2e8b44f2b Draw thaumcraft aspect icons in tooltip (#41)
Co-authored-by: Super <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2025-10-13 14:22:46 +02:00
Martin Robertz c4e3537957 update 2025-10-01 17:23:42 +02:00
EmperorSuper 9bc1e79f64 Add Gadomancy support (Thaumic Sight enchant) (#40) 2025-10-01 08:12:13 +02:00
Martin Robertz bdebd737d6 update 2025-09-21 17:20:45 +02:00
WoriveandMartin Robertz 9f04d3d029 feat(api): Add support for advanced tooltip body (#38)
Co-authored-by: Martin Robertz <[email protected]>
2025-09-21 17:19:57 +02:00
Martin Robertz ef3c4a9774 update 2025-09-17 13:52:33 +02:00
Alexdoru 3b64d21335 change log level of callbackRegistration (#39) 2025-09-16 11:26:17 +02:00
Alexdoru 72c91a3700 Fix FMLLoadCompleteEvent using wrong annotation (#37) 2025-07-14 00:22:10 +00:00
Alexdoru bf6d309038 Delete redundant registration via reflection (#36) 2025-07-13 21:58:24 +02:00
Maya 5bb7f7221a update 2025-06-28 09:59:03 -06:00
AlexdoruandMartin Robertz 6278e4d575 [Memory-opti:fix leak] Fix WorldClient leak in WailaTickHandler and RayTracing (#31)
Co-authored-by: Martin Robertz <[email protected]>
2025-06-28 09:58:51 -06:00
Martin Robertz 7a46d914db update 2025-06-14 00:28:26 +02:00
Alexdoru d30d8ba100 Add config to show icon on HUD or not (#35) 2025-06-13 12:06:54 +02:00
Alexdoru 490a176446 Make strings rendering ignore transparency (#33) 2025-06-11 04:19:57 +02:00
Nikolay S. 453a8f50a7 Re-encode cs_CZ.lang into UTF-8 (#32) 2025-06-10 20:48:42 -05:00
Dream Master d946500c0d update 2025-05-28 12:25:03 +02:00
Alexdoru 487829a16e Stop running tick events twice per tick (#30) 2025-05-28 06:28:45 +02:00
Martin Robertz f153502858 update
(cherry picked from commit 093cf20b71)
2025-05-24 22:31:15 +02:00
dibbydoda 095ea9e3c4 Remove unused EnderIO module (#29) 2025-05-24 20:08:33 +02:00
Maya c6d48b32f7 update 2025-03-20 09:41:10 -05:00
4fb3d1edaa Fix thaumcraft node aspects overflowing out of the tooltip bounding box (#28)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-03-20 09:40:58 -05:00
EmperorSuperandMaya 678bb6dd44 Add a total size counter to thaumcraft nodes (#27)
Co-authored-by: Maya <[email protected]>
2025-03-20 09:35:25 -05:00
Glease 5333808d65 add more information to help debug weird NPE (#26) 2025-03-20 09:30:06 -05:00
Martin Robertz 4750486375 update 2024-11-16 15:38:59 +01:00
Alexdoru 0f9710a9f9 Remove unnecessary reflection (#24) 2024-11-16 02:48:17 +01:00
Martin Robertz 0c0ac4fcfa update 2024-07-02 23:48:19 +02:00
AnrDaemonandQuarri6343 a189446cac fixed broken Maintained mod (#23)
Co-authored-by: Quarri6343 <[email protected]>
2024-07-01 06:43:57 +02:00
Martin Robertz 6279ef2b09 update 2024-05-20 12:35:52 +02:00
Lyfts 6cf6dafb53 Add signal strength indicator for projectred wires (#22) 2024-05-20 12:34:29 +02:00
100 changed files with 690 additions and 3220 deletions

No files matched your search

+1
View File
@@ -27,3 +27,4 @@ whitelist.json
*.iws
src/main/resources/mixins.*.json
*.bat
layout.json
+1 -1
View File
@@ -1,7 +1,7 @@
// Add your dependencies here
dependencies {
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.14-GTNH:dev')
shadowImplementation('au.com.bytecode:opencsv:2.4')
}
+15 -4
View File
@@ -14,7 +14,7 @@ modId = Waila
modGroup = mcp.mobius.waila
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -80,11 +80,16 @@ apiPackage = api
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = Waila_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
@@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
@@ -140,7 +151,7 @@ modrinthProjectId =
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+5 -3
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -203,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
Vendored
+2
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43'
}
+11 -36
View File
@@ -1,6 +1,5 @@
package mcp.mobius.waila;
import java.lang.reflect.Field;
import java.util.Map;
import net.minecraftforge.common.MinecraftForge;
@@ -8,24 +7,24 @@ import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkCheckHandler;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.relauncher.Side;
import mcp.mobius.waila.addons.harvestability.MissingHarvestInfo;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;
import mcp.mobius.waila.addons.vanillamc.TestRegistrar;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
import mcp.mobius.waila.client.KeyEvent;
import mcp.mobius.waila.commands.CommandDumpHandlers;
import mcp.mobius.waila.network.NetworkHandler;
@@ -65,36 +64,21 @@ public class Waila {
@EventHandler
public void initialize(FMLInitializationEvent event) {
try {
Field eBus = FMLModContainer.class.getDeclaredField("eventBus");
eBus.setAccessible(true);
EventBus FMLbus = (EventBus) eBus.get(FMLCommonHandler.instance().findContainerFor(this));
FMLbus.register(this);
} catch (Throwable ignored) {}
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
FMLCommonHandler.instance().bus().register(new KeyEvent());
FMLCommonHandler.instance().bus().register(WailaTickHandler.instance());
FMLCommonHandler.instance().bus().register(new WailaTickHandler());
}
FMLCommonHandler.instance().bus().register(new NetworkHandler());
MissingHarvestInfo.init();
TestRegistrar.init();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.registerHandlers();
ModIdentification.init();
if (Loader.isModLoaded("IguanaTweaksTConstruct")) {
ProxyIguanaTweaks.init();
}
}
@Subscribe
@EventHandler
public void loadComplete(FMLLoadCompleteEvent event) {
proxy.registerMods();
proxy.registerIMCs();
@@ -131,15 +115,6 @@ public class Waila {
imcMessage.getStringValue()));
ModuleRegistrar.instance().addIMCRequest(imcMessage.getStringValue(), imcMessage.getSender());
}
if (imcMessage.key.equalsIgnoreCase("elementregister")) {
Waila.log.info(
String.format(
"Receiving registration request from [ %s ] for method %s",
imcMessage.getSender(),
imcMessage.getStringValue()));
ModuleProbeRegistrar.instance().addIMCRequest(imcMessage.getStringValue(), imcMessage.getSender());
}
}
}
@@ -1,44 +0,0 @@
package mcp.mobius.waila.addons;
import static mcp.mobius.waila.api.SpecialChars.*;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.elements.IProbeInfo;
import mcp.mobius.waila.handlers.HUDHandlerBlocks;
import mcp.mobius.waila.utils.ModIdentification;
public class DefaultProbeInfoProvider {
public static void addStandardBlockInfo(ItemStack itemStack, IProbeInfo probeInfo, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
// TODO: item icon, horizontal layout
// if (!itemStack.isEmpty()) {
// if (Tools.show(mode, config.getShowModName())) {
// probeInfo.horizontal().item(pickBlock).vertical().itemLabel(pickBlock).text(TextStyleClass.MODNAME + modid);
// } else {
// probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).item(pickBlock).itemLabel(pickBlock);
// }
// } else if (Tools.show(mode, config.getShowModName())) {
// probeInfo.vertical().text(TextStyleClass.NAME + getBlockUnlocalizedName(block)).text(TextStyleClass.MODNAME +
// modid);
// } else {
// probeInfo.vertical().text(TextStyleClass.NAME + getBlockUnlocalizedName(block));
// }
HUDHandlerBlocks hudHandlerBlocks = new HUDHandlerBlocks();
IProbeInfo row = probeInfo.horizontal();
row.item(itemStack);
IProbeInfo row_vertical = row.vertical();
row_vertical.text(hudHandlerBlocks.getWailaHead(itemStack, new ArrayList<>(), accessor, config).get(0));
String modName = ModIdentification.nameFromStack(itemStack);
if (modName != null && !modName.isEmpty()) {
row_vertical.text(BLUE + ITALIC + modName);
}
}
}
@@ -1,62 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import java.lang.reflect.Method;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class EnderIOModule {
public static Class<?> TileCapacitorBank = null;
public static Method TCB_getMaxInput = null;
public static Method TCB_getMaxOutput = null;
public static Method TCB_getEnergyStored = null;
public static Method TCB_getMaxEnergyStored = null;
public static Method TCB_getMaxIO = null;
public static Class<?> TileTesseract = null;
public static void register() {
try {
Class.forName("crazypants.enderio.EnderIO");
Waila.log.log(Level.INFO, "EnderIO mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[EnderIO] EnderIO mod not found.");
return;
}
try {
TileCapacitorBank = Class.forName("crazypants.enderio.machine.power.TileCapacitorBank");
TCB_getEnergyStored = TileCapacitorBank.getMethod("getEnergyStored");
TCB_getMaxInput = TileCapacitorBank.getMethod("getMaxInput");
TCB_getMaxOutput = TileCapacitorBank.getMethod("getMaxOutput");
TCB_getMaxEnergyStored = TileCapacitorBank.getMethod("getMaxEnergyStored");
TCB_getMaxIO = TileCapacitorBank.getMethod("getMaxIO");
TileTesseract = Class.forName("crazypants.enderio.machine.hypercube.TileHyperCube");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.WARN, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e) {
Waila.log.log(Level.WARN, "[EnderStorage] Method not found." + e);
return;
} catch (Exception e) {
Waila.log.log(Level.WARN, "[EnderStorage] Unhandled exception." + e);
return;
}
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.inout");
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.storage");
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.owner");
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.channel");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCapacitorBank);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerCapacitor(), TileCapacitorBank);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTesseract(), TileTesseract);
}
}
@@ -1,107 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import static mcp.mobius.waila.api.SpecialChars.*;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.utils.WailaExceptionHandler;
public class HUDHandlerCapacitor implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (accessor.getPlayer().isSneaking()) {
try {
String maxIOStr = LangUtil.translateG("hud.msg.maxio");
String inputStr = LangUtil.translateG("hud.msg.input");
String outputStr = LangUtil.translateG("hud.msg.output");
if (config.getConfig("enderio.storage")) {
Integer maxEnergyStored = (Integer) EnderIOModule.TCB_getMaxEnergyStored
.invoke(accessor.getTileEntity());
Double energyStored = (Double) EnderIOModule.TCB_getEnergyStored.invoke(accessor.getTileEntity());
currenttip.add(
String.format(
"%s%.1f%s / %s%d%s RF",
WHITE,
energyStored * 10,
RESET,
WHITE,
maxEnergyStored * 10,
RESET));
}
if (config.getConfig("enderio.inout")) {
Integer maxIO = (Integer) EnderIOModule.TCB_getMaxIO.invoke(accessor.getTileEntity());
Integer maxInput = (Integer) EnderIOModule.TCB_getMaxInput.invoke(accessor.getTileEntity());
Integer maxOutput = (Integer) EnderIOModule.TCB_getMaxOutput.invoke(accessor.getTileEntity());
currenttip.add(
String.format(
"%s : %s%d%sRF/t ",
maxIOStr,
TAB + ALIGNRIGHT + WHITE,
maxIO * 10,
TAB + ALIGNRIGHT));
currenttip.add(
String.format(
"%s : %s%d%sRF/t ",
inputStr,
TAB + ALIGNRIGHT + WHITE,
maxInput * 10,
TAB + ALIGNRIGHT));
currenttip.add(
String.format(
"%s : %s%d%sRF/t ",
outputStr,
TAB + ALIGNRIGHT + WHITE,
maxOutput * 10,
TAB + ALIGNRIGHT));
}
} catch (Exception e) {
currenttip = WailaExceptionHandler
.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
}
@@ -1,92 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import static mcp.mobius.waila.api.SpecialChars.*;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerTesseract implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (accessor.getPlayer().isSneaking()) {
String channel = "%s : %s%s%s %s";
String freq;
String frequser;
if (config.getConfig("enderio.channel")) {
if (accessor.getNBTData().hasKey("channelName")) {
freq = accessor.getNBTData().getString("channelName");
if (accessor.getNBTData().hasKey("channelUser"))
frequser = "[ " + WHITE + accessor.getNBTData().getString("channelUser") + RESET + " ]";
else frequser = "[ " + WHITE + LangUtil.translateG("hud.msg.public") + RESET + " ]";
} else {
freq = LangUtil.translateG("hud.msg.none");
frequser = "";
}
currenttip.add(
String.format(
channel,
LangUtil.translateG("hud.msg.frequency"),
TAB + WHITE,
freq,
RESET,
frequser));
}
if (config.getConfig("enderio.owner")) {
if (accessor.getNBTData().hasKey("owner")) currenttip.add(
String.format(
"%s : %s%s",
LangUtil.translateG("hud.msg.owner"),
TAB + WHITE,
accessor.getNBTData().getString("owner")));
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
}
@@ -1,14 +0,0 @@
package mcp.mobius.waila.addons.harvestability;
public class Config {
public static final String MINIMAL_SEPARATOR_STRING = " : ";
public static final String CURRENTLY_HARVESTABLE_STRING = "\u2714";
public static final String NOT_CURRENTLY_HARVESTABLE_STRING = "\u2718";
public static final String SHEARABILITY_STRING = "\u2702";
public static final String SILK_TOUCHABILITY_STRING = "\u2712";
}
@@ -1,338 +0,0 @@
package mcp.mobius.waila.addons.harvestability;
import java.util.*;
import net.minecraft.block.Block;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemShears;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IShearable;
import net.minecraftforge.common.config.Configuration;
import mcp.mobius.waila.addons.harvestability.helpers.*;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyCreativeBlocks;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyGregTech;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.ProbeMode;
import mcp.mobius.waila.api.elements.IProbeDataProvider;
import mcp.mobius.waila.api.elements.IProbeInfo;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
import mcp.mobius.waila.utils.Constants;
public class HUDHandlerHarvestability implements IWailaDataProvider, IProbeDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> toolTip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return toolTip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> toolTip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
return toolTip;
}
Block block = accessor.getBlock();
int meta = accessor.getMetadata();
if (ProxyCreativeBlocks.isCreativeBlock(block, meta)) return toolTip;
EntityPlayer player = accessor.getPlayer();
// for disguised blocks
if (itemStack.getItem() instanceof ItemBlock && !ProxyGregTech.isOreBlock(block)
&& !ProxyGregTech.isCasing(block)
&& !ProxyGregTech.isMachine(block)) {
block = Block.getBlockFromItem(itemStack.getItem());
meta = itemStack.getItemDamage();
}
boolean minimalLayout = config.getConfig("harvestability.minimal", false);
List<String> stringParts = new ArrayList<String>();
getHarvestability(stringParts, player, block, meta, accessor.getPosition(), config, minimalLayout);
if (!stringParts.isEmpty()) {
if (minimalLayout) toolTip.add(
StringHelper.concatenateStringList(
stringParts,
EnumChatFormatting.RESET + Config.MINIMAL_SEPARATOR_STRING));
else toolTip.addAll(stringParts);
}
return toolTip;
}
public void getHarvestability(List<String> stringList, EntityPlayer player, Block block, int meta,
MovingObjectPosition position, IWailaConfigHandler config, boolean minimalLayout) {
boolean isSneaking = player.isSneaking();
boolean showHarvestLevel = config.getConfig("harvestability.harvestlevel")
&& (!config.getConfig("harvestability.harvestlevel.sneakingonly") || isSneaking);
boolean showHarvestLevelNum = config.getConfig("harvestability.harvestlevelnum")
&& (!config.getConfig("harvestability.harvestlevelnum.sneakingonly") || isSneaking);
boolean showEffectiveTool = config.getConfig("harvestability.effectivetool")
&& (!config.getConfig("harvestability.effectivetool.sneakingonly") || isSneaking);
boolean showCurrentlyHarvestable = config.getConfig("harvestability.currentlyharvestable")
&& (!config.getConfig("harvestability.currentlyharvestable.sneakingonly") || isSneaking);
boolean hideWhileHarvestable = config.getConfig("harvestability.unharvestableonly", false);
boolean showOresOnly = config.getConfig("harvestability.oresonly", false);
boolean toolRequiredOnly = config.getConfig("harvestability.toolrequiredonly");
if (showHarvestLevel || showEffectiveTool || showCurrentlyHarvestable) {
if (showOresOnly && !OreHelper.isBlockAnOre(block, meta)) {
return;
}
if (!player.isCurrentToolAdventureModeExempt(position.blockX, position.blockY, position.blockZ)
|| BlockHelper.isBlockUnbreakable(
block,
player.worldObj,
position.blockX,
position.blockY,
position.blockZ)) {
String unbreakableString = ColorHelper.getBooleanColor(false) + Config.NOT_CURRENTLY_HARVESTABLE_STRING
+ (!minimalLayout
? EnumChatFormatting.RESET
+ StatCollector.translateToLocal("wailaharvestability.harvestable")
: "");
stringList.add(unbreakableString);
return;
}
// needed to stop array index out of bounds exceptions on mob spawners
// block.getHarvestLevel/getHarvestTool are only 16 elements big
if (meta >= 16) meta = 0;
int harvestLevel = block.getHarvestLevel(meta);
String effectiveTool = BlockHelper.getEffectiveToolOf(
player.worldObj,
position.blockX,
position.blockY,
position.blockZ,
block,
meta);
if (effectiveTool != null && harvestLevel < 0) harvestLevel = 0;
boolean blockHasEffectiveTools = harvestLevel >= 0 && effectiveTool != null;
String shearability = getShearabilityString(player, block, meta, position, config);
String silkTouchability = getSilkTouchabilityString(player, block, meta, position, config);
if (toolRequiredOnly && block.getMaterial().isToolNotRequired()
&& !blockHasEffectiveTools
&& shearability.isEmpty()
&& silkTouchability.isEmpty())
return;
boolean canHarvest = false;
boolean isEffective = false;
boolean isAboveMinHarvestLevel = false;
boolean isHoldingTinkersTool = false;
boolean isHoldingGTTool = false;
ItemStack itemHeld = player.getHeldItem();
if (itemHeld != null) {
isHoldingTinkersTool = ToolHelper.hasToolTag(itemHeld);
isHoldingGTTool = ProxyGregTech.isGTTool(itemHeld);
isAboveMinHarvestLevel = (showCurrentlyHarvestable || showHarvestLevel)
&& ToolHelper.canToolHarvestLevel(itemHeld, block, meta, harvestLevel);
isEffective = showEffectiveTool
&& ToolHelper.isToolEffectiveAgainst(itemHeld, block, meta, effectiveTool);
if (isHoldingGTTool) {
// GT tool don't care net.minecraft.block.material.Material#isToolNotRequired
canHarvest = itemHeld.func_150998_b(block);
} else {
canHarvest = ToolHelper.canToolHarvestBlock(itemHeld, block, meta)
|| (!isHoldingTinkersTool && block.canHarvestBlock(player, meta));
}
}
boolean isCurrentlyHarvestable = (canHarvest && isAboveMinHarvestLevel)
|| (!isHoldingTinkersTool && ForgeHooks.canHarvestBlock(block, player, meta));
if (hideWhileHarvestable && isCurrentlyHarvestable) return;
String currentlyHarvestable = showCurrentlyHarvestable
? ColorHelper.getBooleanColor(isCurrentlyHarvestable)
+ (isCurrentlyHarvestable ? Config.CURRENTLY_HARVESTABLE_STRING
: Config.NOT_CURRENTLY_HARVESTABLE_STRING)
+ (!minimalLayout
? EnumChatFormatting.RESET
+ StatCollector.translateToLocal("wailaharvestability.currentlyharvestable")
: "")
: "";
if (!currentlyHarvestable.isEmpty() || !shearability.isEmpty() || !silkTouchability.isEmpty()) {
String separator = (!shearability.isEmpty() || !silkTouchability.isEmpty() ? " " : "");
stringList.add(
currentlyHarvestable + separator
+ silkTouchability
+ (!silkTouchability.isEmpty() ? separator : "")
+ shearability);
}
if (harvestLevel != -1 && showEffectiveTool && effectiveTool != null) {
String effectiveToolString;
if (StatCollector.canTranslate("wailaharvestability.toolclass." + effectiveTool))
effectiveToolString = StatCollector
.translateToLocal("wailaharvestability.toolclass." + effectiveTool);
else effectiveToolString = effectiveTool.substring(0, 1).toUpperCase() + effectiveTool.substring(1);
stringList.add(
(!minimalLayout ? StatCollector.translateToLocal("wailaharvestability.effectivetool") : "")
+ ColorHelper.getBooleanColor(
isEffective && (!isHoldingTinkersTool || canHarvest),
isHoldingTinkersTool && isEffective && !canHarvest)
+ effectiveToolString);
}
if (harvestLevel >= 1 && (showHarvestLevel || showHarvestLevelNum)) {
String harvestLevelString = "";
String harvestLevelName = StringHelper.stripFormatting(StringHelper.getHarvestLevelName(harvestLevel));
String harvestLevelNum = String.valueOf(harvestLevel);
// only show harvest level number and name if they are different
showHarvestLevelNum = showHarvestLevelNum
&& (!showHarvestLevel || !harvestLevelName.equals(harvestLevelNum));
if (showHarvestLevel) harvestLevelString = harvestLevelName
+ (showHarvestLevelNum ? String.format(" (%d)", harvestLevel) : "");
else if (showHarvestLevelNum) harvestLevelString = harvestLevelNum;
stringList.add(
(!minimalLayout ? StatCollector.translateToLocal("wailaharvestability.harvestlevel") : "")
+ ColorHelper.getBooleanColor(isAboveMinHarvestLevel && canHarvest)
+ harvestLevelString);
}
}
}
public String getShearabilityString(EntityPlayer player, Block block, int meta, MovingObjectPosition position,
IWailaConfigHandler config) {
boolean isSneaking = player.isSneaking();
boolean showShearability = config.getConfig("harvestability.shearability")
&& (!config.getConfig("harvestability.shearability.sneakingonly") || isSneaking);
if (showShearability && (block instanceof IShearable || block == Blocks.deadbush
|| (block == Blocks.double_plant && block.getItemDropped(meta, new Random(), 0) == null))) {
ItemStack itemHeld = player.getHeldItem();
boolean isHoldingShears = itemHeld != null && itemHeld.getItem() instanceof ItemShears;
boolean isShearable = isHoldingShears && ((IShearable) block)
.isShearable(itemHeld, player.worldObj, position.blockX, position.blockY, position.blockZ);
return ColorHelper.getBooleanColor(isShearable, !isShearable && isHoldingShears)
+ Config.SHEARABILITY_STRING;
}
return "";
}
public String getSilkTouchabilityString(EntityPlayer player, Block block, int meta, MovingObjectPosition position,
IWailaConfigHandler config) {
boolean isSneaking = player.isSneaking();
boolean showSilkTouchability = config.getConfig("harvestability.silktouchability")
&& (!config.getConfig("harvestability.silktouchability.sneakingonly") || isSneaking);
if (showSilkTouchability && block
.canSilkHarvest(player.worldObj, player, position.blockX, position.blockY, position.blockZ, meta)) {
Item itemDropped = block.getItemDropped(meta, new Random(), 0);
boolean silkTouchMatters = (itemDropped instanceof ItemBlock && itemDropped != Item.getItemFromBlock(block))
|| block.quantityDropped(new Random()) <= 0;
if (silkTouchMatters) {
boolean hasSilkTouch = EnchantmentHelper.getSilkTouchModifier(player);
return ColorHelper.getBooleanColor(hasSilkTouch) + Config.SILK_TOUCHABILITY_STRING;
}
}
return "";
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> toolTip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return toolTip;
}
public static HashMap<String, Boolean> configOptions = new HashMap<String, Boolean>();
static {
configOptions.put("harvestability.harvestlevel", true);
configOptions.put("harvestability.harvestlevelnum", false);
configOptions.put("harvestability.effectivetool", true);
configOptions.put("harvestability.currentlyharvestable", true);
configOptions.put("harvestability.harvestlevel.sneakingonly", false);
configOptions.put("harvestability.harvestlevelnum.sneakingonly", false);
configOptions.put("harvestability.effectivetool.sneakingonly", false);
configOptions.put("harvestability.currentlyharvestable.sneakingonly", false);
configOptions.put("harvestability.oresonly", false);
configOptions.put("harvestability.minimal", false);
configOptions.put("harvestability.unharvestableonly", false);
configOptions.put("harvestability.toolrequiredonly", true);
configOptions.put("harvestability.shearability", true);
configOptions.put("harvestability.shearability.sneakingonly", false);
configOptions.put("harvestability.silktouchability", true);
configOptions.put("harvestability.silktouchability.sneakingonly", false);
}
public void addProbeInfo(ProbeMode probeMode, ItemStack itemStack, IProbeInfo probeInfo,
IWailaDataAccessor accessor, IWailaConfigHandler config) {
Block block = accessor.getBlock();
int meta = accessor.getMetadata();
if (ProxyCreativeBlocks.isCreativeBlock(block, meta)) return;
EntityPlayer player = accessor.getPlayer();
// for disguised blocks
if (itemStack.getItem() instanceof ItemBlock && !ProxyGregTech.isOreBlock(block)
&& !ProxyGregTech.isCasing(block)
&& !ProxyGregTech.isMachine(block)) {
block = Block.getBlockFromItem(itemStack.getItem());
meta = itemStack.getItemDamage();
}
List<String> stringParts = new ArrayList<String>();
getHarvestability(stringParts, player, block, meta, accessor.getPosition(), config, true);
if (!stringParts.isEmpty()) {
probeInfo.text(
StringHelper.concatenateStringList(
stringParts,
EnumChatFormatting.RESET + Config.MINIMAL_SEPARATOR_STRING));
}
}
public static void register() {
for (Map.Entry<String, Boolean> entry : configOptions.entrySet()) {
// hacky way to set default values to anything but true
ConfigHandler.instance().getConfig(entry.getKey(), entry.getValue());
ModuleRegistrar.instance().addConfig("Harvestability", entry.getKey(), "option." + entry.getKey());
}
ModuleProbeRegistrar.instance().registerProbeProvider(new HUDHandlerHarvestability(), Block.class);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerHarvestability(), Block.class);
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
return tag;
}
}
@@ -1,14 +0,0 @@
package mcp.mobius.waila.addons.harvestability;
import net.minecraft.init.Blocks;
public class MissingHarvestInfo {
public static void init() {
vanilla();
}
public static void vanilla() {
Blocks.web.setHarvestLevel("sword", 0);
}
}
@@ -1,43 +0,0 @@
package mcp.mobius.waila.addons.harvestability.helpers;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.world.World;
public class BlockHelper {
private static final HashMap<String, ItemStack> testTools = new HashMap<String, ItemStack>();
static {
testTools.put("pickaxe", new ItemStack(Items.wooden_pickaxe));
testTools.put("shovel", new ItemStack(Items.wooden_shovel));
testTools.put("axe", new ItemStack(Items.wooden_axe));
}
public static String getEffectiveToolOf(World world, int x, int y, int z, Block block, int metadata) {
String effectiveTool = block.getHarvestTool(metadata);
if (effectiveTool == null) {
float hardness = block.getBlockHardness(world, x, y, z);
if (hardness > 0f) {
for (Map.Entry<String, ItemStack> testToolEntry : testTools.entrySet()) {
ItemStack testTool = testToolEntry.getValue();
if (testTool != null && testTool.getItem() instanceof ItemTool
&& testTool.func_150997_a(block) >= ((ItemTool) testTool.getItem()).func_150913_i()
.getEfficiencyOnProperMaterial()) {
effectiveTool = testToolEntry.getKey();
break;
}
}
}
}
return effectiveTool;
}
public static boolean isBlockUnbreakable(Block block, World world, int x, int y, int z) {
return block.getBlockHardness(world, x, y, z) == -1.0f;
}
}
@@ -1,32 +0,0 @@
package mcp.mobius.waila.addons.harvestability.helpers;
import net.minecraft.util.EnumChatFormatting;
public class ColorHelper {
private static final EnumChatFormatting colorRange[] = { EnumChatFormatting.DARK_RED, EnumChatFormatting.RED,
EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.DARK_GREEN, EnumChatFormatting.GREEN,
EnumChatFormatting.AQUA };
private static final EnumChatFormatting booleanColorRange[] = { EnumChatFormatting.DARK_RED, EnumChatFormatting.RED,
EnumChatFormatting.DARK_GREEN, EnumChatFormatting.GREEN };
public static String getRelativeColor(double val, double min, double max) {
if (min == max) return EnumChatFormatting.RESET.toString();
else if ((max > min && val > max) || (min > max && val < max))
return EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD;
else if ((max > min && val < min) || (min > max && val > min))
return colorRange[0].toString() + EnumChatFormatting.BOLD;
int index = (int) (((val - min) / (max - min)) * (colorRange.length - 1));
return colorRange[Math.max(0, Math.min(colorRange.length - 1, index))].toString();
}
public static String getBooleanColor(boolean val) {
return getBooleanColor(val, false);
}
public static String getBooleanColor(boolean val, boolean modified) {
return booleanColorRange[(val ? 2 : 0) + (modified ? 1 : 0)].toString();
}
}
@@ -1,22 +0,0 @@
package mcp.mobius.waila.addons.harvestability.helpers;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
public class KeyHelper {
public static boolean isCtrlKeyDown() {
// prioritize CONTROL, but allow OPTION as well on Mac (note: GuiScreen's isCtrlKeyDown only checks for the
// OPTION key on Mac)
boolean isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
if (!isCtrlKeyDown && Minecraft.isRunningOnMac)
isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA);
return isCtrlKeyDown;
}
public static boolean isShiftKeyDown() {
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}
}
@@ -1,32 +0,0 @@
package mcp.mobius.waila.addons.harvestability.helpers;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class OreHelper {
public static boolean isBlockAnOre(Block block) {
return isBlockAnOre(block, 0);
}
public static boolean isBlockAnOre(Block block, int metadata) {
return isItemAnOre(new ItemStack(block, 1, metadata));
}
public static boolean isItemAnOre(ItemStack itemStack) {
// check the ore dictionary to see if it starts with "ore"
int[] oreIDs = OreDictionary.getOreIDs(itemStack);
for (int oreID : oreIDs) {
if (OreDictionary.getOreName(oreID).startsWith("ore")) return true;
}
// ore in the display name (but not part of another word)
if (itemStack.getDisplayName().matches(".*(^|\\s)([oO]re)($|\\s).*")) return true;
// ore as the start of the unlocalized name
if (itemStack.getUnlocalizedName().startsWith("ore")) return true;
return false;
}
}
@@ -1,52 +0,0 @@
package mcp.mobius.waila.addons.harvestability.helpers;
import java.lang.reflect.Method;
import java.util.List;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.common.Loader;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;
public class StringHelper {
public static Class<?> HarvestLevels = null;
public static Method getHarvestLevelName = null;
static {
try {
HarvestLevels = Class.forName("tconstruct.library.util.HarvestLevels");
getHarvestLevelName = HarvestLevels.getDeclaredMethod("getHarvestLevelName", int.class);
} catch (Exception e) {}
}
public static String getHarvestLevelName(int num) {
if (getHarvestLevelName != null) {
try {
return (String) getHarvestLevelName.invoke(null, num);
} catch (Exception e) {}
}
if (Loader.isModLoaded("IguanaTweaksTConstruct")) return ProxyIguanaTweaks.getHarvestLevelName(num);
String unlocalized = "wailaharvestability.harvestlevel" + (num + 1);
if (StatCollector.canTranslate(unlocalized)) return StatCollector.translateToLocal(unlocalized);
return String.valueOf(num);
}
public static String concatenateStringList(List<String> strings, String separator) {
StringBuilder sb = new StringBuilder();
String sep = "";
for (String s : strings) {
sb.append(sep).append(s);
sep = separator;
}
return sb.toString();
}
public static String stripFormatting(String str) {
return EnumChatFormatting.getTextWithoutFormattingCodes(str);
}
}
@@ -1,115 +0,0 @@
package mcp.mobius.waila.addons.harvestability.helpers;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeHooks;
import cpw.mods.fml.common.Loader;
public class ToolHelper {
// tinkers construct
private static Class<?> HarvestTool = null;
private static Class<?> DualHarvestTool = null;
private static Method getHarvestType = null;
private static Method getSecondHarvestType = null;
public static boolean tinkersConstructLoaded = false;
public static void init() {
if (Loader.isModLoaded("TConstruct")) {
try {
HarvestTool = Class.forName("tconstruct.library.tools.HarvestTool");
DualHarvestTool = Class.forName("tconstruct.library.tools.DualHarvestTool");
getHarvestType = HarvestTool.getDeclaredMethod("getHarvestType");
getSecondHarvestType = DualHarvestTool.getDeclaredMethod("getSecondHarvestType");
getHarvestType.setAccessible(true);
getSecondHarvestType.setAccessible(true);
tinkersConstructLoaded = true;
} catch (Exception e) {
return;
}
}
}
public static boolean hasToolTag(ItemStack itemStack) {
return itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("InfiTool");
}
public static NBTTagCompound getToolTag(ItemStack tool) {
NBTTagCompound tag = null;
if (tool.hasTagCompound()) tag = tool.getTagCompound().getCompoundTag("InfiTool");
return tag;
}
public static int getPrimaryHarvestLevel(NBTTagCompound toolTag) {
return toolTag.getInteger("HarvestLevel");
}
public static int getSecondaryHarvestLevel(NBTTagCompound toolTag) {
return toolTag.getInteger("HarvestLevel2");
}
public static Set<String> getToolClassesOf(ItemStack tool) {
return tool.getItem().getToolClasses(tool);
}
public static boolean isToolOfClass(ItemStack tool, String toolClass) {
return getToolClassesOf(tool).contains(toolClass);
}
public static boolean toolHasAnyToolClass(ItemStack tool) {
return !getToolClassesOf(tool).isEmpty();
}
public static boolean isToolEffectiveAgainst(ItemStack tool, Block block, int metadata, String effectiveToolClass) {
if (tinkersConstructLoaded && HarvestTool.isInstance(tool.getItem())) {
Item item = tool.getItem();
List<String> harvestTypes = new ArrayList<String>();
try {
harvestTypes.add((String) getHarvestType.invoke(item));
} catch (Exception e) {
e.printStackTrace();
tinkersConstructLoaded = false;
}
if (DualHarvestTool.isInstance(item)) {
try {
harvestTypes.add((String) getSecondHarvestType.invoke(item));
} catch (Exception e) {
e.printStackTrace();
tinkersConstructLoaded = false;
}
}
return harvestTypes.contains(effectiveToolClass);
}
return ForgeHooks.isToolEffective(tool, block, metadata)
|| (toolHasAnyToolClass(tool) ? isToolOfClass(tool, effectiveToolClass)
: tool.getItem().getDigSpeed(tool, block, metadata) > 1.5f);
}
public static boolean canToolHarvestLevel(ItemStack tool, Block block, int metadata, int harvestLevel) {
boolean canTinkersToolHarvestBlock = false;
NBTTagCompound toolTag = ToolHelper.getToolTag(tool);
if (toolTag != null) {
int toolHarvestLevel = Math
.max(ToolHelper.getPrimaryHarvestLevel(toolTag), ToolHelper.getSecondaryHarvestLevel(toolTag));
canTinkersToolHarvestBlock = toolHarvestLevel >= harvestLevel;
}
return canTinkersToolHarvestBlock || ForgeHooks.canToolHarvestBlock(block, metadata, tool);
}
public static boolean canToolHarvestBlock(ItemStack tool, Block block, int metadata) {
return block.getMaterial().isToolNotRequired() || tool.func_150998_b(block); // func_150998_b = canHarvestBlock
}
}
@@ -1,33 +0,0 @@
package mcp.mobius.waila.addons.harvestability.proxy;
import java.lang.reflect.Method;
import net.minecraft.block.Block;
import cpw.mods.fml.common.Loader;
public class ProxyCreativeBlocks {
private static Class<?> CreativeBlocks = null;
private static Method isCreativeBlock = null;
static {
if (Loader.isModLoaded("CreativeBlocks")) {
try {
CreativeBlocks = Class.forName("squeek.creativeblocks.CreativeBlocks");
isCreativeBlock = CreativeBlocks.getDeclaredMethod("isCreativeBlock", Block.class, int.class);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static boolean isCreativeBlock(Block block, int meta) {
if (isCreativeBlock != null) {
try {
return (Boolean) isCreativeBlock.invoke(null, block, meta);
} catch (Exception e) {}
}
return false;
}
}
@@ -1,35 +0,0 @@
package mcp.mobius.waila.addons.harvestability.proxy;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
public class ProxyGregTech {
public static final String modID = "gregtech";
public static final String oreBlockID = "gt.blockores";
public static final String oreBlockUniqueIdentifier = modID + ":" + oreBlockID;
public static final String casingID = "gt.blockcasings";
public static final String casingUniqueIdentifier = modID + ":" + casingID;
public static final String machineID = "gt.blockmachines";
public static final String machineUniqueIdentifier = modID + ":" + machineID;
public static boolean isModLoaded = Loader.isModLoaded(modID);
public static boolean isOreBlock(Block block) {
return isModLoaded && GameRegistry.findUniqueIdentifierFor(block).toString().equals(oreBlockUniqueIdentifier);
}
public static boolean isCasing(Block block) {
return isModLoaded && GameRegistry.findUniqueIdentifierFor(block).toString().equals(casingUniqueIdentifier);
}
public static boolean isMachine(Block block) {
return isModLoaded && GameRegistry.findUniqueIdentifierFor(block).toString().equals(machineUniqueIdentifier);
}
public static boolean isGTTool(ItemStack itemStack) {
return isModLoaded && itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("GT.ToolStats");
}
}
@@ -1,30 +0,0 @@
package mcp.mobius.waila.addons.harvestability.proxy;
import java.lang.reflect.Method;
public class ProxyIguanaTweaks {
private static Class<?> HarvestLevels = null;
private static Method proxyGetHarvestLevelName;
public static void init() {
try {
HarvestLevels = Class.forName("iguanaman.iguanatweakstconstruct.util.HarvestLevels");
proxyGetHarvestLevelName = HarvestLevels.getDeclaredMethod("getHarvestLevelName", int.class);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getHarvestLevelName(int num) {
String harvestLevelName = "<Unknown>";
try {
harvestLevelName = (String) proxyGetHarvestLevelName.invoke(null, num);
} catch (Exception e) {
e.printStackTrace();
}
return harvestLevelName;
}
}
@@ -1,6 +1,9 @@
package mcp.mobius.waila.addons.projectred;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
@@ -1,6 +1,8 @@
package mcp.mobius.waila.addons.statues;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.BLUE;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
@@ -1,6 +1,10 @@
package mcp.mobius.waila.addons.stevescarts;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.ArrayList;
import java.util.List;
@@ -1,6 +1,10 @@
package mcp.mobius.waila.addons.stevescarts;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
@@ -1,6 +1,10 @@
package mcp.mobius.waila.addons.stevescarts;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
@@ -1,6 +1,9 @@
package mcp.mobius.waila.addons.thaumcraft;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.AQUA;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -17,6 +20,8 @@ import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerIAspectContainer implements IWailaDataProvider {
@@ -43,15 +48,32 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
List<String> unknownAspects = new ArrayList<>();
int total = 0;
for (int i = 0; i < taglist.tagCount(); i++) {
NBTTagCompound subtag = taglist.getCompoundTagAt(i);
String aspect = subtag.getString("key");
String amount = String.valueOf(subtag.getInteger("value"));
int value = subtag.getInteger("value");
total += value;
String amount = String.valueOf(value);
if (!aspect.equals("???"))
currenttip.add(String.format("%s" + TAB + ALIGNRIGHT + WHITE + "%s", aspect, amount));
else unknownAspects.add(String.format("%s" + TAB + ALIGNRIGHT + WHITE + "%s", aspect, amount));
if (!aspect.equals("???")) currenttip.add(
SpecialChars.getRenderString("waila.tcaspect", aspect) + TAB + ALIGNRIGHT + WHITE + amount);
else unknownAspects.add(
SpecialChars.getRenderString("waila.tcaspect", aspect) + TAB + ALIGNRIGHT + WHITE + amount);
}
String id = tag.getString("WailaID");
if ((id.equals("TileNode") || id.equals("TileExtendedNode") || id.equals("TileJarNode"))
&& (taglist.tagCount() > 10 || total > 300)) {
currenttip.add(
0,
String.format(
AQUA + "%s" + TAB + ALIGNRIGHT + WHITE + "%s",
LangUtil.translateG("hud.msg.tcnodetotalsize"),
total));
}
currenttip.addAll(unknownAspects);
@@ -77,7 +99,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
ItemStack headSlot = player.inventory.armorInventory[3];
if (headSlot == null) return tag;
boolean hasReveal = ThaumcraftModule.IGoggles.isInstance(headSlot.getItem());
boolean hasReveal = ThaumcraftModule.isGoggles.apply(headSlot);
if (!hasReveal) return tag;
Map<String, ?> knownAspects = (Map<String, ?>) ThaumcraftModule.CommonProxy_getKnownAspects
@@ -98,7 +120,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
if (tileAspects.get(o) > 0) {
if (playerAspects.containsKey(o)) {
NBTTagCompound cmptag = new NBTTagCompound();
cmptag.setString("key", (String) ThaumcraftModule.Aspect_getName.invoke(o));
cmptag.setString("key", (String) ThaumcraftModule.Aspect_tag.get(o));
cmptag.setInteger("value", tileAspects.get(o));
aspects.appendTag(cmptag);
} else {
@@ -110,7 +132,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
}
}
} catch (Exception e) {
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
@@ -1,9 +1,13 @@
package mcp.mobius.waila.addons.thaumcraft;
import java.awt.Color;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.function.Function;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import org.apache.logging.log4j.Level;
@@ -28,12 +32,19 @@ public class ThaumcraftModule {
public static Class<?> Aspect = null;
public static Field Aspect_tag = null;
public static Method Aspect_getName = null;
public static Method Aspect_getAspect = null;
public static Method Aspect_getImage = null;
public static Method Aspect_getColor = null;
public static Class<?> CommonProxy = null;
public static Method CommonProxy_getKnownAspects = null;
public static Class<?> IGoggles = null;
public static ResourceLocation unknownAspectTexture = null;
public static Color unknownAspectColor = null;
public static Function<ItemStack, Boolean> isGoggles = stack -> IGoggles.isInstance(stack.getItem());
public static void register() {
try {
Thaumcraft = Class.forName("thaumcraft.common.Thaumcraft");
@@ -53,12 +64,18 @@ public class ThaumcraftModule {
Aspect_tag = Aspect.getDeclaredField("tag");
Aspect_tag.setAccessible(true);
Aspect_getName = Aspect.getDeclaredMethod("getName");
Aspect_getAspect = Aspect.getMethod("getAspect", java.lang.String.class);
Aspect_getImage = Aspect.getDeclaredMethod("getImage");
Aspect_getColor = Aspect.getDeclaredMethod("getColor");
CommonProxy = Class.forName("thaumcraft.common.CommonProxy");
CommonProxy_getKnownAspects = CommonProxy.getDeclaredMethod("getKnownAspects");
IGoggles = Class.forName("thaumcraft.api.IGoggles");
unknownAspectTexture = new ResourceLocation("thaumcraft", "textures/aspects/_unknown.png");
unknownAspectColor = new Color(0x654242);
ModuleRegistrar.instance().addConfigRemote("Thaumcraft", "thaumcraft.aspects");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), IAspectContainer);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
@@ -0,0 +1,41 @@
package mcp.mobius.waila.addons.thaumcraftGadomancy;
import java.lang.reflect.Field;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
public class GadomancyModule {
public static Class<?> RegisteredEnchantments = null;
public static Field RegisteredEnchantments_revealer = null;
public static int revealerEffectId;
public static void register() {
try {
RegisteredEnchantments = Class.forName("makeo.gadomancy.common.registration.RegisteredEnchantments");
RegisteredEnchantments_revealer = RegisteredEnchantments.getDeclaredField("revealer");
Object revealer = RegisteredEnchantments_revealer.get(null);
revealerEffectId = ((Enchantment) revealer).effectId;
ThaumcraftModule.isGoggles = stack -> ThaumcraftModule.IGoggles.isInstance(stack.getItem())
|| EnchantmentHelper.getEnchantmentLevel(revealerEffectId, stack) > 0;
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[Thaumcraft Gadomancy] Gadomancy mod not found.");
return;
} catch (Exception e) {
Waila.log.log(Level.WARN, "[Thaumcraft Gadomancy] Unhandled exception. {}", e);
return;
}
Waila.log.log(Level.INFO, "Gadomancy mod found.");
}
}
@@ -1,83 +0,0 @@
package mcp.mobius.waila.addons.vanillamc;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.NumberFormat;
import mcp.mobius.waila.api.ProbeMode;
import mcp.mobius.waila.api.elements.IProbeDataProvider;
import mcp.mobius.waila.api.elements.IProbeInfo;
import mcp.mobius.waila.api.elements.ITextStyle;
import mcp.mobius.waila.overlay.DisplayUtil;
/**
* Example class for testing various elements
*/
public class HUDElementHandlerFurnace implements IProbeDataProvider {
@Override
public void addProbeInfo(ProbeMode probeMode, ItemStack itemStack, IProbeInfo probeInfo, IWailaDataAccessor data,
IWailaConfigHandler config) {
int cookTime = data.getNBTData().getShort("CookTime");
if (cookTime != 0) {
cookTime = Math.round(cookTime / 20.0f);
probeInfo.vertical().progress(
cookTime,
10,
probeInfo.defaultProgressStyle().text("Smelting: " + cookTime + " / 10 s").filledColor(0xFF4CBB17)
.alternateFilledColor(0xFF4CBB17).borderColor(0xFF555555)
.numberFormat(NumberFormat.COMMAS));
}
if (probeMode != ProbeMode.EXTENDED) {
return;
}
int burnTime = data.getNBTData().getInteger("BurnTime") / 20;
if (burnTime > 0) {
probeInfo.horizontal().text("Burn")
.item(new ItemStack(Blocks.fire), probeInfo.defaultItemStyle().width(8).height(8))
.text(": " + burnTime + " " + "Seconds Remaining");
}
ItemStack[] items = new ItemStack[3];
NBTTagList itemsTag = data.getNBTData().getTagList("Items", 10);
for (int i = 0; i < itemsTag.tagCount(); i++) {
NBTTagCompound itemTag = itemsTag.getCompoundTagAt(i);
byte slot = itemTag.getByte("Slot");
if (slot >= 0 && slot < items.length) {
items[slot] = ItemStack.loadItemStackFromNBT(itemTag);
}
}
ITextStyle itemPaddedStyle = probeInfo.defaultTextStyle().vPadding(2);
IProbeInfo itemSection = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(0xff00ffff));
if (items[0] != null) {
itemSection.horizontal().text("In: ", itemPaddedStyle)
.item(items[0], probeInfo.defaultItemStyle().width(10).height(10)).text(
" " + DisplayUtil.itemDisplayNameShort(items[0]) + " x" + items[0].stackSize,
itemPaddedStyle);
}
if (items[2] != null) {
itemSection.horizontal().text("Out: ", itemPaddedStyle)
.item(items[2], probeInfo.defaultItemStyle().width(10).height(10)).text(
" " + DisplayUtil.itemDisplayNameShort(items[2]) + " x" + items[2].stackSize,
itemPaddedStyle);
}
if (items[1] != null) {
itemSection.horizontal().text("Fuel: ", itemPaddedStyle)
.item(items[1], probeInfo.defaultItemStyle().width(10).height(10)).text(
" " + DisplayUtil.itemDisplayNameShort(items[1]) + " x" + items[1].stackSize,
itemPaddedStyle);
}
}
}
@@ -1,18 +0,0 @@
package mcp.mobius.waila.addons.vanillamc;
import net.minecraft.block.BlockFurnace;
import cpw.mods.fml.common.event.FMLInterModComms;
import mcp.mobius.waila.api.elements.IProbeRegistrar;
// example class for registering IMC
public class TestRegistrar {
public static void callbackRegister(IProbeRegistrar register) {
register.registerProbeProvider(new HUDElementHandlerFurnace(), BlockFurnace.class);
}
public static void init() {
FMLInterModComms.sendMessage("Waila", "elementregister", TestRegistrar.class.getName() + ".callbackRegister");
}
}
@@ -49,6 +49,4 @@ public interface IWailaDataAccessor {
ForgeDirection getSide();
ItemStack getStack();
float getBlockBreakDamage();
}
@@ -62,6 +62,35 @@ public interface IWailaDataProvider {
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config);
/**
* Callback used to determine if there is extended information to display for the Body section. If this returns
* true, Waila will either display the "Hold <KEY> for more info" prompt or call getWailaAdvancedBody if the key is
* being held.
*
* @param itemStack Current block scanned, in ItemStack form.
* @param accessor Contains most of the relevant information about the current environment.
* @param config Current configuration of Waila.
* @return True if advanced body information is available, false otherwise.
*/
default boolean hasAdvancedBody(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return false; // Default to false for backward compatibility
}
/**
* Callback used to add the extended lines to the Body section of the tooltip. This method is ONLY called if
* hasAdvancedBody returns true AND the player is holding the configured key for advanced tooltips.
*
* @param itemStack Current block scanned, in ItemStack form.
* @param currenttip The current list of tooltip lines, including the normal body.
* @param accessor Contains most of the relevant information about the current environment.
* @param config Current configuration of Waila.
* @return Modified input currenttip with advanced information appended.
*/
default List<String> getWailaAdvancedBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip; // Default to returning the unmodified list
}
/**
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider}
@@ -1,6 +1,6 @@
package mcp.mobius.waila.api;
import java.awt.*;
import java.awt.Dimension;
public interface IWailaTooltipRenderer {
@@ -1,11 +0,0 @@
package mcp.mobius.waila.api;
public enum NumberFormat {
FULL,
COMPACT,
COMMAS,
NONE;
private NumberFormat() {}
}
@@ -1,7 +0,0 @@
package mcp.mobius.waila.api;
public enum ProbeMode {
NORMAL, // Normal display. What a user expects to see
EXTENDED, // Extended. This is used when the player is sneaking
DEBUG // Creative only. This is used when the player holds a creative probe
}
@@ -1,7 +0,0 @@
package mcp.mobius.waila.api.elements;
public enum ElementAlignment {
ALIGN_TOPLEFT,
ALIGN_CENTER,
ALIGN_BOTTOMRIGHT
}
@@ -1,10 +0,0 @@
package mcp.mobius.waila.api.elements;
public interface IElement {
void render(int var1, int var2);
int getWidth();
int getHeight();
}
@@ -1,12 +0,0 @@
package mcp.mobius.waila.api.elements;
public interface IItemStyle {
IItemStyle width(int var1);
IItemStyle height(int var1);
int getWidth();
int getHeight();
}
@@ -1,16 +0,0 @@
package mcp.mobius.waila.api.elements;
public interface ILayoutStyle {
ILayoutStyle borderColor(Integer var1);
ILayoutStyle spacing(int var1);
ILayoutStyle alignment(ElementAlignment var1);
Integer getBorderColor();
int getSpacing();
ElementAlignment getAlignment();
}
@@ -1,23 +0,0 @@
package mcp.mobius.waila.api.elements;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.ProbeMode;
public interface IProbeDataProvider {
default void addProbeInfo(ProbeMode probeMode, ItemStack itemStack, IProbeInfo probeInfo,
IWailaDataAccessor accessor, IWailaConfigHandler config) {}
default NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
}
@@ -1,50 +0,0 @@
package mcp.mobius.waila.api.elements;
import net.minecraft.item.ItemStack;
public interface IProbeInfo {
/**
* Create a default layout style for the horizontal or vertical elements
*/
ILayoutStyle defaultLayoutStyle();
/**
* Create a default style for the progress bar
*/
IProgressStyle defaultProgressStyle();
/**
* Create a default style for the text element
*/
ITextStyle defaultTextStyle();
/**
* Create a default style for the item element
*/
IItemStyle defaultItemStyle();
IProbeInfo text(String text, ITextStyle style);
IProbeInfo text(String text);
IProbeInfo vertical(ILayoutStyle style);
IProbeInfo vertical();
IProbeInfo horizontal(ILayoutStyle style);
IProbeInfo horizontal();
IProbeInfo item(ItemStack stack, IItemStyle style);
IProbeInfo item(ItemStack stack);
IProbeInfo progress(int var1, int var2, IProgressStyle var3);
IProbeInfo progress(int var1, int var2);
IProbeInfo progress(long var1, long var3, IProgressStyle var5);
IProbeInfo progress(long var1, long var3);
}
@@ -1,6 +0,0 @@
package mcp.mobius.waila.api.elements;
public interface IProbeRegistrar {
void registerProbeProvider(IProbeDataProvider dataProvider, Class<?> block);
}
@@ -1,65 +0,0 @@
package mcp.mobius.waila.api.elements;
import mcp.mobius.waila.api.NumberFormat;
public interface IProgressStyle {
/// The color that is used for the border of the progress bar
IProgressStyle borderColor(int c);
/// The color that is used for the background of the progress bar
IProgressStyle backgroundColor(int c);
/// The color that is used for the filled part of the progress bar
IProgressStyle filledColor(int c);
/// If this is different from the filledColor then the fill color will alternate
IProgressStyle alternateFilledColor(int c);
/// If true then text is shown inside the progress bar
IProgressStyle showText(boolean b);
/// The number format to use for the text inside the progress bar
IProgressStyle numberFormat(NumberFormat f);
IProgressStyle text(String text);
IProgressStyle textColor(int color);
IProgressStyle textShadow(boolean b);
/// If the progressbar is a lifebar then this is the maximum width
IProgressStyle width(int w);
IProgressStyle height(int h);
IProgressStyle lifeBar(boolean b);
IProgressStyle armorBar(boolean b);
int getBorderColor();
int getBackgroundColor();
int getFilledColor();
int getAlternatefilledColor();
boolean isShowText();
NumberFormat getNumberFormat();
String getText();
int getTextColor();
boolean isTextShadow();
int getWidth();
int getHeight();
boolean isLifeBar();
boolean isArmorBar();
}
@@ -1,61 +0,0 @@
package mcp.mobius.waila.api.elements;
import mcp.mobius.waila.api.impl.elements.TextStyle;
public interface ITextStyle {
/// Allows copying the state for easier template creation
ITextStyle copy();
default ITextStyle padding(int padding) {
return topPadding(padding).bottomPadding(padding).leftPadding(padding).rightPadding(padding);
}
default ITextStyle vPadding(int padding) {
return topPadding(padding).bottomPadding(padding);
}
default ITextStyle hPadding(int padding) {
return leftPadding(padding).rightPadding(padding);
}
ITextStyle topPadding(int padding);
ITextStyle bottomPadding(int padding);
ITextStyle leftPadding(int padding);
ITextStyle rightPadding(int padding);
default ITextStyle bounds(Integer width, Integer height) {
return width(width).height(height);
}
ITextStyle width(Integer width);
ITextStyle height(Integer height);
ITextStyle alignment(ElementAlignment align);
TextStyle color(int color);
TextStyle shadow(boolean shadow);
int getLeftPadding();
int getRightPadding();
int getTopPadding();
int getBottomPadding();
Integer getWidth();
Integer getHeight();
ElementAlignment getAlignment();
int getColor();
boolean getShadow();
}
@@ -134,6 +134,10 @@ public class ConfigHandler implements IWailaConfigHandler {
return getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
}
public boolean showIcon() {
return getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOWICON, true);
}
/* Default config loading */
public void loadDefaultConfig(FMLPreInitializationEvent event) {
@@ -145,7 +149,7 @@ public class ConfigHandler implements IWailaConfigHandler {
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_METADATA, false);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NEWFILTERS, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOWICON, true);
OverlayConfig.posX = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 5000).getInt();
OverlayConfig.posY = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSY, 100).getInt();
@@ -1,7 +1,6 @@
package mcp.mobius.waila.api.impl;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -22,8 +21,6 @@ import mcp.mobius.waila.utils.NBTUtil;
public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAccessor, IWailaEntityAccessor {
private static final Minecraft mc = Minecraft.getMinecraft();
public World world;
public EntityPlayer player;
public MovingObjectPosition mop;
@@ -40,7 +37,6 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
public ItemStack stack;
public static DataAccessorCommon instance = new DataAccessorCommon();
public float blockBreakDamage;
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop) {
this.set(_world, _player, _mop, null, 0.0);
@@ -59,7 +55,6 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
this.entity = null;
this.blockID = Block.getIdFromBlock(this.block);
this.blockResource = GameData.getBlockRegistry().getNameForObject(this.block);
this.blockBreakDamage = mc.playerController.curBlockDamageMP;
try {
this.stack = new ItemStack(this.block, 1, this.metadata);
} catch (Exception ignored) {}
@@ -205,11 +200,6 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
return this.stack;
}
@Override
public float getBlockBreakDamage() {
return this.blockBreakDamage;
}
public boolean isTimeElapsed(long time) {
return System.currentTimeMillis() - this.timeLastUpdate >= time;
}
@@ -6,23 +6,24 @@ import java.util.Map;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaBlock;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaEntityProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.cbcore.Layout;
import mcp.mobius.waila.client.KeyEvent;
import mcp.mobius.waila.network.Message0x01TERequest;
import mcp.mobius.waila.network.Message0x03EntRequest;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.WailaExceptionHandler;
public class MetaDataProvider {
@@ -68,9 +69,7 @@ public class MetaDataProvider {
if (accessor.getTileEntity() != null && Waila.instance.serverPresent
&& accessor.isTimeElapsed(250)
&& ConfigHandler.instance().showTooltip()
&& ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
&& ConfigHandler.instance().showTooltip()) {
accessor.resetTimer();
HashSet<String> keys = new HashSet<>();
@@ -82,8 +81,7 @@ public class MetaDataProvider {
if (!keys.isEmpty() || ModuleRegistrar.instance().hasNBTProviders(block)
|| ModuleRegistrar.instance().hasNBTProviders(accessor.getTileEntity()))
WailaPacketHandler.INSTANCE
.sendToServer(new Message0x01TERequest(accessor.getTileEntity(), keys, false));
WailaPacketHandler.INSTANCE.sendToServer(new Message0x01TERequest(accessor.getTileEntity(), keys));
} else if (accessor.getTileEntity() != null && !Waila.instance.serverPresent
&& accessor.isTimeElapsed(250)
@@ -151,11 +149,29 @@ public class MetaDataProvider {
}
if (layout == Layout.BODY) for (List<IWailaDataProvider> providersList : bodyBlockProviders.values()) {
boolean hasAdvancedBodyAvailable = false;
final boolean isAdvancedKeyDown = KeyEvent.key_show_advanced.getIsKeyPressed();
for (IWailaDataProvider dataProvider : providersList) try {
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
if (dataProvider.hasAdvancedBody(itemStack, accessor, ConfigHandler.instance())) {
hasAdvancedBodyAvailable = true;
if (isAdvancedKeyDown) {
currenttip = dataProvider
.getWailaAdvancedBody(itemStack, currenttip, accessor, ConfigHandler.instance());
}
}
} catch (Throwable e) {
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
if (hasAdvancedBodyAvailable && !isAdvancedKeyDown) {
String keyName = GameSettings.getKeyDisplayString(KeyEvent.key_show_advanced.getKeyCode());
currenttip.add(LangUtil.translateG("hud.msg.holdkeymoreinfo", keyName));
}
}
if (layout == Layout.FOOTER) for (List<IWailaDataProvider> providersList : tailBlockProviders.values()) {
for (IWailaDataProvider dataProvider : providersList) try {
@@ -4,11 +4,24 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import au.com.bytecode.opencsv.CSVReader;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.*;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaEntityProvider;
import mcp.mobius.waila.api.IWailaFMPDecorator;
import mcp.mobius.waila.api.IWailaFMPProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.IWailaSummaryProvider;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.utils.Constants;
@@ -1,7 +1,12 @@
package mcp.mobius.waila.api.impl;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import mcp.mobius.waila.api.ITaggedList;
@@ -1,126 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.Gui;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.elements.*;
public abstract class AbstractElementPanel implements IElement, IProbeInfo {
protected List<IElement> children = new ArrayList();
protected Integer borderColor;
protected int spacing;
protected ElementAlignment alignment;
public void render(int x, int y) {
if (this.borderColor != null) {
int w = this.getWidth();
int h = this.getHeight();
drawHorizontalLine(x, y, x + w - 1, this.borderColor);
drawHorizontalLine(x, y + h - 1, x + w - 1, this.borderColor);
drawVerticalLine(x, y, y + h - 1, this.borderColor);
drawVerticalLine(x + w - 1, y, y + h, this.borderColor);
}
}
public AbstractElementPanel(Integer borderColor, int spacing, ElementAlignment alignment) {
this.borderColor = borderColor;
this.spacing = spacing;
this.alignment = alignment;
}
public IProbeInfo text(String text, ITextStyle style) {
this.children.add(new ElementText(text, style));
return this;
}
public IProbeInfo text(String text) {
this.children.add(new ElementText(text));
return this;
}
public IProbeInfo vertical(ILayoutStyle style) {
ElementVertical e = new ElementVertical(style.getBorderColor(), style.getSpacing(), style.getAlignment());
this.children.add(e);
return e;
}
public IProbeInfo vertical() {
ElementVertical e = new ElementVertical(null, 2, ElementAlignment.ALIGN_TOPLEFT);
this.children.add(e);
return e;
}
public IProbeInfo horizontal(ILayoutStyle style) {
ElementHorizontal e = new ElementHorizontal(style.getBorderColor(), style.getSpacing(), style.getAlignment());
this.children.add(e);
return e;
}
public IProbeInfo horizontal() {
ElementHorizontal e = new ElementHorizontal((Integer) null, this.spacing, ElementAlignment.ALIGN_TOPLEFT);
this.children.add(e);
return e;
}
public IProbeInfo item(ItemStack stack, IItemStyle style) {
this.children.add(new ElementItemStack(stack, style));
return this;
}
public IProbeInfo item(ItemStack stack) {
return this.item(stack, new ItemStyle());
}
public IProbeInfo progress(int current, int max) {
return this.progress(current, max, new ProgressStyle());
}
public IProbeInfo progress(int current, int max, IProgressStyle style) {
this.children.add(new ElementProgress((long) current, (long) max, style));
return this;
}
public IProbeInfo progress(long current, long max) {
return this.progress(current, max, new ProgressStyle());
}
public IProbeInfo progress(long current, long max, IProgressStyle style) {
this.children.add(new ElementProgress(current, max, style));
return this;
}
// tmp
public static void drawHorizontalLine(int x1, int y1, int x2, int color) {
Gui.drawRect(x1, y1, x2, y1 + 1, color);
}
// tmp
public static void drawVerticalLine(int x1, int y1, int y2, int color) {
Gui.drawRect(x1, y1, x1 + 1, y2, color);
}
@Override
public ILayoutStyle defaultLayoutStyle() {
return new LayoutStyle();
}
@Override
public IProgressStyle defaultProgressStyle() {
return new ProgressStyle();
}
@Override
public ITextStyle defaultTextStyle() {
return new TextStyle();
}
@Override
public IItemStyle defaultItemStyle() {
return new ItemStyle();
}
}
@@ -1,64 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import mcp.mobius.waila.api.elements.ElementAlignment;
import mcp.mobius.waila.api.elements.IElement;
public class ElementHorizontal extends AbstractElementPanel {
public static final int SPACING = 5;
public ElementHorizontal(Integer borderColor, int spacing, ElementAlignment alignment) {
super(borderColor, spacing, alignment);
}
@Override
public void render(int x, int y) {
super.render(x, y);
if (borderColor != null) {
x += 3;
y += 3;
}
int totHeight = getHeight();
for (IElement element : children) {
int h = element.getHeight();
int cy = y;
switch (alignment) {
case ALIGN_TOPLEFT:
break;
case ALIGN_CENTER:
cy = y + (totHeight - h) / 2;
break;
case ALIGN_BOTTOMRIGHT:
cy = y + totHeight - h;
break;
}
element.render(x, cy);
x += element.getWidth() + spacing;
}
}
private int getBorderSpacing() {
return borderColor == null ? 0 : 6;
}
@Override
public int getWidth() {
int w = 0;
for (IElement element : children) {
w += element.getWidth();
}
return w + spacing * (children.size() - 1) + getBorderSpacing();
}
@Override
public int getHeight() {
int h = 0;
for (IElement element : children) {
int hh = element.getHeight();
if (hh > h) {
h = hh;
}
}
return h + getBorderSpacing();
}
}
@@ -1,37 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import mcp.mobius.waila.api.elements.IElement;
import mcp.mobius.waila.api.elements.IItemStyle;
import mcp.mobius.waila.overlay.DisplayUtil;
public class ElementItemStack implements IElement {
private final ItemStack itemStack;
private final IItemStyle style;
public ElementItemStack(ItemStack itemStack, IItemStyle style) {
this.itemStack = itemStack;
this.style = style;
}
@Override
public void render(int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
DisplayUtil.elementRenderStack(x, y, itemStack, style);
}
@Override
public int getWidth() {
return style.getWidth();
}
@Override
public int getHeight() {
return style.getHeight();
}
}
@@ -1,117 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import java.text.DecimalFormat;
import mcp.mobius.waila.api.NumberFormat;
import mcp.mobius.waila.api.elements.IElement;
import mcp.mobius.waila.api.elements.IProgressStyle;
import mcp.mobius.waila.overlay.DisplayUtil;
public class ElementProgress implements IElement {
private final long current;
private final long max;
private final IProgressStyle style;
public ElementProgress(long current, long max, IProgressStyle style) {
this.current = current;
this.max = max;
this.style = style;
}
private static DecimalFormat dfCommas = new DecimalFormat("###,###");
/**
* If the suffix starts with 'm' we can possibly drop that
*/
public static String format(long in, NumberFormat style, String suffix) {
switch (style) {
case FULL:
return Long.toString(in) + suffix;
case COMPACT: {
int unit = 1000;
if (in < unit) {
return Long.toString(in) + " " + suffix;
}
int exp = (int) (Math.log(in) / Math.log(unit));
char pre;
if (suffix.startsWith("m")) {
suffix = suffix.substring(1);
if (exp - 2 >= 0) {
pre = "kMGTPE".charAt(exp - 2);
return String.format("%.1f %s", in / Math.pow(unit, exp), pre) + suffix;
} else {
return String.format("%.1f %s", in / Math.pow(unit, exp), suffix);
}
} else {
pre = "kMGTPE".charAt(exp - 1);
return String.format("%.1f %s", in / Math.pow(unit, exp), pre) + suffix;
}
}
case COMMAS:
return dfCommas.format(in) + suffix;
case NONE:
return suffix;
}
return Long.toString(in);
}
@Override
public void render(int x, int y) {
render(style, current, max, x, y, getWidth(), getHeight());
}
private static void render(IProgressStyle style, long current, long max, int x, int y, int w, int h) {
DisplayUtil.drawThickBeveledBox(
x,
y,
x + w,
y + h,
1,
style.getBorderColor(),
style.getBorderColor(),
style.getBackgroundColor());
if (current > 0L && max > 0L) {
int dx = (int) Math.min(current * (long) (w - 2) / max, (long) (w - 2));
if (style.getFilledColor() == style.getAlternatefilledColor()) {
if (dx > 0) {
DisplayUtil.drawThickBeveledBox(
x + 1,
y + 1,
x + dx + 1,
y + h - 1,
1,
style.getFilledColor(),
style.getFilledColor(),
style.getFilledColor());
}
} else {
for (int xx = x + 1; xx <= x + dx + 1; ++xx) {
int color = (xx & 1) == 0 ? style.getFilledColor() : style.getAlternatefilledColor();
DisplayUtil.drawVerticalLine(xx, y + 1, y + h - 1, color);
}
}
}
if (style.isShowText()) {
DisplayUtil.drawString(style.getText(), x + 3, y + 2, style.getTextColor(), style.isTextShadow());
}
}
@Override
public int getWidth() {
if (style.isLifeBar()) {
if (current * 4 >= style.getWidth()) {
return 100;
} else {
return (int) (current * 4 + 2);
}
}
return style.getWidth();
}
@Override
public int getHeight() {
return style.getHeight();
}
}
@@ -1,68 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import net.minecraft.client.Minecraft;
import mcp.mobius.waila.api.elements.IElement;
import mcp.mobius.waila.api.elements.ITextStyle;
import mcp.mobius.waila.overlay.DisplayUtil;
public class ElementText implements IElement {
private final String text;
private final ITextStyle style;
private static final int DEFAULT_HEIGHT = 10;
public ElementText(String text) {
this(text, new TextStyle());
}
public ElementText(String text, ITextStyle style) {
this.text = text;
this.style = style;
}
public void render(int x, int y) {
int width = getTextWidth();
switch (style.getAlignment()) {
case ALIGN_BOTTOMRIGHT -> DisplayUtil.drawString(
text,
(x + getInternalWidth() - width) + style.getLeftPadding(),
y + style.getTopPadding(),
style.getColor(),
style.getShadow());
case ALIGN_CENTER -> DisplayUtil.drawString(
text,
((x + (getInternalWidth() / 2)) - (width / 2)) + style.getLeftPadding(),
y + style.getTopPadding(),
style.getColor(),
style.getShadow());
case ALIGN_TOPLEFT -> DisplayUtil.drawString(
text,
x + style.getLeftPadding(),
y + style.getTopPadding(),
style.getColor(),
style.getShadow());
}
}
public int getTextWidth() {
return Minecraft.getMinecraft().fontRenderer.getStringWidth(text);
}
protected int getInternalWidth() {
return (style.getWidth() != null ? style.getWidth() : getTextWidth());
}
@Override
public int getWidth() {
return style.getLeftPadding() + (style.getWidth() != null ? style.getWidth() : getTextWidth())
+ style.getRightPadding();
}
@Override
public int getHeight() {
return style.getTopPadding() + (style.getHeight() != null ? style.getHeight() : DEFAULT_HEIGHT)
+ style.getBottomPadding();
}
}
@@ -1,73 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import java.util.Iterator;
import mcp.mobius.waila.api.elements.ElementAlignment;
import mcp.mobius.waila.api.elements.IElement;
public class ElementVertical extends AbstractElementPanel {
public ElementVertical(Integer borderColor, int spacing, ElementAlignment alignment) {
super(borderColor, spacing, alignment);
}
public void render(int x, int y) {
super.render(x, y);
if (this.borderColor != null) {
x += 3;
y += 3;
}
int totWidth = this.getWidth();
IElement element;
for (Iterator var4 = this.children.iterator(); var4.hasNext(); y += element.getHeight() + this.spacing) {
element = (IElement) var4.next();
int w = element.getWidth();
int cx = x;
switch (this.alignment) {
case ALIGN_TOPLEFT:
default:
break;
case ALIGN_CENTER:
cx = x + (totWidth - w) / 2;
break;
case ALIGN_BOTTOMRIGHT:
cx = x + totWidth - w;
}
element.render(cx, y);
}
}
private int getBorderSpacing() {
return this.borderColor == null ? 0 : 6;
}
public int getHeight() {
int h = 0;
IElement element;
for (Iterator var2 = this.children.iterator(); var2.hasNext(); h += element.getHeight()) {
element = (IElement) var2.next();
}
return h + this.spacing * (this.children.size() - 1) + this.getBorderSpacing();
}
public int getWidth() {
int w = 0;
Iterator var2 = this.children.iterator();
while (var2.hasNext()) {
IElement element = (IElement) var2.next();
int ww = element.getWidth();
if (ww > w) {
w = ww;
}
}
return w + this.getBorderSpacing();
}
}
@@ -1,34 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import mcp.mobius.waila.api.elements.IItemStyle;
public class ItemStyle implements IItemStyle {
private int width = 20;
private int height = 20;
public ItemStyle(int w, int h) {
width = w;
height = h;
}
public ItemStyle() {}
public IItemStyle width(int w) {
this.width = w;
return this;
}
public IItemStyle height(int h) {
this.height = h;
return this;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
}
@@ -1,43 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import mcp.mobius.waila.api.elements.ElementAlignment;
import mcp.mobius.waila.api.elements.ILayoutStyle;
public class LayoutStyle implements ILayoutStyle {
private Integer borderColor = null;
private ElementAlignment alignment;
private int spacing;
public LayoutStyle() {
this.alignment = ElementAlignment.ALIGN_TOPLEFT;
this.spacing = -1;
}
public ILayoutStyle alignment(ElementAlignment alignment) {
this.alignment = alignment;
return this;
}
public ElementAlignment getAlignment() {
return this.alignment;
}
public LayoutStyle borderColor(Integer c) {
this.borderColor = c;
return this;
}
public LayoutStyle spacing(int f) {
this.spacing = f;
return this;
}
public Integer getBorderColor() {
return this.borderColor;
}
public int getSpacing() {
return this.spacing;
}
}
@@ -1,99 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import java.util.HashSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.addons.DefaultProbeInfoProvider;
import mcp.mobius.waila.api.ProbeMode;
import mcp.mobius.waila.api.elements.IProbeDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.network.Message0x01TERequest;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.WailaExceptionHandler;
public class MetaProbeDataProvider {
public ProbeInfo handleBlockElementData(ItemStack itemStack, World world, EntityPlayer player,
MovingObjectPosition mop, DataAccessorCommon accessor) {
Block block = accessor.getBlock();
ProbeInfo probeInfo = new ProbeInfo();
DefaultProbeInfoProvider.addStandardBlockInfo(itemStack, probeInfo, accessor, ConfigHandler.instance());
if (!ModuleProbeRegistrar.instance().hasProviders(block)
&& !ModuleProbeRegistrar.instance().hasProviders(accessor.getTileEntity())) {
return probeInfo;
}
ProbeMode probeMode = player.isSneaking() ? ProbeMode.EXTENDED
: player.capabilities.isCreativeMode ? ProbeMode.DEBUG : ProbeMode.NORMAL;
if (accessor.getTileEntity() != null && Waila.instance.serverPresent
&& accessor.isTimeElapsed(250)
&& ConfigHandler.instance().showTooltip()
&& !ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
accessor.resetTimer();
HashSet<String> keys = new HashSet<>();
if (ModuleProbeRegistrar.instance().hasProviders(block)
|| ModuleProbeRegistrar.instance().hasProviders(accessor.getTileEntity()))
WailaPacketHandler.INSTANCE
.sendToServer(new Message0x01TERequest(accessor.getTileEntity(), keys, true));
} else if (accessor.getTileEntity() != null && !Waila.instance.serverPresent
&& accessor.isTimeElapsed(250)
&& ConfigHandler.instance().showTooltip()) {
try {
NBTTagCompound tag = new NBTTagCompound();
accessor.getTileEntity().writeToNBT(tag);
accessor.setNBTData(tag);
} catch (Exception e) {
WailaExceptionHandler.handleErr(e, this.getClass().getName(), null);
}
}
/* Lookup by class (for blocks) */
if (ModuleProbeRegistrar.instance().hasProviders(block)) {
List<IProbeDataProvider> probeDataProviders = ModuleProbeRegistrar.instance().getProviders(block);
for (IProbeDataProvider probeDataProvider : probeDataProviders) {
probeDataProvider.addProbeInfo(probeMode, itemStack, probeInfo, accessor, ConfigHandler.instance());
}
}
/* Lookup by class (for tileentities) */
if (ModuleProbeRegistrar.instance().hasProviders(accessor.getTileEntity())) {
List<IProbeDataProvider> probeDataProviders = ModuleProbeRegistrar.instance()
.getProviders(accessor.getTileEntity());
for (IProbeDataProvider probeDataProvider : probeDataProviders) {
probeDataProvider.addProbeInfo(probeMode, itemStack, probeInfo, accessor, ConfigHandler.instance());
}
}
return probeInfo;
}
// append legacy Tooltip into new ProbeInfo if possible
public ProbeInfo appendTooltipData(ProbeInfo probeInfo, List<String> tooltip, ItemStack itemStack,
DataAccessorCommon accessor) {
if (tooltip.isEmpty()) {
return probeInfo;
}
for (String s : tooltip) {
probeInfo.text(s);
}
return probeInfo;
}
}
@@ -1,64 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import mcp.mobius.waila.api.elements.IProbeDataProvider;
import mcp.mobius.waila.api.elements.IProbeRegistrar;
public class ModuleProbeRegistrar implements IProbeRegistrar {
private static ModuleProbeRegistrar instance = null;
public LinkedHashMap<Class<?>, ArrayList<IProbeDataProvider>> probeProviders = new LinkedHashMap<>();;
public LinkedHashMap<String, String> IMCRequests = new LinkedHashMap<>();
private ModuleProbeRegistrar() {
instance = this;
}
public static ModuleProbeRegistrar instance() {
if (ModuleProbeRegistrar.instance == null) ModuleProbeRegistrar.instance = new ModuleProbeRegistrar();
return ModuleProbeRegistrar.instance;
}
/* IMC HANDLING */
public void addIMCRequest(String method, String modname) {
this.IMCRequests.put(method, modname);
}
@Override
public void registerProbeProvider(IProbeDataProvider dataProvider, Class<?> block) {
this.registerProvider(dataProvider, block, this.probeProviders);
}
private void registerProvider(IProbeDataProvider dataProvider, Class<?> clazz,
LinkedHashMap<Class<?>, ArrayList<IProbeDataProvider>> target) {
if (clazz == null || dataProvider == null) throw new RuntimeException(
"Trying to register a null provider or null block ! Please check the stacktrace to know what was the original registration method.");
if (!target.containsKey(clazz)) target.put(clazz, new ArrayList<>());
ArrayList<IProbeDataProvider> providers = target.get(clazz);
if (providers.contains(dataProvider)) return;
target.get(clazz).add(dataProvider);
}
public boolean hasProviders(Object obj) {
for (Class clazz : probeProviders.keySet()) if (clazz.isInstance(obj)) return true;
return false;
}
public List<IProbeDataProvider> getProviders(Object obj) {
List<IProbeDataProvider> returnList = new ArrayList<>();
for (Class clazz : probeProviders.keySet()) {
if (clazz.isInstance(obj)) returnList.addAll(probeProviders.get(clazz));
}
return returnList;
}
}
@@ -1,21 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import java.util.List;
import mcp.mobius.waila.api.elements.ElementAlignment;
import mcp.mobius.waila.api.elements.IElement;
public class ProbeInfo extends ElementVertical {
public List<IElement> getElements() {
return this.children;
}
public ProbeInfo() {
super(null, 2, ElementAlignment.ALIGN_TOPLEFT);
}
public void removeElement(IElement element) {
this.getElements().remove(element);
}
}
@@ -1,142 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import mcp.mobius.waila.api.NumberFormat;
import mcp.mobius.waila.api.elements.IProgressStyle;
public class ProgressStyle implements IProgressStyle {
private int borderColor = -1;
private int backgroundColor = -16777216;
private int filledColor = -5592406;
private int alternatefilledColor = -5592406;
private boolean showText = true;
private String text;
private int textColor = 0xffffffff;
private boolean textShadow = true;
private int width = 100;
private int height = 12;
private boolean lifeBar = false;
private boolean armorBar = false;
private NumberFormat numberFormat;
public ProgressStyle() {
this.numberFormat = NumberFormat.COMPACT;
}
public ProgressStyle borderColor(int c) {
this.borderColor = c;
return this;
}
public ProgressStyle backgroundColor(int c) {
this.backgroundColor = c;
return this;
}
public ProgressStyle filledColor(int c) {
this.filledColor = c;
return this;
}
public ProgressStyle alternateFilledColor(int c) {
this.alternatefilledColor = c;
return this;
}
public ProgressStyle showText(boolean b) {
this.showText = b;
return this;
}
public ProgressStyle numberFormat(NumberFormat f) {
this.numberFormat = f;
return this;
}
public ProgressStyle text(String text) {
this.text = text;
return this;
}
public ProgressStyle textColor(int color) {
this.textColor = color;
return this;
}
public ProgressStyle textShadow(boolean b) {
this.textShadow = b;
return this;
}
public ProgressStyle width(int w) {
this.width = w;
return this;
}
public ProgressStyle height(int h) {
this.height = h;
return this;
}
public IProgressStyle lifeBar(boolean b) {
this.lifeBar = b;
return this;
}
public IProgressStyle armorBar(boolean b) {
this.armorBar = b;
return this;
}
public int getBorderColor() {
return this.borderColor;
}
public int getBackgroundColor() {
return this.backgroundColor;
}
public int getFilledColor() {
return this.filledColor;
}
public int getAlternatefilledColor() {
return this.alternatefilledColor;
}
public boolean isShowText() {
return this.showText;
}
public NumberFormat getNumberFormat() {
return this.numberFormat;
}
public String getText() {
return this.text;
}
public int getTextColor() {
return this.textColor;
}
public boolean isTextShadow() {
return this.textShadow;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
public boolean isLifeBar() {
return this.lifeBar;
}
public boolean isArmorBar() {
return this.armorBar;
}
}
@@ -1,123 +0,0 @@
package mcp.mobius.waila.api.impl.elements;
import mcp.mobius.waila.api.elements.ElementAlignment;
import mcp.mobius.waila.api.elements.ITextStyle;
import mcp.mobius.waila.overlay.OverlayConfig;
public class TextStyle implements ITextStyle {
int top = 0;
int bottom = 0;
int left = 0;
int right = 0;
Integer width = null;
Integer height = null;
ElementAlignment align = ElementAlignment.ALIGN_TOPLEFT;
int color = OverlayConfig.fontcolor;
boolean shadow = false;
@Override
public ITextStyle copy() {
return new TextStyle().bottomPadding(bottom).leftPadding(left).rightPadding(right).topPadding(top)
.bounds(width, height).alignment(align);
}
@Override
public TextStyle topPadding(int padding) {
top = padding;
return this;
}
@Override
public TextStyle bottomPadding(int padding) {
bottom = padding;
return this;
}
@Override
public TextStyle leftPadding(int padding) {
left = padding;
return this;
}
@Override
public TextStyle rightPadding(int padding) {
right = padding;
return this;
}
@Override
public TextStyle alignment(ElementAlignment align) {
this.align = align;
return this;
}
@Override
public TextStyle width(Integer width) {
this.width = width;
return this;
}
@Override
public TextStyle height(Integer height) {
this.height = height;
return this;
}
@Override
public TextStyle color(int color) {
this.color = color;
return this;
}
@Override
public TextStyle shadow(boolean shadow) {
this.shadow = shadow;
return this;
}
@Override
public int getLeftPadding() {
return left;
}
@Override
public int getRightPadding() {
return right;
}
@Override
public int getTopPadding() {
return top;
}
@Override
public int getBottomPadding() {
return bottom;
}
@Override
public ElementAlignment getAlignment() {
return align;
}
@Override
public Integer getWidth() {
return width;
}
@Override
public Integer getHeight() {
return height;
}
@Override
public int getColor() {
return color;
}
@Override
public boolean getShadow() {
return shadow;
}
}
@@ -10,8 +10,10 @@ import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
import mcp.mobius.waila.handlers.nei.NEIHandler;
import mcp.mobius.waila.utils.Constants;
public class KeyEvent {
@@ -21,6 +23,7 @@ public class KeyEvent {
public static KeyBinding key_liquid;
public static KeyBinding key_recipe;
public static KeyBinding key_usage;
public static KeyBinding key_show_advanced;
public KeyEvent() {
ClientRegistry
@@ -33,6 +36,8 @@ public class KeyEvent {
key_recipe = new KeyBinding(Constants.BIND_WAILA_RECIPE, Keyboard.KEY_NUMPAD3, "Waila"));
ClientRegistry.registerKeyBinding(
key_usage = new KeyBinding(Constants.BIND_WAILA_USAGE, Keyboard.KEY_NUMPAD4, "Waila"));
ClientRegistry.registerKeyBinding(
key_show_advanced = new KeyBinding(Constants.BIND_WAILA_SHOW_ADVANCED, Keyboard.KEY_LSHIFT, "Waila"));
}
@SubscribeEvent
@@ -43,38 +48,41 @@ public class KeyEvent {
if (mc.currentScreen == null) {
mc.displayGuiScreen(new ScreenConfig(null));
}
} else if (showKey && ConfigHandler.instance()
return;
}
if (showKey && ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)) {
boolean status = ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
ConfigHandler.instance()
.setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, !status);
boolean status = ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, !status);
} else if (showKey && !ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)) {
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
} else
if (showKey && !ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)) {
ConfigHandler.instance()
.setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
} else
if (key_liquid.isPressed()) {
boolean status = ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, true);
ConfigHandler.instance()
.setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, !status);
} else if (key_recipe.isPressed()) {
if (Loader.isModLoaded("NotEnoughItems")) {
try {
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler")
.getDeclaredMethod("openRecipeGUI", boolean.class).invoke(null, true);
} catch (Exception ignored) {}
}
} else if (key_usage.isPressed()) {
if (Loader.isModLoaded("NotEnoughItems")) {
try {
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler")
.getDeclaredMethod("openRecipeGUI", boolean.class).invoke(null, false);
} catch (Exception ignored) {}
}
if (key_liquid.isPressed()) {
boolean status = ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, true);
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, !status);
} else if (key_recipe.isPressed()) {
if (Loader.isModLoaded("NotEnoughItems")) {
NEIHandler.openRecipeGUI(true);
}
} else if (key_usage.isPressed()) {
if (Loader.isModLoaded("NotEnoughItems")) {
NEIHandler.openRecipeGUI(false);
}
}
}
@SubscribeEvent
public void tickClient(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.START) return;
if (!KeyEvent.key_show.getIsKeyPressed()
&& !ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)
&& ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, false)) {
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, false);
}
}
}
@@ -8,7 +8,6 @@ import net.minecraftforge.event.world.WorldEvent;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.cbcore.LangUtil;
@@ -17,6 +16,8 @@ import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
import mcp.mobius.waila.handlers.HUDHandlerBlocks;
import mcp.mobius.waila.handlers.HUDHandlerEntities;
import mcp.mobius.waila.handlers.VanillaTooltipHandler;
import mcp.mobius.waila.handlers.nei.NEIHandler;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderAspectString;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderHealth;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderProgressBar;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderStack;
@@ -34,12 +35,7 @@ public class ProxyClient extends ProxyServer {
LangUtil.loadLangDir("waila");
if (Loader.isModLoaded("NotEnoughItems")) {
try {
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler").getDeclaredMethod("register").invoke(null);
} catch (Exception e) {
Waila.log.error("Failed to hook into NEI properly. Reverting to Vanilla tooltip handler");
MinecraftForge.EVENT_BUS.register(new VanillaTooltipHandler());
}
NEIHandler.register();
} else {
MinecraftForge.EVENT_BUS.register(new VanillaTooltipHandler());
}
@@ -59,6 +55,8 @@ public class ProxyClient extends ProxyServer {
ModuleRegistrar.instance().registerTooltipRenderer("waila.stack", new TTRenderStack());
ModuleRegistrar.instance().registerTooltipRenderer("waila.progress", new TTRenderProgressBar());
ModuleRegistrar.instance().registerTooltipRenderer("waila.tcaspect", new TTRenderAspectString());
MinecraftForge.EVENT_BUS.register(new WorldUnloadEventHandler());
}
@@ -73,7 +71,9 @@ public class ProxyClient extends ProxyServer {
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
DataAccessorCommon.instance = new DataAccessorCommon();
if (event.world.isRemote) {
DataAccessorCommon.instance = new DataAccessorCommon();
}
}
}
}
@@ -5,7 +5,11 @@ import net.minecraftforge.common.config.Configuration;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.*;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.RenderPriority;
import mcp.mobius.waila.gui.interfaces.Signal;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
@@ -2,10 +2,7 @@ package mcp.mobius.waila.gui.screens.config;
import net.minecraft.client.gui.GuiScreen;
import org.lwjgl.util.Point;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
@@ -22,27 +19,9 @@ public class ScreenModuleConfig extends ScreenBase {
public ScreenModuleConfig(GuiScreen parent, String modname) {
super(parent);
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0) {
protected int scrollValue = 0;
@Override
public void onMouseWheel(MouseEvent event) {
scrollValue += event.z * 4;
if (scrollValue > 0) {
scrollValue = 0;
}
}
@Override
public void draw(Point pos) {
if (scrollValue <= 0) {
geom.setPos(0, 20.0 + scrollValue, true, true);
}
}
});
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0));
this.getRoot().getWidget("ButtonContainer").setGeometry(
new WidgetGeometry(0.0, 20.0, 100.0, 200.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.TOP));
new WidgetGeometry(0.0, 20.0, 100.0, 60.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.TOP));
ButtonContainerLabel buttonContainer = ((ButtonContainerLabel) this.getRoot().getWidget("ButtonContainer"));
@@ -88,12 +88,12 @@ public class ScreenWailaConfig extends ScreenBase {
new ButtonBooleanConfig(
this.getRoot(),
Configuration.CATEGORY_GENERAL,
Constants.CFG_WAILA_FORCE_LEGACY_MODE,
Constants.CFG_WAILA_SHOWICON,
true,
false,
"screen.button.no",
"screen.button.yes"),
"choice.forcelegacymode");
"choice.showicon");
this.getRoot().addWidget("LayoutConfigPos", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutConfigPos")
@@ -7,7 +7,11 @@ import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.*;
import mcp.mobius.waila.gui.widgets.ItemStackDisplay;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.ViewTable;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
public class ScreenEnchants extends ScreenBase {
@@ -14,7 +14,7 @@ package mcp.mobius.waila.gui.truetyper;
* <http://www.gnu.org/licenses/>.
*/
import java.awt.*;
import java.awt.Font;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
@@ -1,6 +1,11 @@
package mcp.mobius.waila.gui.truetyper;
import java.awt.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
@@ -1,6 +1,8 @@
package mcp.mobius.waila.handlers;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.BLUE;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.RENDER;
import java.util.List;
@@ -1,6 +1,10 @@
package mcp.mobius.waila.handlers;
import static mcp.mobius.waila.api.SpecialChars.*;
import static mcp.mobius.waila.api.SpecialChars.BLUE;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import static mcp.mobius.waila.api.SpecialChars.getRenderString;
import java.util.List;
@@ -19,9 +19,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.elements.IProbeDataProvider;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
import mcp.mobius.waila.utils.AccessHelper;
import mcp.mobius.waila.utils.NBTUtil;
import mcp.mobius.waila.utils.WailaExceptionHandler;
@@ -43,17 +41,15 @@ public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x0
public int posY;
public int posZ;
public HashSet<String> keys = new HashSet<>();
public boolean useNewAPI;
public Message0x01TERequest() {}
public Message0x01TERequest(TileEntity ent, HashSet<String> keys, boolean useNewAPI) {
public Message0x01TERequest(TileEntity ent, HashSet<String> keys) {
this.dim = ent.getWorldObj().provider.dimensionId;
this.posX = ent.xCoord;
this.posY = ent.yCoord;
this.posZ = ent.zCoord;
this.keys = keys;
this.useNewAPI = useNewAPI;
}
@Override
@@ -65,8 +61,6 @@ public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x0
target.writeInt(this.keys.size());
for (String key : keys) WailaPacketHandler.INSTANCE.writeString(target, key);
target.writeBoolean(useNewAPI);
}
@Override
@@ -82,8 +76,6 @@ public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x0
for (int i = 0; i < nkeys; i++) this.keys.add(WailaPacketHandler.INSTANCE.readString(dat));
msg.useNewAPI = dat.readBoolean();
} catch (Exception e) {
WailaExceptionHandler.handleErr(e, this.getClass().toString(), null);
}
@@ -99,41 +91,10 @@ public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x0
if (entity == null) return;
try {
NBTTagCompound tag = new NBTTagCompound();
boolean hasProbeBlock = ModuleProbeRegistrar.instance().hasProviders(block);
boolean hasProbeEntity = ModuleProbeRegistrar.instance().hasProviders(entity);
boolean hasNBTBlock = ModuleRegistrar.instance().hasNBTProviders(block);
boolean hasNBTEnt = ModuleRegistrar.instance().hasNBTProviders(entity);
if ((hasProbeBlock || hasProbeEntity) && msg.useNewAPI) {
tag.setInteger("x", msg.posX);
tag.setInteger("y", msg.posY);
tag.setInteger("z", msg.posZ);
tag.setString("id", (String) ((HashMap) classToNameMap.get(null)).get(entity.getClass()));
EntityPlayerMP player = ((NetHandlerPlayServer) ctx.channel().attr(NetworkRegistry.NET_HANDLER)
.get()).playerEntity;
for (IProbeDataProvider provider : ModuleProbeRegistrar.instance().getProviders(block)) {
try {
tag = provider.getNBTData(player, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (AbstractMethodError | NoSuchMethodError ame) {
// tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
}
}
for (IProbeDataProvider provider : ModuleProbeRegistrar.instance().getProviders(entity)) {
try {
tag = provider.getNBTData(player, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (AbstractMethodError | NoSuchMethodError ame) {
// tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
}
}
}
// We will try to use old tooltips regardless of the mode
if ((hasNBTBlock || hasNBTEnt)) {
if (hasNBTBlock || hasNBTEnt) {
tag.setInteger("x", msg.posX);
tag.setInteger("y", msg.posY);
tag.setInteger("z", msg.posZ);
@@ -15,17 +15,14 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.api.elements.IItemStyle;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.WailaExceptionHandler;
@@ -86,44 +83,6 @@ public class DisplayUtil {
enable2DRender();
}
public static void elementRenderStack(int x, int y, ItemStack stack, IItemStyle itemStyle) {
enable3DRender();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float xScale = (float) itemStyle.getWidth() / 16;
float yScale = (float) itemStyle.getHeight() / 16;
try {
GL11.glPushMatrix(); // マトリックスを保存
// スケールを適用
GL11.glScalef(xScale, yScale, 1);
// アイテムを描画
RenderHelper.enableGUIStandardItemLighting();
renderItem.renderItemAndEffectIntoGUI(
fontRenderer,
textureManager,
stack,
(int) (x / xScale),
(int) (y / yScale));
renderItem.renderItemOverlayIntoGUI(
fontRenderer,
textureManager,
stack,
(int) (x / xScale),
(int) (y / yScale));
RenderHelper.disableStandardItemLighting();
} catch (Exception e) {
String stackStr = stack != null ? stack.toString() : "NullStack";
WailaExceptionHandler.handleErr(e, "renderStack | " + stackStr, null);
} finally {
GL11.glPopMatrix(); // マトリックスを復元
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
enable2DRender();
}
public static void enable3DRender() {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
@@ -218,19 +177,4 @@ public class DisplayUtil {
DisplayUtil.drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
}
public static void drawThickBeveledBox(int x1, int y1, int x2, int y2, int thickness, int topleftcolor,
int botrightcolor, int fillcolor) {
if (fillcolor != -1) {
Gui.drawRect(x1 + 1, y1 + 1, x2 - 1, y2 - 1, fillcolor);
}
Gui.drawRect(x1, y1, x2 - 1, y1 + thickness, topleftcolor);
Gui.drawRect(x1, y1, x1 + thickness, y2 - 1, topleftcolor);
Gui.drawRect(x2 - thickness, y1, x2, y2 - 1, botrightcolor);
Gui.drawRect(x1, y2 - thickness, x2, y2, botrightcolor);
}
public static void drawVerticalLine(int x1, int y1, int y2, int color) {
Gui.drawRect(x1, y1, x1 + 1, y2, color);
}
}
@@ -16,17 +16,13 @@ public class OverlayConfig {
public static int fontcolor;
public static float scale;
// spotless:off
public static void updateColors() {
OverlayConfig.alpha = (int) (ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_ALPHA, 0) / 100.0f
* 256) << 24;
OverlayConfig.bgcolor = OverlayConfig.alpha
+ ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_BGCOLOR, 0);
OverlayConfig.gradient1 = OverlayConfig.alpha
+ ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_GRADIENT1, 0);
OverlayConfig.gradient2 = OverlayConfig.alpha
+ ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_GRADIENT2, 0);
OverlayConfig.fontcolor = OverlayConfig.alpha
+ ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FONTCOLOR, 0);
alpha = (int) (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_ALPHA, 0) / 100.0f * 255f) << 24;
bgcolor = alpha + ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_BGCOLOR, 0);
gradient1 = alpha + ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_GRADIENT1, 0);
gradient2 = alpha + ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_GRADIENT2, 0);
fontcolor = ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FONTCOLOR, 0);
}
// spotless:on
}
@@ -11,16 +11,11 @@ import mcp.mobius.waila.api.impl.ConfigHandler;
public class OverlayRenderer {
protected static boolean hasBlending;
protected static boolean hasLight;
protected static boolean hasDepthTest;
protected static boolean hasLight0;
protected static boolean hasLight1;
protected static boolean hasRescaleNormal;
protected static boolean hasColorMaterial;
protected static int boundTexIndex;
private static boolean hasBlending;
private static boolean hasDepthTest;
private static int boundTexIndex;
public static void renderOverlay() {
public static void renderOverlay(Tooltip tooltip) {
Minecraft mc = Minecraft.getMinecraft();
if (!(mc.currentScreen == null && mc.theWorld != null
&& Minecraft.isGuiEnabled()
@@ -31,16 +26,16 @@ public class OverlayRenderer {
if (RayTracing.instance().getTarget().typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK
&& RayTracing.instance().getTargetStack() != null) {
renderOverlay(WailaTickHandler.instance().tooltip);
doRenderOverlay(tooltip);
}
if (RayTracing.instance().getTarget().typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY
&& ConfigHandler.instance().getConfig("general.showents")) {
renderOverlay(WailaTickHandler.instance().tooltip);
doRenderOverlay(tooltip);
}
}
public static void renderOverlay(Tooltip tooltip) {
private static void doRenderOverlay(Tooltip tooltip) {
GL11.glPushMatrix();
saveGLState();
@@ -80,26 +75,23 @@ public class OverlayRenderer {
}
public static void saveGLState() {
private static void saveGLState() {
hasBlending = GL11.glGetBoolean(GL11.GL_BLEND);
hasLight = GL11.glGetBoolean(GL11.GL_LIGHTING);
hasDepthTest = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
boundTexIndex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
}
public static void loadGLState() {
private static void loadGLState() {
if (hasBlending) GL11.glEnable(GL11.GL_BLEND);
else GL11.glDisable(GL11.GL_BLEND);
if (hasLight1) GL11.glEnable(GL11.GL_LIGHT1);
else GL11.glDisable(GL11.GL_LIGHT1);
if (hasDepthTest) GL11.glEnable(GL11.GL_DEPTH_TEST);
else GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, boundTexIndex);
GL11.glPopAttrib();
}
public static void drawTooltipBox(int x, int y, int w, int h, int bg, int grad1, int grad2) {
private static void drawTooltipBox(int x, int y, int w, int h, int bg, int grad1, int grad2) {
DisplayUtil.drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
DisplayUtil.drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
DisplayUtil.drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);// center
@@ -107,7 +99,6 @@ public class OverlayRenderer {
DisplayUtil.drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
DisplayUtil.drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
DisplayUtil.drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
DisplayUtil.drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
DisplayUtil.drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
}
@@ -26,6 +26,7 @@ import mcp.mobius.waila.utils.Constants;
public class RayTracing {
private MovingObjectPosition target = null;
private static RayTracing _instance;
private RayTracing() {}
@@ -35,22 +36,22 @@ public class RayTracing {
return _instance;
}
private MovingObjectPosition target = null;
private final Minecraft mc = Minecraft.getMinecraft();
public void fire() {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY
&& !shouldHidePlayer(mc.objectMouseOver.entityHit)) {
this.target = mc.objectMouseOver;
return;
}
EntityLivingBase viewpoint = mc.renderViewEntity;
if (viewpoint == null) return;
this.target = this.rayTrace(viewpoint, mc.playerController.getBlockReachDistance(), 0);
}
public void clear() {
target = null;
}
private static boolean shouldHidePlayer(Entity targetEnt) {
// Check if entity is player with invisibility effect
if (targetEnt instanceof EntityPlayer thePlayer) {
@@ -116,7 +117,7 @@ public class RayTracing {
if (this.target == null) return items;
World world = mc.theWorld;
World world = Minecraft.getMinecraft().theWorld;
int x = this.target.blockX;
int y = this.target.blockY;
@@ -1,152 +0,0 @@
package mcp.mobius.waila.overlay;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraftforge.common.config.Configuration;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.elements.ProbeInfo;
import mcp.mobius.waila.utils.Constants;
public class TOPOverlayRenderer {
protected static boolean hasBlending;
protected static boolean hasLight;
protected static boolean hasDepthTest;
protected static boolean hasLight0;
protected static boolean hasLight1;
protected static boolean hasRescaleNormal;
protected static boolean hasColorMaterial;
protected static int boundTexIndex;
static int w, h, x, y, ty;
private static float progressAlpha = 0;
private static long lastMilliSecond;
private static float savedProgress = 0;
private static final int MARGIN = 5;
private static final int DEFAULT_COLOR = 0xFFA0A0A0;
private static final int FAILURE_COLOR = 0xFFAA0000;
public static void renderOverlay() {
Minecraft mc = Minecraft.getMinecraft();
if (!(mc.currentScreen == null && mc.theWorld != null
&& Minecraft.isGuiEnabled()
&& !mc.gameSettings.keyBindPlayerList.getIsKeyPressed()
&& ConfigHandler.instance().showTooltip()
&& RayTracing.instance().getTarget() != null))
return;
computePositionAndSize(WailaTickHandler.instance().probe);
renderElements(WailaTickHandler.instance().probe);
}
public static void renderElements(ProbeInfo probeInfo) {
GL11.glPushMatrix();
saveGLState();
GL11.glScalef(OverlayConfig.scale, OverlayConfig.scale, 1.0f);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
drawTooltipBox(x, y, w, h, OverlayConfig.bgcolor, OverlayConfig.gradient1, OverlayConfig.gradient2);
drawProgressBar();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
probeInfo.render(x + MARGIN, y + MARGIN);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
loadGLState();
GL11.glPopMatrix();
}
private static void drawProgressBar() {
float elapsedSecond = (float) (System.currentTimeMillis() - lastMilliSecond) / 1000;
float damage = Minecraft.getMinecraft().playerController.curBlockDamageMP;
if (damage == 0 && progressAlpha <= 0) {
lastMilliSecond = System.currentTimeMillis();
return;
}
int drawX = x + 1;
int drawY = y; // TODO: configurable top / bottom drawing
if (damage > 0) {
progressAlpha = Math.min(damage, 0.6F);
progressAlpha += 0.4F * damage;
savedProgress = damage;
} else {
progressAlpha -= elapsedSecond;
}
int color = applyAlpha(DEFAULT_COLOR, progressAlpha); // TODO: change color with harvestability
int width = (int) ((w - 1) * savedProgress);
DisplayUtil.drawGradientRect(drawX, drawY, width - 1, 2, color, color);
lastMilliSecond = System.currentTimeMillis();
}
private static int applyAlpha(int color, float alpha) {
int red = (color >> 16) & 0xFF;
int green = (color >> 8) & 0xFF;
int blue = color & 0xFF;
int appliedAlpha = (int) (alpha * 255); // アルファ値を0〜255の範囲に変換
return (appliedAlpha << 24) | (red << 16) | (green << 8) | blue;
}
public static void saveGLState() {
hasBlending = GL11.glGetBoolean(GL11.GL_BLEND);
hasLight = GL11.glGetBoolean(GL11.GL_LIGHTING);
hasDepthTest = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
boundTexIndex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
}
public static void loadGLState() {
if (hasBlending) GL11.glEnable(GL11.GL_BLEND);
else GL11.glDisable(GL11.GL_BLEND);
if (hasLight1) GL11.glEnable(GL11.GL_LIGHT1);
else GL11.glDisable(GL11.GL_LIGHT1);
if (hasDepthTest) GL11.glEnable(GL11.GL_DEPTH_TEST);
else GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, boundTexIndex);
GL11.glPopAttrib();
}
public static void drawTooltipBox(int x, int y, int w, int h, int bg, int grad1, int grad2) {
DisplayUtil.drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
DisplayUtil.drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
DisplayUtil.drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);// center
DisplayUtil.drawGradientRect(x, y + 1, 1, h - 1, bg, bg);
DisplayUtil.drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
DisplayUtil.drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
DisplayUtil.drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
DisplayUtil.drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
DisplayUtil.drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
}
private static void computePositionAndSize(ProbeInfo probeInfo) {
Point pos = new Point(
ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 0),
ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSY, 0));
w = probeInfo.getWidth() + MARGIN * 2;
h = probeInfo.getHeight() + MARGIN * 2;
Dimension size = DisplayUtil.displaySize();
x = ((int) (size.width / OverlayConfig.scale) - w - 1) * pos.x / 10000;
y = ((int) (size.height / OverlayConfig.scale) - h - 1) * pos.y / 10000;
ty = (h - probeInfo.getHeight()) / 2 + 1;
}
}
@@ -106,6 +106,8 @@ public class Tooltip {
public Tooltip(List<String> textData, boolean hasIcon) {
if (hasIcon) hasIcon = ConfigHandler.instance().showIcon();
columnsWidth.add(0); // Small init of the arrays to have at least one element
columnsPos.add(0);
@@ -134,9 +136,20 @@ public class Tooltip {
// We correct if we only have one column
if (columnsWidth.size() == 1) columnsWidth.set(0, maxStringW);
// We compute the position of the columns to be able to align the renderable later on
for (int i = 1; i < columnsWidth.size(); i++)
columnsPos.set(i, columnsWidth.get(i - 1) + columnsPos.get(i - 1) + TabSpacing);
int tmp = 0;
for (int i = 0; i < columnsWidth.size(); i++) {
tmp += columnsWidth.get(i);
// We compute the position of the columns to be able to align the renderable later on
if (i != 0) {
columnsPos.set(i, columnsWidth.get(i - 1) + columnsPos.get(i - 1) + TabSpacing);
}
}
// We correct for edge cases where the longest string in a column is in a line shorter than the longest line
tmp += TabSpacing * (columnsWidth.size() - 1);
maxStringW = Math.max(maxStringW, tmp);
this.computeRenderables();
this.computePositionAndSize(hasIcon);
@@ -12,193 +12,138 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.MetaDataProvider;
import mcp.mobius.waila.api.impl.TipList;
import mcp.mobius.waila.api.impl.elements.MetaProbeDataProvider;
import mcp.mobius.waila.api.impl.elements.ProbeInfo;
import mcp.mobius.waila.cbcore.Layout;
import mcp.mobius.waila.client.KeyEvent;
import mcp.mobius.waila.utils.Constants;
public class WailaTickHandler {
public Tooltip tooltip = null;
public MetaDataProvider handler = new MetaDataProvider();
private Tooltip tooltip = null;
private final MetaDataProvider handler = new MetaDataProvider();
public ProbeInfo probe = null;
public MetaProbeDataProvider elementHandler = new MetaProbeDataProvider();
private final Minecraft mc = Minecraft.getMinecraft();
private static WailaTickHandler _instance;
private WailaTickHandler() {}
public static WailaTickHandler instance() {
if (_instance == null) _instance = new WailaTickHandler();
return _instance;
@SubscribeEvent
public void tickRender(TickEvent.RenderTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
OverlayRenderer.renderOverlay(tooltip);
}
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void tickRender(TickEvent.RenderTickEvent event) {
if (probe != null) {
TOPOverlayRenderer.renderOverlay();
public void tickClient(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.START) return;
Minecraft mc = Minecraft.getMinecraft();
World world = mc.theWorld;
EntityPlayer player = mc.thePlayer;
if (world == null || player == null) {
this.tooltip = null;
RayTracing.instance().clear();
return;
}
OverlayRenderer.renderOverlay();
}
RayTracing.instance().fire();
MovingObjectPosition target = RayTracing.instance().getTarget();
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void tickClient(TickEvent.ClientTickEvent event) {
List<String> currenttip;
List<String> currenttipHead;
List<String> currenttipBody;
List<String> currenttipTail;
if (target != null && target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
DataAccessorCommon accessor = DataAccessorCommon.instance;
accessor.set(world, player, target);
ItemStack targetStack = RayTracing.instance().getTargetStack(); // Here we get either the proper stack
// or the override
if (!Keyboard.isKeyDown(KeyEvent.key_show.getKeyCode())
&& !ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)
&& ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, false)) {
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, false);
}
if (targetStack != null) {
currenttip = new TipList<String, String>();
currenttipHead = new TipList<String, String>();
currenttipBody = new TipList<String, String>();
currenttipTail = new TipList<String, String>();
World world = mc.theWorld;
EntityPlayer player = mc.thePlayer;
if (world != null && player != null) {
RayTracing.instance().fire();
MovingObjectPosition target = RayTracing.instance().getTarget();
currenttipHead = handler.handleBlockTextData(
targetStack,
world,
player,
target,
accessor,
currenttipHead,
Layout.HEADER);
currenttipBody = handler
.handleBlockTextData(targetStack, world, player, target, accessor, currenttipBody, Layout.BODY);
currenttipTail = handler.handleBlockTextData(
targetStack,
world,
player,
target,
accessor,
currenttipTail,
Layout.FOOTER);
probe = null;
if (target != null && target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK
&& !ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
DataAccessorCommon accessor = DataAccessorCommon.instance;
accessor.set(world, player, target);
ItemStack targetStack = RayTracing.instance().getTargetStack();
if (targetStack != null) {
probe = elementHandler.handleBlockElementData(targetStack, world, player, target, accessor);
if (ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHIFTBLOCK, false)
&& !currenttipBody.isEmpty()
&& !accessor.getPlayer().isSneaking()) {
currenttipBody.clear();
currenttipBody.add(ITALIC + "Press shift for more data");
}
currenttip.addAll(currenttipHead);
currenttip.addAll(currenttipBody);
currenttip.addAll(currenttipTail);
this.tooltip = new Tooltip(currenttip, targetStack);
}
} else if (target != null && target.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {
DataAccessorCommon accessor = DataAccessorCommon.instance;
accessor.set(world, player, target);
List<String> currenttip;
List<String> currenttipHead;
List<String> currenttipBody;
List<String> currenttipTail;
if (target != null && target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
DataAccessorCommon accessor = DataAccessorCommon.instance;
accessor.set(world, player, target);
ItemStack targetStack = RayTracing.instance().getTargetStack(); // Here we get either the proper stack
// or the override
Entity targetEnt = RayTracing.instance().getTargetEntity(); // This need to be replaced by the override
// check.
if (targetStack != null) {
currenttip = new TipList<String, String>();
currenttipHead = new TipList<String, String>();
currenttipBody = new TipList<String, String>();
currenttipTail = new TipList<String, String>();
if (targetEnt != null) {
currenttip = new TipList<String, String>();
currenttipHead = new TipList<String, String>();
currenttipBody = new TipList<String, String>();
currenttipTail = new TipList<String, String>();
currenttipHead = handler.handleBlockTextData(
targetStack,
world,
player,
target,
accessor,
currenttipHead,
Layout.HEADER);
currenttipBody = handler.handleBlockTextData(
targetStack,
world,
player,
target,
accessor,
currenttipBody,
Layout.BODY);
currenttipTail = handler.handleBlockTextData(
targetStack,
world,
player,
target,
accessor,
currenttipTail,
Layout.FOOTER);
currenttipHead = handler.handleEntityTextData(
targetEnt,
world,
player,
target,
accessor,
currenttipHead,
Layout.HEADER);
currenttipBody = handler
.handleEntityTextData(targetEnt, world, player, target, accessor, currenttipBody, Layout.BODY);
currenttipTail = handler.handleEntityTextData(
targetEnt,
world,
player,
target,
accessor,
currenttipTail,
Layout.FOOTER);
if (ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHIFTBLOCK, false)
&& !currenttipBody.isEmpty()
&& !accessor.getPlayer().isSneaking()) {
currenttipBody.clear();
currenttipBody.add(ITALIC + "Press shift for more data");
}
currenttip.addAll(currenttipHead);
currenttip.addAll(currenttipBody);
currenttip.addAll(currenttipTail);
this.tooltip = new Tooltip(currenttip, targetStack);
if (!ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
probe = elementHandler.appendTooltipData(probe, currenttipBody, targetStack, accessor);
}
if (ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHIFTENTS, false)
&& !currenttipBody.isEmpty()
&& !accessor.getPlayer().isSneaking()) {
currenttipBody.clear();
currenttipBody.add(ITALIC + "Press shift for more data");
}
} else if (target != null && target.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {
DataAccessorCommon accessor = DataAccessorCommon.instance;
accessor.set(world, player, target);
Entity targetEnt = RayTracing.instance().getTargetEntity(); // This need to be replaced by the override
// check.
currenttip.addAll(currenttipHead);
currenttip.addAll(currenttipBody);
currenttip.addAll(currenttipTail);
if (targetEnt != null) {
currenttip = new TipList<String, String>();
currenttipHead = new TipList<String, String>();
currenttipBody = new TipList<String, String>();
currenttipTail = new TipList<String, String>();
currenttipHead = handler.handleEntityTextData(
targetEnt,
world,
player,
target,
accessor,
currenttipHead,
Layout.HEADER);
currenttipBody = handler.handleEntityTextData(
targetEnt,
world,
player,
target,
accessor,
currenttipBody,
Layout.BODY);
currenttipTail = handler.handleEntityTextData(
targetEnt,
world,
player,
target,
accessor,
currenttipTail,
Layout.FOOTER);
if (ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHIFTENTS, false)
&& !currenttipBody.isEmpty()
&& !accessor.getPlayer().isSneaking()) {
currenttipBody.clear();
currenttipBody.add(ITALIC + "Press shift for more data");
}
currenttip.addAll(currenttipHead);
currenttip.addAll(currenttipBody);
currenttip.addAll(currenttipTail);
this.tooltip = new Tooltip(currenttip, false);
}
this.tooltip = new Tooltip(currenttip, false);
}
}
@@ -0,0 +1,90 @@
package mcp.mobius.waila.overlay.tooltiprenderers;
import java.awt.Color;
import java.awt.Dimension;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.overlay.DisplayUtil;
import mcp.mobius.waila.overlay.OverlayConfig;
public class TTRenderAspectString implements IWailaTooltipRenderer {
@Override
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
int width;
if (params[0].equals("???")) {
width = DisplayUtil.getDisplayWidth(params[0]);
} else {
try {
Object aspect = ThaumcraftModule.Aspect_getAspect.invoke(null, params[0]);
if (aspect == null) {
width = DisplayUtil.getDisplayWidth(params[0]);
} else width = DisplayUtil.getDisplayWidth((String) ThaumcraftModule.Aspect_getName.invoke(aspect));
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
return new Dimension(width + 10, params[0].isEmpty() ? 0 : 8);
}
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
try {
if (params[0].equals("???")) {
drawTag(0, 0, ThaumcraftModule.unknownAspectTexture, ThaumcraftModule.unknownAspectColor, 200);
DisplayUtil.drawString(params[0], 10, 0, OverlayConfig.fontcolor, true);
return;
}
Object aspect = ThaumcraftModule.Aspect_getAspect.invoke(null, params[0]);
if (aspect == null) return;
drawTag(
0,
0,
(ResourceLocation) ThaumcraftModule.Aspect_getImage.invoke(aspect),
new Color((int) ThaumcraftModule.Aspect_getColor.invoke(aspect)),
200);
DisplayUtil.drawString(
(String) ThaumcraftModule.Aspect_getName.invoke(aspect),
10,
0,
OverlayConfig.fontcolor,
true);
} catch (ReflectiveOperationException e) {
DisplayUtil.drawString(params[0], 10, 0, OverlayConfig.fontcolor, true);
throw new RuntimeException(e);
}
}
public static void drawTag(double x, double y, ResourceLocation image, Color color, double z) {
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(image);
GL11.glColor4f(
(float) color.getRed() / 255.0F,
(float) color.getGreen() / 255.0F,
(float) color.getBlue() / 255.0F,
1);
Tessellator var9 = Tessellator.instance;
var9.startDrawingQuads();
var9.setColorRGBA_F(
(float) color.getRed() / 255.0F,
(float) color.getGreen() / 255.0F,
(float) color.getBlue() / 255.0F,
1);
var9.addVertexWithUV(x + 0.0D, y + 8.0D, z, 0.0D, 1.0D);
var9.addVertexWithUV(x + 8.0D, y + 8.0D, z, 1.0D, 1.0D);
var9.addVertexWithUV(x + 8.0D, y + 0.0D, z, 1.0D, 0.0D);
var9.addVertexWithUV(x + 0.0D, y + 0.0D, z, 0.0D, 0.0D);
var9.draw();
}
}
@@ -11,7 +11,6 @@ import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
import mcp.mobius.waila.addons.etb.ETBModule;
import mcp.mobius.waila.addons.exu.ExtraUtilitiesModule;
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
import mcp.mobius.waila.addons.harvestability.HUDHandlerHarvestability;
import mcp.mobius.waila.addons.harvestcraft.HarvestcraftModule;
import mcp.mobius.waila.addons.ic2.IC2Module;
import mcp.mobius.waila.addons.magicalcrops.MagicalCropsModule;
@@ -21,15 +20,14 @@ import mcp.mobius.waila.addons.railcraft.RailcraftModule;
import mcp.mobius.waila.addons.statues.StatuesModule;
import mcp.mobius.waila.addons.stevescarts.StevesCartsModule;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.addons.thaumcraftGadomancy.GadomancyModule;
import mcp.mobius.waila.addons.thermaldynamics.ThermalDynamicsModule;
import mcp.mobius.waila.addons.thermalexpansion.ThermalExpansionModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerFurnace;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.elements.IProbeRegistrar;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
import mcp.mobius.waila.handlers.DecoratorFMP;
import mcp.mobius.waila.handlers.HUDHandlerFMP;
@@ -53,6 +51,9 @@ public class ProxyServer {
/* Thaumcraft */
ThaumcraftModule.register();
/* Gadomancy */
GadomancyModule.register();
/* EnderStorage */
EnderStorageModule.register();
@@ -101,8 +102,6 @@ public class ProxyServer {
/* Agriculture */
AgricultureModule.register();
HUDHandlerHarvestability.register();
if (Loader.isModLoaded("ForgeMultipart")) {
HUDHandlerFMP.register();
DecoratorFMP.register();
@@ -113,49 +112,18 @@ public class ProxyServer {
for (String s : ModuleRegistrar.instance().IMCRequests.keySet()) {
this.callbackRegistration(s, ModuleRegistrar.instance().IMCRequests.get(s));
}
for (String s : ModuleProbeRegistrar.instance().IMCRequests.keySet()) {
this.callbackProbeRegistration(s, ModuleProbeRegistrar.instance().IMCRequests.get(s));
}
}
public void callbackRegistration(String method, String modname) {
String[] splitName = method.split("\\.");
String methodName = splitName[splitName.length - 1];
String className = method.substring(0, method.length() - methodName.length() - 1);
Waila.log.info(String.format("Trying to reflect %s %s", className, methodName));
Waila.log.debug(String.format("Trying to reflect %s %s", className, methodName));
try {
Class<?> reflectClass = Class.forName(className);
Method reflectMethod = reflectClass.getDeclaredMethod(methodName, IWailaRegistrar.class);
reflectMethod.invoke(null, ModuleRegistrar.instance());
Waila.log.info(String.format("Success in registering %s", modname));
} catch (ClassNotFoundException e) {
Waila.log.warn(String.format("Could not find class %s", className));
} catch (NoSuchMethodException e) {
Waila.log.warn(String.format("Could not find method %s", methodName));
} catch (Exception e) {
Waila.log.warn(String.format("Exception while trying to access the method : %s", e));
}
}
public void callbackProbeRegistration(String method, String modname) {
String[] splitName = method.split("\\.");
String methodName = splitName[splitName.length - 1];
String className = method.substring(0, method.length() - methodName.length() - 1);
Waila.log.info(String.format("Trying to reflect %s %s", className, methodName));
try {
Class<?> reflectClass = Class.forName(className);
Method reflectMethod = reflectClass.getDeclaredMethod(methodName, IProbeRegistrar.class);
reflectMethod.invoke(null, ModuleProbeRegistrar.instance());
Waila.log.info(String.format("Success in registering %s", modname));
} catch (ClassNotFoundException e) {
Waila.log.warn(String.format("Could not find class %s", className));
} catch (NoSuchMethodException e) {
@@ -6,6 +6,7 @@ public final class Constants {
public static String BIND_WAILA_CFG = "waila.keybind.wailaconfig";
public static String BIND_WAILA_SHOW = "waila.keybind.wailadisplay";
public static String BIND_WAILA_SHOW_ADVANCED = "waila.keybind.showadvanced";
public static String BIND_WAILA_LIQUID = "waila.keybind.liquid";
public static String BIND_WAILA_RECIPE = "waila.keybind.recipe";
public static String BIND_WAILA_USAGE = "waila.keybind.usage";
@@ -19,6 +20,7 @@ public final class Constants {
public static String CFG_WAILA_LIQUID = "waila.cfg.liquid";
public static String CFG_WAILA_METADATA = "waila.cfg.metadata";
public static String CFG_WAILA_KEYBIND = "waila.cfg.keybind";
public static String CFG_WAILA_SHOWICON = "waila.cfg.showicon";
public static String CFG_WAILA_POSX = "waila.cfg.posx";
public static String CFG_WAILA_POSY = "waila.cfg.posy";
public static String CFG_WAILA_SCALE = "waila.cfg.scale";
@@ -27,7 +29,6 @@ public final class Constants {
public static String CFG_WAILA_NHEARTS = "waila.cfg.heartsperline";
public static String CFG_WAILA_MAXHP = "waila.cfg.maxhpbeforetext";
public static String CFG_WAILA_NEWFILTERS = "waila.cfg.newfilters";
public static String CFG_WAILA_FORCE_LEGACY_MODE = "waila.cfg.forcelegacymode";
public static String CFG_WAILA_ALPHA = "waila.cfg.alpha";
public static String CFG_WAILA_BGCOLOR = "waila.cfg.bgcolor";
@@ -5,7 +5,13 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
import net.minecraft.nbt.*;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagShort;
public class NBTUtil {
@@ -17,11 +17,20 @@ public class WailaExceptionHandler {
if (!errs.contains(className)) {
errs.add(className);
for (StackTraceElement elem : e.getStackTrace()) {
Waila.log.log(
Level.WARN,
String.format("%s.%s:%s", elem.getClassName(), elem.getMethodName(), elem.getLineNumber()));
if (elem.getClassName().contains("waila")) break;
Throwable working = e;
while (working != null) {
if (working != e) {
Waila.log.log(Level.WARN, String.format("Caused by: %s", working));
}
for (StackTraceElement elem : working.getStackTrace()) {
Waila.log.log(
Level.WARN,
String.format("%s.%s:%s", elem.getClassName(), elem.getMethodName(), elem.getLineNumber()));
if (working == e && elem.getClassName().contains("waila")) break;
}
working = working.getCause();
}
Waila.log.log(Level.WARN, String.format("Catched unhandled exception : [%s] %s", className, e));
-1
View File
@@ -1 +0,0 @@
public net.minecraft.client.multiplayer.PlayerControllerMP field_78770_f # curBlockDamageMP
+101 -98
View File
@@ -1,148 +1,151 @@
screen.button.waila=Waila
screen.button.modules=Moduly
screen.label.scale=Mìøítko
screen.label.dragtuto=Chytni HUD pro nastavení jeho pozice.
screen.label.scale=Mìøítko
screen.label.dragtuto=Chytni HUD pro nastavení jeho pozice.
screen.button.default=Defaultní
screen.button.cancel=Zrušit
screen.button.default=Defaultní
screen.button.cancel=Zrušit
screen.button.ok=Ok
screen.button.yes=Ano
screen.button.no=Ne
screen.button.back=Zpìt
screen.button.hidden=Skrytý
screen.button.visible=Viditelný
screen.button.maintained=Spravované
screen.button.toggled=Pøepnuté
screen.button.back=Zpìt
screen.button.hidden=Skrytý
screen.button.visible=Viditelný
screen.button.maintained=Spravované
screen.button.toggled=Pøepnuté
choice.showhidewaila=Zobrazit/Skrýt Wailu
choice.showhidewaila=Zobrazit/Skrýt Wailu
choice.showhideidmeta=Zobrazit ID:Metadata
choice.toggledmaintained=Pøepnuté/Spravované
choice.toggledmaintained=Pøepnuté/Spravované
choice.showliquids=Tekutiny
choice.shifttoggledblock=Pliž se pro pøepnutí blokù
choice.shifttoggledents=Pliž se pro pøepnutí entit
screen.button.configureaspect=Nastavení vzhledu...
choice.shifttoggledblock=Pliž se pro pøepnutí blokù
choice.shifttoggledents=Pliž se pro pøepnutí entit
screen.button.configureaspect=Nastavení vzhledu...
enchant.title.name=Jméno
enchant.title.minlvl=Minimální lvl
enchant.title.maxlvl=Maximální lvl
enchant.title.name=Jméno
enchant.title.minlvl=Minimální lvl
enchant.title.maxlvl=Maximální lvl
enchant.title.weight=Hmotnost
enchant.label.enchantability=Oèarovatelnost
enchant.label.enchantability=Oèarovatelnost
waila.keybind.wailaconfig=[Waila] Nastavení obrazu
waila.keybind.wailadisplay=[Waila] Zobrazit/Skrýt
waila.keybind.wailaconfig=[Waila] Nastavení obrazu
waila.keybind.wailadisplay=[Waila] Zobrazit/Skrýt
waila.keybind.showadvanced=[Waila] Rozšířit popisek
waila.keybind.liquid=[Waila] Zobrazit tekutiny
waila.keybind.recipe=[Waila] Zobrazit recept
waila.keybind.usage=[Waila] Zobrazit použití
waila.keybind.testing=[Waila] Testování
waila.keybind.usage=[Waila] Zobrazit použití
waila.keybind.testing=[Waila] Testování
client.msg.norecipe=Nenalezen žádný recept.
client.msg.nousage=Nenalezeno žádné využití.
client.msg.norecipe=Nenalezen žádný recept.
client.msg.nousage=Nenalezeno žádné využití.
hud.msg.holdkeymoreinfo=Držte %s pro více informací
hud.msg.none=<Nic>
hud.msg.empty=<Prázdný>
hud.msg.output=Výstup
hud.msg.empty=<Prázdný>
hud.msg.output=Výstup
hud.msg.input=Vstup
hud.msg.out=Ven
hud.msg.in=Dovnitø
hud.msg.in=Dovnitø
hud.msg.power=Energie
hud.msg.storage=Úložištì
hud.msg.stored=Uloženo
hud.msg.any=Jakýkoliv
hud.msg.mode=Mód
hud.msg.maxpower=Maximální Energie
hud.msg.trigger=Spouštìè
hud.msg.maxio=Maximální propustnost
hud.msg.storage=Úložištì
hud.msg.stored=Uloženo
hud.msg.any=Jakýkoliv
hud.msg.mode=Mód
hud.msg.maxpower=Maximální Energie
hud.msg.trigger=Spouštìè
hud.msg.maxio=Maximální propustnost
hud.msg.send=Odeslat
hud.msg.recv=Obdržet
hud.msg.item=Pøedmìt
hud.msg.recv=Obdržet
hud.msg.item=Pøedmìt
hud.msg.fluid=Tekutina
hud.msg.energ=Energie
hud.msg.frequency=Frekvence
hud.msg.owner=Vlastník
hud.msg.public=Veøejné
hud.msg.restricted=Omezené
hud.msg.private=Soukromé
hud.msg.owner=Vlastník
hud.msg.public=Veøejné
hud.msg.restricted=Omezené
hud.msg.private=Soukromé
hud.msg.white=Bílá
hud.msg.orange=Oranžová
hud.msg.magenta=Purpurová
hud.msg.lblue=Svìtle modrá
hud.msg.yellow=Žlutá
hud.msg.lime=Svìtle zelená
hud.msg.pink=Rùžová
hud.msg.gray=Šedá
hud.msg.lgray=Svìtle šedá
hud.msg.cyan=Tyrkysová
hud.msg.purple=Fialová
hud.msg.blue=Modrá
hud.msg.brown=Hnìdá
hud.msg.green=Zelená
hud.msg.red=Èervená
hud.msg.black=Èerná
hud.msg.white=Bílá
hud.msg.orange=Oranžová
hud.msg.magenta=Purpurová
hud.msg.lblue=Svìtle modrá
hud.msg.yellow=Žlutá
hud.msg.lime=Svìtle zelená
hud.msg.pink=Rùžová
hud.msg.gray=Šedá
hud.msg.lgray=Svìtle šedá
hud.msg.cyan=Tyrkysová
hud.msg.purple=Fialová
hud.msg.blue=Modrá
hud.msg.brown=Hnìdá
hud.msg.green=Zelená
hud.msg.red=Èervená
hud.msg.black=Èerná
hud.msg.growth=Rùst
hud.msg.mature=Stáøí
hud.msg.growth=Rùst
hud.msg.mature=Stáøí
hud.msg.off=Vypnuto
hud.msg.on=Zapnuto
hud.msg.state=Stav
hud.msg.delay=Prodleva
hud.msg.comparator=Porovnávaè
hud.msg.comparator=Porovnávaè
hud.msg.substractor=Substraktor
hud.msg.record=Záznam
hud.msg.record=Záznam
hud.msg.offers=Poskytuje
hud.msg.demands=Požaduje
hud.msg.demands=Požaduje
option.appeng.monitorcontent=Obsah monitoru
option.bb.content=Obsah barelu
option.bc.tankamount=Množství tekutiny
option.bc.tankamount=Množství tekutiny
option.bc.tanktype=Typ tekutiny
option.enderstorage.colors=Barvy
option.ic2.inputeumach=Maximální pøíjem EU [Stroje]
option.ic2.inputeuother=Maximální pøíjem EU [Ostatní]
option.ic2.inputeu=Maximální pøijem EU
option.ic2.outputeu=Maximální výstup EU
option.ic2.storage=Uloženo energie
option.ic2.consump=Zobrazit spotøebu
option.ic2.tradeomat=Zobrazit Trade-O-Mat požadavek
option.thaumcraft.storedvis=Úložištì kondenzátoru
option.thermalexpansion.energyhandler=Zobrazit úložištì RF
option.thermalexpansion.energycell=Zobrazit ECell VSTUP/VÝSTUP
option.ic2.inputeumach=Maximální pøíjem EU [Stroje]
option.ic2.inputeuother=Maximální pøíjem EU [Ostatní]
option.ic2.inputeu=Maximální pøijem EU
option.ic2.outputeu=Maximální výstup EU
option.ic2.storage=Uloženo energie
option.ic2.consump=Zobrazit spotøebu
option.ic2.tradeomat=Zobrazit Trade-O-Mat požadavek
option.thaumcraft.storedvis=Úložištì kondenzátoru
option.thermalexpansion.energyhandler=Zobrazit úložištì RF
option.thermalexpansion.energycell=Zobrazit ECell VSTUP/VÝSTUP
option.thermalexpansion.fluidtype=Zobrazit typ tekutiny
option.thermalexpansion.fluidamount=Zobrazit množství tekutiny
option.thermalexpansion.tankmode=Zobrazit mód nádrže
option.thermalexpansion.fluidamount=Zobrazit množství tekutiny
option.thermalexpansion.tankmode=Zobrazit mód nádrže
option.thermalexpansion.tesssendrecv=Tesseract mode
option.thermalexpansion.tessfreq=Frekvence Teseraktu
option.thermalexpansion.owner=Zobrazit majitele
option.thermalexpansion.conditemmode=Zobrazit mód Itemduktu
option.thermalexpansion.conditemmode=Zobrazit mód Itemduktu
option.vanilla.spawntype=Typ spawneru
option.vanilla.growthvalue=Hodnota rùstu
option.vanilla.leverstate=Stav páky
option.vanilla.repeater=Prodleva opakovaèe
option.vanilla.comparator=Mód porovnávaèe
option.vanilla.redstone=Ruditová energie
option.vanilla.jukebox=Jukeboxový disk
option.vanilla.silverfish=Skrýt rybenku
option.vanilla.growthvalue=Hodnota rùstu
option.vanilla.leverstate=Stav páky
option.vanilla.repeater=Prodleva opakovaèe
option.vanilla.comparator=Mód porovnávaèe
option.vanilla.redstone=Ruditová energie
option.vanilla.jukebox=Jukeboxový disk
option.vanilla.silverfish=Skrýt rybenku
option.etb.displaydata=Zobrazit data slotu
option.enderio.inout=Zobrazit vstup/výstup
option.enderio.storage=Zobrazit uskladnìné MJ
option.enderio.inout=Zobrazit vstup/výstup
option.enderio.storage=Zobrazit uskladnìné MJ
option.enderio.owner=Zobrazit majitele bloku
option.enderio.channel=Zobrazit kanál nadkrychle
option.bcapi.storage=Zobrazit uskladnìné MJ
option.bcapi.consump=Zobrazit maximální energii
option.bcapi.trigger=Zobrazit spouštìjící se energii
option.pr.showio=Zobrazit IO brány
option.enderio.channel=Zobrazit kanál nadkrychle
option.bcapi.storage=Zobrazit uskladnìné MJ
option.bcapi.consump=Zobrazit maximální energii
option.bcapi.trigger=Zobrazit spouštìjící se energii
option.pr.showio=Zobrazit IO brány
option.pr.showdata=Zobrazit data bran
option.extrautilities.fluidamount=Zobrazit množství tekutin
option.openblocks.fluidamount=Zobrazit množství tekutin
option.railcraft.fluidamount=Zobrazit množství tekutin
option.secretrooms.hide=Skrýt camo bloky
option.carpenters.hide=Skrýt camo bloky
option.extrautilities.fluidamount=Zobrazit množství tekutin
option.openblocks.fluidamount=Zobrazit množství tekutin
option.railcraft.fluidamount=Zobrazit množství tekutin
option.secretrooms.hide=Skrýt camo bloky
option.carpenters.hide=Skrýt camo bloky
option.stevescarts.showall=Zobrazit data
option.stevescarts.colorblind=Barevný mód
option.stevescarts.shifttoggle=Shift pro pøepnutí
option.general.showhp=Zobrazit zdraví entit
option.general.showcrop=Zobrazit rùst plodin
option.stevescarts.colorblind=Barevný mód
option.stevescarts.shifttoggle=Shift pro pøepnutí
option.general.showhp=Zobrazit zdraví entit
option.general.showcrop=Zobrazit rùst plodin
option.thaumcraft.aspects=Zobrazit aspekty
@@ -30,6 +30,7 @@ enchant.label.enchantability=Verzauberbarkeit
waila.keybind.wailaconfig=[Waila] Config-Bildschirm
waila.keybind.wailadisplay=[Waila] Zeigen/Verstecken
waila.keybind.showadvanced=[Waila] Tooltip erweitern
waila.keybind.liquid=[Waila] Zeige Flüssigkeiten
waila.keybind.recipe=[Waila] Zeige Rezept
waila.keybind.usage=[Waila] Zeige Nutzung
@@ -38,6 +39,8 @@ waila.keybind.testing=[Waila] Testen
client.msg.norecipe=Kein Rezept gefunden.
client.msg.nousage=Keine Nutzung gefunden.
hud.msg.holdkeymoreinfo=Halte %s für mehr Infos
hud.msg.none=<Nichts>
hud.msg.empty=<Leer>
hud.msg.output=Output
@@ -20,7 +20,7 @@ choice.toggledmaintained=Toggled/Maintained
choice.showliquids=Liquids
choice.shifttoggledblock=Sneak toggle blocks
choice.shifttoggledents=Sneak toggle entities
choice.forcelegacymode=Force legacy mode
choice.showicon=Show/Hide Icon
screen.button.configureaspect=Configure aspect...
enchant.title.name=Name
@@ -31,6 +31,7 @@ enchant.label.enchantability=Enchantability
waila.keybind.wailaconfig=[Waila] Config screen
waila.keybind.wailadisplay=[Waila] Show/Hide
waila.keybind.showadvanced=[Waila] Expand Tooltip
waila.keybind.liquid=[Waila] Show liquids
waila.keybind.recipe=[Waila] Show recipe
waila.keybind.usage=[Waila] Show usage
@@ -39,6 +40,8 @@ waila.keybind.testing=[Waila] Testing
client.msg.norecipe=No recipe found.
client.msg.nousage=No usage found.
hud.msg.holdkeymoreinfo=Hold %s for more info
hud.msg.none=<None>
hud.msg.empty=<Empty>
hud.msg.output=Output
@@ -96,6 +99,8 @@ hud.msg.record=Record
hud.msg.offers=Offers
hud.msg.demands=Demands
hud.msg.tcnodetotalsize=Total Size
option.appeng.monitorcontent=Monitor's content
option.bb.content=Barrel's content
option.bc.tankamount=Liquid amount
@@ -150,39 +155,4 @@ option.general.showhp=Show entities health
option.general.showcrop=Show crop growth
option.thaumcraft.aspects=Show aspects
nei.options.keys.showenchant=Show enchanting values
# waila harvestability
# tools
wailaharvestability.toolclass.pickaxe=Pickaxe
wailaharvestability.toolclass.shovel=Shovel
wailaharvestability.toolclass.axe=Axe
wailaharvestability.toolclass.chisel=Chisel
wailaharvestability.toolclass.scoop=Scoop
wailaharvestability.toolclass.crowbar=Crowbar
wailaharvestability.toolclass.sword=Sword
# tooltips
wailaharvestability.effectivetool=Effective Tool :
wailaharvestability.harvestlevel=Harvest Level :
wailaharvestability.currentlyharvestable= Currently Harvestable
wailaharvestability.harvestable= Harvestable
# options
option.harvestability.harvestlevel=Harvest level
option.harvestability.effectivetool=Effective tool
option.harvestability.currentlyharvestable=Currently harvestable
option.harvestability.oresonly=Ores only
option.harvestability.harvestlevel.sneakingonly=Sneak only: Harvest level
option.harvestability.effectivetool.sneakingonly=Sneak only: Effective tool
option.harvestability.currentlyharvestable.sneakingonly=Sneak only: Harvestable
option.harvestability.minimal=Minimal mode
option.harvestability.unharvestableonly=Unharvestable only
option.harvestability.toolrequiredonly=Tool required only
option.harvestability.shearability=Shearability
option.harvestability.shearability.sneakingonly=Sneak only: Shearability
option.harvestability.silktouchability=Silk Touchability
option.harvestability.silktouchability.sneakingonly=Sneak only: Silk Touchability
option.harvestability.harvestlevelnum=Harvest level no.
option.harvestability.harvestlevelnum.sneakingonly=Sneak only: Harvest level no.
nei.options.keys.showenchant=Show enchanting values
@@ -30,6 +30,7 @@ enchant.label.enchantability=Loitsitav
waila.keybind.wailaconfig=[Waila] Konfiguratsiooni ekraan
waila.keybind.wailadisplay=[Waila] Näita/Peida
waila.keybind.showadvanced=[Waila] Laienda kohtspikrit
waila.keybind.liquid=[Waila] Näita vedelikke
waila.keybind.recipe=[Waila] Näita retsepti
waila.keybind.usage=[Waila] Näita kasutamist
@@ -38,6 +39,8 @@ waila.keybind.testing=[Waila] Testimine
client.msg.norecipe=Ühtegi retsepti ei leitud.
client.msg.nousage=Ühtegi kasutust ei leitud.
hud.msg.holdkeymoreinfo=Hoia %s lisainfo saamiseks
hud.msg.none=<Mitte Ükski>
hud.msg.empty=<Tühi>
hud.msg.output=Väljund
@@ -28,6 +28,7 @@ enchant.label.enchantability=Enchantabilitée
waila.keybind.wailaconfig=[Waila] Ecran de config
waila.keybind.wailadisplay=[Waila] Afficher/Masquer
waila.keybind.showadvanced=[Waila] Développer l'info-bulle
waila.keybind.liquid=[Waila] Afficher les liquides
waila.keybind.recipe=[Waila] Afficher les recettes
waila.keybind.usage=[Waila] Afficher l'utilisation
@@ -36,6 +37,8 @@ waila.keybind.testing=[Waila] Test
client.msg.norecipe=Pas de recette trouvée.
client.msg.nousage=Pas d'utilisation trouvée.
hud.msg.holdkeymoreinfo=Maintenez %s pour plus d'infos
hud.msg.none=<Aucun>
hud.msg.empty=<Vide>
hud.msg.output=Sortie
@@ -30,6 +30,7 @@ enchant.label.enchantability=Incantabilità
waila.keybind.wailaconfig=[Waila] Config menù
waila.keybind.wailadisplay=[Waila] Mostra/Nascondi
waila.keybind.showadvanced=[Waila] Espandi tooltip
waila.keybind.liquid=[Waila] Mostra liquidi
waila.keybind.recipe=[Waila] Mostra ricetta
waila.keybind.usage=[Waila] Mostra uso
@@ -38,6 +39,8 @@ waila.keybind.testing=[Waila] Provare
client.msg.norecipe=Nessuna ricetta trovata.
client.msg.nousage=Nessun uso trovato.
hud.msg.holdkeymoreinfo=Tieni premuto %s per più info
hud.msg.none=<Niente>
hud.msg.empty=<Vuoto>
hud.msg.output=Uscita
@@ -28,6 +28,7 @@ enchant.label.enchantability=Enchantbaarheid
waila.keybind.wailaconfig=[Waila] Configuratiescherm
waila.keybind.wailadisplay=[Waila] Toon/Verberg
waila.keybind.showadvanced=[Waila] Tooltip uitvouwen
waila.keybind.liquid=[Waila] Toon vloeistoffen
waila.keybind.recipe=[Waila] Toon recepten
waila.keybind.usage=[Waila] Toon gebruik
@@ -36,6 +37,8 @@ waila.keybind.testing=[Waila] Testen
client.msg.norecipe=Geen recept gevonden.
client.msg.nousage=Geen gebruik gevonden.
hud.msg.holdkeymoreinfo=Houd %s ingedrukt voor meer info
hud.msg.none=<Geen>
hud.msg.empty=<Leeg>
hud.msg.output=Uitvoer
@@ -30,6 +30,7 @@ enchant.label.enchantability=Зачарование
waila.keybind.wailaconfig=[Waila] Меню настроек
waila.keybind.wailadisplay=[Waila] Показать/Скрыть
waila.keybind.showadvanced=[Waila] Развернуть подсказку
waila.keybind.liquid=[Waila] Показать жидкости
waila.keybind.recipe=[Waila] Показать рецепт
waila.keybind.usage=[Waila] Показать применение
@@ -38,6 +39,8 @@ waila.keybind.testing=[Waila] Тестировать
client.msg.norecipe=Рецептов не найдено.
client.msg.nousage=Применений не найдено.
hud.msg.holdkeymoreinfo=Удерживайте %s для подробностей
hud.msg.none=<Ничего>
hud.msg.empty=<Пусто>
hud.msg.output=Вывод
@@ -30,6 +30,7 @@ enchant.label.enchantability=附魔能力
waila.keybind.wailaconfig=[Waila]配置屏幕
waila.keybind.wailadisplay=[Waila]显示/隐藏
waila.keybind.showadvanced=[Waila]展开工具提示
waila.keybind.liquid=[Waila]显示流体
waila.keybind.recipe=[Waila]显示合成
waila.keybind.usage=[Waila]显示可参与合成
@@ -38,6 +39,8 @@ waila.keybind.testing=[Waila]测试中
client.msg.norecipe=未发现合成表.
client.msg.nousage=未发现可参与合成.
hud.msg.holdkeymoreinfo=按住 %s 查看更多信息
hud.msg.none=<无>
hud.msg.empty=<空>
hud.msg.output=输出