forked from RepoMirrors/kami-blue
temporary gui fix for #68
This commit is contained in:
parent
b560408564
commit
0e281b77d7
|
@ -27,7 +27,10 @@ import me.zeroeightsix.kami.setting.Setting;
|
||||||
import me.zeroeightsix.kami.setting.Settings;
|
import me.zeroeightsix.kami.setting.Settings;
|
||||||
import me.zeroeightsix.kami.setting.SettingsRegister;
|
import me.zeroeightsix.kami.setting.SettingsRegister;
|
||||||
import me.zeroeightsix.kami.setting.config.Configuration;
|
import me.zeroeightsix.kami.setting.config.Configuration;
|
||||||
import me.zeroeightsix.kami.util.*;
|
import me.zeroeightsix.kami.util.Friends;
|
||||||
|
import me.zeroeightsix.kami.util.LagCompensator;
|
||||||
|
import me.zeroeightsix.kami.util.RichPresence;
|
||||||
|
import me.zeroeightsix.kami.util.Wrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
@ -198,6 +201,7 @@ public class KamiMod {
|
||||||
ModuleManager.getModuleByName("InfoOverlay").setEnabled(true);
|
ModuleManager.getModuleByName("InfoOverlay").setEnabled(true);
|
||||||
ModuleManager.getModuleByName("InventoryViewer").setEnabled(true);
|
ModuleManager.getModuleByName("InventoryViewer").setEnabled(true);
|
||||||
ModuleManager.getModuleByName("ActiveModules").setEnabled(true);
|
ModuleManager.getModuleByName("ActiveModules").setEnabled(true);
|
||||||
|
ModuleManager.getModuleByName("FixGui").setEnabled(true);
|
||||||
|
|
||||||
if (((Capes) ModuleManager.getModuleByName("Capes")).startupGlobal.getValue()) {
|
if (((Capes) ModuleManager.getModuleByName("Capes")).startupGlobal.getValue()) {
|
||||||
ModuleManager.getModuleByName("Capes").setEnabled(true);
|
ModuleManager.getModuleByName("Capes").setEnabled(true);
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package me.zeroeightsix.kami.module.modules.gui;
|
package me.zeroeightsix.kami.module.modules.gui;
|
||||||
|
|
||||||
import me.zeroeightsix.kami.KamiMod;
|
|
||||||
import me.zeroeightsix.kami.gui.kami.KamiGUI;
|
|
||||||
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
|
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
|
||||||
import me.zeroeightsix.kami.gui.rgui.util.ContainerHelper;
|
|
||||||
import me.zeroeightsix.kami.module.Module;
|
import me.zeroeightsix.kami.module.Module;
|
||||||
import me.zeroeightsix.kami.setting.Setting;
|
import me.zeroeightsix.kami.setting.Setting;
|
||||||
import me.zeroeightsix.kami.setting.Settings;
|
import me.zeroeightsix.kami.setting.Settings;
|
||||||
|
@ -16,10 +13,8 @@ import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static me.zeroeightsix.kami.command.Command.sendDisableMessage;
|
import static me.zeroeightsix.kami.command.Command.sendDisableMessage;
|
||||||
import static me.zeroeightsix.kami.util.ColourConverter.rgbToInt;
|
import static me.zeroeightsix.kami.util.GuiFrameUtil.getFrameByName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updated by S-B99 on 21/02/20
|
* Updated by S-B99 on 21/02/20
|
||||||
|
@ -43,20 +38,6 @@ public class InventoryViewer extends Module {
|
||||||
private boolean isTop = false;
|
private boolean isTop = false;
|
||||||
private boolean isBottom = false;
|
private boolean isBottom = false;
|
||||||
|
|
||||||
KamiGUI kamiGUI = KamiMod.getInstance().getGuiManager();
|
|
||||||
|
|
||||||
// This is bad, but without a rearchitecture, it's probably staying... - 20kdc
|
|
||||||
private Frame getInventoryViewer() {
|
|
||||||
kamiGUI = KamiMod.getInstance().getGuiManager();
|
|
||||||
if (kamiGUI == null)
|
|
||||||
return null;
|
|
||||||
List<Frame> frames = ContainerHelper.getAllChildren(Frame.class, kamiGUI);
|
|
||||||
for (Frame frame : frames)
|
|
||||||
if (frame.getTitle().equalsIgnoreCase("inventory viewer"))
|
|
||||||
return frame;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int invMoveHorizontal() {
|
private int invMoveHorizontal() {
|
||||||
if (!docking.getValue() || mcTexture.getValue()) return 0;
|
if (!docking.getValue() || mcTexture.getValue()) return 0;
|
||||||
if (isLeft) return 45;
|
if (isLeft) return 45;
|
||||||
|
@ -72,7 +53,7 @@ public class InventoryViewer extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePos() {
|
private void updatePos() {
|
||||||
Frame frame = getInventoryViewer();
|
Frame frame = getFrameByName("inventory viewer");
|
||||||
if (frame == null)
|
if (frame == null)
|
||||||
return;
|
return;
|
||||||
isTop = frame.getDocking().isTop();
|
isTop = frame.getDocking().isTop();
|
||||||
|
@ -125,11 +106,11 @@ public class InventoryViewer extends Module {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRender() {
|
public void onRender() {
|
||||||
Frame frame = getInventoryViewer();
|
Frame frame = getFrameByName("inventory viewer");
|
||||||
if (frame == null)
|
if (frame == null)
|
||||||
return;
|
return;
|
||||||
if (frame.isPinned()) {
|
if (frame.isPinned()) {
|
||||||
final NonNullList<ItemStack> items = InventoryViewer.mc.player.inventory.mainInventory;
|
final NonNullList<ItemStack> items = mc.player.inventory.mainInventory;
|
||||||
boxRender(frame.getX(), frame.getY());
|
boxRender(frame.getX(), frame.getY());
|
||||||
itemRender(items, frame.getX(), frame.getY());
|
itemRender(items, frame.getX(), frame.getY());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package me.zeroeightsix.kami.module.modules.hidden;
|
||||||
|
|
||||||
|
import me.zeroeightsix.kami.module.Module;
|
||||||
|
|
||||||
|
import static me.zeroeightsix.kami.util.GuiFrameUtil.fixFrames;
|
||||||
|
|
||||||
|
@Module.Info(name = "Hidden:FixGui", category = Module.Category.HIDDEN, showOnArray = Module.ShowOnArray.OFF, description = "Moves GUI elements back on screen")
|
||||||
|
public class FixGui extends Module {
|
||||||
|
public void onUpdate() {
|
||||||
|
fixFrames(mc);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package me.zeroeightsix.kami.util;
|
||||||
|
|
||||||
|
import me.zeroeightsix.kami.KamiMod;
|
||||||
|
import me.zeroeightsix.kami.command.Command;
|
||||||
|
import me.zeroeightsix.kami.gui.kami.KamiGUI;
|
||||||
|
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
|
||||||
|
import me.zeroeightsix.kami.gui.rgui.util.ContainerHelper;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import org.lwjgl.opengl.Display;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author S-B99
|
||||||
|
* Created by S-B99 on 24/03/20
|
||||||
|
*/
|
||||||
|
public class GuiFrameUtil {
|
||||||
|
// This is bad, but without a rearchitecture, it's probably staying... - 20kdc and S-B99
|
||||||
|
public static Frame getFrameByName(String name) {
|
||||||
|
KamiGUI kamiGUI = KamiMod.getInstance().getGuiManager();
|
||||||
|
if (kamiGUI == null)
|
||||||
|
return null;
|
||||||
|
List<Frame> frames = ContainerHelper.getAllChildren(Frame.class, kamiGUI);
|
||||||
|
for (Frame frame : frames)
|
||||||
|
if (frame.getTitle().equalsIgnoreCase(name))
|
||||||
|
return frame;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Additional method to prevent calling kamiGui if you already have an instance */
|
||||||
|
public static Frame getFrameByName(KamiGUI kamiGUI, String name) {
|
||||||
|
if (kamiGUI == null)
|
||||||
|
return null;
|
||||||
|
List<Frame> frames = ContainerHelper.getAllChildren(Frame.class, kamiGUI);
|
||||||
|
for (Frame frame : frames)
|
||||||
|
if (frame.getTitle().equalsIgnoreCase(name))
|
||||||
|
return frame;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fixFrames(Minecraft mc) {
|
||||||
|
KamiGUI kamiGUI = KamiMod.getInstance().getGuiManager();
|
||||||
|
if (kamiGUI == null) return;
|
||||||
|
List<Frame> frames = ContainerHelper.getAllChildren(Frame.class, kamiGUI);
|
||||||
|
for (Frame frame : frames) {
|
||||||
|
int divider = mc.gameSettings.guiScale;
|
||||||
|
if (divider == 0) divider = 4;
|
||||||
|
if (frame.getX() > (Display.getWidth() / divider)) {
|
||||||
|
frame.setX((Display.getWidth() / divider) - frame.getWidth());
|
||||||
|
}
|
||||||
|
if (frame.getY() > (Display.getHeight() / divider)) {
|
||||||
|
frame.setY((Display.getHeight() / divider) - frame.getHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue