diff options
54 files changed, 1020 insertions, 372 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index aa9a9ef8..a5991e0f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -20,9 +20,9 @@ package kr.syeyoung.dungeonsguide.commands; import com.google.gson.JsonObject; import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.GuiConfigV2; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.cosmetics.chatreplacers.*; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; @@ -34,7 +34,6 @@ import kr.syeyoung.dungeonsguide.events.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; import kr.syeyoung.dungeonsguide.features.impl.party.api.ApiFetchur; -import kr.syeyoung.dungeonsguide.party.PartyInviteViewer; import kr.syeyoung.dungeonsguide.party.PartyManager; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; import kr.syeyoung.dungeonsguide.stomp.*; @@ -43,7 +42,6 @@ import kr.syeyoung.dungeonsguide.utils.MapUtils; import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; @@ -399,7 +397,7 @@ public class CommandDungeonsGuide extends CommandBase { StaticResourceCache.INSTANCE.getResource(uid).thenAccept(a -> { sender.addChatMessage(new ChatComponentText(a.getResourceID()+": "+a.getValue()+": "+a.isExists())); }); - } else{ + } else { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg help §7-§fShows command help")); @@ -425,7 +423,7 @@ public class CommandDungeonsGuide extends CommandBase { try { if (openConfig && e.phase == TickEvent.Phase.START ) { openConfig = false; - Minecraft.getMinecraft().displayGuiScreen(new GuiConfig()); + Minecraft.getMinecraft().displayGuiScreen(new GuiConfigV2()); } } catch (Throwable t) { t.printStackTrace(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java deleted file mode 100644 index 61edf38d..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.config.guiconfig; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; - -public class ConfigPanelCreator implements Function<String, MPanel> { - public static final ConfigPanelCreator INSTANCE = new ConfigPanelCreator(); - - public static final Map<String, Supplier<MPanel>> map = new HashMap<String, Supplier<MPanel>>(); - - @Nullable - @Override - public MPanel apply(@Nullable String input) { - if (!map.containsKey(input)) return null; - return map.get(input).get(); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java index b68c0b0c..645ba3a9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java @@ -1,37 +1,33 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.location; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDelegate; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.gui.MGui; import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.Vec3; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; import java.awt.*; import java.io.IOException; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/Marker.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java index 27ced7ee..7a0b9c58 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/Marker.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java @@ -16,10 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.location; import lombok.AllArgsConstructor; -import lombok.Data; import lombok.Getter; import lombok.ToString; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java new file mode 100644 index 00000000..b22175a4 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java @@ -0,0 +1,46 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.config.guiconfig.nyu; + +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.gui.MGui; +import net.minecraft.client.Minecraft; + +import java.awt.*; + +public class GuiConfigV2 extends MGui { + + private RootConfigPanel rootConfigPanel; + + public GuiConfigV2() { + rootConfigPanel = new RootConfigPanel(); + rootConfigPanel.setPageGenerator(ConfigPanelCreator.INSTANCE); + getMainPanel().add(rootConfigPanel); + } + + + @Override + public void initGui() { + super.initGui(); + int dw = Minecraft.getMinecraft().displayWidth; + int dh = Minecraft.getMinecraft().displayHeight; + rootConfigPanel.setBounds(new Rectangle((dw-1000)/2, (dh-800)/2, 1000,800)); + rootConfigPanel.setScale(2.0f); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java new file mode 100644 index 00000000..5d00d15a --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java @@ -0,0 +1,75 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.config.guiconfig.nyu; + +import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.function.Consumer; + +public class MCategoryElement extends MPanel { + private String category; + private Consumer<String> onClick; + private int leftPad = 0; + private int offsetX; + private RootConfigPanel rootConfigPanel; + public MCategoryElement(String category, Consumer<String> onClick, int leftPad, int offsetX, RootConfigPanel rooot) { + this.category = category; + this.onClick = onClick; + this.leftPad = leftPad; + this.offsetX = offsetX; + this.rootConfigPanel = rooot; + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + if (rootConfigPanel.getCurrentPage().equals(category)) { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.13f)); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } else if (lastAbsClip.contains(absMousex, absMousey)) { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.09f)); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + + + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + String name = category.substring(category.lastIndexOf(".")+1); + fr.drawString(name, leftPad,2,-1); + + } + + @Override + public Dimension getPreferredSize() { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + return new Dimension(fr.getStringWidth(category.substring(category.lastIndexOf(".")+1)) + leftPad+10, fr.FONT_HEIGHT+4); + } + + @Override + public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { + if (!lastAbsClip.contains(absMouseX, absMouseY)) { return; } + if (onClick != null) onClick.accept(category); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MNotFound.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MNotFound.java new file mode 100644 index 00000000..0d58be44 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MNotFound.java @@ -0,0 +1,40 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.config.guiconfig.nyu; + +import kr.syeyoung.dungeonsguide.gui.MPanel; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class MNotFound extends MPanel { + @Override + public void resize(int parentWidth, int parentHeight) { + setBounds(new Rectangle(0,0,parentWidth,parentHeight)); + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("404 Not Found", (getBounds().width - fr.getStringWidth("404 Not Found")) / 2, (getBounds().height - fr.FONT_HEIGHT) / 2, -1); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java new file mode 100644 index 00000000..b81d96a2 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java @@ -0,0 +1,160 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.config.guiconfig.nyu; + +import com.google.common.base.Function; +import kr.syeyoung.dungeonsguide.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.gui.elements.*; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import net.minecraft.client.gui.Gui; + +import java.awt.*; +import java.util.HashMap; +import java.util.Map; + +public class RootConfigPanel extends MPanelScaledGUI { + + private MScrollablePanel navigationScroll; + + private MList navigation = new MList(); + + private MScrollablePanel contentScroll; + + + private final Map<String, MPanel> pages = new HashMap<String, MPanel>(); + @Getter + @Setter + private Function<String, MPanel> pageGenerator; + @Getter + private String currentPage = ""; + + public RootConfigPanel() { + navigationScroll = new MScrollablePanel(1); + navigationScroll.setHideScrollBarWhenNotNecessary(false); + add(navigationScroll); + navigationScroll.add(navigation); + navigationScroll.add(new MSpacer(0,0,1,1)); + + contentScroll = new MScrollablePanel(3); + contentScroll.setHideScrollBarWhenNotNecessary(true); + add(contentScroll); + + setupNavigation(); + navigation.setGap(0); + navigation.setDrawLine(false); + + rePlaceElements(); + } + + @Data + @Accessors(chain = true, fluent = true) + private static class NestedCategory { + private final String categoryFull; + private String categoryName; + public NestedCategory(String categoryFull) { + this.categoryFull =categoryFull; + this.categoryName = categoryFull.substring(categoryFull.lastIndexOf(".")+1); + } + + private Map<String, NestedCategory> children = new HashMap<>(); + public NestedCategory child(NestedCategory child) { + this.children.put(child.categoryName, child); + return this; + } + } + + private void setupNavigation() { + NestedCategory root = new NestedCategory("ROOT"); + for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { + String category = abstractFeature.getCategory(); + + NestedCategory currentRoot = root; + for (String s : category.split("\\.")) { + NestedCategory finalCurrentRoot = currentRoot; + currentRoot = currentRoot.children().computeIfAbsent(s, k -> new NestedCategory(finalCurrentRoot.categoryFull+"."+k)); + } + } + for (NestedCategory value : root.children().values()) { + setupNavigationRecursive(value, navigation, 0, 17); + } + } + private void setupNavigationRecursive(NestedCategory nestedCategory, MPanel parent, int depth, int offset) { + if (nestedCategory.children().size() == 0) { + MCategoryElement current = new MCategoryElement(nestedCategory.categoryFull, this::setCurrentPage, 13 * depth + 17, offset, this); + parent.add(current); + } else { + MCategoryElement current = new MCategoryElement(nestedCategory.categoryFull, this::setCurrentPage, 3,offset, this); + MCollapsable mCollapsable = new MCollapsable(current, this::rePlaceElements); + mCollapsable.setLeftPad(offset-13); + mCollapsable.getLowerElements().setDrawLine(false); + mCollapsable.getLowerElements().setGap(0); + mCollapsable.setLeftPadElements(0); + parent.add(mCollapsable); + + for (NestedCategory value : nestedCategory.children().values()) { + setupNavigationRecursive(value, mCollapsable, depth+1, offset+13); + } + } + } + + + public void setCurrentPage(String currentPage) { + this.currentPage = currentPage; + + contentScroll.getContentArea().getChildComponents().forEach(contentScroll.getContentArea()::remove); + if (!pages.containsKey(currentPage)) { + MPanel page = pageGenerator.apply(currentPage); + if (page == null) page = new MNotFound(); + pages.put(currentPage, page); + } + contentScroll.getContentArea().add(pages.get(currentPage)); + rePlaceElements(); + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + Dimension effectiveDim = getEffectiveDimension(); + Gui.drawRect(0,0, (int) (effectiveDim.width), (int) (effectiveDim.height), RenderUtils.blendAlpha(0, 0.0f)); + Gui.drawRect(1,1, (int) (effectiveDim.width)-1, (int) (effectiveDim.height) - 1, RenderUtils.blendAlpha(0x141414, 0.00f)); + Gui.drawRect(1,1, (int) (effectiveDim.width)-1, 25, RenderUtils.blendAlpha(0x0, 0.20f)); + } + + @Override + public void setBounds(Rectangle bounds) { + super.setBounds(bounds); + rePlaceElements(); + } + + private void rePlaceElements() { + Dimension effectiveDim = getEffectiveDimension(); + navigation.setBounds(new Rectangle(new Point(0,1), new Dimension(Math.max(100, Math.max(navigation.getPreferredSize().width, navigationScroll.getBounds().width-10)), navigation.getPreferredSize().height))); + navigation.realignChildren(); + navigationScroll.evalulateContentArea(); + Rectangle navBound; + navigationScroll.setBounds(navBound = new Rectangle(1,25, navigation.getBounds().width+10, effectiveDim.height-24)); + + contentScroll.setBounds(new Rectangle(navBound.x + navBound.width + 1, 25, effectiveDim.width - navBound.x - navBound.width - 2, effectiveDim.height -26)); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/ConfigPanelCreator.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/ConfigPanelCreator.java new file mode 100644 index 00000000..57db9864 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/ConfigPanelCreator.java @@ -0,0 +1,40 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.config.guiconfig.old; + +import com.google.common.base.Function; +import com.google.common.base.Supplier; +import kr.syeyoung.dungeonsguide.gui.MPanel; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; + +public class ConfigPanelCreator implements Function<String, MPanel> { + public static final ConfigPanelCreator INSTANCE = new ConfigPanelCreator(); + + public static final Map<String, Supplier<MPanel>> map = new HashMap<String, Supplier<MPanel>>(); + + @Nullable + @Override + public MPanel apply(@Nullable String input) { + if (!map.containsKey(input)) return null; + return map.get(input).get(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/FeatureEditPane.java index 7f6d5a4f..2109c1a7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/FeatureEditPane.java @@ -1,39 +1,29 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.old; -import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import java.awt.*; -import java.io.IOException; import java.util.*; import java.util.List; @@ -107,11 +97,6 @@ public class FeatureEditPane extends MPanel { } } - @Override - public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { - super.render0(resolution, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks); - } - @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiConfig.java index 24b98e00..822c5e2f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiConfig.java @@ -1,43 +1,35 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.old; import com.google.common.base.Supplier; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.gui.MGui; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MNavigatingPane; -import kr.syeyoung.dungeonsguide.gui.elements.MTabbedPane; +import kr.syeyoung.dungeonsguide.gui.elements.MPanelScaledGUI; import lombok.Getter; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.BufferUtils; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; import java.awt.*; -import java.io.IOException; -import java.nio.FloatBuffer; import java.util.List; import java.util.Map; import java.util.Stack; @@ -51,9 +43,13 @@ public class GuiConfig extends MGui { private final Stack<String> history = new Stack(); + private MPanelScaledGUI panelScaledGUI; public GuiConfig() { + + panelScaledGUI = new MPanelScaledGUI(); + getMainPanel().add(panelScaledGUI); MNavigatingPane tabbedPane = new MNavigatingPane(); - getMainPanel().add(tabbedPane); + panelScaledGUI.add(tabbedPane); tabbedPane.setBackground2(new Color(38, 38, 38, 255)); tabbedPane.setPageGenerator(ConfigPanelCreator.INSTANCE); @@ -90,6 +86,7 @@ public class GuiConfig extends MGui { @Override public void initGui() { super.initGui(); - getMainPanel().setBounds(new Rectangle(Math.min((Minecraft.getMinecraft().displayWidth - 500) / 2, Minecraft.getMinecraft().displayWidth), Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),500,300)); + panelScaledGUI.setBounds(new Rectangle(Math.min((Minecraft.getMinecraft().displayWidth - 1000) / 2, Minecraft.getMinecraft().displayWidth), Math.min((Minecraft.getMinecraft().displayHeight - 700) / 2, Minecraft.getMinecraft().displayHeight),1000,700)); + panelScaledGUI.setScale(1.0); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiParameterValueEdit.java index 0d7b819c..b759ead9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiParameterValueEdit.java @@ -1,22 +1,22 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.old; import kr.syeyoung.dungeonsguide.gui.MGui; import kr.syeyoung.dungeonsguide.gui.MPanel; @@ -29,14 +29,8 @@ import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; import java.awt.*; -import java.io.IOException; public class GuiParameterValueEdit extends MGui { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MFeature.java index 4e29eae4..4b3b8237 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MFeature.java @@ -1,31 +1,29 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.old; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -36,7 +34,6 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import java.awt.*; -import java.util.Arrays; import java.util.List; import java.util.ArrayList; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MParameter.java index 2bfabe3e..49db94a8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MParameter.java @@ -1,22 +1,22 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.old; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.features.AbstractFeature; @@ -27,7 +27,6 @@ import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; import kr.syeyoung.dungeonsguide.roomedit.Parameter; import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDefaultParameterConfig.java index a38f1a06..9f8dafc4 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDefaultParameterConfig.java @@ -1,41 +1,33 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.old; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.MParameter; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; import java.util.List; import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Set; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDelegate.java index bfd92cef..720ae30a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDelegate.java @@ -1,31 +1,31 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.config.guiconfig.old; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.Marker; import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MPopupMenu; import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -40,7 +40,6 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.*; import java.util.List; -import java.util.stream.Stream; public class PanelDelegate extends MPanel { private final GuiFeature guiFeature; @@ -94,9 +93,9 @@ public class PanelDelegate extends MPanel { } @Override - public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { + public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { GlStateManager.pushMatrix(); - super.render0(resolution, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks); + super.render0(scale, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks); GlStateManager.popMatrix(); if (snapped != null && selectedPart != -2) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java index 904ff043..96683f5b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java @@ -20,7 +20,7 @@ package kr.syeyoung.dungeonsguide.eventlistener; import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.events.*; import kr.syeyoung.dungeonsguide.features.*; import kr.syeyoung.dungeonsguide.features.AbstractFeature; @@ -31,7 +31,6 @@ import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java index 3429a4df..7b2d5ba0 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java @@ -21,15 +21,14 @@ package kr.syeyoung.dungeonsguide.features; import com.google.common.base.Supplier; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.PanelDefaultParameterConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig; import kr.syeyoung.dungeonsguide.config.types.TypeConverter; import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; import kr.syeyoung.dungeonsguide.gui.MPanel; import lombok.Getter; import lombok.Setter; -import net.minecraft.client.Minecraft; import java.util.*; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 860cd86a..b1db6d2d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -152,12 +152,18 @@ public class FeatureRegistry { public static final FeatureMechanicBrowse SECRET_BROWSE = register(new FeatureMechanicBrowse()); public static final FeatureActions SECRET_ACTIONS = register(new FeatureActions()); public static final FeatureSoulRoomWarning SECRET_FAIRYSOUL = register(new FeatureSoulRoomWarning()); - public static final SimpleFeature SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Secret", "Auto browse next secret.", "Auto browse best next secret after current one completes.\nthe first pathfinding of first secret needs to be triggered first in order for this option to work", "secret.autobrowse", false)); - public static final SimpleFeature SECRET_AUTO_START = register(new SimpleFeature("Secret", "Auto browse secret upon entering room", "Auto browse best secret upon entering the room.", "secret.autouponenter", false)); - public static final SimpleFeature SECRET_NEXT_KEY = register(new SimpleFeature("Secret", "Auto browse next secret upon pressing a key", "Auto browse the best next secret when you press key.\nChange key at your key settings (Settings -> Controls)", "secret.keyfornext", false)); - public static final SimpleFeature SECRET_TOGGLE_KEY = register(new SimpleFeature("Secret", "Press a key to toggle pathfind lines", "A key for toggling pathfound line visibility.\nChange key at your key settings (Settings -> Controls)", "secret.togglePathfind")); + public static final SimpleFeature SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Dungeon Secret.Secret Pathfind", "Auto browse next secret.", "Auto browse best next secret after current one completes.\nthe first pathfinding of first secret needs to be triggered first in order for this option to work", "secret.autobrowse", false)); + public static final SimpleFeature SECRET_AUTO_START = register(new SimpleFeature("Dungeon Secret.Secret Pathfind", "Auto browse secret upon entering room", "Auto browse best secret upon entering the room.", "secret.autouponenter", false)); + public static final SimpleFeature SECRET_NEXT_KEY = register(new SimpleFeature("Dungeon Secret.Secret Pathfind", "Auto browse next secret upon pressing a key", "Auto browse the best next secret when you press key.\nChange key at your key settings (Settings -> Controls)", "secret.keyfornext", false)); + public static final SimpleFeature SECRET_TOGGLE_KEY = register(new SimpleFeature("Dungeon Secret.Pathfind Display", "Press a key to toggle pathfind lines", "A key for toggling pathfound line visibility.\nChange key at your key settings (Settings -> Controls)", "secret.togglePathfind")); public static final SimpleFeature SECRET_FREEZE_LINES = register(new FeatureFreezePathfind()); public static final FeatureNicknamePrefix COSMETIC_PREFIX = register(new FeatureNicknamePrefix()); public static final FeatureNicknameColor COSMETIC_NICKNAMECOLOR = register(new FeatureNicknameColor()); + + public static final SimpleFeature TEST_1 = register(new SimpleFeature("Test", "t", "t", "emp")); + public static final SimpleFeature TEST_1_1 = register(new SimpleFeature("Test.Test1", "t", "t", "emp")); + public static final SimpleFeature TEST_1_2 = register(new SimpleFeature("Test.Test2", "t", "t", "emp")); + public static final SimpleFeature TEST_1_2_1 = register(new SimpleFeature("Test.Test2.Test1", "t", "t", "emp")); + } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java index ceb7ec69..4c60c090 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java @@ -19,12 +19,11 @@ package kr.syeyoung.dungeonsguide.features; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.*; import lombok.AccessLevel; @@ -32,7 +31,6 @@ import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -40,9 +38,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import java.awt.*; -import java.lang.reflect.Array; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; @Getter diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java index 0242cfc6..1711f955 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java @@ -21,9 +21,9 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; import com.google.common.base.Supplier; import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.PanelDefaultParameterConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.features.FeatureParameter; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java index ebfa2456..c81539a0 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java @@ -18,11 +18,10 @@ package kr.syeyoung.dungeonsguide.features.impl.cosmetics; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.util.EnumChatFormatting; public class FeatureNicknameColor extends SimpleFeature { public FeatureNicknameColor() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java index e3d5a28f..4796eaa1 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java @@ -18,18 +18,10 @@ package kr.syeyoung.dungeonsguide.features.impl.cosmetics; -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.PanelDefaultParameterConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.DataRendererEditor; -import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; -import kr.syeyoung.dungeonsguide.gui.MPanel; - -import java.util.Arrays; -import java.util.Collections; public class FeatureNicknamePrefix extends SimpleFeature { public FeatureNicknamePrefix() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java index 7f358f29..e888edcf 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java @@ -19,7 +19,7 @@ package kr.syeyoung.dungeonsguide.features.impl.cosmetics; import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; @@ -35,7 +35,6 @@ import java.awt.*; import java.util.*; import java.util.List; import java.util.function.Function; -import java.util.stream.Collectors; public class PrefixSelectorGUI extends MPanel { private GuiConfig config; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java index c0925a1e..50dad040 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java @@ -18,8 +18,6 @@ package kr.syeyoung.dungeonsguide.features.impl.party.customgui; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameter; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText; @@ -40,7 +38,6 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import java.awt.*; -import java.util.Arrays; import java.util.List; public class PanelPartyListElement extends MPanel { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java index 8f10f146..1e844e13 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java @@ -18,9 +18,7 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java index 58327fcf..dd14bee4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java @@ -18,9 +18,7 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java index cc6589de..13d256ff 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java @@ -18,7 +18,6 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.features.impl.party.api.*; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java index b9c16e13..80a918ef 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java @@ -18,7 +18,6 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonSpecificData; import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonStat; import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonType; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java index c93b05d3..09e89928 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java @@ -18,7 +18,7 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; import kr.syeyoung.dungeonsguide.gui.MPanel; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -78,7 +78,7 @@ public class DataRendererEditor extends MPanel { Gui.drawRect(155 + hamburgerWidth,4 + fr.FONT_HEIGHT + 3,156 + hamburgerWidth, 236+ fr.FONT_HEIGHT + 3, 0xFF222222); GlStateManager.pushMatrix(); - clip(sr, scissor.x + 6+hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); + clip(scissor.x + 6+hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); GlStateManager.translate(6+hamburgerWidth, 5+fr.FONT_HEIGHT+3, 0); int culmutativeY = 0; int relSelectedY = selectedY - (5+ fr.FONT_HEIGHT + 3); @@ -92,7 +92,7 @@ public class DataRendererEditor extends MPanel { else dim = dataRenderer.getDimension(); if (culmutativeY + dim.height > relSelectedY && relSelectedY >= culmutativeY && !drewit) { - clip(sr, scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); + clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -105,7 +105,7 @@ public class DataRendererEditor extends MPanel { dim = dataRenderer.renderDummy(); GlStateManager.popMatrix(); } - clip(sr, scissor.x, scissor.y, scissor.width, scissor.height); + clip(scissor.x, scissor.y, scissor.width, scissor.height); GlStateManager.translate(-hamburgerWidth-1, 0, 0); Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFF777777); GlStateManager.enableBlend(); @@ -118,7 +118,7 @@ public class DataRendererEditor extends MPanel { } DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - clip(sr, scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); + clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); Dimension dim; GlStateManager.enableBlend(); @@ -133,7 +133,7 @@ public class DataRendererEditor extends MPanel { dim = dataRenderer.renderDummy(); GlStateManager.popMatrix(); } - clip(sr, scissor.x, scissor.y, scissor.width, scissor.height); + clip(scissor.x, scissor.y, scissor.width, scissor.height); GlStateManager.translate(-hamburgerWidth-1, 0, 0); Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFFAAAAAA); GlStateManager.enableBlend(); @@ -148,7 +148,7 @@ public class DataRendererEditor extends MPanel { if (currentlySelected != null && new Rectangle(0,5+fr.FONT_HEIGHT + 3, hamburgerWidth+11, 232).contains(selectedX, selectedY) && !drewit) { DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); Dimension dim; - clip(sr, scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); + clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -161,7 +161,7 @@ public class DataRendererEditor extends MPanel { dim = dataRenderer.renderDummy(); GlStateManager.popMatrix(); } - clip(sr, scissor.x, scissor.y, scissor.width, scissor.height); + clip(scissor.x, scissor.y, scissor.width, scissor.height); GlStateManager.translate(-hamburgerWidth-1, 0, 0); Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFF777777); GlStateManager.enableBlend(); @@ -181,7 +181,7 @@ public class DataRendererEditor extends MPanel { rest.remove(currentlySelected); for (String datarenderers : rest) { DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - clip(sr, scissor.x + 156 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); + clip(scissor.x + 156 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); Dimension dim; GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -195,7 +195,7 @@ public class DataRendererEditor extends MPanel { dim = dataRenderer.renderDummy(); GlStateManager.popMatrix(); } - clip(sr, scissor.x + 155, scissor.y + 5+fr.FONT_HEIGHT+3, hamburgerWidth, 230); + clip(scissor.x + 155, scissor.y + 5+fr.FONT_HEIGHT+3, hamburgerWidth, 230); GlStateManager.translate(-hamburgerWidth-1, 0, 0); Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFFAAAAAA); GlStateManager.enableBlend(); @@ -205,7 +205,7 @@ public class DataRendererEditor extends MPanel { GlStateManager.translate(hamburgerWidth+1,dim.height,0); } GlStateManager.popMatrix(); - clip(sr, 0,0,sr.getScaledWidth(), sr.getScaledHeight()); + clip(0,0,sr.getScaledWidth(), sr.getScaledHeight()); { if (currentlySelected != null) { GlStateManager.pushMatrix(); @@ -233,7 +233,7 @@ public class DataRendererEditor extends MPanel { GlStateManager.popMatrix(); } } - clip(sr, scissor.x, scissor.y, scissor.width, scissor.height); + clip(scissor.x, scissor.y, scissor.width, scissor.height); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java index 7fe2e148..e2895967 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java @@ -18,19 +18,11 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonStat; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonType; import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import java.awt.*; -import java.util.Arrays; public class DataRendererFairySouls implements DataRenderer { @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java index 8f2724aa..db09d941 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java @@ -18,9 +18,7 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonClass; import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java index 0bc62e9f..eff18d13 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java @@ -18,17 +18,11 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; -import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import java.awt.*; -import java.util.Arrays; public class DataRendererSetUrOwn implements DataRenderer { @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java index 067226e5..12867cd6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java @@ -18,9 +18,6 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; -import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonClass; import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; import kr.syeyoung.dungeonsguide.features.impl.party.api.Skill; import kr.syeyoung.dungeonsguide.utils.RenderUtils; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java index 9ffe0217..c1730ed7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java @@ -20,15 +20,13 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; import com.google.common.base.Supplier; import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.hychat.HyChat; import io.github.moulberry.hychat.chat.ChatManager; import io.github.moulberry.hychat.gui.GuiChatBox; import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.PanelDefaultParameterConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig; import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; import kr.syeyoung.dungeonsguide.features.FeatureParameter; @@ -38,35 +36,25 @@ import kr.syeyoung.dungeonsguide.features.impl.party.api.*; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; -import kr.syeyoung.dungeonsguide.features.text.PanelTextParameterConfig; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.party.PartyManager; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; import lombok.Getter; import lombok.Setter; import lombok.SneakyThrows; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.gui.*; import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.DefaultPlayerSkin; -import net.minecraft.client.resources.SkinManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.HoverEvent; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; import net.minecraft.scoreboard.Team; import net.minecraft.util.*; import net.minecraft.world.World; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java index 35606731..b62a168f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java @@ -39,7 +39,7 @@ import java.util.List; public class FeatureActions extends TextHUDFeature { public FeatureActions() { - super("Secret", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview", false, 200, getFontRenderer().FONT_HEIGHT * 10); + super("Dungeon Secret.Pathfind Display", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview", false, 200, getFontRenderer().FONT_HEIGHT * 10); getStyles().add(new TextStyle("pathfinding", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("mechanic", new AColor(0x55, 0xFF,0x55,255), new AColor(0, 0,0,0), false)); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java index f9016b15..67f0be5f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java @@ -24,7 +24,7 @@ import kr.syeyoung.dungeonsguide.features.SimpleFeature; public class FeatureFreezePathfind extends SimpleFeature { public FeatureFreezePathfind() { - super("Secret", "Freeze Pathfind", "Freeze Pathfind, meaning the pathfind lines won't change when you move", "secret.freezepathfind", false); + super("Dungeon Secret.Pathfind Display", "Freeze Pathfind", "Freeze Pathfind, meaning the pathfind lines won't change when you move", "secret.freezepathfind", false); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java index f2cac046..224ace06 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java @@ -21,8 +21,8 @@ package kr.syeyoung.dungeonsguide.features.impl.secret; import com.google.common.collect.Lists; import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; @@ -56,9 +56,8 @@ import java.util.Map; import java.util.UUID; public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderListener, GuiClickListener, WorldRenderListener { - public FeatureMechanicBrowse() { - super("Secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); + super("Dungeon Secret.Secret Pathfind","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); parameters.put("linecolor2", new FeatureParameter<AColor>("linecolor2", "Color", "Color of Pathfind line", new AColor(0xFF00FF00, true), "acolor")); parameters.put("linethickness", new FeatureParameter<Float>("linethickness", "Thickness", "Thickness of Pathfind line", 1.0f, "float")); parameters.put("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "How many ticks per line refresh?", 10, "integer")); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java index 6559bd61..70c0b2be 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java @@ -18,35 +18,21 @@ package kr.syeyoung.dungeonsguide.features.text; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameter; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MColor; import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor; import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; -import org.w3c.dom.css.Rect; import java.awt.*; -import java.io.IOException; import java.util.*; import java.util.List; @@ -126,7 +112,7 @@ public class PanelTextParameterConfig extends MPanel { Gui.drawRect(4,4,width+6, height+6, 0xFF222222); Gui.drawRect(5,5,width+5, height+5, 0xFF555555); Rectangle clip = new Rectangle(scissor.x + 5, scissor.y + 5, width, height); - clip(new ScaledResolution(Minecraft.getMinecraft()), clip.x, clip.y, clip.width, clip.height); + clip(clip.x, clip.y, clip.width, clip.height); GlStateManager.pushMatrix(); GlStateManager.translate(offsetX + 5, offsetY + 5, 0); @@ -147,7 +133,7 @@ public class PanelTextParameterConfig extends MPanel { } } } - clip(new ScaledResolution(Minecraft.getMinecraft()), scissor.x, scissor.y, scissor.width, scissor.height); + clip(scissor.x, scissor.y, scissor.width, scissor.height); GlStateManager.popMatrix(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java index 9ee1814c..b3488bdd 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java @@ -19,28 +19,20 @@ package kr.syeyoung.dungeonsguide.features.text; import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.PanelDefaultParameterConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; -import java.awt.*; import java.util.*; import java.util.List; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java index feef2848..c5428c14 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java @@ -61,7 +61,7 @@ public class MGui extends GuiScreen { GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.color(1, 1, 1, 1); GlStateManager.scale(1.0/scaledResolution.getScaleFactor(), 1.0/scaledResolution.getScaleFactor(), 1.0d); - mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight), i, j, i, j, partialTicks); + mainPanel.render0(1, new Point(0,0), new Rectangle(0,0,Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight), i, j, i, j, partialTicks); GlStateManager.popAttrib(); GlStateManager.popMatrix(); GlStateManager.enableBlend(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java index a91cb6c6..0f842b34 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java @@ -23,8 +23,8 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; @@ -49,6 +49,8 @@ public class MPanel { @Setter protected MPanel parent; + private boolean debug = false; + public void setBackgroundColor(Color c) { if (c == null) return; this.backgroundColor = c; @@ -109,7 +111,7 @@ public class MPanel { @Setter private boolean ignoreBoundOnClip; - public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a + public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a lastParentPoint = parentPoint; int relMousex = relMousex0 - getBounds().x; @@ -127,7 +129,8 @@ public class MPanel { lastAbsClip = clip; if (clip.getSize().height * clip.getSize().width == 0) return; - clip(resolution, clip.x, clip.y, clip.width, clip.height); + this.scale = scale; + clip(clip.x, clip.y, clip.width, clip.height); GlStateManager.pushAttrib(); GL11.glEnable(GL11.GL_SCISSOR_TEST); @@ -147,28 +150,30 @@ public class MPanel { render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip); GlStateManager.popAttrib(); GlStateManager.popMatrix(); + if (debug && lastAbsClip.contains(absMousex, absMousey)) { + Gui.drawRect(0, 0, getBounds().width, getBounds().height, 0x2200FF00); + GL11.glDisable(GL11.GL_SCISSOR_TEST); +// Gui.drawRect(0, 0, getPreferredSize().width, getPreferredSize().height, 0x220000FF); + } GL11.glDisable(GL11.GL_SCISSOR_TEST); GlStateManager.popAttrib(); - Point newPt = new Point(parentPoint.x + getBounds().x, parentPoint.y + getBounds().y); for (MPanel mPanel : getChildComponents()){ GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - mPanel.render0(resolution, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks); + mPanel.render0(scale, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks); GlStateManager.popAttrib(); GlStateManager.popMatrix(); } } - - public static void clip(ScaledResolution resolution, int x, int y, int width, int height) { + protected double scale; + public void clip(int x, int y, int width, int height) { if (width < 0 || height < 0) return; -// int scale = resolution.getScaleFactor(); - int scale = 1; - GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale); + GL11.glScissor((int) (x * scale), Minecraft.getMinecraft().displayHeight - (int) ((y + height) * scale), (int)(width* scale), (int) (height * scale)); } protected Rectangle determineClip(Rectangle rect1, Rectangle rect2) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java new file mode 100644 index 00000000..ef10377e --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java @@ -0,0 +1,131 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.gui.elements; + +import kr.syeyoung.dungeonsguide.gui.MPanel; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +/** + * Note it is passive. + */ +public class MCollapsable extends MPanel { + @Getter + @Setter + private boolean collapsed = true; + + private MPanel representing; + @Getter + private MList lowerElements; + + @Getter @Setter + private int leftPad = 0, leftPadElements = 13; + + private Runnable onPreferedSizeChange; + + public MCollapsable(MPanel representing, Runnable onPreferedSizeChange) { + this.representing = representing; + super.add(representing); + lowerElements = new MList(); + lowerElements.setGap(0); + super.add(lowerElements); + + this.onPreferedSizeChange = onPreferedSizeChange; + } + + @Override + public Dimension getPreferredSize() { + Dimension rep = representing.getPreferredSize(); + if (collapsed) { + return new Dimension(rep.width+leftPad+10, rep.height); + } else { + Dimension lowerElem = lowerElements.getPreferredSize(); + return new Dimension(Math.max(rep.width+leftPad+10, leftPadElements + lowerElem.width), rep.height+lowerElem.height+lowerElements.getGap()); + } + } + + @Override + public void setBounds(Rectangle bounds) { + super.setBounds(bounds); + Dimension representingSize =this.representing.getPreferredSize(); + Dimension lowerSize = lowerElements.getPreferredSize(); + + representing.setBounds(new Rectangle(new Point(leftPad+10, 0), new Dimension(bounds.width - (leftPad+10), representingSize.height))); + lowerElements.setBounds(new Rectangle(new Point(leftPadElements, representingSize.height+lowerElements.getGap()), new Dimension(bounds.width - (leftPadElements), lowerSize.height))); + lowerElements.realignChildren(); + } + + @Override + public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { + super.render0(scale, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks); + + clip(lastAbsClip.x, lastAbsClip.y, lastAbsClip.width, lastAbsClip.height); +// GL11.glEnable(GL11.GL_SCISSOR_TEST); + + + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + if (collapsed) { + GlStateManager.translate(leftPad + 10 - fr.getStringWidth(">"),(bounds.height - fr.FONT_HEIGHT)/2,0); + } else { + GlStateManager.translate(leftPad + fr.FONT_HEIGHT,(representing.getPreferredSize().height - fr.getStringWidth(">"))/2,0); + GlStateManager.rotate(90, 0,0,1); + } + + fr.drawString(">", 0,0, -1); + + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); + GL11.glDisable(GL11.GL_SCISSOR_TEST); + } + + @Override + public void add(MPanel child) { + lowerElements.add(child); + if (onPreferedSizeChange != null) onPreferedSizeChange.run(); + } + + @Override + public void remove(MPanel panel) { + lowerElements.remove(panel); + if (onPreferedSizeChange != null) onPreferedSizeChange.run(); + } + + @Override + public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { + if (relMouseX >= leftPad && relMouseY >= 0 && relMouseX <= leftPad + 10 && relMouseY <= representing.getPreferredSize().height) { + collapsed = !collapsed; + if (onPreferedSizeChange != null) onPreferedSizeChange.run(); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java index f6df0e19..9719f63f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java @@ -20,6 +20,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import kr.syeyoung.dungeonsguide.gui.MPanel; import lombok.Getter; +import lombok.Setter; import net.minecraft.client.gui.Gui; import java.awt.*; @@ -28,6 +29,9 @@ public class MList extends MPanel { @Getter private int gap = 5; + @Getter @Setter + private boolean drawLine = true; + public void setGap(int gap) { this.gap = gap; realignChildren(); @@ -35,19 +39,35 @@ public class MList extends MPanel { private final int gapLineColor = 0xFFFFFFFF; - protected void realignChildren() { + public void realignChildren() { int y = 0; for (MPanel childComponent : getChildComponents()) { Dimension preferedSize = childComponent.getPreferredSize(); childComponent.setBounds(new Rectangle(0, y, bounds.width, Math.max(10, preferedSize.height))); y += preferedSize.height; - y += gap; + if (gap > 0) + y += gap; } setSize(new Dimension(getSize().width, Math.max(0, y-gap))); } @Override + public Dimension getPreferredSize() { + int maxW = 0; + int h = 0; + for (MPanel childComponent : getChildComponents()) { + Dimension preferedSize = childComponent.getPreferredSize(); + if (preferedSize.width > maxW) maxW = preferedSize.width; + h += preferedSize.height; + if (gap > 0) h += gap; + } + return new Dimension(maxW, Math.max(0, h-gap)); + } + + @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + if (gap <= 0) return; + if (!drawLine) return; for (int i = 1; i < getChildComponents().size(); i++) { MPanel panel = getChildComponents().get(i); Rectangle bound = panel.getBounds(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java new file mode 100644 index 00000000..64599058 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java @@ -0,0 +1,199 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.gui.elements; + +import kr.syeyoung.dungeonsguide.gui.MPanel; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class MPanelScaledGUI extends MPanel { + @Getter + private double scale = 1.0; + + private double relativeScale; + + public void setScale(double scale) { + this.scale = scale; + for (MPanel childComponent : childComponents) { + childComponent.resize0((int) (getBounds().width/scale), (int) (getBounds().height/scale)); + } + } + + @Override + public void setBounds(Rectangle bounds) { + if (bounds == null) return; + this.bounds.x = bounds.x; + this.bounds.y = bounds.y; + this.bounds.width = bounds.width; + this.bounds.height = bounds.height; + + for (MPanel childComponent : childComponents) { + childComponent.resize0((int) (getBounds().width/scale), (int) (getBounds().height/scale)); + } + onBoundsUpdate(); + } + + public Dimension getEffectiveDimension() { + return new Dimension((int)(getBounds().width / scale), (int)(getBounds().height / scale)); + } + + @Override + public void render0(double parentScale, Point parentPoint, Rectangle parentClip, int absMousex0, int absMousey0, int relMousex0, int relMousey0, float partialTicks) { + lastParentPoint = parentPoint; + + GlStateManager.translate(getBounds().x, getBounds().y, 5); + GlStateManager.color(1,1,1,0); + + Rectangle absBound = getBounds().getBounds(); + absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); + + Rectangle clip; + if (isIgnoreBoundOnClip()) clip = parentClip; + else clip = determineClip(parentClip, absBound); + lastAbsClip = clip; + + if (clip.getSize().height * clip.getSize().width == 0) return; + + int absMousex = (int) (absMousex0 / scale), absMousey = (int) (absMousey0 / scale); + int relMousex = (int) ((relMousex0 - getBounds().x) / scale); + int relMousey = (int) ((relMousey0 - getBounds().y) /scale); + + // FROM HERE, IT IS SCALED + + GlStateManager.scale(this.scale, this.scale, 1); + clip = new Rectangle((int) (clip.x / scale), (int) (clip.y / scale), (int) (clip.width / scale), (int) (clip.height / scale)); + + + this.relativeScale = parentScale * this.scale; + clip(clip.x, clip.y, clip.width, clip.height); + + + GlStateManager.pushAttrib(); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + + GlStateManager.pushAttrib(); + GuiScreen.drawRect(0,0, (int) (getBounds().width / scale), (int) (getBounds().height / scale), backgroundColor.getRGB()); + GlStateManager.enableBlend(); + GlStateManager.popAttrib(); + + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + + render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); + + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GlStateManager.popAttrib(); + + + Point newPt = new Point((int) ((parentPoint.x + getBounds().x) / scale), (int) ((parentPoint.y + getBounds().y) / scale)); + + for (MPanel mPanel : getChildComponents()){ + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + mPanel.render0(scale, newPt,clip,absMousex, absMousey, relMousex, relMousey, partialTicks); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); + } + } + + @Override + public void clip(int x, int y, int width, int height) { + if (width < 0 || height < 0) return; + + GL11.glScissor((int) (x * relativeScale), Minecraft.getMinecraft().displayHeight - (int) ((y + height) * relativeScale), (int)(width* relativeScale), (int) (height * relativeScale)); + } + + @Override + public void resize0(int parentWidth, int parentHeight) { + super.resize0(parentWidth, parentHeight); + } + + + public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) { + int relMousex = (int) ((relMouseX0 - getBounds().x) / scale); + int relMousey = (int) ((relMouseY0 - getBounds().y) / scale); + absMouseX = (int) (absMouseX / scale); + absMouseY = (int) (absMouseY / scale); + + boolean noClip = true; + boolean focusedOverall = false; + for (MPanel childComponent : getChildComponents()) { + if (childComponent.mouseClicked0(absMouseX, absMouseY,relMousex, relMousey, mouseButton)) { + noClip = false; + focusedOverall = true; + } + } + + if (getBounds().contains(relMouseX0, relMouseY0) && noClip) { + isFocused = true; + focusedOverall = true; + } else { + isFocused = false; + } + mouseClicked(absMouseX, absMouseY, relMousex, relMousey, mouseButton); + + return focusedOverall; + } + public void mouseReleased0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int state) { + int relMousex = (int) ((relMouseX0 - getBounds().x) / scale); + int relMousey = (int) ((relMouseY0 - getBounds().y) / scale); + absMouseX = (int) (absMouseX / scale); + absMouseY = (int) (absMouseY / scale); + + for (MPanel childComponent : getChildComponents()) { + childComponent.mouseReleased0(absMouseX, absMouseY, relMousex, relMousey, state); + } + mouseReleased(absMouseX, absMouseY, relMousex, relMousey, state); + } + public void mouseClickMove0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int clickedMouseButton, long timeSinceLastClick) { + int relMousex = (int) ((relMouseX0 - getBounds().x) / scale); + int relMousey = (int) ((relMouseY0 - getBounds().y) / scale); + absMouseX = (int) (absMouseX / scale); + absMouseY = (int) (absMouseY / scale); + + for (MPanel childComponent : getChildComponents()) { + childComponent.mouseClickMove0(absMouseX, absMouseY, relMousex, relMousey, clickedMouseButton, timeSinceLastClick); + } + mouseClickMove(absMouseX, absMouseY, relMousex, relMousey, clickedMouseButton, timeSinceLastClick); + } + public void mouseScrolled0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { + int relMousex = (int) ((relMouseX0 - getBounds().x) / scale); + int relMousey = (int) ((relMouseY0 - getBounds().y) / scale); + absMouseX = (int) (absMouseX / scale); + absMouseY = (int) (absMouseY / scale); + + for (MPanel childComponent : getChildComponents()) { + childComponent.mouseScrolled0(absMouseX, absMouseY, relMousex, relMousey, scrollAmount); + } + mouseScrolled(absMouseX, absMouseY, relMousex, relMousey, scrollAmount); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java index 3ee4e516..9bd3b130 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java @@ -201,7 +201,7 @@ public class MPortableColorEdit extends MPanel { } @Override - public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { + public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { int relMousex = relMousex0 - getBounds().x; int relMousey = relMousey0 - getBounds().y; @@ -213,8 +213,8 @@ public class MPortableColorEdit extends MPanel { absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); Rectangle clip = determineClip(parentClip, absBound); lastAbsClip = clip; - - clip(resolution, clip.x, clip.y, clip.width, clip.height); +this.scale =scale; + clip(clip.x, clip.y, clip.width, clip.height); GlStateManager.pushAttrib(); GL11.glDisable(GL11.GL_SCISSOR_TEST); @@ -237,7 +237,7 @@ public class MPortableColorEdit extends MPanel { for (MPanel mPanel : getChildComponents()){ GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - mPanel.render0(resolution, newPt, new Rectangle(newPt, new Dimension(getBounds().getSize())), absMousex, absMousey, relMousex, relMousey, partialTicks); + mPanel.render0(scale, newPt, new Rectangle(newPt, new Dimension(getBounds().getSize())), absMousex, absMousey, relMousex, relMousey, partialTicks); GlStateManager.popAttrib(); GlStateManager.popMatrix(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java index ecd94b07..215c7c6d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java @@ -37,6 +37,10 @@ public class MScrollBar extends MPanel { @Getter private int current; + @Getter + @Setter + private int width = 10; + public void addToCurrent(int dv) { int current2 = current + dv; @@ -48,7 +52,7 @@ public class MScrollBar extends MPanel { @Override public Dimension getPreferredSize() { - return new Dimension(axis == Axis.X ? -1 : 20, axis == Axis.Y ? -1 : 20); + return new Dimension(axis == Axis.X ? -1 : width, axis == Axis.Y ? -1 : width); } @Getter diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java index bdbf51d0..42a3cb91 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java @@ -40,8 +40,6 @@ public class MScrollablePanel extends MPanel { private final int axis; // 1: Y 2: X 3: both. - private Dimension totalContentArea = new Dimension(); - private MPanel viewPort; @Getter private MPanel contentArea; @@ -135,23 +133,28 @@ public class MScrollablePanel extends MPanel { @Override public void setBounds(Rectangle bounds) { super.setBounds(bounds); - boolean hideX = false, hideY = false; - if (bounds.width > contentAreaDim.width && hideScrollBarWhenNotNecessary) hideX = true; - if (bounds.height > contentAreaDim.height && hideScrollBarWhenNotNecessary) hideY = true; + boolean hideX = (axis & 2) == 0, hideY = (axis & 1) == 0; + viewPort.setBounds(new Rectangle(0,0,bounds.width, bounds.height)); + evalulateContentArea(); + if (bounds.width >= contentAreaDim.width && hideScrollBarWhenNotNecessary) hideX = true; + if (bounds.height >= contentAreaDim.height && hideScrollBarWhenNotNecessary) hideY = true; - if (axis == 3 && !(hideX || hideY)) { + if (!(hideX || hideY)) { Dimension preferedX = scrollBarX.getPreferredSize(); Dimension preferedY = scrollBarY.getPreferredSize(); scrollBarY.setBounds(new Rectangle(bounds.width - preferedY.width, 0, preferedY.width, bounds.height - preferedX.height)); scrollBarX.setBounds(new Rectangle(0, bounds.height - preferedX.height, bounds.width - preferedY.width, preferedX.height)); - } else if (axis == 2 || (axis == 3 && hideY)) { + } else if ((hideY && !hideX)) { Dimension preferedX = scrollBarX.getPreferredSize(); scrollBarY.setBounds(new Rectangle(0,0,0,0)); scrollBarX.setBounds(new Rectangle(0, bounds.height - preferedX.height, bounds.width, preferedX.height)); - } else if (axis == 1 || (axis == 3 && hideX)) { + } else if ((hideX && !hideY)) { Dimension preferedY = scrollBarY.getPreferredSize(); scrollBarX.setBounds(new Rectangle(0,0,0,0)); scrollBarY.setBounds(new Rectangle(bounds.width - preferedY.width, 0, preferedY.width, bounds.height)); + } else if (hideX && hideY){ + scrollBarY.setBounds(new Rectangle(0,0,0,0)); + scrollBarX.setBounds(new Rectangle(0,0,0,0)); } viewPort.setBounds(new Rectangle(0,0,bounds.width-scrollBarY.getBounds().width, bounds.height - scrollBarX.getBounds().height)); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java new file mode 100644 index 00000000..11336a7c --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java @@ -0,0 +1,36 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.gui.elements; + +import kr.syeyoung.dungeonsguide.gui.MPanel; + +import java.awt.*; + +public class MSpacer extends MPanel { + + int width, height; + public MSpacer(int x, int y, int width, int height) { + setBounds(new Rectangle(x,y,width,height)); + this.width = width; this.height = height; + } + @Override + public Dimension getPreferredSize() { + return new Dimension(width, height); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java index a971cc30..6d8b3f51 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java @@ -68,7 +68,7 @@ public class MTextField extends MPanel { Gui.drawRect(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB()); Minecraft mc = Minecraft.getMinecraft(); - clip(new ScaledResolution(mc), clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2); + clip(clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2); FontRenderer fr = mc.fontRendererObj; int y = (getBounds().height - fr.FONT_HEIGHT) / 2; GlStateManager.enableBlend(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java index 561ecb0c..7492f17d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java @@ -50,7 +50,7 @@ public class MTooltip extends MPanel { return super.getTooltipsOpen() - 1; } - public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a + public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a int relMousex = relMousex0 - getBounds().x; int relMousey = relMousey0 - getBounds().y; @@ -61,7 +61,8 @@ public class MTooltip extends MPanel { Rectangle clip = getBounds().getBounds(); GlStateManager.pushAttrib(); GL11.glEnable(GL11.GL_SCISSOR_TEST); - clip(resolution, clip.x, clip.y, clip.width, clip.height); + this.scale = scale; + clip(clip.x, clip.y, clip.width, clip.height); GlStateManager.pushAttrib(); GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB()); @@ -83,7 +84,7 @@ public class MTooltip extends MPanel { for (MPanel mPanel : getChildComponents()){ GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - mPanel.render0(resolution, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks); + mPanel.render0(scale, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks); GlStateManager.popAttrib(); GlStateManager.popMatrix(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java index 24f42fdc..6c866ec9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java @@ -53,12 +53,12 @@ public class RoomDataDisplayPane extends MPanel { int[][] blocks = dungeonRoom.getDungeonRoomInfo().getBlocks(); // draw Axis; Gui.drawRect(0,0,10,10,0x77777777); - clip(sr, clip.x + 10, clip.y, clip.width - 10, 10); + clip(clip.x + 10, clip.y, clip.width - 10, 10); Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); for (int x = 0; x < blocks[0].length; x++) { fr.drawString(x+"", x * 16 +10 + offsetX, 0, 0xFFFFFFFF); } - clip(sr, clip.x, clip.y +10, 10, clip.height-10); + clip(clip.x, clip.y +10, 10, clip.height-10); Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); for (int z = 0; z < blocks.length; z++) { fr.drawString(z+"", 2, z * 16 + 10 + offsetY, 0xFFFFFFFF); @@ -67,7 +67,7 @@ public class RoomDataDisplayPane extends MPanel { int hoverX = (relMousex0 - offsetX - 10) / 16; int hoverY = (relMousey0 - offsetY - 10) / 16; // draw Content - clip(sr, clip.x + 10, clip.y +10, clip.width - 10, clip.height - 10); + clip(clip.x + 10, clip.y +10, clip.width - 10, clip.height - 10); for (int z = 0; z < blocks.length; z++) { for (int x = 0; x < blocks[z].length; x++) { int data = blocks[z][x]; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java index 5290291f..3379098b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java @@ -18,14 +18,12 @@ package kr.syeyoung.dungeonsguide.roomedit.panes; -import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText; import kr.syeyoung.dungeonsguide.utils.ArrayUtils; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -70,12 +68,12 @@ public class RoomMatchDisplayPane extends MPanel { // draw Axis; Gui.drawRect(0,0,10,10,0x77777777); - clip(sr, clip.x + 10, clip.y, clip.width - 10, 10); + clip(clip.x + 10, clip.y, clip.width - 10, 10); Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); for (int x = 0; x < width; x++) { fr.drawString(x+"", x * 16 +10 + offsetX, 0, 0xFFFFFFFF); } - clip(sr, clip.x, clip.y +10, 10, clip.height-10); + clip(clip.x, clip.y +10, 10, clip.height-10); Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); for (int z = 0; z < height; z++) { fr.drawString(z+"", 2, z * 16 + 10 + offsetY, 0xFFFFFFFF); @@ -84,7 +82,7 @@ public class RoomMatchDisplayPane extends MPanel { int hoverX = (relMousex0 - offsetX - 10) / 16; int hoverY = (relMousey0 - offsetY - 10) / 16; // draw Content - clip(sr, clip.x + 10, clip.y +10, clip.width - 10, clip.height - 10); + clip(clip.x + 10, clip.y +10, clip.width - 10, clip.height - 10); boolean tooltiped=false; for (int z = 0; z < height; z++) { for (int x = 0; x < width; x++) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java index b6c5c22d..e9518d64 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java @@ -55,6 +55,53 @@ public class RenderUtils { public static boolean allowScrolling; public static int scrollX = 0; + public static void drawRect(int left, int top, int right, int bottom, AColor color) + { + if (left < right) + { + int i = left; + left = right; + right = i; + } + + if (top < bottom) + { + int j = top; + top = bottom; + bottom = j; + } + + float f3 = (float)(color.getRGB() >> 24 & 255) / 255.0F; + float f = (float)(color.getRGB() >> 16 & 255) / 255.0F; + float f1 = (float)(color.getRGB() >> 8 & 255) / 255.0F; + float f2 = (float)(color.getRGB() & 255) / 255.0F; + if (!color.isChroma() && f3 == 0) return; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + if (!color.isChroma()) { + GlStateManager.color(f, f1, f2, f3); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(left, bottom, 0.0D).endVertex(); + worldrenderer.pos(right, bottom, 0.0D).endVertex(); + worldrenderer.pos(right, top, 0.0D).endVertex(); + worldrenderer.pos(left, top, 0.0D).endVertex(); + } else { + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); + GlStateManager.shadeModel(GL11.GL_SMOOTH); + color(worldrenderer.pos(left, bottom, 0.0D), getColorAt(left, bottom, color)).endVertex(); + color(worldrenderer.pos(right, bottom, 0.0D), getColorAt(right, bottom, color)).endVertex(); + color(worldrenderer.pos(right, top, 0.0D), getColorAt(right, top, color)).endVertex(); + color(worldrenderer.pos(left, top, 0.0D), getColorAt(left, top, color)).endVertex(); + } + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + + public static void drawRoundedRectangle(int x, int y, int width, int height, int radius, double delta, int color) { GlStateManager.pushMatrix(); GlStateManager.translate(width/2.0+x, height/2.0+y, 0); |