mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-16 18:45:05 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16eeb90243 | ||
|
|
3dcc754fb0 | ||
|
|
511aae0e52 |
No files matched your search
@@ -6,7 +6,6 @@ dependencies {
|
||||
shadowImplementation('au.com.bytecode:opencsv:2.4')
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.463:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Dashboard:1.0.2:api")
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'waila'
|
||||
|
||||
@@ -29,19 +29,17 @@ import mcp.mobius.waila.client.KeyEvent;
|
||||
import mcp.mobius.waila.commands.CommandDumpHandlers;
|
||||
import mcp.mobius.waila.network.NetworkHandler;
|
||||
import mcp.mobius.waila.network.WailaPacketHandler;
|
||||
import mcp.mobius.waila.overlay.DashboardHud;
|
||||
import mcp.mobius.waila.overlay.DecoratorRenderer;
|
||||
import mcp.mobius.waila.overlay.OverlayConfig;
|
||||
import mcp.mobius.waila.overlay.WailaTickHandler;
|
||||
import mcp.mobius.waila.server.ProxyServer;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
import mcp.mobius.waila.utils.ModIdentification;
|
||||
|
||||
@Mod(
|
||||
modid = "Waila",
|
||||
name = "Waila",
|
||||
version = Tags.GRADLETOKEN_VERSION,
|
||||
dependencies = "after:NotEnoughItems@[1.0.4.0,);after:dashboard@[1.0.2,)",
|
||||
dependencies = "after:NotEnoughItems@[1.0.4.0,)",
|
||||
acceptableRemoteVersions = "*",
|
||||
guiFactory = "mcp.mobius.waila.client.WailaGuiFactory")
|
||||
public class Waila {
|
||||
@@ -71,7 +69,6 @@ public class Waila {
|
||||
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
|
||||
FMLCommonHandler.instance().bus().register(new KeyEvent());
|
||||
FMLCommonHandler.instance().bus().register(new WailaTickHandler());
|
||||
if (LoadedMods.DASHBOARD) DashboardHud.register();
|
||||
}
|
||||
FMLCommonHandler.instance().bus().register(new NetworkHandler());
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import cpw.mods.fml.common.registry.GameData;
|
||||
import mcp.mobius.waila.api.IWailaCommonAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaEntityAccessor;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerInventory;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
|
||||
public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAccessor, IWailaEntityAccessor {
|
||||
@@ -123,9 +124,23 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData() {
|
||||
if ((this.tileEntity != null) && this.isTagCorrectTileEntity(this.remoteNbt)) return remoteNbt;
|
||||
if ((this.tileEntity != null) && this.isTagCorrectTileEntity(this.remoteNbt)) {
|
||||
if (!remoteNbt.getBoolean(HUDHandlerInventory.TAG_SUMMARY_ONLY)) return remoteNbt;
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
try {
|
||||
this.tileEntity.writeToNBT(tag);
|
||||
} catch (Exception ignored) {}
|
||||
return HUDHandlerInventory.mergeSummary(remoteNbt, tag);
|
||||
}
|
||||
|
||||
if ((this.entity != null) && this.isTagCorrectEntity(this.remoteNbt)) return remoteNbt;
|
||||
if ((this.entity != null) && this.isTagCorrectEntity(this.remoteNbt)) {
|
||||
if (!remoteNbt.getBoolean(HUDHandlerInventory.TAG_SUMMARY_ONLY)) return remoteNbt;
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
try {
|
||||
this.entity.writeToNBT(tag);
|
||||
} catch (Exception ignored) {}
|
||||
return HUDHandlerInventory.mergeSummary(remoteNbt, tag);
|
||||
}
|
||||
|
||||
if (this.tileEntity != null) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
@@ -21,6 +21,7 @@ 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.handlers.HUDHandlerInventory;
|
||||
import mcp.mobius.waila.network.Message0x01TERequest;
|
||||
import mcp.mobius.waila.network.Message0x03EntRequest;
|
||||
import mcp.mobius.waila.network.WailaPacketHandler;
|
||||
@@ -80,7 +81,8 @@ public class MetaDataProvider {
|
||||
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(accessor.getTileEntity()));
|
||||
|
||||
if (!keys.isEmpty() || ModuleRegistrar.instance().hasNBTProviders(block)
|
||||
|| ModuleRegistrar.instance().hasNBTProviders(accessor.getTileEntity()))
|
||||
|| ModuleRegistrar.instance().hasNBTProviders(accessor.getTileEntity())
|
||||
|| HUDHandlerInventory.shouldRequest(accessor.getTileEntity()))
|
||||
WailaPacketHandler.INSTANCE.sendToServer(new Message0x01TERequest(accessor.getTileEntity(), keys));
|
||||
|
||||
} else if (accessor.getTileEntity() != null && !Waila.instance.serverPresent
|
||||
@@ -193,7 +195,8 @@ public class MetaDataProvider {
|
||||
if (ModuleRegistrar.instance().hasSyncedNBTKeys(accessor.getEntity()))
|
||||
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(accessor.getEntity()));
|
||||
|
||||
if (!keys.isEmpty() || ModuleRegistrar.instance().hasNBTEntityProviders(accessor.getEntity()))
|
||||
if (!keys.isEmpty() || ModuleRegistrar.instance().hasNBTEntityProviders(accessor.getEntity())
|
||||
|| HUDHandlerInventory.shouldRequest(accessor.getEntity()))
|
||||
WailaPacketHandler.INSTANCE.sendToServer(new Message0x03EntRequest(accessor.getEntity(), keys));
|
||||
|
||||
} else if (accessor.getEntity() != null && !Waila.instance.serverPresent && accessor.isTimeElapsed(250)) {
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
package mcp.mobius.waila.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryLargeChest;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
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.IWailaEntityAccessor;
|
||||
import mcp.mobius.waila.api.IWailaEntityProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
/**
|
||||
* Shows "X items in Y of Z slots" for every block and entity that is an {@link IInventory}.
|
||||
* <p>
|
||||
* The server always adds the summary to the NBT answer of a {@link IInventory} target (see
|
||||
* {@link #writeSummary(Object, World, int, int, int, NBTTagCompound)}). This is not done with an NBT provider, because
|
||||
* an NBT provider would stop the synced NBT keys of other mods for all inventories.
|
||||
* <p>
|
||||
* If the client only asked because of the summary, the answer has only the summary and {@link #TAG_SUMMARY_ONLY}. The
|
||||
* client then adds the summary to its own NBT of the target, so that other mods still get the same NBT as before.
|
||||
*/
|
||||
public class HUDHandlerInventory implements IWailaDataProvider, IWailaEntityProvider {
|
||||
|
||||
public static final String CFG_SHOW = "general.showinventory";
|
||||
|
||||
private static final String TAG_ITEMS = "WailaInvItems";
|
||||
private static final String TAG_USED = "WailaInvUsed";
|
||||
private static final String TAG_SLOTS = "WailaInvSlots";
|
||||
public static final String TAG_SUMMARY_ONLY = "WailaInvOnly";
|
||||
|
||||
/**
|
||||
* @return true if the client must ask the server for the summary of this target.
|
||||
*/
|
||||
public static boolean shouldRequest(Object target) {
|
||||
// Players implement IInventory, so this also summarises player inventories. Test instanceof EntityPlayer to
|
||||
// skip.
|
||||
return target instanceof IInventory && ConfigHandler.instance().getConfig(CFG_SHOW, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Server side: adds the item count, the used slots and the total slots of the target to the tag.
|
||||
*/
|
||||
public static void writeSummary(Object target, NBTTagCompound tag) {
|
||||
if (!(target instanceof IInventory)) return;
|
||||
try {
|
||||
IInventory inv = (IInventory) target;
|
||||
|
||||
// Count both halves of a double chest. The chest updates its neighbours every tick.
|
||||
if (target instanceof TileEntityChest chest) {
|
||||
TileEntityChest other = chest.adjacentChestXNeg != null ? chest.adjacentChestXNeg
|
||||
: chest.adjacentChestXPos != null ? chest.adjacentChestXPos
|
||||
: chest.adjacentChestZNeg != null ? chest.adjacentChestZNeg : chest.adjacentChestZPos;
|
||||
if (other != null) inv = new InventoryLargeChest("", chest, other);
|
||||
}
|
||||
|
||||
long items = 0;
|
||||
int used = 0;
|
||||
int slots = inv.getSizeInventory();
|
||||
for (int i = 0; i < slots; i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack == null || stack.getItem() == null || stack.stackSize <= 0) continue;
|
||||
items += stack.stackSize;
|
||||
used++;
|
||||
}
|
||||
|
||||
tag.setLong(TAG_ITEMS, items);
|
||||
tag.setInteger(TAG_USED, used);
|
||||
tag.setInteger(TAG_SLOTS, slots);
|
||||
} catch (Exception e) {
|
||||
// Do not lose the data of the other providers because of one bad inventory
|
||||
WailaExceptionHandler.handleErr(e, "HUDHandlerInventory | " + target.getClass().getName(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Client side: adds the values of a summary only answer to the local NBT of the target.
|
||||
*/
|
||||
public static NBTTagCompound mergeSummary(NBTTagCompound remote, NBTTagCompound local) {
|
||||
for (String key : new String[] { TAG_ITEMS, TAG_USED, TAG_SLOTS }) {
|
||||
NBTBase tag = remote.getTag(key);
|
||||
if (tag != null) local.setTag(key, tag.copy());
|
||||
}
|
||||
return local;
|
||||
}
|
||||
|
||||
private static void addLine(NBTTagCompound tag, List<String> currenttip, IWailaConfigHandler config) {
|
||||
if (tag == null || !config.getConfig(CFG_SHOW, true) || !tag.hasKey(TAG_SLOTS)) return;
|
||||
int slots = tag.getInteger(TAG_SLOTS);
|
||||
if (slots <= 0) return;
|
||||
long items = tag.getLong(TAG_ITEMS);
|
||||
int used = tag.getInteger(TAG_USED);
|
||||
String key = items == 1 ? "hud.msg.inventory.single" : "hud.msg.inventory";
|
||||
currenttip.add(String.format(LangUtil.translateG(key), items, used, slots));
|
||||
}
|
||||
|
||||
@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) {
|
||||
addLine(accessor.getNBTData(), currenttip, config);
|
||||
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) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
addLine(accessor.getNBTData(), currenttip, config);
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, Entity ent, NBTTagCompound tag, World world) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
HUDHandlerInventory provider = new HUDHandlerInventory();
|
||||
ModuleRegistrar.instance().addConfig("General", CFG_SHOW, true);
|
||||
ModuleRegistrar.instance().registerBodyProvider((IWailaDataProvider) provider, IInventory.class);
|
||||
ModuleRegistrar.instance().registerBodyProvider((IWailaEntityProvider) provider, IInventory.class);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerInventory;
|
||||
import mcp.mobius.waila.utils.AccessHelper;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
@@ -125,11 +126,16 @@ public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x0
|
||||
}
|
||||
}
|
||||
|
||||
} else if (msg.keys.isEmpty()) {
|
||||
// The client asked only for the inventory summary
|
||||
tag.setBoolean(HUDHandlerInventory.TAG_SUMMARY_ONLY, true);
|
||||
} else {
|
||||
entity.writeToNBT(tag);
|
||||
tag = NBTUtil.createTag(tag, msg.keys);
|
||||
}
|
||||
|
||||
HUDHandlerInventory.writeSummary(entity, tag);
|
||||
|
||||
tag.setInteger("WailaX", msg.posX);
|
||||
tag.setInteger("WailaY", msg.posY);
|
||||
tag.setInteger("WailaZ", msg.posZ);
|
||||
|
||||
@@ -16,6 +16,7 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import mcp.mobius.waila.api.IWailaEntityProvider;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerInventory;
|
||||
import mcp.mobius.waila.utils.AccessHelper;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
@@ -83,11 +84,16 @@ public class Message0x03EntRequest extends SimpleChannelInboundHandler<Message0x
|
||||
}
|
||||
}
|
||||
|
||||
} else if (msg.keys.isEmpty()) {
|
||||
// The client asked only for the inventory summary
|
||||
tag.setBoolean(HUDHandlerInventory.TAG_SUMMARY_ONLY, true);
|
||||
} else {
|
||||
entity.writeToNBT(tag);
|
||||
tag = NBTUtil.createTag(tag, msg.keys);
|
||||
}
|
||||
|
||||
HUDHandlerInventory.writeSummary(entity, tag);
|
||||
|
||||
tag.setInteger("WailaEntityID", entity.getEntityId());
|
||||
|
||||
WailaPacketHandler.INSTANCE.sendTo(new Message0x04EntNBTData(tag), WailaPacketHandler.getPlayer(ctx));
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package mcp.mobius.waila.overlay;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import com.gtnewhorizons.dashboard.api.HudBounds;
|
||||
import com.gtnewhorizons.dashboard.api.HudElement;
|
||||
import com.gtnewhorizons.dashboard.api.HudRegistry;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Lets players move, resize and hide the info box in Dashboard's HUD editor. The only class using Dashboard, so only
|
||||
* call it while Dashboard is loaded.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final class DashboardHud {
|
||||
|
||||
private static final long SAMPLE_REUSE_MILLIS = 1000;
|
||||
|
||||
private static final HudElement INFO_BOX = new HudElement("waila:info_box", DashboardHud::getBounds)
|
||||
.setOwnSettings("dashboard.element.waila.info_box.own_settings", "waila.keybind.wailaconfig");
|
||||
|
||||
private static Tooltip sample;
|
||||
private static long lastSampleTime;
|
||||
|
||||
/** The box drawn last, before scaling, so the element follows its size and Waila's position setting. */
|
||||
private static boolean boxDrawn;
|
||||
private static int boxX;
|
||||
private static int boxY;
|
||||
private static int boxWidth;
|
||||
private static int boxHeight;
|
||||
|
||||
private DashboardHud() {}
|
||||
|
||||
public static void register() {
|
||||
INFO_BOX.setPreview((screenWidth, screenHeight) -> OverlayRenderer.drawPreview(getSample()));
|
||||
HudRegistry.register(INFO_BOX);
|
||||
}
|
||||
|
||||
/** The mod that drew the box, if not Waila, is shown next to Waila's name in the editor. */
|
||||
static boolean beginBox(String drawnBy, int x, int y, int width, int height) {
|
||||
INFO_BOX.setModNameAddon(drawnBy);
|
||||
boxDrawn = true;
|
||||
boxX = x;
|
||||
boxY = y;
|
||||
boxWidth = width;
|
||||
boxHeight = height;
|
||||
return HudRegistry.beginRender(INFO_BOX);
|
||||
}
|
||||
|
||||
static void endBox() {
|
||||
HudRegistry.endRender();
|
||||
}
|
||||
|
||||
/**
|
||||
* The same sample is kept while the editor is open, since a box drawn by another mod may start over for every new
|
||||
* one. A new one is made after a break, so it follows changed Waila settings.
|
||||
*/
|
||||
private static Tooltip getSample() {
|
||||
long now = System.currentTimeMillis();
|
||||
if (sample == null || now - lastSampleTime > SAMPLE_REUSE_MILLIS) {
|
||||
sample = createSample();
|
||||
}
|
||||
lastSampleTime = now;
|
||||
return sample;
|
||||
}
|
||||
|
||||
/** Stone, like looking at a block. */
|
||||
private static Tooltip createSample() {
|
||||
ItemStack stone = new ItemStack(Blocks.stone);
|
||||
return new Tooltip(
|
||||
Arrays.asList(
|
||||
EnumChatFormatting.WHITE + stone.getDisplayName(),
|
||||
EnumChatFormatting.BLUE.toString() + EnumChatFormatting.ITALIC + "Minecraft"),
|
||||
stone);
|
||||
}
|
||||
|
||||
/** Before the first box is drawn, the sample's place and size. */
|
||||
private static HudBounds getBounds(int screenWidth, int screenHeight) {
|
||||
if (!boxDrawn) {
|
||||
if (sample == null) {
|
||||
sample = createSample();
|
||||
}
|
||||
return getBounds(sample.x, sample.y, sample.w + 1, sample.h + 1);
|
||||
}
|
||||
return getBounds(boxX, boxY, boxWidth, boxHeight);
|
||||
}
|
||||
|
||||
private static HudBounds getBounds(int x, int y, int width, int height) {
|
||||
float scale = OverlayConfig.scale;
|
||||
return new HudBounds(
|
||||
Math.round(x * scale),
|
||||
Math.round(y * scale),
|
||||
Math.round(width * scale),
|
||||
Math.round(height * scale));
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class OverlayRenderer {
|
||||
|
||||
@@ -38,32 +37,7 @@ public class OverlayRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws a sample box, for previews like a HUD editor's. */
|
||||
static void drawPreview(Tooltip tooltip) {
|
||||
doRenderOverlay(tooltip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call right before drawing the info box, with its place and size before scaling, also when another mod draws the
|
||||
* box. Lets a HUD editor move, resize or hide it. False means the box is hidden, so skip drawing it and do not call
|
||||
* {@link #endBox()}.
|
||||
*/
|
||||
public static boolean beginBox(int x, int y, int width, int height) {
|
||||
return beginBox(null, x, y, width, height);
|
||||
}
|
||||
|
||||
/** Like {@link #beginBox(int, int, int, int)}, for a mod that draws the box itself, so a HUD editor can name it. */
|
||||
public static boolean beginBox(String drawnBy, int x, int y, int width, int height) {
|
||||
return !LoadedMods.DASHBOARD || DashboardHud.beginBox(drawnBy, x, y, width, height);
|
||||
}
|
||||
|
||||
/** Call right after drawing the info box, only if {@link #beginBox} returned true. */
|
||||
public static void endBox() {
|
||||
if (LoadedMods.DASHBOARD) DashboardHud.endBox();
|
||||
}
|
||||
|
||||
private static void doRenderOverlay(Tooltip tooltip) {
|
||||
if (!beginBox(tooltip.x, tooltip.y, tooltip.w + 1, tooltip.h + 1)) return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
saveGLState();
|
||||
@@ -100,7 +74,7 @@ public class OverlayRenderer {
|
||||
|
||||
loadGLState();
|
||||
GL11.glPopMatrix();
|
||||
endBox();
|
||||
|
||||
}
|
||||
|
||||
private static void saveGLState() {
|
||||
|
||||
@@ -29,6 +29,7 @@ import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.handlers.DecoratorFMP;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerFMP;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerInventory;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class ProxyServer {
|
||||
@@ -41,6 +42,7 @@ public class ProxyServer {
|
||||
|
||||
HUDHandlerVanilla.register();
|
||||
HUDHandlerFurnace.register();
|
||||
HUDHandlerInventory.register();
|
||||
|
||||
/* BUILDCRAFT */
|
||||
BCModule.register();
|
||||
|
||||
@@ -8,5 +8,4 @@ public class LoadedMods {
|
||||
public static boolean NEI = Loader.isModLoaded("NotEnoughItems");
|
||||
public static boolean GT5U = Loader.isModLoaded("gregtech_nh");
|
||||
public static boolean WAILA_PLUGINS = Loader.isModLoaded("wailaplugins");
|
||||
public static boolean DASHBOARD = Loader.isModLoaded("dashboard");
|
||||
}
|
||||
@@ -43,6 +43,8 @@ client.msg.nousage=No usage found.
|
||||
hud.msg.holdkeymoreinfo=Hold %s for more info
|
||||
|
||||
hud.msg.empty=Empty
|
||||
hud.msg.inventory=%d items in %d of %d slots
|
||||
hud.msg.inventory.single=%d item in %d of %d slots
|
||||
hud.msg.output=Output
|
||||
hud.msg.input=Input
|
||||
hud.msg.out=Out
|
||||
@@ -153,6 +155,7 @@ option.stevescarts.shifttoggle=Shift toggle
|
||||
option.general.showents=Show entities
|
||||
option.general.showhp=Show entities health
|
||||
option.general.showcrop=Show crop growth
|
||||
option.general.showinventory=Show inventory summary
|
||||
option.thaumcraft.aspects=Show aspects
|
||||
|
||||
nei.options.keys.showenchant=Show enchanting values
|
||||
Reference in new issue
Block a user