mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-16 01:55:12 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
191e1f2442 | ||
|
|
c33e565e0d | ||
|
|
f931b4f885 | ||
|
|
041160c427 | ||
|
|
bb9efac917 |
No files matched your search
@@ -14,6 +14,7 @@ dependencies {
|
||||
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Dashboard:1.0.19:api")
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false}
|
||||
|
||||
@@ -58,6 +58,7 @@ import crazypants.enderio.gui.TooltipHandlerBurnTime;
|
||||
import crazypants.enderio.gui.TooltipHandlerFluid;
|
||||
import crazypants.enderio.gui.TooltipHandlerGrinding;
|
||||
import crazypants.enderio.item.ConduitProbeOverlayRenderer;
|
||||
import crazypants.enderio.item.DashboardHud;
|
||||
import crazypants.enderio.item.KeyTracker;
|
||||
import crazypants.enderio.item.ToolTickHandler;
|
||||
import crazypants.enderio.item.YetaWrenchOverlayRenderer;
|
||||
@@ -401,6 +402,9 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
new YetaWrenchOverlayRenderer();
|
||||
new ConduitProbeOverlayRenderer();
|
||||
if (EnderIO.hasDashboard) {
|
||||
DashboardHud.register();
|
||||
}
|
||||
if (Config.useSneakMouseWheelYetaWrench) {
|
||||
ToolTickHandler th = new ToolTickHandler();
|
||||
MinecraftForge.EVENT_BUS.register(th);
|
||||
|
||||
@@ -192,6 +192,7 @@ import crazypants.util.EE3Util;
|
||||
after:Thaumcraft;\
|
||||
after:appliedenergistics2@[rv2-beta-8,);\
|
||||
after:Railcraft@[9.16.7,);\
|
||||
after:dashboard@[1.0.19,);\
|
||||
after:betterbuilderswands@[0.13.12,)\
|
||||
""", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
|
||||
public class EnderIO {
|
||||
@@ -219,6 +220,7 @@ public class EnderIO {
|
||||
public static final boolean hasEtFuturum = Loader.isModLoaded("etfuturum");
|
||||
public static final boolean hasWailaPlugins = Loader.isModLoaded("wailaplugins");
|
||||
public static final boolean hasAutomagy = Loader.isModLoaded("Automagy");
|
||||
public static final boolean hasDashboard = Loader.isModLoaded("dashboard");
|
||||
|
||||
// Materials
|
||||
public static ItemCapacitor itemBasicCapacitor;
|
||||
|
||||
@@ -38,15 +38,24 @@ public class ConduitProbeOverlayRenderer {
|
||||
}
|
||||
|
||||
private void doRenderOverlay(RenderGameOverlayEvent event, ItemStack equippedProbe) {
|
||||
if (EnderIO.hasDashboard && !DashboardHud.beginProbe(event.resolution)) {
|
||||
return;
|
||||
}
|
||||
draw(equippedProbe.getItemDamage() == 0, event.resolution);
|
||||
if (EnderIO.hasDashboard) {
|
||||
DashboardHud.endRender();
|
||||
}
|
||||
}
|
||||
|
||||
static void draw(boolean probeMode, ScaledResolution res) {
|
||||
IconEIO icon1, icon2;
|
||||
if (equippedProbe.getItemDamage() == 0) {
|
||||
if (probeMode) {
|
||||
icon1 = IconEIO.PROBE_OVERLAY_PROBE;
|
||||
icon2 = IconEIO.PROBE_OVERLAY_COPY_OFF;
|
||||
} else {
|
||||
icon1 = IconEIO.PROBE_OVERLAY_PROBE_OFF;
|
||||
icon2 = IconEIO.PROBE_OVERLAY_COPY;
|
||||
}
|
||||
ScaledResolution res = event.resolution;
|
||||
|
||||
double offsetX = res.getScaledWidth() - 48;
|
||||
double offsetY = res.getScaledHeight() - 16;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package crazypants.enderio.item;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
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;
|
||||
import crazypants.enderio.conduit.ConduitDisplayMode;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
/**
|
||||
* Lets players move, resize and hide the Conduit Probe and Yeta Wrench HUD 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 HudElement PROBE = new HudElement(
|
||||
"enderio:conduit_probe",
|
||||
(screenWidth, screenHeight) -> new HudBounds(screenWidth - 80, screenHeight - 48, 64, 32));
|
||||
|
||||
/** Only with the default overlay, which shows it for a moment after switching. */
|
||||
private static final HudElement WRENCH_SELECTOR = new HudElement(
|
||||
"enderio:yeta_wrench_selector",
|
||||
(screenWidth, screenHeight) -> new HudBounds(screenWidth / 2 - 22, screenHeight / 2 - 24, 44, 16))
|
||||
.setActiveCheck(() -> Config.yetaWrenchOverlayMode == 0);
|
||||
|
||||
/** The corner icon, the column or the group of icons, depending on the overlay setting. */
|
||||
private static final HudElement WRENCH_MODE = new HudElement(
|
||||
"enderio:yeta_wrench_mode",
|
||||
DashboardHud::getWrenchModeBounds);
|
||||
|
||||
private DashboardHud() {}
|
||||
|
||||
public static void register() {
|
||||
PROBE.setPreview((screenWidth, screenHeight) -> HudRegistry.render(PROBE, () -> {
|
||||
ConduitProbeOverlayRenderer.draw(true, HudRegistry.getResolution());
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
}));
|
||||
WRENCH_SELECTOR.setPreview(
|
||||
(screenWidth, screenHeight) -> HudRegistry.render(
|
||||
WRENCH_SELECTOR,
|
||||
() -> YetaWrenchOverlayRenderer
|
||||
.draw(ConduitDisplayMode.ALL, HudRegistry.getResolution(), true)));
|
||||
WRENCH_MODE.setPreview(
|
||||
(screenWidth, screenHeight) -> HudRegistry.render(
|
||||
WRENCH_MODE,
|
||||
() -> YetaWrenchOverlayRenderer
|
||||
.draw(ConduitDisplayMode.ALL, HudRegistry.getResolution(), false)));
|
||||
HudRegistry.register(PROBE);
|
||||
HudRegistry.register(WRENCH_SELECTOR);
|
||||
HudRegistry.register(WRENCH_MODE);
|
||||
}
|
||||
|
||||
/** False means the player hid it, so skip drawing it and do not call {@link #endRender()}. */
|
||||
static boolean beginProbe(ScaledResolution resolution) {
|
||||
return HudRegistry.beginRender(PROBE, resolution);
|
||||
}
|
||||
|
||||
/** The selector while it shows, otherwise the corner icon, the column or the group of icons. */
|
||||
static boolean beginWrench(ScaledResolution resolution, boolean showSelector) {
|
||||
return HudRegistry.beginRender(showSelector ? WRENCH_SELECTOR : WRENCH_MODE, resolution);
|
||||
}
|
||||
|
||||
static void endRender() {
|
||||
HudRegistry.endRender();
|
||||
}
|
||||
|
||||
/** Measured like YetaWrenchOverlayRenderer draws each overlay. */
|
||||
private static HudBounds getWrenchModeBounds(int screenWidth, int screenHeight) {
|
||||
int modeCount = ConduitDisplayMode.registrySize();
|
||||
return switch (Config.yetaWrenchOverlayMode) {
|
||||
case 1 -> new HudBounds(screenWidth - 23, screenHeight - modeCount * 18 - 6, 23, modeCount * 18 + 6);
|
||||
case 2 -> new HudBounds(screenWidth - modeCount * 8 - 16, screenHeight - 40, (modeCount + 1) / 2 * 16, 32);
|
||||
default -> new HudBounds(screenWidth - 20, screenHeight - 20, 16, 16);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vector4f;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.api.tool.IConduitControl;
|
||||
import crazypants.enderio.conduit.ConduitDisplayMode;
|
||||
import crazypants.enderio.config.Config;
|
||||
@@ -57,20 +58,28 @@ public class YetaWrenchOverlayRenderer {
|
||||
lastTick = ClientHandler.getTicksElapsed();
|
||||
}
|
||||
|
||||
ScaledResolution res = event.resolution;
|
||||
boolean showSelector = displayTickCount > 0 && Config.yetaWrenchOverlayMode == 0;
|
||||
if (showSelector && lastTick < ClientHandler.getTicksElapsed()) {
|
||||
lastTick++;
|
||||
displayTickCount--;
|
||||
}
|
||||
if (EnderIO.hasDashboard && !DashboardHud.beginWrench(event.resolution, showSelector)) {
|
||||
return;
|
||||
}
|
||||
draw(mode, event.resolution, showSelector);
|
||||
if (EnderIO.hasDashboard) {
|
||||
DashboardHud.endRender();
|
||||
}
|
||||
}
|
||||
|
||||
static void draw(ConduitDisplayMode mode, ScaledResolution res, boolean showSelector) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
int modeCount = ConduitDisplayMode.registrySize();
|
||||
Iterable<ConduitDisplayMode> renderable = ConduitDisplayMode.getRenderableModes();
|
||||
|
||||
switch (Config.yetaWrenchOverlayMode) {
|
||||
case 0:
|
||||
if (displayTickCount > 0) {
|
||||
|
||||
if (lastTick < ClientHandler.getTicksElapsed()) {
|
||||
lastTick++;
|
||||
displayTickCount--;
|
||||
}
|
||||
|
||||
if (showSelector) {
|
||||
int x = res.getScaledWidth() / 2 - 8;
|
||||
int y = res.getScaledHeight() / 2 - 24;
|
||||
|
||||
|
||||
Reference in new issue
Block a user