diff options
author | syeyoung <cyoung06@naver.com> | 2022-05-21 21:18:14 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2022-05-21 21:28:52 +0900 |
commit | 20dd3f99a7b139b5848128246c622fd9cfefa478 (patch) | |
tree | 78e5f84ad22fd53876d488f6b58c3528aebe6501 /src/main/java/kr/syeyoung/dungeonsguide/roomedit | |
parent | 50de034c046c4ddea033b73793c8825ecb5bb86f (diff) | |
download | Skyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.tar.gz Skyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.tar.bz2 Skyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.zip |
- Project separation
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit')
39 files changed, 0 insertions, 5117 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java deleted file mode 100755 index 1cafcbc7..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java +++ /dev/null @@ -1,87 +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.roomedit; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; -import lombok.Data; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiScreen; - -import java.util.LinkedList; -import java.util.Stack; - -public class EditingContext { - - private static EditingContext editingContext; - - public static void createEditingContext(DungeonRoom dungeonRoom) { - editingContext = new EditingContext(dungeonRoom); - } - - public static EditingContext getEditingContext() { - return editingContext; - } - - public static void endEditingSession() { - editingContext = null; - Minecraft.getMinecraft().displayGuiScreen(null); - } - - - private EditingContext(DungeonRoom dungeonRoom) { - this.room = dungeonRoom; - } - - @Getter - private final DungeonRoom room; - - @Getter - private final Stack<GuiScreen> guiStack = new Stack<GuiScreen>(); - - public boolean isEditingSecrets() { - return guiDungeonRoomEdit.isEditingSelected(); - } - public void endEditing() { - guiDungeonRoomEdit.endEditing(); - } - - private GuiDungeonRoomEdit guiDungeonRoomEdit; - @Getter - private GuiScreen current; - - public void openGui(GuiScreen gui) { - if (gui instanceof GuiDungeonRoomEdit) guiDungeonRoomEdit = (GuiDungeonRoomEdit) gui; - guiStack.push(current); - this.current = gui; - Minecraft.getMinecraft().displayGuiScreen(gui); - } - - public void goBack() { - current = guiStack.pop(); - Minecraft.getMinecraft().displayGuiScreen(current); - } - - public void reopen() { - Minecraft.getMinecraft().displayGuiScreen(current); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java deleted file mode 100755 index eb4d8987..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.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.roomedit; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -public class Parameter { - private String name; - private Object previousData; - private Object newData; - - public Parameter(String name, Object previousData, Object newData) { - this.name = name; this.previousData = previousData; this.newData = newData; - } - - private Runnable onSetNewData; - - public void setNewData(Object newData) { - this.newData = newData; - if (onSetNewData != null) onSetNewData.run(); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java deleted file mode 100755 index 4410d08e..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java +++ /dev/null @@ -1,143 +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.roomedit.gui; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -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.input.Mouse; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class GuiDungeonAddSet extends MGui { - - private final ValueEditOffsetPointSet valueEditOffsetPointSet; - - private final MButton add; - private final MButton back; - - - @Getter - private final OffsetPoint start; - @Getter - private final OffsetPoint end; - - public void onWorldRender(float partialTicks) { - for (OffsetPoint pos:getBlockPoses()) { - RenderUtils.highlightBlock(pos.getBlockPos(EditingContext.getEditingContext().getRoom()), new Color(0,255,255,50), partialTicks); - } - RenderUtils.highlightBlock(start.getBlockPos(EditingContext.getEditingContext().getRoom()), new Color(255,0,0,100), partialTicks); - RenderUtils.highlightBlock(end.getBlockPos(EditingContext.getEditingContext().getRoom()), new Color(0,255,0,100), partialTicks); - } - - public List<OffsetPoint> getBlockPoses() { - int minX = Math.min(start.getX(), end.getX()); - int minY = Math.min(start.getY(), end.getY()); - int minZ = Math.min(start.getZ(), end.getZ()); - int maxX = Math.max(start.getX(), end.getX()); - int maxY = Math.max(start.getY(), end.getY()); - int maxZ = Math.max(start.getZ(), end.getZ()); - - List<OffsetPoint> offsetPoints = new ArrayList<OffsetPoint>(); - for (int z = minZ; z <= maxZ; z++) { - for (int x = minX; x <=maxX; x++) { - for (int y = maxY; y >= minY; y --) { - offsetPoints.add(new OffsetPoint(x,y,z)); - } - } - } - return offsetPoints; - } - - public void add() { - valueEditOffsetPointSet.addAll(getBlockPoses()); - } - - public GuiDungeonAddSet(final ValueEditOffsetPointSet processorParameterEditPane) { - this.valueEditOffsetPointSet = processorParameterEditPane; - getMainPanel().setBackgroundColor(new Color(17, 17, 17, 179)); - { - start = new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition()); - end = new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition()); - } - { - MValue mValue = new MValue(start, Collections.emptyList()); - mValue.setBounds(new Rectangle(0,0,150,20)); - getMainPanel().add(mValue); - MValue mValue2 = new MValue(end,Collections.emptyList()); - mValue2.setBounds(new Rectangle(0,20,150,20)); - getMainPanel().add(mValue2); - } - { - add = new MButton() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0,parentHeight - 20, parentWidth / 2, 20)); - } - }; - add.setText("Add"); - add.setBackgroundColor(Color.red); - add.setOnActionPerformed(new Runnable() { - @Override - public void run() { - add(); - EditingContext.getEditingContext().goBack(); - } - }); - - back = new MButton(){ - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(parentWidth / 2,parentHeight - 20, parentWidth / 2, 20)); - } - }; - back.setText("Go back"); - back.setBackgroundColor(Color.green); - back.setOnActionPerformed(new Runnable() { - @Override - public void run() { - EditingContext.getEditingContext().goBack(); - } - }); - getMainPanel().add(add); - getMainPanel().add(back); - } - } - - @Override - public void initGui() { - super.initGui(); - // update bounds - getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300)); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java deleted file mode 100755 index 584d8472..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java +++ /dev/null @@ -1,179 +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.roomedit.gui; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; -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.input.Mouse; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.io.IOException; - -public class GuiDungeonParameterEdit extends MGui { - - private final Parameter parameter; - private final DungeonRoom dungeonRoom; - - private String classSelection; - - private final MPanel currentValueEdit; - - private final MButton save; - private final MButton delete; - - @Getter - private ValueEdit valueEdit; - - public GuiDungeonParameterEdit(final MParameter parameter2, final DynamicEditor processorParameterEditPane) { - dungeonRoom = EditingContext.getEditingContext().getRoom(); - getMainPanel().setBackgroundColor(new Color(17, 17, 17, 179)); - this.parameter = parameter2.getParameter(); - { - MTextField mTextField = new MTextField() { - @Override - public void edit(String str) { - parameter.setName(str); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Name", mTextField); - - mTextField.setText(parameter.getName()); - mLabelAndElement.setBounds(new Rectangle(0,0,200, 20)); - getMainPanel().add(mLabelAndElement); - } - { - classSelection = parameter.getNewData() == null ?"null" : parameter.getNewData().getClass().getName(); - final MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(processorParameterEditPane.allowedClass(), classSelection) { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0, 20, parentWidth,20)); - } - - @Override - public String selectionToDisplay(String selection) { - String[] split = selection.split("\\."); - return super.selectionToDisplay(split[split.length - 1]); - } - }; - - mStringSelectionButton.setOnUpdate(new Runnable() { - @Override - public void run() { - classSelection = mStringSelectionButton.getSelected(); - updateClassSelection(); - } - }); - mStringSelectionButton.setBounds(new Rectangle(0,20,150,20)); - getMainPanel().add(mStringSelectionButton); - } - { - currentValueEdit = new MPanel(){ - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0, 40, parentWidth,parentHeight - 60)); - } - }; - getMainPanel().add(currentValueEdit); - } - { - delete = new MButton() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0,parentHeight - 20, parentWidth / 2, 20)); - } - }; - delete.setText("Delete"); - delete.setBackgroundColor(Color.red); - delete.setOnActionPerformed(new Runnable() { - @Override - public void run() { - processorParameterEditPane.delete(parameter2); - EditingContext.getEditingContext().goBack(); - } - }); - - save = new MButton(){ - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(parentWidth / 2,parentHeight - 20, parentWidth / 2, 20)); - } - }; - save.setText("Go back"); - save.setBackgroundColor(Color.green); - save.setOnActionPerformed(new Runnable() { - @Override - public void run() { - EditingContext.getEditingContext().goBack(); - } - }); - getMainPanel().add(delete); - getMainPanel().add(save); - } - updateClassSelection(); - } - - public void updateClassSelection() { - currentValueEdit.getChildComponents().clear(); - - ValueEditCreator valueEditCreator = ValueEditRegistry.getValueEditMap(classSelection); - - if (!classSelection.equals(parameter.getNewData() == null ?"null" :parameter.getNewData().getClass().getName())) { - parameter.setNewData(valueEditCreator.createDefaultValue(parameter)); - parameter.setPreviousData(valueEditCreator.cloneObj(parameter.getNewData())); - } - - MPanel valueEdit = (MPanel) valueEditCreator.createValueEdit(parameter); - if (valueEdit == null) { - MLabel valueEdit2 = new MLabel() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0, 0, parentWidth,20)); - } - }; - valueEdit2.setText("No Value Edit"); - valueEdit2.setBounds(new Rectangle(0,0,150,20)); - valueEdit = valueEdit2; - this.valueEdit = null; - } else{ - this.valueEdit = (ValueEdit) valueEdit; - } - valueEdit.resize0(currentValueEdit.getBounds().width, currentValueEdit.getBounds().height); - currentValueEdit.add(valueEdit); - } - @Override - public void initGui() { - super.initGui(); - // update bounds - getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300)); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java deleted file mode 100755 index 18c05ae5..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java +++ /dev/null @@ -1,75 +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.roomedit.gui; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MTabbedPane; -import kr.syeyoung.dungeonsguide.roomedit.panes.*; -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.input.Mouse; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.io.IOException; - -public class GuiDungeonRoomEdit extends MGui { - - private final DungeonRoom room; - - private final MTabbedPane tabbedPane; - @Getter - private final SecretEditPane sep; - - public GuiDungeonRoomEdit(DungeonRoom room) { - this.room = room; - - MTabbedPane tabbedPane = new MTabbedPane(); - getMainPanel().add(tabbedPane); - tabbedPane.setBackground2(new Color(17, 17, 17, 179)); - - - tabbedPane.addTab("General", new GeneralEditPane(room)); - tabbedPane.addTab("Match", new RoomDataDisplayPane(room)); - tabbedPane.addTab("Secrets", sep = new SecretEditPane(room)); - tabbedPane.addTab("Actions", new ActionDisplayPane(room)); - tabbedPane.addTab("Test", new RoommatchingPane(room)); - tabbedPane.addTab("Proc.Params", new ProcessorParameterEditPane(room)); - this.tabbedPane = tabbedPane; - } - - public boolean isEditingSelected() { - return "Secrets".equals(tabbedPane.getSelectedKey()); - } - public void endEditing() { - tabbedPane.setSelectedKey("General"); - } - - @Override - public void initGui() { - super.initGui(); - // update bounds - 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)); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java deleted file mode 100755 index 56192361..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java +++ /dev/null @@ -1,133 +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.roomedit.gui; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; -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.input.Mouse; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.List; -import java.io.IOException; - -public class GuiDungeonValueEdit extends MGui { - private DungeonRoom dungeonRoom; - - - private MPanel currentValueEdit; - - private MButton save; - - @Getter - private ValueEdit valueEdit; - - private List<MPanel> addons; - - private Object editingObj; - - public GuiDungeonValueEdit(final Object object, final List<MPanel> addons) { - try { - dungeonRoom = EditingContext.getEditingContext().getRoom(); - this.addons = addons; - this.editingObj = object; - getMainPanel().setBackgroundColor(new Color(17, 17, 17, 179)); - { - currentValueEdit = new MPanel() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0, 0, parentWidth, parentHeight - 20 - addons.size() * 20)); - } - }; - getMainPanel().add(currentValueEdit); - } - - for (MPanel addon : addons) { - getMainPanel().add(addon); - } - { - save = new MButton() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0, parentHeight - 20, parentWidth, 20)); - } - }; - save.setText("Go back"); - save.setBackgroundColor(Color.green); - save.setOnActionPerformed(new Runnable() { - @Override - public void run() { - EditingContext.getEditingContext().goBack(); - } - }); - getMainPanel().add(save); - } - updateClassSelection(); - } catch (Exception e){} - } - - public void updateClassSelection() { - currentValueEdit.getChildComponents().clear(); - - ValueEditCreator valueEditCreator = ValueEditRegistry.getValueEditMap(editingObj == null ?"null":editingObj.getClass().getName()); - - MPanel valueEdit = (MPanel) valueEditCreator.createValueEdit(new Parameter("", editingObj, editingObj)); - if (valueEdit == null) { - MLabel valueEdit2 = new MLabel() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0, 0, parentWidth,20)); - } - }; - valueEdit2.setText("No Value Edit"); - valueEdit2.setBounds(new Rectangle(0,0,150,20)); - valueEdit = valueEdit2; - this.valueEdit = null; - } else{ - this.valueEdit = (ValueEdit) valueEdit; - } - valueEdit.resize0(currentValueEdit.getBounds().width, currentValueEdit.getBounds().height); - currentValueEdit.add(valueEdit); - } - @Override - public void initGui() { - super.initGui(); - // update bounds - getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300)); - - - for (int i = 0; i < addons.size(); i++) { - addons.get(i).setBounds(new Rectangle(0, getMainPanel().getBounds().height - (i+1) * 20 - 20, getMainPanel().getBounds().width, 20)); - } - save.setBounds(new Rectangle(0 ,getMainPanel().getBounds().height - 20, getMainPanel().getBounds().width, 20)); - } - -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java deleted file mode 100755 index 04ae7643..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java +++ /dev/null @@ -1,143 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonBreakableWall; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.init.Blocks; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Collections; - -public class ValueEditBreakableWall extends MPanel implements ValueEdit<DungeonBreakableWall> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonBreakableWall dungeonBreakableWall; - - private final MLabel label; - private final MValue<OffsetPointSet> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - private final MButton updateOnlyAir; - - public ValueEditBreakableWall(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonBreakableWall = (DungeonBreakableWall) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Wall Points"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonBreakableWall.getSecretPoint(), Collections.emptyList()); - add(value); - - updateOnlyAir = new MButton(); - updateOnlyAir.setText("Update Air"); - updateOnlyAir.setBackgroundColor(Color.green); - updateOnlyAir.setForeground(Color.black); - updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); - add(updateOnlyAir); - updateOnlyAir.setOnActionPerformed(new Runnable() { - @Override - public void run() { - OffsetPointSet ofs = dungeonBreakableWall.getSecretPoint(); - List<OffsetPoint> filtered = new ArrayList<OffsetPoint>(); - for (OffsetPoint offsetPoint : ofs.getOffsetPointList()) { - if (offsetPoint.getBlock(EditingContext.getEditingContext().getRoom()) != Blocks.air) continue; - filtered.add(offsetPoint); - } - dungeonBreakableWall.getSecretPoint().setOffsetPointList(filtered); - } - }); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonBreakableWall.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonBreakableWall.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonBreakableWall.highlight(new Color(0,255,255,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditBreakableWall> { - - @Override - public ValueEditBreakableWall createValueEdit(Parameter parameter) { - return new ValueEditBreakableWall(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonBreakableWall(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonBreakableWall)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java deleted file mode 100755 index 0fc7de4c..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java +++ /dev/null @@ -1,157 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonDoor; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.init.Blocks; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonDoor dungeonDoor; - - private final MLabel label; - private final MValue<OffsetPointSet> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite_par; - private final MTextField preRequisite2; - private final MLabelAndElement preRequisite2_par; - private final MButton updateOnlyAir; - - public ValueEditDoor(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonDoor = (DungeonDoor) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Wall Points"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonDoor.getSecretPoint(), Collections.emptyList()); - add(value); - - updateOnlyAir = new MButton(); - updateOnlyAir.setText("Update Air"); - updateOnlyAir.setBackgroundColor(Color.green); - updateOnlyAir.setForeground(Color.black); - updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); - add(updateOnlyAir); - updateOnlyAir.setOnActionPerformed(new Runnable() { - @Override - public void run() { - OffsetPointSet ofs = dungeonDoor.getSecretPoint(); - List<OffsetPoint> filtered = new ArrayList<OffsetPoint>(); - for (OffsetPoint offsetPoint : ofs.getOffsetPointList()) { - if (offsetPoint.getBlock(EditingContext.getEditingContext().getRoom()) != Blocks.air) continue; - filtered.add(offsetPoint); - } - dungeonDoor.getSecretPoint().setOffsetPointList(filtered); - } - }); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonDoor.setOpenPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonDoor.getOpenPreRequisite(), ",")); - preRequisite_par = new MLabelAndElement("Open Req.",preRequisite); - preRequisite_par.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(preRequisite_par); - - preRequisite2 = new MTextField() { - @Override - public void edit(String str) { - dungeonDoor.setClosePreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite2.setText(TextUtils.join(dungeonDoor.getClosePreRequisite(), ",")); - preRequisite2_par = new MLabelAndElement("Close Req.",preRequisite2); - preRequisite2_par.setBounds(new Rectangle(0,80,getBounds().width,20)); - add(preRequisite2_par); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); - preRequisite_par.setBounds(new Rectangle(0,60,getBounds().width,20)); - preRequisite2_par.setBounds(new Rectangle(0,80,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonDoor.highlight(new Color(0,255,255,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditDoor> { - - @Override - public ValueEditDoor createValueEdit(Parameter parameter) { - return new ValueEditDoor(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonDoor(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonDoor)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java deleted file mode 100755 index 7c211b52..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java +++ /dev/null @@ -1,122 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonDummy; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonNPC; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditDummy extends MPanel implements ValueEdit<DungeonDummy> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonDummy dungeonSecret; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - - public ValueEditDummy(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonSecret = (DungeonDummy) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Dummy Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonSecret.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonSecret.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditDummy> { - - @Override - public ValueEditDummy createValueEdit(Parameter parameter) { - return new ValueEditDummy(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonDummy(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonDummy)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditFairySoul.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditFairySoul.java deleted file mode 100755 index 7ac9ac1a..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditFairySoul.java +++ /dev/null @@ -1,119 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditFairySoul extends MPanel implements ValueEdit<DungeonFairySoul> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonFairySoul dungeonSecret; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - - public ValueEditFairySoul(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonSecret = (DungeonFairySoul) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("FairySoul Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonSecret.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonSecret.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditFairySoul> { - - @Override - public ValueEditFairySoul createValueEdit(Parameter parameter) { - return new ValueEditFairySoul(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonFairySoul(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonFairySoul)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditJournal.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditJournal.java deleted file mode 100755 index f56b1630..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditJournal.java +++ /dev/null @@ -1,123 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonJournal; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - - -public class ValueEditJournal extends MPanel implements ValueEdit<DungeonJournal> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonJournal dungeonSecret; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - - public ValueEditJournal(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonSecret = (DungeonJournal) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Journal Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonSecret.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonSecret.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditJournal> { - - @Override - public ValueEditJournal createValueEdit(Parameter parameter) { - return new ValueEditJournal(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonJournal(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonJournal)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java deleted file mode 100755 index aaeb607f..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java +++ /dev/null @@ -1,133 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonLever; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditLever extends MPanel implements ValueEdit<DungeonLever> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonLever dungeonLever; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - private final MTextField target; - private final MLabelAndElement target2; - - public ValueEditLever(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonLever = (DungeonLever) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Secret Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonLever.getLeverPoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonLever.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonLever.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - - - target = new MTextField() { - @Override - public void edit(String str) { - dungeonLever.setTriggering(str); - } - }; - target.setText(dungeonLever.getTriggering()); - target2 = new MLabelAndElement("Target",target); - target2.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(target2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - target2.setBounds(new Rectangle(0,60,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonLever.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditLever> { - - @Override - public ValueEditLever createValueEdit(Parameter parameter) { - return new ValueEditLever(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonLever(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonLever)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java deleted file mode 100755 index 4146b491..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java +++ /dev/null @@ -1,123 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonNPC; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditNPC extends MPanel implements ValueEdit<DungeonNPC> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonNPC dungeonSecret; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - - public ValueEditNPC(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonSecret = (DungeonNPC) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("NPC Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonSecret.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonSecret.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditNPC> { - - @Override - public ValueEditNPC createValueEdit(Parameter parameter) { - return new ValueEditNPC(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonNPC(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonNPC)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java deleted file mode 100755 index ede6ee43..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java +++ /dev/null @@ -1,143 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonOnewayDoor; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.init.Blocks; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class ValueEditOnewayDoor extends MPanel implements ValueEdit<DungeonOnewayDoor> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonOnewayDoor dungeonDoor; - - private final MLabel label; - private final MValue<OffsetPointSet> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - private final MButton updateOnlyAir; - - public ValueEditOnewayDoor(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonDoor = (DungeonOnewayDoor) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Wall Points"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonDoor.getSecretPoint(), Collections.emptyList()); - add(value); - - updateOnlyAir = new MButton(); - updateOnlyAir.setText("Update Air"); - updateOnlyAir.setBackgroundColor(Color.green); - updateOnlyAir.setForeground(Color.black); - updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); - add(updateOnlyAir); - updateOnlyAir.setOnActionPerformed(new Runnable() { - @Override - public void run() { - OffsetPointSet ofs = dungeonDoor.getSecretPoint(); - List<OffsetPoint> filtered = new ArrayList<OffsetPoint>(); - for (OffsetPoint offsetPoint : ofs.getOffsetPointList()) { - if (offsetPoint.getBlock(EditingContext.getEditingContext().getRoom()) != Blocks.air) continue; - filtered.add(offsetPoint); - } - dungeonDoor.getSecretPoint().setOffsetPointList(filtered); - } - }); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonDoor.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonDoor.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonDoor.highlight(new Color(0,255,255,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditOnewayDoor> { - - @Override - public ValueEditOnewayDoor createValueEdit(Parameter parameter) { - return new ValueEditOnewayDoor(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonOnewayDoor(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonOnewayDoor)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java deleted file mode 100755 index 2a15adad..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java +++ /dev/null @@ -1,137 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonOnewayLever; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditOnewayLever extends MPanel implements ValueEdit<DungeonOnewayLever> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonOnewayLever dungeonLever; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - private final MTextField target; - private final MLabelAndElement target2; - - - public ValueEditOnewayLever(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonLever = (DungeonOnewayLever) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Secret Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonLever.getLeverPoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonLever.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonLever.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - - - target = new MTextField() { - @Override - public void edit(String str) { - dungeonLever.setTriggering(str); - } - }; - target.setText(dungeonLever.getTriggering()); - target2 = new MLabelAndElement("Target",target); - target2.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(target2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - target2.setBounds(new Rectangle(0,60,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonLever.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditOnewayLever> { - - @Override - public ValueEditOnewayLever createValueEdit(Parameter parameter) { - return new ValueEditOnewayLever(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonOnewayLever(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonOnewayLever)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java deleted file mode 100755 index 99d60baa..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java +++ /dev/null @@ -1,136 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonPressurePlate; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditPressurePlate extends MPanel implements ValueEdit<DungeonPressurePlate> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonPressurePlate dungeonPressureplate; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - private final MTextField target; - private final MLabelAndElement target2; - - - public ValueEditPressurePlate(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonPressureplate = (DungeonPressurePlate) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Secret Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonPressureplate.getPlatePoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonPressureplate.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonPressureplate.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - - - target = new MTextField() { - @Override - public void edit(String str) { - dungeonPressureplate.setTriggering(str); - } - }; - target.setText(dungeonPressureplate.getTriggering()); - target2 = new MLabelAndElement("Target",target); - target2.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(target2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - target2.setBounds(new Rectangle(0,60,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonPressureplate.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditPressurePlate> { - - @Override - public ValueEditPressurePlate createValueEdit(Parameter parameter) { - return new ValueEditPressurePlate(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonPressurePlate(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonPressurePlate)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java deleted file mode 100755 index 72cb410b..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java +++ /dev/null @@ -1,129 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonSecret dungeonSecret; - - private final MLabel label; - private final MValue<OffsetPoint> value; - private final MStringSelectionButton selectionButton; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - - public ValueEditSecret(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonSecret = (DungeonSecret) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Secret Point"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList()); - add(value); - - selectionButton = new MStringSelectionButton(Arrays.asList("CHEST", "BAT", "ITEM_DROP", "ESSENCE"), dungeonSecret.getSecretType().name()); - selectionButton.setOnUpdate(new Runnable() { - @Override - public void run() { - dungeonSecret.setSecretType(DungeonSecret.SecretType.valueOf(selectionButton.getSelected())); - } - }); - add(selectionButton); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonSecret.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - selectionButton.setBounds(new Rectangle(0,40,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonSecret.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditSecret> { - - @Override - public ValueEditSecret createValueEdit(Parameter parameter) { - return new ValueEditSecret(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonSecret(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonSecret)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java deleted file mode 100755 index 042a8258..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java +++ /dev/null @@ -1,118 +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.roomedit.mechanicedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonTomb; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.awt.*; -import java.util.Arrays; -import java.util.Collections; - -public class ValueEditTomb extends MPanel implements ValueEdit<DungeonTomb> { - private Parameter parameter; - - // scroll pane - // just create - // add set - private final DungeonTomb dungeonTomb; - - private final MLabel label; - private final MValue<OffsetPointSet> value; - private final MTextField preRequisite; - private final MLabelAndElement preRequisite2; - - public ValueEditTomb(final Parameter parameter2) { - this.parameter = parameter2; - this.dungeonTomb = (DungeonTomb) parameter2.getNewData(); - - - label = new MLabel(); - label.setText("Tomb Points"); - label.setAlignment(MLabel.Alignment.LEFT); - add(label); - - value = new MValue(dungeonTomb.getSecretPoint(), Collections.emptyList()); - add(value); - - preRequisite = new MTextField() { - @Override - public void edit(String str) { - dungeonTomb.setPreRequisite(Arrays.asList(str.split(","))); - } - }; - preRequisite.setText(TextUtils.join(dungeonTomb.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(preRequisite2); - } - - @Override - public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,getBounds().width, 20)); - value.setBounds(new Rectangle(0,20,getBounds().width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - dungeonTomb.highlight(new Color(0,255,255,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditTomb> { - - @Override - public ValueEditTomb createValueEdit(Parameter parameter) { - return new ValueEditTomb(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new DungeonTomb(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((DungeonTomb)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java deleted file mode 100755 index 68ccdf6c..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java +++ /dev/null @@ -1,82 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTree; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; - -import java.awt.*; - -public class ActionDisplayPane extends MPanel { - private final DungeonRoom dungeonRoom; - - private ActionTreeDisplayPane displayPane; - - private final MTextField textField; - private final MButton calculate; - public ActionDisplayPane(final DungeonRoom dungeonRoom) { - this.dungeonRoom = dungeonRoom; - - { - textField = new MTextField(); - textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); - add(textField); - } - { - calculate = new MButton(); - calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); - calculate.setText("calculate"); - calculate.setOnActionPerformed(new Runnable() { - @Override - public void run() { - try { - remove(displayPane); - - String text = textField.getText(); - String target = text.split(":")[0]; - String state = text.split(":")[1]; - ActionChangeState actionChangeState = new ActionChangeState(target, state); - ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom); - - displayPane = new ActionTreeDisplayPane(dungeonRoom, tree); - displayPane.setBounds(new Rectangle(0,25,getBounds().width,getBounds().height-25)); - add(displayPane); - } catch (Throwable t) { - t.printStackTrace(); - } - } - }); - add(calculate); - } - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - @Override - public void onBoundsUpdate() { - textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); - calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java deleted file mode 100755 index dd8331a7..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java +++ /dev/null @@ -1,217 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTree; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTreeUtil; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -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 net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.*; -import java.util.List; - -public class ActionTreeDisplayPane extends MPanel { - - private int offsetX = 0; - private int offsetY = 0; - - private float scale; - - private final DungeonRoom dungeonRoom; - private final ActionTree tree; - private List<Action> linearified; - public ActionTreeDisplayPane(DungeonRoom dungeonRoom, ActionTree tree) { - this.dungeonRoom = dungeonRoom; - this.tree = tree; - try { - this.linearified = ActionTreeUtil.linearifyActionTree(tree); - } catch (Exception e) { - linearified = new ArrayList<Action>(); - e.printStackTrace(); - } - scale = 1.0f; - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - GlStateManager.pushMatrix(); - GlStateManager.translate(offsetX, offsetY, 0); - GlStateManager.scale(scale,scale,1); - int x = renderTree(tree, 5, 5, Minecraft.getMinecraft().fontRendererObj, null, new HashMap<ActionTree, Point>()); - renderLinearified(linearified, x, 5, fr); - GlStateManager.popMatrix(); - } - - public int renderTree(ActionTree actionTree, int x, int y, FontRenderer fr, Point drawLineFrom, HashMap<ActionTree, Point> drawmPoints) { - if (drawmPoints.containsKey(actionTree)) { - // recursive, fu - Point pt = drawmPoints.get(actionTree); - - GlStateManager.pushMatrix(); - - GlStateManager.enableBlend(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); - GlStateManager.blendFunc(770, 771); - GlStateManager.enableBlend(); - GL11.glLineWidth(1); - GlStateManager.color(1, 0, 0, 1); - GL11.glBegin(2); - GL11.glVertex2d(drawLineFrom.x, drawLineFrom.y); - GL11.glVertex2d(pt.x, pt.y); - GL11.glEnd(); - GlStateManager.disableBlend(); - GlStateManager.enableTexture2D(); - GlStateManager.enableDepth(); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); - - return 0; - } - - Dimension dim = renderAction(actionTree.getCurrent(), x, y, fr); - if (drawLineFrom != null) { - GlStateManager.pushMatrix(); - - - GlStateManager.enableBlend(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); - GlStateManager.blendFunc(770, 771); - GlStateManager.enableBlend(); - GL11.glLineWidth(1); - GlStateManager.color(1, 1, 1, 1); - GL11.glBegin(2); - GL11.glVertex2d(drawLineFrom.x, drawLineFrom.y); - GL11.glVertex2d(x + dim.width / 2, y); - GL11.glEnd(); - GlStateManager.disableBlend(); - GlStateManager.enableTexture2D(); - GlStateManager.enableDepth(); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); - - } - Point pt = new Point(x + dim.width / 2, y + dim.height); - - drawmPoints.put(actionTree, new Point(x + dim.width / 2, y + dim.height / 2)); - int xOff = 0; - for (ActionTree tree:actionTree.getChildren()) { - xOff += renderTree(tree, x + xOff, y + dim.height + 10, fr, pt, drawmPoints) + 10; - } - return Math.max(xOff, dim.width); - } - - public void renderLinearified(List<Action> actions, int x, int y, FontRenderer fr) { - Point lastPt = null; - int y2 = y; - - for (Action action : actions) { - Dimension dim = renderAction(action, x, y2, fr); - if (lastPt != null) { - GlStateManager.pushMatrix(); - - - GlStateManager.enableBlend(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); - GlStateManager.blendFunc(770, 771); - GlStateManager.enableBlend(); - GL11.glLineWidth(1); - GlStateManager.color(1, 1, 1, 1); - GL11.glBegin(2); - GL11.glVertex2d(lastPt.x, lastPt.y); - GL11.glVertex2d(x + dim.width / 2, y2); - GL11.glEnd(); - GlStateManager.disableBlend(); - GlStateManager.enableTexture2D(); - GlStateManager.enableDepth(); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); - - } - lastPt = new Point(x + dim.width / 2, y2 + dim.height); - - y2 += dim.height + 10; - } - } - - public Dimension renderAction(Action action, int x, int y, FontRenderer fr) { - String[] lines = action.toString().split("\n"); - int maxWidth = 0; - for (String line : lines) { - if (fr.getStringWidth(line) > maxWidth) maxWidth= fr.getStringWidth(line); - } - int offset = 2; - int height = (fr.FONT_HEIGHT + offset) * lines.length; - - Gui.drawRect(x,y,x + maxWidth +10, y + height + 10, 0xff000000); - Gui.drawRect(x+1,y+1,x + maxWidth +8, y + height + 8, 0xff4d4d4d); - for (int i = 0; i < lines.length; i++) { - fr.drawString(lines[i], x + 5, y + 5 + i*(fr.FONT_HEIGHT + offset), 0xffffffff); - } - - return new Dimension(maxWidth + 10, height + 10); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,25,parentWidth,parentHeight-25)); - } - - - private int lastX; - private int lastY; - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - lastX = absMouseX; - lastY = absMouseY; - } - - @Override - public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - int dX = absMouseX - lastX; - int dY = absMouseY - lastY; - offsetX += dX; - offsetY += dY; - lastX = absMouseX; - lastY = absMouseY; - } - - @Override - public void mouseScrolled0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - if (scrollAmount > 0) scale += 0.1; - if (scrollAmount < 0) scale -= 0.1; - - if (scale < 0) scale = 0.1f; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java deleted file mode 100755 index 1c10e647..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java +++ /dev/null @@ -1,29 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.gui.elements.MParameter; - -import java.util.List; - -public interface DynamicEditor { - void delete(MParameter parameter); - - List<String> allowedClass(); -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java deleted file mode 100755 index 1133a8a9..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ /dev/null @@ -1,285 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; - -import java.awt.*; -import java.io.*; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.UUID; -import java.util.zip.GZIPOutputStream; - -public class GeneralEditPane extends MPanel { - private final DungeonRoom dungeonRoom; - - private final MLabelAndElement uuid; - private final MLabelAndElement name; - private final MLabelAndElement secrets; - - private final MLabelAndElement shape; - private final MLabelAndElement rotation; - private final MLabelAndElement shape2; - - private MButton save; - private final MButton end; - private final MButton schematic; - - private final MLabelAndElement roomProcessor; - - public GeneralEditPane(final DungeonRoom dungeonRoom) { - this.dungeonRoom = dungeonRoom; - { - MLabel la; - uuid = new MLabelAndElement("Room UUID: ", la = new MLabel()); - la.setText(dungeonRoom.getDungeonRoomInfo().getUuid().toString()); - uuid.setBounds(new Rectangle(0,0,getBounds().width, 20)); - add(uuid); - } - { - MTextField la = new MTextField() { - @Override - public void edit(String str) { - dungeonRoom.getDungeonRoomInfo().setName(str); - } - }; - name = new MLabelAndElement("Room Name: ", la); - la.setText(dungeonRoom.getDungeonRoomInfo().getName()); - name.setBounds(new Rectangle(0,20,getBounds().width, 20)); - add(name); - } - { - final MIntegerSelectionButton la = new MIntegerSelectionButton(dungeonRoom.getDungeonRoomInfo().getTotalSecrets()); - la.setOnUpdate(new Runnable() { - @Override - public void run() { - dungeonRoom.getDungeonRoomInfo().setTotalSecrets(la.getData()); - } - }); - secrets = new MLabelAndElement("Room Secrets: ", la); - secrets.setBounds(new Rectangle(0,40,getBounds().width, 20)); - add(secrets); - } - - { - MLabel la; - shape = new MLabelAndElement("Room Shape: ", la = new MLabel()); - la.setText(dungeonRoom.getDungeonRoomInfo().getShape()+""); - shape.setBounds(new Rectangle(0,60,getBounds().width, 20)); - add(shape); - } - - { - MLabel la; - rotation = new MLabelAndElement("Found Room Rotation: ", la = new MLabel()); - la.setText(dungeonRoom.getRoomMatcher().getRotation()+""); - rotation.setBounds(new Rectangle(0,80,getBounds().width, 20)); - add(rotation); - } - { - MLabel la; - shape2 = new MLabelAndElement("Found Room Shape: ", la = new MLabel()); - la.setText(dungeonRoom.getShape()+""); - shape2.setBounds(new Rectangle(0,100,getBounds().width, 20)); - add(shape2); - } - { - final MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(new ArrayList<String>(ProcessorFactory.getProcessors()), dungeonRoom.getDungeonRoomInfo().getProcessorId()); - roomProcessor = new MLabelAndElement("Room Processor: ", mStringSelectionButton); - roomProcessor.setBounds(new Rectangle(0,120,getBounds().width, 20)); - add(roomProcessor); - - mStringSelectionButton.setOnUpdate(new Runnable() { - @Override - public void run() { - dungeonRoom.getDungeonRoomInfo().setProcessorId(mStringSelectionButton.getSelected()); - dungeonRoom.updateRoomProcessor(); - } - }); - } - { - end = new MButton(); - end.setText("End Editing Session"); - end.setOnActionPerformed(new Runnable() { - @Override - public void run() { - EditingContext.endEditingSession(); - } - }); - end.setBackgroundColor(Color.green); - end.setBounds(new Rectangle(0,140,getBounds().width, 20)); - add(end); - } - { - schematic = new MButton(); - schematic.setText("Save Schematic"); - schematic.setOnActionPerformed(new Runnable() { - @Override - public void run() { - try { - NBTTagCompound nbtTagCompound2 = createNBT(); - - File f=new File(DungeonsGuide.getDungeonsGuide().getConfigDir(), "schematics/"+ - dungeonRoom.getDungeonRoomInfo().getName()+"-"+dungeonRoom.getDungeonRoomInfo().getUuid().toString()+"-"+ UUID.randomUUID()+".schematic"); - - Method method = null; - try { - method = NBTTagCompound.class.getDeclaredMethod("write", DataOutput.class); - method.setAccessible(true); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - return; - } - FileOutputStream fos = new FileOutputStream(f); - DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(fos))); - - try - { - dataoutputstream.writeByte(nbtTagCompound2.getId()); - - dataoutputstream.writeUTF("Schematic"); - method.invoke(nbtTagCompound2, dataoutputstream); - } - finally - { - dataoutputstream.close(); - } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSaved to "+f.getName())); - } catch (Throwable e) { - e.printStackTrace(); - } - - } - }); - schematic.setBackgroundColor(Color.orange); - schematic.setBounds(new Rectangle(0,180,getBounds().width, 20)); - add(schematic); - } - { - if (dungeonRoom.getDungeonRoomInfo().isRegistered()) return; - save = new MButton(); - save.setText("Save RoomData"); - save.setOnActionPerformed(new Runnable() { - @Override - public void run() { - DungeonRoomInfoRegistry.register(dungeonRoom.getDungeonRoomInfo()); - remove(save); - } - }); - save.setBackgroundColor(Color.green); - save.setBounds(new Rectangle(0,10,getBounds().width, 20)); - add(save); - } - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - @Override - public void onBoundsUpdate() { - if (save != null) - save.setBounds(new Rectangle(0,160,getBounds().width, 20)); - end.setBounds(new Rectangle(1,140,getBounds().width-2, 20)); - if (schematic != null) - schematic.setBounds(new Rectangle(0,180,getBounds().width, 20)); - } - - private NBTTagCompound createNBT() { - NBTTagCompound compound = new NBTTagCompound(); - compound.setShort("Width", (short) (dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 1)); - compound.setShort("Height", (short) 255); - compound.setShort("Length", (short) (dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1)); - int size =compound.getShort("Width") * compound.getShort("Height") * compound.getShort("Length"); - - byte[] blocks = new byte[size]; - byte[] meta = new byte[size]; - byte[] extra = new byte[size]; - byte[] extranibble = new byte[(int) Math.ceil(size / 2.0)]; - - boolean extraEx = false; - NBTTagList tileEntitiesList = new NBTTagList(); - for (int x = 0; x < compound.getShort("Width"); x++) { - for (int y = 0; y < compound.getShort("Height"); y++) { - for (int z = 0; z < compound.getShort("Length"); z++) { - int index = x + (y * compound.getShort("Length") + z) * compound.getShort("Width"); - BlockPos pos = dungeonRoom.getRelativeBlockPosAt(x,y - 70,z); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); - boolean acc = dungeonRoom.canAccessRelative(x,z); - int id = Block.getIdFromBlock(blockState.getBlock()); - blocks[index] = acc ? (byte) id : 0; - meta[index] = acc ? (byte) blockState.getBlock().getMetaFromState(blockState) : 0; - if ((extra[index] = (byte) ((acc ? id : 0) >> 8)) > 0) { - extraEx = true; - } - - if (blockState.getBlock().hasTileEntity(blockState)) { - TileEntity tileEntity = dungeonRoom.getContext().getWorld().getTileEntity(pos); - try { - final NBTTagCompound tileEntityCompound = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityCompound); - tileEntitiesList.appendTag(tileEntityCompound); - } catch (final Exception e) { - final BlockPos tePos = tileEntity.getPos(); - - blocks[index] = (byte) 7; - meta[index] = 0; - extra[index] = 0; - } - } - } - } - } - for (int i = 0; i < extranibble.length; i++) { - if (i * 2 + 1 < extra.length) { - extranibble[i] = (byte) ((extra[i * 2 + 0] << 4) | extra[i * 2 + 1]); - } else { - extranibble[i] = (byte) (extra[i * 2 + 0] << 4); - } - } - - - compound.setByteArray("Blocks", blocks); - compound.setByteArray("Data", meta); - compound.setString("Materials", "Alpha"); - if (extraEx) { - compound.setByteArray("AddBlocks", extranibble); - } - compound.setTag("Entities", new NBTTagList()); - compound.setTag("TileEntities", tileEntitiesList); - - return compound; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java deleted file mode 100755 index d719185d..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java +++ /dev/null @@ -1,144 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MParameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class ProcessorParameterEditPane extends MPanel implements DynamicEditor { - private final DungeonRoom dungeonRoom; - - private MButton save; - private MButton create; - private final List<MParameter> parameters = new ArrayList<MParameter>(); - - public ProcessorParameterEditPane(DungeonRoom dungeonRoom) { - this.dungeonRoom = dungeonRoom; - buildElements(); - } - - public void buildElements() { - { - create = new MButton(); - create.setText("Create New Parameter"); - create.setBackgroundColor(Color.cyan); - create.setBounds(new Rectangle(0,0,100,20)); - create.setOnActionPerformed(new Runnable() { - @Override - public void run() { - MParameter parameter; - parameters.add(parameter = new MParameter(new Parameter(UUID.randomUUID().toString(), null, null), ProcessorParameterEditPane.this)); - parameter.setParent(ProcessorParameterEditPane.this); - parameter.setBounds(new Rectangle(0,0,getBounds().width, 20)); - } - }); - - save = new MButton(); - save.setText("Save"); - save.setBackgroundColor(Color.green); - save.setBounds(new Rectangle(0,0,100,20)); - save.setOnActionPerformed(new Runnable() { - @Override - public void run() { - DungeonRoomInfo dungeonRoomInfo = dungeonRoom.getDungeonRoomInfo(); - dungeonRoomInfo.getProperties().clear(); - - for (MParameter parameter : parameters) { - Parameter real = parameter.getParameter(); - - ValueEditCreator vec = ValueEditRegistry.getValueEditMap(real.getNewData() == null ? "null" :real.getNewData().getClass().getName()); - - real.setPreviousData(vec.cloneObj(real.getNewData())); - dungeonRoomInfo.getProperties().put(real.getName(), real.getNewData()); - } - } - }); - create.setParent(this); save.setParent(this); - } - { - for (Map.Entry<String, Object> en : dungeonRoom.getDungeonRoomInfo().getProperties().entrySet()) { - ValueEditCreator vec = ValueEditRegistry.getValueEditMap(en.getValue() == null ? "null" :en.getValue().getClass().getName()); - - MParameter mParameter = new MParameter(new Parameter(en.getKey(), vec.cloneObj(en.getValue()), vec.cloneObj(en.getValue())), this); - mParameter.setBounds(new Rectangle(0,0,getBounds().width,20)); - parameters.add(mParameter); - mParameter.setParent(this); - } - } - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - - public void delete(MParameter parameter) { - parameters.remove(parameter); - } - - @Override - public List<String> allowedClass() { - return ValueEditRegistry.getClassesSupported(); - } - - - @Override - public List<MPanel> getChildComponents() { - ArrayList<MPanel> panels = new ArrayList<MPanel>(parameters); - panels.add(create); - panels.add(save); - return panels; - } - - private int offsetY = 0; - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - int heights = 0; - for (MPanel panel:getChildComponents()) { - panel.setPosition(new Point(0, -offsetY + heights)); - heights += panel.getBounds().height; - } - } - - @Override - public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - if (scrollAmount > 0) offsetY -= 20; - else if (scrollAmount < 0) offsetY += 20; - if (offsetY < 0) offsetY = 0; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java deleted file mode 100755 index bd3da672..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java +++ /dev/null @@ -1,127 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.block.Block; -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.item.Item; -import net.minecraft.item.ItemStack; - -import java.awt.*; - -public class RoomDataDisplayPane extends MPanel { - - private int offsetX = 0; - private int offsetY = 0; - - private int selectedX = -1; - private int selectedY = -1; - - private final DungeonRoom dungeonRoom; - public RoomDataDisplayPane(DungeonRoom dungeonRoom) { - this.dungeonRoom = dungeonRoom; - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - int[][] blocks = dungeonRoom.getDungeonRoomInfo().getBlocks(); - // draw Axis; - Gui.drawRect(0,0,10,10,0x77777777); - 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(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); - } - - int hoverX = (relMousex0 - offsetX - 10) / 16; - int hoverY = (relMousey0 - offsetY - 10) / 16; - // draw Content - 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]; - if (z == selectedY && x == selectedX){ - Gui.drawRect(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA707070); - } else if (z == hoverY && x == hoverX) { - Gui.drawRect(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA505050); - } - - - if (data == -1) fr.drawString("X", x *16 +10 + offsetX, z *16 +10 + offsetY,0xFFFFFF); - else drawItemStack(new ItemStack(Item.getItemFromBlock(Block.getBlockById(data)), 1), x * 16 +10 + offsetX, z *16 +10 + offsetY); - } - } - - } - private void drawItemStack(ItemStack stack, int x, int y) - { - Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, x, y); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - @Override - public void keyPressed(char typedChar, int keyCode) { - int[][] blocks = dungeonRoom.getDungeonRoomInfo().getBlocks(); - if (selectedX != -1 && selectedY != -1 && selectedY < blocks.length && selectedX < blocks[0].length) { - dungeonRoom.getDungeonRoomInfo().getBlocks()[selectedY][selectedX] = -1; - } - } - - private int lastX; - private int lastY; - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - lastX = absMouseX; - lastY = absMouseY; - - if (lastAbsClip.contains(absMouseX, absMouseY)) { - selectedX = (relMouseX - offsetX - 10) / 16; - selectedY = (relMouseY - offsetY - 10) / 16; - } - } - - @Override - public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - int dX = absMouseX - lastX; - int dY = absMouseY - lastY; - offsetX += dX; - offsetY += dY; - lastX = absMouseX; - lastY = absMouseY; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java deleted file mode 100755 index 3379098b..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java +++ /dev/null @@ -1,152 +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.roomedit.panes; - -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 net.minecraft.block.Block; -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.item.Item; -import net.minecraft.item.ItemStack; - -import java.awt.*; -import java.util.Arrays; -import java.util.UUID; - -public class RoomMatchDisplayPane extends MPanel { - - private int offsetX = 0; - private int offsetY = 0; - - private final DungeonRoom dungeonRoom; - - private final int[][] currentBlocks; - private int[][] targetBlocks; - public RoomMatchDisplayPane(DungeonRoom dungeonRoom, UUID uid, int rotation) { - this.dungeonRoom = dungeonRoom; - - currentBlocks = dungeonRoom.getRoomMatcher().createNew().getBlocks(); - targetBlocks = DungeonRoomInfoRegistry.getByUUID(uid).getBlocks(); - for (int i = 0; i < rotation; i++) - targetBlocks = ArrayUtils.rotateCounterClockwise(targetBlocks); - } - - MTooltip mTooltip; - int lastTooltipX = -1, lastTooltipZ = -1; - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - int height = Math.max(currentBlocks.length, targetBlocks.length); - int width = Math.max(currentBlocks[0].length, targetBlocks[0].length); - - // draw Axis; - Gui.drawRect(0,0,10,10,0x77777777); - 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(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); - } - - int hoverX = (relMousex0 - offsetX - 10) / 16; - int hoverY = (relMousey0 - offsetY - 10) / 16; - // draw Content - 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++) { - int data1; - try { data1 = currentBlocks[z][x]; } catch (Exception e) { - data1 = -2; - } - int data2; - try { data2 = targetBlocks[z][x]; } catch (Exception e) { - data2 = -2; - } - - if (z == hoverY && x == hoverX) { - Gui.drawRect(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA505050); - } - - if (data1 == data2) drawItemStack(new ItemStack(Item.getItemFromBlock(Block.getBlockById(data1)), 1), x * 16 +10 + offsetX, z *16 +10 + offsetY); - else if (data2 == -1 || data1 == -1) { - drawItemStack(new ItemStack(Item.getItemFromBlock(Block.getBlockById(data1 == -1 ? data2 : data1)), 1), x * 16 +10 + offsetX, z *16 +10 + offsetY); - fr.drawString("S", x *16 +10 + offsetX, z *16 +10 + offsetY,0xFFFFFF00); - } else { - fr.drawString("N", x *16 +10 + offsetX, z *16 +10 + offsetY,0xFFFF0000); - } - if (z == hoverY && x == hoverX) { - tooltiped = true; - if (lastTooltipX != x || lastTooltipZ != z){ - if (mTooltip != null) mTooltip.close(); - mTooltip = new MTooltipText(Arrays.asList("Expected "+data2 +" But found "+data1)); - mTooltip.open(this); - } - } - } - } - if (!tooltiped && mTooltip != null) { - mTooltip.close(); - mTooltip = null; - } - - } - private void drawItemStack(ItemStack stack, int x, int y) - { - Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, x, y); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - private int lastX; - private int lastY; - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - lastX = absMouseX; - lastY = absMouseY; - } - - @Override - public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - int dX = absMouseX - lastX; - int dY = absMouseY - lastY; - offsetX += dX; - offsetY += dY; - lastX = absMouseX; - lastY = absMouseY; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java deleted file mode 100755 index 00d7ae04..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java +++ /dev/null @@ -1,84 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; - -import java.awt.*; -import java.util.UUID; - -public class RoommatchingPane extends MPanel { - private final DungeonRoom dungeonRoom; - - private RoomMatchDisplayPane displayPane; - - private final MTextField textField; - private final MButton calculate; - public RoommatchingPane(final DungeonRoom dungeonRoom) { - this.dungeonRoom = dungeonRoom; - - { - textField = new MTextField(); - textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); - add(textField); - } - { - calculate = new MButton(); - calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); - calculate.setText("match"); - calculate.setOnActionPerformed(new Runnable() { - @Override - public void run() { - try { - remove(displayPane); - - String text = textField.getText(); - String target = text.split(":")[0]; - String state = text.split(":")[1]; - - UUID uid = UUID.fromString(target); - int rotation = Integer.parseInt(state) % 4; - - - displayPane = new RoomMatchDisplayPane(dungeonRoom, uid, rotation); - displayPane.setBounds(new Rectangle(0,25,getBounds().width,getBounds().height-25)); - add(displayPane); - } catch (Throwable t) { - t.printStackTrace(); - } - } - }); - add(calculate); - } - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - @Override - public void onBoundsUpdate() { - textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); - calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java deleted file mode 100755 index 70b3e381..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java +++ /dev/null @@ -1,156 +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.roomedit.panes; - -import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MParameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class SecretEditPane extends MPanel implements DynamicEditor { - private final DungeonRoom dungeonRoom; - - private MButton save; - private MButton create; - private final List<MParameter> parameters = new ArrayList<MParameter>(); - - private final List<String> allowedClasses = new ArrayList<String>(); - - public SecretEditPane(DungeonRoom dungeonRoom) { - this.dungeonRoom = dungeonRoom; - buildElements(); - - for (String clazz : ValueEditRegistry.getClassesSupported()) { - if (clazz.contains("mechanics") || clazz.equals("null")) { - allowedClasses.add(clazz); - } - } - } - - public void createNewMechanic(String uid, DungeonMechanic data) { - MParameter parameter; - parameters.add(parameter = new MParameter(new Parameter(uid, data, data), SecretEditPane.this)); - parameter.setBounds(new Rectangle(0,0,getBounds().width, 20)); - parameter.setParent(SecretEditPane.this); - } - - public void buildElements() { - { - create = new MButton(); - create.setText("Create New Mechanic"); - create.setBackgroundColor(Color.cyan); - create.setBounds(new Rectangle(0,0,100,20)); - create.setOnActionPerformed(new Runnable() { - @Override - public void run() { - createNewMechanic(UUID.randomUUID().toString(), null); - } - }); - - save = new MButton(); - save.setText("Save"); - save.setBackgroundColor(Color.green); - save.setBounds(new Rectangle(0,0,100,20)); - save.setOnActionPerformed(new Runnable() { - @Override - public void run() { - DungeonRoomInfo dungeonRoomInfo = dungeonRoom.getDungeonRoomInfo(); - dungeonRoomInfo.getMechanics().clear(); - - for (MParameter parameter : parameters) { - Parameter real = parameter.getParameter(); - - ValueEditCreator vec = ValueEditRegistry.getValueEditMap(real.getNewData() == null ? "null" :real.getNewData().getClass().getName()); - - real.setPreviousData(vec.cloneObj(real.getNewData())); - dungeonRoomInfo.getMechanics().put(real.getName(), (DungeonMechanic) real.getNewData()); - } - } - }); - create.setParent(this); save.setParent(this); - } - { - for (Map.Entry<String, DungeonMechanic> en : dungeonRoom.getDungeonRoomInfo().getMechanics().entrySet()) { - ValueEditCreator vec = ValueEditRegistry.getValueEditMap(en.getValue() == null ? "null" :en.getValue().getClass().getName()); - - MParameter mParameter = new MParameter(new Parameter(en.getKey(), vec.cloneObj(en.getValue()), vec.cloneObj(en.getValue())), this); - mParameter.setBounds(new Rectangle(0,0,getBounds().width,20)); - parameters.add(mParameter); - mParameter.setParent(this); - } - } - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - - public void delete(MParameter parameter) { - parameters.remove(parameter); - } - - @Override - public List<String> allowedClass() { - return allowedClasses; - } - - @Override - public List<MPanel> getChildComponents() { - ArrayList<MPanel> panels = new ArrayList<MPanel>(parameters); - panels.add(create); - panels.add(save); - return panels; - } - - private int offsetY = 0; - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - int heights = 0; - for (MPanel panel:getChildComponents()) { - panel.setPosition(new Point(0, -offsetY + heights)); - heights += panel.getBounds().height; - } - } - - @Override - public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - if (scrollAmount > 0) offsetY -= 20; - else if (scrollAmount < 0) offsetY += 20; - if (offsetY < 0) offsetY = 0; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEdit.java deleted file mode 100755 index b5c135c4..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEdit.java +++ /dev/null @@ -1,27 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.roomedit.Parameter; - -public interface ValueEdit<T extends Object> { - void setParameter(Parameter parameter); - - void renderWorld(float partialTicks); -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java deleted file mode 100755 index e3e22bf7..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java +++ /dev/null @@ -1,339 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MColor; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { - private Parameter parameter; - private final MFloatSelectionButton h; - private final MFloatSelectionButton s; - private final MFloatSelectionButton v; - private final MFloatSelectionButton a; - - - @Override - public void renderWorld(float partialTicks) { - - } - public ValueEditAColor(final Parameter parameter2) { - this.parameter = parameter2; - { - MColor color = new MColor() { - @Override - public Color getColor() { - return (Color) parameter2.getPreviousData(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",color); - mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); - add(mLabelAndElement); - } - { - MColor color = new MColor() { - @Override - public Color getColor() { - return (Color) parameter2.getNewData(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("New",color); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - - Color color = (Color) parameter2.getNewData(); - Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsv); - alpha = color.getAlpha() / 255.0f; - - { - h = new MFloatSelectionButton(hsv[0] * 360); - h.setOnUpdate(new Runnable() { - @Override - public void run() { - hsv[0] = h.getData() / 360; - update(); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("H", h); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - { - s = new MFloatSelectionButton(hsv[1] * 100); - s.setOnUpdate(new Runnable() { - @Override - public void run() { - hsv[1] = s.getData() / 100; - update(); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("S", s); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - { - v = new MFloatSelectionButton(hsv[2] * 100); - v.setOnUpdate(new Runnable() { - @Override - public void run() { - hsv[2] = v.getData() / 100; - update(); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("V", v); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - { - a = new MFloatSelectionButton(alpha * 100); - a.setOnUpdate(new Runnable() { - @Override - public void run() { - alpha = a.getData() / 100; - update(); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("A", a); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - } - - private final float[] hsv = new float[3]; - private float alpha = 0; - - public void update() { - if (hsv[2] > 1) hsv[2] = 1; - if (hsv[2] < 0) hsv[2] = 0; - if (hsv[1] > 1) hsv[1] = 1; - if (hsv[1] < 0) hsv[1] = 0; - parameter.setNewData(new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | (MathHelper.clamp_int((int)(alpha * 255), 0, 255) << 24), true )); - h.setData((float) Math.floor(hsv[0] * 360)); - s.setData((float) Math.floor(hsv[1] * 100)); - v.setData((float) Math.floor(hsv[2] * 100)); - a.setData((float) Math.floor(alpha * 100)); - h.updateSelected(); - s.updateSelected(); - v.updateSelected(); - a.updateSelected(); - } - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - // draw CoolRect - int width = getBounds().width - 60; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); - GlStateManager.shadeModel(GL11.GL_SMOOTH); - GlStateManager.enableBlend(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - -// worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); - - int rgb = Color.HSBtoRGB(hsv[0], hsv[1], 1); - float r = (rgb >> 16 & 255) / 255.0f; - float g = (rgb >> 8 & 255) / 255.0f; - float b = (rgb & 255) / 255.0f; - GL11.glBegin(GL11.GL_TRIANGLES); - GlStateManager.color(0,0,0,alpha);GL11.glVertex3i(25+width ,45, 0); - GlStateManager.color(0,0,0,alpha);GL11.glVertex3i(10+width , 45, 0); - GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); - - GlStateManager.color(0,0,0,alpha); GL11.glVertex3i(10+width , 45, 0); - GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(10+width , 45 + width, 0); - GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); - GL11.glEnd(); - rgb = Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]); - r = (rgb >> 16 & 255) / 255.0f; - g = (rgb >> 8 & 255) / 255.0f; - b = (rgb & 255) / 255.0f; - GL11.glBegin(GL11.GL_TRIANGLES); - GlStateManager.color(r,g,b,0);GL11.glVertex3i(50+width ,45, 0); - GlStateManager.color(r,g,b,0);GL11.glVertex3i(35+width , 45, 0); - GlStateManager.color(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); - -// GlStateManager.color(r,g,b,0); GL11.glVertex3i(35+width , 45, 0); -// GlStateManager.color(r,g,b,1);GL11.glVertex3i(35+width , 45 + width, 0); -// GlStateManager.color(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); - GL11.glEnd(); - - - float radius = width/2f; - float cx = 5 + radius; - float cy = 45 + radius; - - GL11.glBegin(GL11.GL_TRIANGLE_FAN); - GlStateManager.color(1,1,1,alpha); - GL11.glVertex3f(cx,cy,0); - for (int i = 0; i <= 360; i++) { - float rad = 3.141592653f * i / 180; - int rgb2 = Color.HSBtoRGB(i / 360f, 1, hsv[2]); - float r2 = (rgb2 >> 16 & 255) / 255.0f; - float g2 = (rgb2 >> 8 & 255) / 255.0f; - float b2 = (rgb2 & 255) / 255.0f; - GlStateManager.color(r2,g2,b2, alpha); - GL11.glVertex3f(MathHelper.sin(rad) * radius + cx, MathHelper.cos(rad) * radius + cy, 0); - } - GL11.glEnd(); - GlStateManager.shadeModel(shademodel); - - GlStateManager.color(1,1,1,1); - worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); - float rad2 = 2 * 3.141592653f * hsv[0] ; - float x = 5 + radius + (MathHelper.sin(rad2)) * hsv[1] * radius; - float y = 45 + radius + (MathHelper.cos(rad2))* hsv[1] * radius; - for (int i = 0; i < 100; i++) { - float rad = 2 * 3.141592653f * (i / 100f); - worldrenderer.pos(MathHelper.sin(rad) * 2 + x, MathHelper.cos(rad) * 2 + y, 0).endVertex(); - } - tessellator.draw(); - - worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); - worldrenderer.pos(8+width, 45 + (hsv[2]) * width, 0.5).endVertex(); - worldrenderer.pos(27+width, 45 + (hsv[2]) * width, 0.5).endVertex(); - tessellator.draw(); - - worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); - worldrenderer.pos(33+width, 45 + (alpha) * width, 0.5).endVertex(); - worldrenderer.pos(52+width, 45 + (alpha) * width, 0.5).endVertex(); - tessellator.draw(); - - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - GlStateManager.color(1,1,1,1); - GlStateManager.color(1,1,1,1); - } - private int selected = 0; - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - int width = getBounds().width - 60; - float radius = width / 2f; - float circleX = 5 + radius; - float circleY = 45 + radius; - selected = 0; - { - // check circle - float dx = relMouseX - circleX; - float dy = circleY - relMouseY; - if (dx * dx + dy * dy <= radius * radius) { - double theta = (MathHelper.atan2(dy, dx) / Math.PI * 180 + 90) % 360; - hsv[0] = (float) theta / 360f; - hsv[1] = MathHelper.sqrt_float(dx * dx + dy * dy) / radius; - selected = 1; - } - } - { - if (10+width <= relMouseX && relMouseX <= 25 + width && - 45 <= relMouseY && relMouseY <= 45 + width) { - hsv[2] = (relMouseY - 45) / (float)width; - selected = 2; - } - } - { - if (35+width <= relMouseX && relMouseX <= 50 + width && - 45 <= relMouseY && relMouseY <= 45 + width) { - alpha = (relMouseY - 45) / (float)width; - selected = 3; - } - } - update(); - } - - @Override - public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - int width = getBounds().width - 60; - float radius = width / 2f; - float circleX = 5 + radius; - float circleY = 45 + radius; - { - // check circle - float dx = relMouseX - circleX; - float dy = circleY - relMouseY; - if (selected == 1) { - double theta = (MathHelper.atan2(dy, dx) / Math.PI * 180 + 90) % 360; - hsv[0] = (float) theta / 360f; - hsv[1] = MathHelper.clamp_float(MathHelper.sqrt_float(dx * dx + dy * dy) / radius, 0, 1); - } - } - { - if (selected == 2) { - hsv[2] = MathHelper.clamp_float((relMouseY - 45) / (float)width, 0, 1); - } - if (selected == 3) { - alpha = MathHelper.clamp_float((relMouseY - 45) / (float)width, 0, 1); - } - } - update(); - } - - @Override - public void onBoundsUpdate() { - int cnt = 0; - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); cnt++; - if (cnt > 2) { - panel.setPosition(new Point(0, getBounds().width + (cnt - 3) * 20)); - } - } - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditAColor> { - - @Override - public ValueEditAColor createValueEdit(Parameter parameter) { - return new ValueEditAColor(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new AColor(255,0,0,255); - } - - @Override - public Object cloneObj(Object object) { - return object; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java deleted file mode 100755 index dfd854bf..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java +++ /dev/null @@ -1,101 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; - -import java.awt.*; -import java.util.Arrays; - -public class ValueEditBoolean extends MPanel implements ValueEdit<Boolean> { - private Parameter parameter; - - - public ValueEditBoolean(Parameter parameter2) { - this.parameter = parameter2; - { - MLabel label = new MLabel() { - @Override - public String getText() { - return parameter.getPreviousData().toString(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); - add(mLabelAndElement); - } - { - boolean newData = (Boolean) parameter.getNewData(); - final MStringSelectionButton textField = new MStringSelectionButton(Arrays.asList("true", "false"), Boolean.toString(newData)); - textField.setOnUpdate(new Runnable() { - @Override - public void run() { - parameter.setNewData(Boolean.valueOf(textField.getSelected())); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditBoolean> { - - @Override - public ValueEditBoolean createValueEdit(Parameter parameter) { - return new ValueEditBoolean(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return true; - } - - @Override - public Object cloneObj(Object object) { - return object; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java deleted file mode 100755 index 3e59154e..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java +++ /dev/null @@ -1,287 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -public class ValueEditColor extends MPanel implements ValueEdit<Color> { - private Parameter parameter; - private final MFloatSelectionButton h; - private final MFloatSelectionButton s; - private final MFloatSelectionButton v; - - - @Override - public void renderWorld(float partialTicks) { - - } - public ValueEditColor(final Parameter parameter2) { - this.parameter = parameter2; - { - MColor color = new MColor() { - @Override - public Color getColor() { - return (Color) parameter2.getPreviousData(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",color); - mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); - add(mLabelAndElement); - } - { - MColor color = new MColor() { - @Override - public Color getColor() { - return (Color) parameter2.getNewData(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("New",color); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - - Color color = (Color) parameter2.getNewData(); - Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsv); - - { - h = new MFloatSelectionButton(hsv[0] * 360); - h.setOnUpdate(new Runnable() { - @Override - public void run() { - hsv[0] = h.getData() / 360; - update(); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("H", h); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - { - s = new MFloatSelectionButton(hsv[1] * 100); - s.setOnUpdate(new Runnable() { - @Override - public void run() { - hsv[1] = s.getData() / 100; - update(); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("S", s); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - { - v = new MFloatSelectionButton(hsv[2] * 100); - v.setOnUpdate(new Runnable() { - @Override - public void run() { - hsv[2] = v.getData() / 100; - update(); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("V", v); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - } - - private final float[] hsv = new float[3]; - - public void update() { - if (hsv[2] > 1) hsv[2] = 1; - if (hsv[2] < 0) hsv[2] = 0; - if (hsv[1] > 1) hsv[1] = 1; - if (hsv[1] < 0) hsv[1] = 0; - parameter.setNewData(new Color(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]))); - h.setData((float) Math.floor(hsv[0] * 360)); - s.setData((float) Math.floor(hsv[1] * 100)); - v.setData((float) Math.floor(hsv[2] * 100)); - h.updateSelected(); - s.updateSelected(); - v.updateSelected(); - } - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - // draw CoolRect - int width = getBounds().width - 30; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); - GlStateManager.shadeModel(GL11.GL_SMOOTH); - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); -// worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); - - int rgb = Color.HSBtoRGB(hsv[0], hsv[1], 1); - float r = (rgb >> 16 & 255) / 255.0f; - float g = (rgb >> 8 & 255) / 255.0f; - float b = (rgb & 255) / 255.0f; - GL11.glBegin(GL11.GL_TRIANGLES); - GlStateManager.color(0,0,0,1);GL11.glVertex3i(25+width ,45, 0); - GlStateManager.color(0,0,0,1);GL11.glVertex3i(10+width , 45, 0); - GlStateManager.color(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); - - GlStateManager.color(0,0,0,1); GL11.glVertex3i(10+width , 45, 0); - GlStateManager.color(r,g,b,1);GL11.glVertex3i(10+width , 45 + width, 0); - GlStateManager.color(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); - GL11.glEnd(); - - float radius = width/2f; - float cx = 5 + radius; - float cy = 45 + radius; - - GL11.glBegin(GL11.GL_TRIANGLE_FAN); - GlStateManager.color(1,1,1,1); - GL11.glVertex3f(cx,cy,0); - for (int i = 0; i <= 360; i++) { - float rad = 3.141592653f * i / 180; - int rgb2 = Color.HSBtoRGB(i / 360f, 1, hsv[2]); - float r2 = (rgb2 >> 16 & 255) / 255.0f; - float g2 = (rgb2 >> 8 & 255) / 255.0f; - float b2 = (rgb2 & 255) / 255.0f; - GlStateManager.color(r2,g2,b2, 1); - GL11.glVertex3f(MathHelper.sin(rad) * radius + cx, MathHelper.cos(rad) * radius + cy, 0); - } - GL11.glEnd(); - GlStateManager.shadeModel(shademodel); - - GlStateManager.color(1,1,1,1); - worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); - float rad2 = 2 * 3.141592653f * hsv[0] ; - float x = 5 + radius + (MathHelper.sin(rad2)) * hsv[1] * radius; - float y = 45 + radius + (MathHelper.cos(rad2))* hsv[1] * radius; - for (int i = 0; i < 100; i++) { - float rad = 2 * 3.141592653f * (i / 100f); - worldrenderer.pos(MathHelper.sin(rad) * 2 + x, MathHelper.cos(rad) * 2 + y, 0).endVertex(); - } - tessellator.draw(); - - worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); - worldrenderer.pos(8+width, 45 + (hsv[2]) * width, 0.5).endVertex(); - worldrenderer.pos(27+width, 45 + (hsv[2]) * width, 0.5).endVertex(); - tessellator.draw(); - - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - GlStateManager.color(1,1,1,1); - GlStateManager.color(1,1,1,1); - } - private int selected = 0; - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - int width = getBounds().width - 30; - float radius = width / 2f; - float circleX = 5 + radius; - float circleY = 45 + radius; - selected = 0; - { - // check circle - float dx = relMouseX - circleX; - float dy = circleY - relMouseY; - if (dx * dx + dy * dy <= radius * radius) { - double theta = (MathHelper.atan2(dy, dx) / Math.PI * 180 + 90) % 360; - hsv[0] = (float) theta / 360f; - hsv[1] = MathHelper.sqrt_float(dx * dx + dy * dy) / radius; - selected = 1; - } - } - { - if (10+width <= relMouseX && relMouseX <= 25 + width && - 45 <= relMouseY && relMouseY <= 45 + width) { - hsv[2] = (relMouseY - 45) / (float)width; - selected = 2; - } - } - update(); - } - - @Override - public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - int width = getBounds().width - 30; - float radius = width / 2f; - float circleX = 5 + radius; - float circleY = 45 + radius; - { - // check circle - float dx = relMouseX - circleX; - float dy = circleY - relMouseY; - if (selected == 1) { - double theta = (MathHelper.atan2(dy, dx) / Math.PI * 180 + 90) % 360; - hsv[0] = (float) theta / 360f; - hsv[1] = MathHelper.clamp_float(MathHelper.sqrt_float(dx * dx + dy * dy) / radius, 0, 1); - } - } - { - if (selected == 2) { - hsv[2] = MathHelper.clamp_float((relMouseY - 45) / (float)width, 0, 1); - } - } - update(); - } - - @Override - public void onBoundsUpdate() { - int cnt = 0; - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); cnt++; - if (cnt > 2) { - panel.setPosition(new Point(0, getBounds().width + (cnt - 2) * 20)); - } - } - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditColor> { - - @Override - public ValueEditColor createValueEdit(Parameter parameter) { - return new ValueEditColor(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return Color.red; - } - - @Override - public Object cloneObj(Object object) { - return object; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditCreator.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditCreator.java deleted file mode 100755 index dda484d9..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditCreator.java +++ /dev/null @@ -1,29 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.roomedit.Parameter; - -public interface ValueEditCreator<T extends ValueEdit> { - T createValueEdit(Parameter parameter); - - Object createDefaultValue(Parameter parameter); - - Object cloneObj(Object object); -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java deleted file mode 100755 index 4092cf28..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java +++ /dev/null @@ -1,99 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; - -import java.awt.*; - -public class ValueEditFloat extends MPanel implements ValueEdit<Float> { - private Parameter parameter; - - - @Override - public void renderWorld(float partialTicks) { - - } - public ValueEditFloat(final Parameter parameter2) { - this.parameter = parameter2; - { - MLabel label = new MLabel() { - @Override - public String getText() { - return parameter.getPreviousData().toString(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); - add(mLabelAndElement); - } - { - float newData = (Float) parameter.getNewData(); - final MFloatSelectionButton textField = new MFloatSelectionButton(newData); - textField.setOnUpdate(new Runnable() { - @Override - public void run() { - parameter.setNewData(textField.getData()); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditFloat> { - - @Override - public ValueEditFloat createValueEdit(Parameter parameter) { - return new ValueEditFloat(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return 0.0f; - } - - @Override - public Object cloneObj(Object object) { - return object; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java deleted file mode 100755 index 8a5f36c9..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java +++ /dev/null @@ -1,99 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MIntegerSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; - -import java.awt.*; - -public class ValueEditInteger extends MPanel implements ValueEdit<Integer> { - private Parameter parameter; - - - @Override - public void renderWorld(float partialTicks) { - - } - public ValueEditInteger(final Parameter parameter2) { - this.parameter = parameter2; - { - MLabel label = new MLabel() { - @Override - public String getText() { - return parameter.getPreviousData().toString(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); - add(mLabelAndElement); - } - { - int newData = (Integer) parameter.getNewData(); - final MIntegerSelectionButton textField = new MIntegerSelectionButton(newData); - textField.setOnUpdate(new Runnable() { - @Override - public void run() { - parameter.setNewData(textField.getData()); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditInteger> { - - @Override - public ValueEditInteger createValueEdit(Parameter parameter) { - return new ValueEditInteger(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return 0; - } - - @Override - public Object cloneObj(Object object) { - return object; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java deleted file mode 100755 index 4c9e32a7..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java +++ /dev/null @@ -1,38 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.roomedit.Parameter; - -public class ValueEditNull implements ValueEditCreator { - @Override - public ValueEdit createValueEdit(Parameter parameter) { - return null; - } - - @Override - public Cloneable createDefaultValue(Parameter parameter) { - return null; - } - - @Override - public Object cloneObj(Object object) { - return null; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java deleted file mode 100755 index 1cd4deba..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java +++ /dev/null @@ -1,163 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import java.awt.*; - -public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { - private Parameter parameter; - - @Override - public void renderWorld(float partialTicks) { - RenderUtils.highlightBlock(((OffsetPoint)parameter.getPreviousData()).getBlockPos(EditingContext.getEditingContext().getRoom()), new Color(255,0,0,150), partialTicks); - RenderUtils.highlightBlock(((OffsetPoint)parameter.getNewData()).getBlockPos(EditingContext.getEditingContext().getRoom()), new Color(0,255,0,150), partialTicks); - } - - public ValueEditOffsetPoint(final Parameter parameter2) { - this.parameter = parameter2; - { - MLabel label = new MLabel() { - @Override - public String getText() { - return parameter.getPreviousData().toString(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); - add(mLabelAndElement); - } - OffsetPoint newData = (OffsetPoint) parameter.getNewData(); - { - final MIntegerSelectionButton textField = new MIntegerSelectionButton(newData.getX()); - textField.setOnUpdate(new Runnable() { - @Override - public void run() { - ((OffsetPoint) parameter.getNewData()).setX(textField.getData()); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("x",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - { - final MIntegerSelectionButton textField = new MIntegerSelectionButton(newData.getY()); - textField.setOnUpdate(new Runnable() { - @Override - public void run() { - ((OffsetPoint) parameter.getNewData()).setY(textField.getData()); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("y",textField); - mLabelAndElement.setBounds(new Rectangle(0,40,getBounds().width,20)); - add(mLabelAndElement); - } - { - final MIntegerSelectionButton textField = new MIntegerSelectionButton(newData.getZ()); - textField.setOnUpdate(new Runnable() { - @Override - public void run() { - ((OffsetPoint) parameter.getNewData()).setZ(textField.getData()); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("z",textField); - mLabelAndElement.setBounds(new Rectangle(0,60,getBounds().width,20)); - add(mLabelAndElement); - } - { - final MLabel setToHEre = new MLabel() { - @Override - public String getText() { - OffsetPoint offsetPoint = (OffsetPoint) parameter.getNewData(); - return Block.getIdFromBlock(offsetPoint.getBlock(EditingContext.getEditingContext().getRoom())) + - ":" + offsetPoint.getData(EditingContext.getEditingContext().getRoom()); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("newPt",setToHEre); - mLabelAndElement.setBounds(new Rectangle(0,80,getBounds().width,20)); - add(mLabelAndElement); - } - { - final MButton setToHEre2 = new MButton(); - setToHEre2.setText("Set to here"); - setToHEre2.setBackgroundColor(Color.green); - setToHEre2.setOnActionPerformed(new Runnable() { - @Override - public void run() { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ); - ((OffsetPoint)parameter2.getNewData()).setPosInWorld(EditingContext.getEditingContext().getRoom(),pos ); - } - }); - MLabelAndElement mLabelAndElement = new MLabelAndElement("set",setToHEre2); - mLabelAndElement.setBounds(new Rectangle(0,100,getBounds().width,20)); - add(mLabelAndElement); - } - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditOffsetPoint> { - - @Override - public ValueEditOffsetPoint createValueEdit(Parameter parameter) { - return new ValueEditOffsetPoint(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition()); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((OffsetPoint)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java deleted file mode 100755 index 0cdaab0d..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java +++ /dev/null @@ -1,250 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.Getter; -import net.minecraft.client.Minecraft; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetPointSet> { - private Parameter parameter; - - // scroll pane - // just create - // add set - - private final MPanel scroll; - @Getter - private final List<MPanel> MParameters = new ArrayList<MPanel>(); - - private final MButton add; - private final MButton addSet; - - public void delete(OffsetPoint offsetPoint) { - ((OffsetPointSet)parameter.getNewData()).getOffsetPointList().remove(offsetPoint); - Iterator<MPanel> iterator = MParameters.iterator(); - while (iterator.hasNext()) { - MValue panel = (MValue) iterator.next(); - if (panel.getData() == offsetPoint) { - iterator.remove(); - break; - } - } - - } - - public ValueEditOffsetPointSet(final Parameter parameter2) { - this.parameter = parameter2; - { - scroll = new MPanel() { - private int offsetY = 0; - - @Override - public List<MPanel> getChildComponents() { - return MParameters; - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - int heights = 0; - for (MPanel panel:getChildComponents()) { - panel.setPosition(new Point(0, -offsetY + heights)); - heights += panel.getBounds().height; - } - } - - @Override - public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) { - if (!getBounds().contains(relMouseX0, relMouseY0)) { - return false; - } - - int relMousex = relMouseX0 - getBounds().x; - int relMousey = relMouseY0 - getBounds().y; - - 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; - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - @Override - public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - if (new Rectangle(new Point(0,0), getSize()).contains(relMouseX0, relMouseY0)) { - if (scrollAmount >0) offsetY += 20; - else if (scrollAmount < 0) offsetY -= 20; - if (offsetY <0) offsetY = 0; - } - } - }; - scroll.setBounds(new Rectangle(0,0,getBounds().width, getBounds().height-20)); - add(scroll); - } - - { - add = new MButton() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0,parentHeight - 20, parentWidth / 2, 20)); - } - }; - add.setText("Add"); - add.setBackgroundColor(Color.green); - add.setOnActionPerformed(new Runnable() { - @Override - public void run() { - OffsetPoint offsetPoint = new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition()); - MValue mValue; - MParameters.add(mValue = new MValue(offsetPoint, buildAddonsFor(offsetPoint))); - ((OffsetPointSet)parameter.getNewData()).getOffsetPointList().add(offsetPoint); - mValue.setSize(new Dimension(getBounds().width, 20)); - } - }); - - addSet = new MButton(){ - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(parentWidth / 2,parentHeight - 20, parentWidth / 2, 20)); - } - }; - addSet.setText("Add Set"); - addSet.setBackgroundColor(Color.cyan); - addSet.setOnActionPerformed(new Runnable() { - @Override - public void run() { - EditingContext.getEditingContext().openGui(new GuiDungeonAddSet(ValueEditOffsetPointSet.this)); - } - }); - add(add); - add(addSet); - } - for (OffsetPoint offsetPoint : ((OffsetPointSet)parameter.getNewData()).getOffsetPointList()) { - MParameters.add(new MValue(offsetPoint, buildAddonsFor(offsetPoint))); - } - } - - public List<MPanel> buildAddonsFor(final OffsetPoint offsetPoint) { - ArrayList<MPanel> panels = new ArrayList<MPanel>(); - MButton mButton = new MButton(); - mButton.setText("Delete"); - mButton.setForeground(Color.white); - mButton.setBackgroundColor(Color.red); - mButton.setOnActionPerformed(new Runnable() { - @Override - public void run() { - delete(offsetPoint); - } - }); - panels.add(mButton); - return panels; - } - - @Override - public void onBoundsUpdate() { - scroll.setBounds(new Rectangle(0,0,getBounds().width, getBounds().height-20)); - add.setBounds(new Rectangle(0,getBounds().height-20,getBounds().width / 2, 20)); - addSet.setBounds(new Rectangle(getBounds().width / 2,getBounds().height-20,getBounds().width / 2, 20)); - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void renderWorld(float partialTicks) { - for (OffsetPoint offsetPoint :((OffsetPointSet)parameter.getNewData()).getOffsetPointList()) { - RenderUtils.highlightBlock(offsetPoint.getBlockPos(EditingContext.getEditingContext().getRoom()), new Color(0,255,255,50), partialTicks); - } - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public void addAll(List<OffsetPoint> blockPoses) { - ((OffsetPointSet)parameter.getNewData()).getOffsetPointList().addAll(blockPoses); - for (OffsetPoint blockPose : blockPoses) { - MParameters.add(new MValue(blockPose, buildAddonsFor(blockPose))); - } - } - - public static class Generator implements ValueEditCreator<ValueEditOffsetPointSet> { - - @Override - public ValueEditOffsetPointSet createValueEdit(Parameter parameter) { - return new ValueEditOffsetPointSet(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return new OffsetPointSet(); - } - - @Override - public Object cloneObj(Object object) { - try { - return ((OffsetPointSet)object).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - assert false; - return null; - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java deleted file mode 100755 index 1df64a6c..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java +++ /dev/null @@ -1,70 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; -import kr.syeyoung.dungeonsguide.roomedit.mechanicedit.*; - -import java.awt.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ValueEditRegistry { - private static final Map<String, ValueEditCreator> valueEditMap = new HashMap<String, ValueEditCreator>(); - - public static ValueEditCreator getValueEditMap(String className) { - return valueEditMap.get(className); - } - - public static List<String> getClassesSupported() { - return new ArrayList<String>(valueEditMap.keySet()); - } - - static { - valueEditMap.put("null", new ValueEditNull()); - valueEditMap.put(String.class.getName(), new ValueEditString.Generator()); - valueEditMap.put(Boolean.class.getName(), new ValueEditBoolean.Generator()); - valueEditMap.put(Integer.class.getName(), new ValueEditInteger.Generator()); - valueEditMap.put(Float.class.getName(), new ValueEditFloat.Generator()); - valueEditMap.put(OffsetPoint.class.getName(), new ValueEditOffsetPoint.Generator()); - valueEditMap.put(OffsetPointSet.class.getName(), new ValueEditOffsetPointSet.Generator()); - valueEditMap.put(Color.class.getName(), new ValueEditColor.Generator()); - valueEditMap.put(AColor.class.getName(), new ValueEditAColor.Generator()); - - - valueEditMap.put(DungeonSecret.class.getName(), new ValueEditSecret.Generator()); - valueEditMap.put(DungeonFairySoul.class.getName(), new ValueEditFairySoul.Generator()); - valueEditMap.put(DungeonNPC.class.getName(), new ValueEditNPC.Generator()); - valueEditMap.put(DungeonTomb.class.getName(), new ValueEditTomb.Generator()); - valueEditMap.put(DungeonBreakableWall.class.getName(), new ValueEditBreakableWall.Generator()); - valueEditMap.put(DungeonJournal.class.getName(), new ValueEditJournal.Generator()); - valueEditMap.put(DungeonDummy.class.getName(), new ValueEditDummy.Generator()); - - valueEditMap.put(DungeonPressurePlate.class.getName(), new ValueEditPressurePlate.Generator()); - valueEditMap.put(DungeonOnewayLever.class.getName(), new ValueEditOnewayLever.Generator()); - valueEditMap.put(DungeonLever.class.getName(), new ValueEditLever.Generator()); - valueEditMap.put(DungeonDoor.class.getName(), new ValueEditDoor.Generator()); - valueEditMap.put(DungeonOnewayDoor.class.getName(), new ValueEditOnewayDoor.Generator()); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java deleted file mode 100755 index 157e7b42..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java +++ /dev/null @@ -1,99 +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.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; - -import java.awt.*; - -public class ValueEditString extends MPanel implements ValueEdit<String> { - private Parameter parameter; - - @Override - public void renderWorld(float partialTicks) { - - } - - public ValueEditString(Parameter parameter2) { - this.parameter = parameter2; - { - MLabel label = new MLabel() { - @Override - public String getText() { - return parameter.getPreviousData().toString(); - } - }; - MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); - add(mLabelAndElement); - } - { - String newData = (String) parameter.getNewData(); - MTextField textField = new MTextField() { - @Override - public void edit(String str) { - parameter.setNewData(str); - } - }; - textField.setText(newData); - MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); - add(mLabelAndElement); - } - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(getBounds().width, 20)); - } - } - - @Override - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - public static class Generator implements ValueEditCreator<ValueEditString> { - - @Override - public ValueEditString createValueEdit(Parameter parameter) { - return new ValueEditString(parameter); - } - - @Override - public Object createDefaultValue(Parameter parameter) { - return "default"; - } - - @Override - public Object cloneObj(Object object) { - return object; - } - } -} |