diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit')
3 files changed, 71 insertions, 43 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java index 30d80f3d..5d26c5cb 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java @@ -48,41 +48,43 @@ public class GuiDungeonValueEdit extends GuiScreen { private Object editingObj; public GuiDungeonValueEdit(final Object object, final List<MPanel> addons) { - dungeonRoom = EditingContext.getEditingContext().getRoom(); - this.addons = addons; - this.editingObj = object; - mainPanel.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)); - } - }; - mainPanel.add(currentValueEdit); - } + try { + dungeonRoom = EditingContext.getEditingContext().getRoom(); + this.addons = addons; + this.editingObj = object; + mainPanel.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)); + } + }; + mainPanel.add(currentValueEdit); + } for (MPanel addon : addons) { mainPanel.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(); - } - }); - mainPanel.add(save); - } - updateClassSelection(); + { + 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(); + } + }); + mainPanel.add(save); + } + updateClassSelection(); + } catch (Exception e){} } public void updateClassSelection() { @@ -118,34 +120,56 @@ public class GuiDungeonValueEdit extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); - GlStateManager.pushAttrib(); - mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.popAttrib(); - GL11.glPopMatrix(); + try { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + GL11.glPushMatrix(); + GlStateManager.pushAttrib(); + mainPanel.render0(scaledResolution, new Point(0, 0), new Rectangle(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + GlStateManager.popAttrib(); + GL11.glPopMatrix(); + } catch (Throwable e) { + e.printStackTrace(); + } } @Override public void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - mainPanel.keyTyped0(typedChar, keyCode); + + try { + super.keyTyped(typedChar, keyCode); + mainPanel.keyTyped0(typedChar, keyCode); + } catch (Throwable t) { + t.printStackTrace(); + } } @Override public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + try { super.mouseClicked(mouseX, mouseY, mouseButton); mainPanel.mouseClicked0(mouseX, mouseY,mouseX,mouseY, mouseButton); + } catch (Throwable t) { + t.printStackTrace(); + } } @Override public void mouseReleased(int mouseX, int mouseY, int state) { + try { mainPanel.mouseReleased0(mouseX, mouseY,mouseX,mouseY, state); + } catch (Throwable t) { + t.printStackTrace(); + } } @Override public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick); + try { + mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick); + + } catch (Throwable t) { + t.printStackTrace(); + } } @Override @@ -157,7 +181,11 @@ public class GuiDungeonValueEdit extends GuiScreen { int wheel = Mouse.getDWheel(); if (wheel != 0) { - mainPanel.mouseScrolled0(i, j,i,j, wheel); + try { + mainPanel.mouseScrolled0(i, j,i,j, wheel); + } catch (Throwable t) { + t.printStackTrace(); + } } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java index 6774b067..debe2be5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java @@ -116,7 +116,7 @@ public class ValueEditBreakableWall extends MPanel implements ValueEdit<DungeonS @Override public Object cloneObj(Object object) { try { - return ((DungeonSecret)object).clone(); + return ((DungeonBreakableWall)object).clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java index 09992bb3..f5578825 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java @@ -93,7 +93,7 @@ public class ValueEditTomb extends MPanel implements ValueEdit<DungeonSecret> { @Override public Object cloneObj(Object object) { try { - return ((DungeonSecret)object).clone(); + return ((DungeonTomb)object).clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } |