From f744ba5eb145e22398244e07b64528dc24bf02ca Mon Sep 17 00:00:00 2001 From: ExE Boss Date: Wed, 21 Dec 2016 15:52:49 +0100 Subject: [PATCH] Update to latest snapshot --- build.gradle | 12 +++--- gradle.properties | 2 +- minecraft/1.7/build.gradle | 4 +- minecraft/1.7/gradle.properties | 5 ++- .../forge/v1_7}/DrawableGuiComponent.java | 2 +- .../{mc17 => mc/forge/v1_7}/GuiUtils.java | 4 +- .../{mc17 => mc/forge/v1_7}/MCButton.java | 2 +- .../{mc17 => mc/forge/v1_7}/MCCanvas.java | 2 +- .../{mc17 => mc/forge/v1_7}/MCGui.java | 8 ++-- .../mc/forge/v1_7}/MCGuiComponent.java | 2 +- .../mc/forge/v1_7}/MCGuiComponentFactory.java | 2 +- .../mc/forge/v1_7}/MCGuiContainer.java | 4 +- .../{mc17 => mc/forge/v1_7}/MCGuiFactory.java | 21 ++++++---- .../mc/forge/v1_7}/MCGuiPlayerInventory.java | 8 ++-- .../{mc17 => mc/forge/v1_7}/MCGuiSlot.java | 10 ++--- .../mc/forge/v1_7}/dependency/GuiModule.java | 6 +-- .../forge/v1_7}/launch/NovaGuiWrapper.java | 8 ++-- .../forge/v1_7}/network/PacketGui.java | 8 ++-- .../forge/v1_7}/text/AbstractParagraph.java | 2 +- .../{mc17 => mc/forge/v1_7}/text/IText.java | 2 +- .../forge/v1_7}/text/MCTextRenderer.java | 6 +-- .../mc/forge/v1_7}/text/Paragraph.java | 4 +- .../mc/forge/v1_7}/text/SimpleParagraph.java | 4 +- minecraft/1.8/build.gradle | 4 +- minecraft/1.8/gradle.properties | 5 ++- .../forge/v1_8}/DrawableGuiComponent.java | 2 +- .../{mc18 => mc/forge/v1_8}/GuiUtils.java | 4 +- .../{mc18 => mc/forge/v1_8}/MCButton.java | 2 +- .../{mc18 => mc/forge/v1_8}/MCCanvas.java | 2 +- .../{mc18 => mc/forge/v1_8}/MCGui.java | 8 ++-- .../mc/forge/v1_8}/MCGuiComponent.java | 2 +- .../mc/forge/v1_8}/MCGuiComponentFactory.java | 2 +- .../mc/forge/v1_8}/MCGuiContainer.java | 4 +- .../{mc18 => mc/forge/v1_8}/MCGuiFactory.java | 21 ++++++---- .../mc/forge/v1_8}/MCGuiPlayerInventory.java | 8 ++-- .../{mc18 => mc/forge/v1_8}/MCGuiSlot.java | 10 ++--- .../mc/forge/v1_8}/dependency/GuiModule.java | 6 +-- .../forge/v1_8}/launch/NovaGuiWrapper.java | 8 ++-- .../forge/v1_8}/network/PacketGui.java | 8 ++-- .../forge/v1_8}/text/AbstractParagraph.java | 2 +- .../{mc18 => mc/forge/v1_8}/text/IText.java | 2 +- .../forge/v1_8}/text/MCTextRenderer.java | 6 +-- .../mc/forge/v1_8}/text/Paragraph.java | 4 +- .../mc/forge/v1_8}/text/SimpleParagraph.java | 4 +- minecraft/build.gradle | 27 +++++++------ .../java/nova/gui/AbstractGuiContainer.java | 3 +- src/main/java/nova/gui/ComponentEvent.java | 16 ++++---- src/main/java/nova/gui/Gui.java | 6 +-- src/main/java/nova/gui/GuiComponent.java | 14 +++---- .../java/nova/gui/GuiComponentException.java | 2 + src/main/java/nova/gui/GuiEvent.java | 4 +- src/main/java/nova/gui/GuiException.java | 4 +- src/main/java/nova/gui/component/Button.java | 1 + .../component/inventory/PlayerInventory.java | 4 +- .../nova/gui/component/inventory/Slot.java | 6 +-- .../nova/gui/factory/GuiEventFactory.java | 2 +- .../java/nova/gui/factory/GuiFactory.java | 17 ++++---- .../java/nova/gui/factory/GuiManager.java | 39 ++++++++++++------- src/main/java/nova/gui/launch/NovaGui.java | 2 +- .../java/nova/gui/layout/LayoutException.java | 4 +- src/main/java/nova/gui/render/Vertex2D.java | 1 + 61 files changed, 217 insertions(+), 177 deletions(-) rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/DrawableGuiComponent.java (92%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/GuiUtils.java (92%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/MCButton.java (98%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/MCCanvas.java (98%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/MCGui.java (97%) mode change 100755 => 100644 rename minecraft/{1.8/src/main/java/nova/gui/wrapper/mc18 => 1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7}/MCGuiComponent.java (95%) rename minecraft/{1.8/src/main/java/nova/gui/wrapper/mc18 => 1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7}/MCGuiComponentFactory.java (96%) rename minecraft/{1.8/src/main/java/nova/gui/wrapper/mc18 => 1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7}/MCGuiContainer.java (94%) rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/MCGuiFactory.java (85%) mode change 100755 => 100644 rename minecraft/{1.8/src/main/java/nova/gui/wrapper/mc18 => 1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7}/MCGuiPlayerInventory.java (87%) rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/MCGuiSlot.java (92%) mode change 100755 => 100644 rename minecraft/{1.8/src/main/java/nova/gui/wrapper/mc18 => 1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7}/dependency/GuiModule.java (66%) rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/launch/NovaGuiWrapper.java (73%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/network/PacketGui.java (81%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/text/AbstractParagraph.java (95%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/text/IText.java (98%) mode change 100755 => 100644 rename minecraft/1.7/src/main/java/nova/gui/wrapper/{mc17 => mc/forge/v1_7}/text/MCTextRenderer.java (95%) mode change 100755 => 100644 rename minecraft/{1.8/src/main/java/nova/gui/wrapper/mc18 => 1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7}/text/Paragraph.java (96%) rename minecraft/{1.8/src/main/java/nova/gui/wrapper/mc18 => 1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7}/text/SimpleParagraph.java (94%) rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/DrawableGuiComponent.java (92%) rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/GuiUtils.java (93%) rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/MCButton.java (98%) rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/MCCanvas.java (98%) rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/MCGui.java (97%) mode change 100755 => 100644 rename minecraft/{1.7/src/main/java/nova/gui/wrapper/mc17 => 1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8}/MCGuiComponent.java (95%) mode change 100755 => 100644 rename minecraft/{1.7/src/main/java/nova/gui/wrapper/mc17 => 1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8}/MCGuiComponentFactory.java (96%) mode change 100755 => 100644 rename minecraft/{1.7/src/main/java/nova/gui/wrapper/mc17 => 1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8}/MCGuiContainer.java (94%) mode change 100755 => 100644 rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/MCGuiFactory.java (85%) rename minecraft/{1.7/src/main/java/nova/gui/wrapper/mc17 => 1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8}/MCGuiPlayerInventory.java (87%) mode change 100755 => 100644 rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/MCGuiSlot.java (92%) rename minecraft/{1.7/src/main/java/nova/gui/wrapper/mc17 => 1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8}/dependency/GuiModule.java (66%) mode change 100755 => 100644 rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/launch/NovaGuiWrapper.java (74%) mode change 100755 => 100644 rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/network/PacketGui.java (81%) mode change 100755 => 100644 rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/text/AbstractParagraph.java (95%) rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/text/IText.java (98%) rename minecraft/1.8/src/main/java/nova/gui/wrapper/{mc18 => mc/forge/v1_8}/text/MCTextRenderer.java (95%) rename minecraft/{1.7/src/main/java/nova/gui/wrapper/mc17 => 1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8}/text/Paragraph.java (96%) mode change 100755 => 100644 rename minecraft/{1.7/src/main/java/nova/gui/wrapper/mc17 => 1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8}/text/SimpleParagraph.java (94%) mode change 100755 => 100644 diff --git a/build.gradle b/build.gradle index 486a58e..43d2e12 100644 --- a/build.gradle +++ b/build.gradle @@ -1,26 +1,24 @@ plugins { id "java" - id "nova.gradle" version "0.2.5" + id "nova.gradle" version "0.2.6" id "maven-publish" id "com.jfrog.artifactory" version "3.1.1" } - apply from: "https://raw.githubusercontent.com/NOVA-Team/NOVA-Gradle/master/shared-scripts/java.gradle" dependencies { - compile "nova.core:NovaCore:$novaVersion" - testCompile "nova.core:NovaCore:$novaVersion:wrappertests" + compile nova(nova_version) } + nova { wrappers { "17" { - wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$novaVersion" + wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$nova_version" runtime project(":minecraft:1.7") } - "18" { - wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$novaVersion" + wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$nova_version" runtime project(":minecraft:1.8") } } diff --git a/gradle.properties b/gradle.properties index a35cc57..dc9e34e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ version = 0.0.1-SNAPSHOT group = nova.gui -novaVersion = 0.1.0-SNAPSHOT +nova_version = 0.1.0-SNAPSHOT packaging = jar info.inceptionYear = 2015 diff --git a/minecraft/1.7/build.gradle b/minecraft/1.7/build.gradle index 11d6cbf..c2b452b 100755 --- a/minecraft/1.7/build.gradle +++ b/minecraft/1.7/build.gradle @@ -58,8 +58,8 @@ minecraft { dependencies { compile rootProject - compile group: "nova.core", name: "NovaCore", version: property("novaVersion"), changing: true - compile "nova.wrapper.mc1710:NovaWrapper-MC1.7.10:0.1-SNAPSHOT:deobf" + compile group: "nova.core", name: "NOVA-Core", version: property("nova_version"), changing: true + compile "nova.core:NOVA-Core-Wrapper-MC1.7:0.1.0-SNAPSHOT:deobf" } processResources { diff --git a/minecraft/1.7/gradle.properties b/minecraft/1.7/gradle.properties index b7ea1f6..d502192 100755 --- a/minecraft/1.7/gradle.properties +++ b/minecraft/1.7/gradle.properties @@ -1,7 +1,10 @@ +group = nova.gui + minecraft.version = 1.7.10 forge.version = 10.13.4.1448-1.7.10 +forgeGradleVersion = 1.2-SNAPSHOT packaging = jar info.inceptionYear = 2015 -info.description = The NOVA-Minecraft Minecraft 1.7.10 wrapper. +info.description = The NOVA-GUI Minecraft 1.7.10 wrapper. info.organization.name = NOVA diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/DrawableGuiComponent.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/DrawableGuiComponent.java old mode 100755 new mode 100644 similarity index 92% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/DrawableGuiComponent.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/DrawableGuiComponent.java index 091a9eb..b1d5b50 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/DrawableGuiComponent.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/DrawableGuiComponent.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_7; import nova.gui.nativeimpl.NativeGuiComponent; import nova.gui.render.Graphics; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/GuiUtils.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/GuiUtils.java old mode 100755 new mode 100644 similarity index 92% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/GuiUtils.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/GuiUtils.java index 33b8e8c..f6e3007 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/GuiUtils.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/GuiUtils.java @@ -1,9 +1,9 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_7; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.util.ResourceLocation; -import nova.wrapper.mc1710.launcher.NovaMinecraft; +import nova.core.wrapper.mc.forge.v17.launcher.NovaMinecraft; import org.lwjgl.opengl.GL11; public class GuiUtils { diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCButton.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCButton.java old mode 100755 new mode 100644 similarity index 98% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCButton.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCButton.java index 34905f2..717e8c0 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCButton.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCButton.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_7; import cpw.mods.fml.client.config.GuiButtonExt; import cpw.mods.fml.common.FMLCommonHandler; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCCanvas.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCCanvas.java old mode 100755 new mode 100644 similarity index 98% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCCanvas.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCCanvas.java index c47bafe..6ea18f7 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCCanvas.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCCanvas.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_7; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGui.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGui.java old mode 100755 new mode 100644 similarity index 97% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGui.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGui.java index 70ab313..909c028 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGui.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGui.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_7; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; @@ -12,6 +12,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import nova.core.network.Packet; +import nova.core.wrapper.mc.forge.v17.network.netty.MCNetworkManager; import nova.gui.Gui; import nova.gui.GuiComponent; import nova.gui.GuiEvent.MouseEvent.EnumMouseButton; @@ -20,10 +21,9 @@ import nova.gui.render.Canvas; import nova.gui.render.Graphics; import nova.gui.render.text.TextMetrics; -import nova.gui.wrapper.mc17.text.MCTextRenderer; +import nova.gui.wrapper.mc.forge.v1_7.text.MCTextRenderer; import nova.internal.core.Game; -import nova.gui.wrapper.mc17.network.PacketGui; -import nova.wrapper.mc1710.network.netty.MCNetworkManager; +import nova.gui.wrapper.mc.forge.v1_7.network.PacketGui; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiComponent.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiComponent.java similarity index 95% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiComponent.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiComponent.java index 41376d6..cb51e31 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiComponent.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiComponent.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_7; import nova.gui.GuiComponent; import nova.gui.Outline; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiComponentFactory.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiComponentFactory.java similarity index 96% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiComponentFactory.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiComponentFactory.java index c1d8ce2..7cf7551 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiComponentFactory.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiComponentFactory.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_7; import nova.gui.AbstractGuiContainer; import nova.gui.Gui; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiContainer.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiContainer.java similarity index 94% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiContainer.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiContainer.java index 0025e67..0292b3b 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiContainer.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiContainer.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_7; import nova.gui.AbstractGuiContainer; import nova.gui.GuiComponent; @@ -6,7 +6,7 @@ import nova.gui.nativeimpl.NativeContainer; import nova.gui.render.Canvas; import nova.gui.render.Graphics; -import nova.gui.wrapper.mc18.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCContainer; import java.util.ArrayList; import java.util.List; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiFactory.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiFactory.java old mode 100755 new mode 100644 similarity index 85% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiFactory.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiFactory.java index 991c119..7cb6b18 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiFactory.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiFactory.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_7; import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.client.Minecraft; @@ -8,14 +8,15 @@ import net.minecraft.inventory.Container; import net.minecraft.world.World; import nova.core.entity.Entity; +import nova.core.wrapper.mc.forge.v17.launcher.NovaMinecraft; +import nova.core.wrapper.mc.forge.v17.wrapper.entity.backward.BWEntity; import nova.gui.Gui; import nova.gui.GuiException; import nova.gui.factory.GuiFactory; import nova.gui.factory.GuiManager; -import nova.gui.wrapper.mc17.MCGui.MCContainer; -import nova.gui.wrapper.mc17.MCGui.MCGuiScreen; -import nova.wrapper.mc1710.launcher.NovaMinecraft; -import nova.wrapper.mc1710.wrapper.entity.BWEntity; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCGuiScreen; +import nova.internal.core.Game; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import java.util.ArrayList; @@ -27,6 +28,10 @@ public class MCGuiFactory extends GuiManager { private static Optional guiToOpen = Optional.empty(); private static List idMappedFactories = new ArrayList<>(); + public MCGuiFactory() { + super(Game.events()); + } + @Override public GuiFactory register(GuiFactory factory) { idMappedFactories.add(factory); @@ -35,8 +40,8 @@ public GuiFactory register(GuiFactory factory) { @Override public void showGui(String identifier, Entity entity, Vector3D pos) { - GuiFactory factory = getFactory(identifier).orElseThrow(() -> new GuiException(String.format("No GUI called %s registered!", identifier))); - Gui gui = factory.makeGUI(); + GuiFactory factory = registry.get(identifier).orElseThrow(() -> new GuiException(String.format("No GUI called %s registered!", identifier))); + Gui gui = factory.build(); showGui(gui, entity, pos, idMappedFactories.indexOf(factory)); } @@ -104,7 +109,7 @@ public GuiContainer getClientGuiElement(int id, EntityPlayer player, World world guiToOpen = Optional.empty(); } else { // Try to get the client side GUI from the id mapping - gui = idMappedFactories.get(id).makeGUI(); + gui = idMappedFactories.get(id).build(); } if (gui == null) { throw new GuiException("Couldn't get client side instance for the provided GUI of id " + id + " !"); diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiPlayerInventory.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiPlayerInventory.java similarity index 87% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiPlayerInventory.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiPlayerInventory.java index 7a81323..4c5992b 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiPlayerInventory.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiPlayerInventory.java @@ -1,12 +1,12 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_7; import net.minecraft.inventory.IInventory; +import nova.core.wrapper.mc.forge.v17.wrapper.inventory.BWInventory; import nova.gui.component.inventory.PlayerInventory; import nova.gui.nativeimpl.NativePlayerInventory; import nova.gui.render.Graphics; -import nova.gui.wrapper.mc18.MCGui.MCContainer; -import nova.gui.wrapper.mc18.MCGui.MCGuiScreen; -import nova.wrapper.mc18.wrapper.inventory.BWInventory; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCGuiScreen; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import java.util.ArrayList; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiSlot.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiSlot.java old mode 100755 new mode 100644 similarity index 92% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiSlot.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiSlot.java index 78c9a40..98d9190 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiSlot.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/MCGuiSlot.java @@ -1,17 +1,17 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_7; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import nova.core.wrapper.mc.forge.v17.wrapper.inventory.FWInventory; +import nova.core.wrapper.mc.forge.v17.wrapper.item.ItemConverter; import nova.gui.component.inventory.Slot; import nova.gui.nativeimpl.NativeSlot; import nova.gui.render.Graphics; -import nova.gui.wrapper.mc17.MCGui.MCContainer; -import nova.gui.wrapper.mc17.MCGui.MCGuiScreen; -import nova.wrapper.mc1710.wrapper.inventory.FWInventory; -import nova.wrapper.mc1710.wrapper.item.ItemConverter; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCGuiScreen; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import org.lwjgl.opengl.GL11; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/dependency/GuiModule.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/dependency/GuiModule.java similarity index 66% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/dependency/GuiModule.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/dependency/GuiModule.java index b7757d9..7203873 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/dependency/GuiModule.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/dependency/GuiModule.java @@ -1,9 +1,9 @@ -package nova.gui.wrapper.mc18.dependency; +package nova.gui.wrapper.mc.forge.v1_7.dependency; import nova.gui.factory.GuiComponentFactory; import nova.gui.factory.GuiManager; -import nova.gui.wrapper.mc18.MCGuiComponentFactory; -import nova.gui.wrapper.mc18.MCGuiFactory; +import nova.gui.wrapper.mc.forge.v1_7.MCGuiComponentFactory; +import nova.gui.wrapper.mc.forge.v1_7.MCGuiFactory; import se.jbee.inject.bind.BinderModule; public class GuiModule extends BinderModule { diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/launch/NovaGuiWrapper.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/launch/NovaGuiWrapper.java old mode 100755 new mode 100644 similarity index 73% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/launch/NovaGuiWrapper.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/launch/NovaGuiWrapper.java index 54da186..5c8662f --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/launch/NovaGuiWrapper.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/launch/NovaGuiWrapper.java @@ -1,13 +1,13 @@ -package nova.gui.wrapper.mc17.launch; +package nova.gui.wrapper.mc.forge.v1_7.launch; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import nova.core.loader.Loadable; import nova.core.loader.Mod; -import nova.gui.wrapper.mc17.MCGuiFactory; -import nova.gui.wrapper.mc17.dependency.GuiModule; -import nova.wrapper.mc1710.launcher.NovaMinecraft; +import nova.core.wrapper.mc.forge.v17.launcher.NovaMinecraft; +import nova.gui.wrapper.mc.forge.v1_7.MCGuiFactory; +import nova.gui.wrapper.mc.forge.v1_7.dependency.GuiModule; /** * The main class to initialize the Gui Plugin diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/network/PacketGui.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/network/PacketGui.java old mode 100755 new mode 100644 similarity index 81% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/network/PacketGui.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/network/PacketGui.java index 8310995..b252f0d --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/network/PacketGui.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/network/PacketGui.java @@ -1,14 +1,14 @@ -package nova.gui.wrapper.mc17.network; +package nova.gui.wrapper.mc.forge.v1_7.network; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import net.minecraft.entity.player.EntityPlayer; import nova.core.network.Packet; +import nova.core.wrapper.mc.forge.v17.network.MCPacket; +import nova.core.wrapper.mc.forge.v17.network.discriminator.PacketAbstract; import nova.gui.GuiException; -import nova.wrapper.mc1710.network.MCPacket; -import nova.wrapper.mc1710.network.discriminator.PacketAbstract; -import nova.gui.wrapper.mc17.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_7.MCGui.MCContainer; //TODO: Integrate withPriority NOVA public class PacketGui extends PacketAbstract { diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/AbstractParagraph.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/AbstractParagraph.java old mode 100755 new mode 100644 similarity index 95% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/AbstractParagraph.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/AbstractParagraph.java index 3aa85a2..be6bd80 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/AbstractParagraph.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/AbstractParagraph.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17.text; +package nova.gui.wrapper.mc.forge.v1_7.text; import nova.gui.render.text.TextRenderer.RenderedText; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/IText.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/IText.java old mode 100755 new mode 100644 similarity index 98% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/IText.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/IText.java index 58aa5ee..628cc69 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/IText.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/IText.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17.text; +package nova.gui.wrapper.mc.forge.v1_7.text; import net.minecraft.client.gui.FontRenderer; import nova.gui.render.text.FormattedText.TextFormat; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/MCTextRenderer.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/MCTextRenderer.java old mode 100755 new mode 100644 similarity index 95% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/MCTextRenderer.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/MCTextRenderer.java index 2a3fd5a..b3edfd3 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/MCTextRenderer.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/MCTextRenderer.java @@ -1,12 +1,12 @@ -package nova.gui.wrapper.mc17.text; +package nova.gui.wrapper.mc.forge.v1_7.text; import net.minecraft.client.gui.FontRenderer; import nova.core.render.Color; import nova.core.util.math.MathUtil; import nova.gui.render.text.FormattedText; import nova.gui.render.text.TextRenderer; -import nova.gui.wrapper.mc17.MCCanvas; -import nova.gui.wrapper.mc17.text.IText.Text; +import nova.gui.wrapper.mc.forge.v1_7.MCCanvas; +import nova.gui.wrapper.mc.forge.v1_7.text.IText.Text; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import org.lwjgl.opengl.GL11; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/Paragraph.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/Paragraph.java similarity index 96% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/Paragraph.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/Paragraph.java index 1dcfcec..b8b3c31 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/Paragraph.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/Paragraph.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18.text; +package nova.gui.wrapper.mc.forge.v1_7.text; import com.google.common.collect.Lists; import net.minecraft.client.gui.FontRenderer; @@ -6,7 +6,7 @@ import nova.gui.render.text.FormattedText.TextFormat; import nova.gui.render.text.TextRenderer; import nova.gui.render.text.TextRenderer.RenderedText; -import nova.gui.wrapper.mc18.text.IText.Word; +import nova.gui.wrapper.mc.forge.v1_7.text.IText.Word; import org.lwjgl.opengl.GL11; import java.util.List; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/SimpleParagraph.java b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/SimpleParagraph.java similarity index 94% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/SimpleParagraph.java rename to minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/SimpleParagraph.java index 2717818..d23cfe7 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/SimpleParagraph.java +++ b/minecraft/1.7/src/main/java/nova/gui/wrapper/mc/forge/v1_7/text/SimpleParagraph.java @@ -1,11 +1,11 @@ -package nova.gui.wrapper.mc18.text; +package nova.gui.wrapper.mc.forge.v1_7.text; import net.minecraft.client.gui.FontRenderer; import nova.gui.render.text.FormattedText; import nova.gui.render.text.FormattedText.TextFormat; import nova.gui.render.text.TextRenderer; import nova.gui.render.text.TextRenderer.RenderedText; -import nova.gui.wrapper.mc18.text.IText.Text; +import nova.gui.wrapper.mc.forge.v1_7.text.IText.Text; import org.lwjgl.opengl.GL11; class SimpleParagraph extends AbstractParagraph implements RenderedText { diff --git a/minecraft/1.8/build.gradle b/minecraft/1.8/build.gradle index 5cdba31..a25ae6b 100644 --- a/minecraft/1.8/build.gradle +++ b/minecraft/1.8/build.gradle @@ -42,8 +42,8 @@ minecraft { dependencies { compile rootProject - compile group: "nova.core", name: "NovaCore", version: property("novaVersion"), changing: true - compile "nova.wrapper.mc18:NovaWrapper-MC1.8:0.1-SNAPSHOT:deobf" + compile group: "nova.core", name: "NOVA-Core", version: property("nova_version"), changing: true + compile "nova.core:NOVA-Core-Wrapper-MC1.8:0.1.0-SNAPSHOT:deobf" } processResources { diff --git a/minecraft/1.8/gradle.properties b/minecraft/1.8/gradle.properties index 583a1a8..210e104 100644 --- a/minecraft/1.8/gradle.properties +++ b/minecraft/1.8/gradle.properties @@ -1,7 +1,10 @@ +group = nova.gui + minecraft.version = 1.8 forge.version = 11.14.3.1491 +forgeGradleVersion = 1.2-SNAPSHOT packaging = jar info.inceptionYear = 2015 -info.description = The NOVA-Minecraft Minecraft 1.8 wrapper. +info.description = The NOVA-GUI Minecraft 1.8 wrapper. info.organization.name = NOVA diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/DrawableGuiComponent.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/DrawableGuiComponent.java similarity index 92% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/DrawableGuiComponent.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/DrawableGuiComponent.java index d926d4e..3d00618 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/DrawableGuiComponent.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/DrawableGuiComponent.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_8; import nova.gui.nativeimpl.NativeGuiComponent; import nova.gui.render.Graphics; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/GuiUtils.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/GuiUtils.java similarity index 93% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/GuiUtils.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/GuiUtils.java index d4e6b2c..8d4bf43 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/GuiUtils.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/GuiUtils.java @@ -1,9 +1,9 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_8; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.util.ResourceLocation; -import nova.wrapper.mc18.launcher.NovaMinecraft; +import nova.core.wrapper.mc.forge.v18.launcher.NovaMinecraft; import org.lwjgl.opengl.GL11; public class GuiUtils { diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCButton.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCButton.java similarity index 98% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCButton.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCButton.java index a1bd637..a649f61 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCButton.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCButton.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_8; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCCanvas.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCCanvas.java similarity index 98% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCCanvas.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCCanvas.java index a678d7c..bbe61b1 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCCanvas.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCCanvas.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_8; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGui.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGui.java old mode 100755 new mode 100644 similarity index 97% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGui.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGui.java index 776801a..4a784ec --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGui.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGui.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_8; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -12,6 +12,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import nova.core.network.Packet; +import nova.core.wrapper.mc.forge.v18.network.netty.MCNetworkManager; import nova.gui.Gui; import nova.gui.GuiComponent; import nova.gui.GuiEvent.MouseEvent.EnumMouseButton; @@ -20,10 +21,9 @@ import nova.gui.render.Canvas; import nova.gui.render.Graphics; import nova.gui.render.text.TextMetrics; -import nova.gui.wrapper.mc18.text.MCTextRenderer; +import nova.gui.wrapper.mc.forge.v1_8.text.MCTextRenderer; import nova.internal.core.Game; -import nova.gui.wrapper.mc18.network.PacketGui; -import nova.wrapper.mc18.network.netty.MCNetworkManager; +import nova.gui.wrapper.mc.forge.v1_8.network.PacketGui; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiComponent.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiComponent.java old mode 100755 new mode 100644 similarity index 95% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiComponent.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiComponent.java index 37d10e7..34087b3 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiComponent.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiComponent.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_8; import nova.gui.GuiComponent; import nova.gui.Outline; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiComponentFactory.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiComponentFactory.java old mode 100755 new mode 100644 similarity index 96% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiComponentFactory.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiComponentFactory.java index 3bc9bf7..6edd12c --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiComponentFactory.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiComponentFactory.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_8; import nova.gui.AbstractGuiContainer; import nova.gui.Gui; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiContainer.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiContainer.java old mode 100755 new mode 100644 similarity index 94% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiContainer.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiContainer.java index 2293ed2..787f071 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiContainer.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiContainer.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_8; import nova.gui.AbstractGuiContainer; import nova.gui.GuiComponent; @@ -6,7 +6,7 @@ import nova.gui.nativeimpl.NativeContainer; import nova.gui.render.Canvas; import nova.gui.render.Graphics; -import nova.gui.wrapper.mc17.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCContainer; import java.util.ArrayList; import java.util.List; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiFactory.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiFactory.java similarity index 85% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiFactory.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiFactory.java index 2420f9b..41fb007 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiFactory.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiFactory.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_8; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -8,14 +8,15 @@ import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; import nova.core.entity.Entity; +import nova.core.wrapper.mc.forge.v18.launcher.NovaMinecraft; +import nova.core.wrapper.mc.forge.v18.wrapper.entity.backward.BWEntity; import nova.gui.Gui; import nova.gui.GuiException; import nova.gui.factory.GuiFactory; import nova.gui.factory.GuiManager; -import nova.gui.wrapper.mc18.MCGui.MCContainer; -import nova.gui.wrapper.mc18.MCGui.MCGuiScreen; -import nova.wrapper.mc18.launcher.NovaMinecraft; -import nova.wrapper.mc18.wrapper.entity.BWEntity; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCGuiScreen; +import nova.internal.core.Game; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import java.util.ArrayList; @@ -27,6 +28,10 @@ public class MCGuiFactory extends GuiManager { private static Optional guiToOpen = Optional.empty(); private static List idMappedFactories = new ArrayList<>(); + public MCGuiFactory() { + super(Game.events()); + } + @Override public GuiFactory register(GuiFactory factory) { idMappedFactories.add(factory); @@ -35,8 +40,8 @@ public GuiFactory register(GuiFactory factory) { @Override public void showGui(String identifier, Entity entity, Vector3D pos) { - GuiFactory factory = getFactory(identifier).orElseThrow(() -> new GuiException(String.format("No GUI called %s registered!", identifier))); - Gui gui = factory.makeGUI(); + GuiFactory factory = registry.get(identifier).orElseThrow(() -> new GuiException(String.format("No GUI called %s registered!", identifier))); + Gui gui = factory.build(); showGui(gui, entity, pos, idMappedFactories.indexOf(factory)); } @@ -105,7 +110,7 @@ public GuiContainer getClientGuiElement(int id, EntityPlayer player, World world guiToOpen = Optional.empty(); } else { // Try to get the client side GUI from the id mapping - gui = idMappedFactories.get(id).makeGUI(); + gui = idMappedFactories.get(id).build(); } if (gui == null) { throw new GuiException("Couldn't get client side instance for the provided GUI of id " + id + " !"); diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiPlayerInventory.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiPlayerInventory.java old mode 100755 new mode 100644 similarity index 87% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiPlayerInventory.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiPlayerInventory.java index dc58571..40231bf --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/MCGuiPlayerInventory.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiPlayerInventory.java @@ -1,12 +1,12 @@ -package nova.gui.wrapper.mc17; +package nova.gui.wrapper.mc.forge.v1_8; import net.minecraft.inventory.IInventory; +import nova.core.wrapper.mc.forge.v18.wrapper.inventory.BWInventory; import nova.gui.component.inventory.PlayerInventory; import nova.gui.nativeimpl.NativePlayerInventory; import nova.gui.render.Graphics; -import nova.gui.wrapper.mc17.MCGui.MCContainer; -import nova.gui.wrapper.mc17.MCGui.MCGuiScreen; -import nova.wrapper.mc1710.wrapper.inventory.BWInventory; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCGuiScreen; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import java.util.ArrayList; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiSlot.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiSlot.java similarity index 92% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiSlot.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiSlot.java index bd7c588..7b1ffa1 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/MCGuiSlot.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/MCGuiSlot.java @@ -1,17 +1,17 @@ -package nova.gui.wrapper.mc18; +package nova.gui.wrapper.mc.forge.v1_8; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import nova.core.wrapper.mc.forge.v18.wrapper.inventory.FWInventory; +import nova.core.wrapper.mc.forge.v18.wrapper.item.ItemConverter; import nova.gui.component.inventory.Slot; import nova.gui.nativeimpl.NativeSlot; import nova.gui.render.Graphics; -import nova.gui.wrapper.mc18.MCGui.MCContainer; -import nova.gui.wrapper.mc18.MCGui.MCGuiScreen; -import nova.wrapper.mc18.wrapper.inventory.FWInventory; -import nova.wrapper.mc18.wrapper.item.ItemConverter; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCGuiScreen; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import org.lwjgl.opengl.GL11; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/dependency/GuiModule.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/dependency/GuiModule.java old mode 100755 new mode 100644 similarity index 66% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/dependency/GuiModule.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/dependency/GuiModule.java index d70baf9..046d83f --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/dependency/GuiModule.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/dependency/GuiModule.java @@ -1,9 +1,9 @@ -package nova.gui.wrapper.mc17.dependency; +package nova.gui.wrapper.mc.forge.v1_8.dependency; import nova.gui.factory.GuiComponentFactory; import nova.gui.factory.GuiManager; -import nova.gui.wrapper.mc17.MCGuiComponentFactory; -import nova.gui.wrapper.mc17.MCGuiFactory; +import nova.gui.wrapper.mc.forge.v1_8.MCGuiComponentFactory; +import nova.gui.wrapper.mc.forge.v1_8.MCGuiFactory; import se.jbee.inject.bind.BinderModule; public class GuiModule extends BinderModule { diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/launch/NovaGuiWrapper.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/launch/NovaGuiWrapper.java old mode 100755 new mode 100644 similarity index 74% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/launch/NovaGuiWrapper.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/launch/NovaGuiWrapper.java index 68b7219..43c856e --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/launch/NovaGuiWrapper.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/launch/NovaGuiWrapper.java @@ -1,13 +1,13 @@ -package nova.gui.wrapper.mc18.launch; +package nova.gui.wrapper.mc.forge.v1_8.launch; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import nova.core.loader.Loadable; import nova.core.loader.Mod; -import nova.gui.wrapper.mc18.MCGuiFactory; -import nova.gui.wrapper.mc18.dependency.GuiModule; -import nova.wrapper.mc18.launcher.NovaMinecraft; +import nova.core.wrapper.mc.forge.v18.launcher.NovaMinecraft; +import nova.gui.wrapper.mc.forge.v1_8.MCGuiFactory; +import nova.gui.wrapper.mc.forge.v1_8.dependency.GuiModule; /** * The main class to initialize the Gui Plugin diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/network/PacketGui.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/network/PacketGui.java old mode 100755 new mode 100644 similarity index 81% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/network/PacketGui.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/network/PacketGui.java index a477f30..2f8ac05 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/network/PacketGui.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/network/PacketGui.java @@ -1,14 +1,14 @@ -package nova.gui.wrapper.mc18.network; +package nova.gui.wrapper.mc.forge.v1_8.network; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import net.minecraft.entity.player.EntityPlayer; import nova.core.network.Packet; +import nova.core.wrapper.mc.forge.v18.network.MCPacket; +import nova.core.wrapper.mc.forge.v18.network.discriminator.PacketAbstract; import nova.gui.GuiException; -import nova.wrapper.mc18.network.MCPacket; -import nova.wrapper.mc18.network.discriminator.PacketAbstract; -import nova.gui.wrapper.mc18.MCGui.MCContainer; +import nova.gui.wrapper.mc.forge.v1_8.MCGui.MCContainer; //TODO: This is NOT used. NO-OP public class PacketGui extends PacketAbstract { diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/AbstractParagraph.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/AbstractParagraph.java similarity index 95% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/AbstractParagraph.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/AbstractParagraph.java index 7248176..c305533 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/AbstractParagraph.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/AbstractParagraph.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18.text; +package nova.gui.wrapper.mc.forge.v1_8.text; import nova.gui.render.text.TextRenderer.RenderedText; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/IText.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/IText.java similarity index 98% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/IText.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/IText.java index 06460ae..6af3204 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/IText.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/IText.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc18.text; +package nova.gui.wrapper.mc.forge.v1_8.text; import net.minecraft.client.gui.FontRenderer; import nova.gui.render.text.FormattedText.TextFormat; diff --git a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/MCTextRenderer.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/MCTextRenderer.java similarity index 95% rename from minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/MCTextRenderer.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/MCTextRenderer.java index 5e4ad7f..817a609 100644 --- a/minecraft/1.8/src/main/java/nova/gui/wrapper/mc18/text/MCTextRenderer.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/MCTextRenderer.java @@ -1,12 +1,12 @@ -package nova.gui.wrapper.mc18.text; +package nova.gui.wrapper.mc.forge.v1_8.text; import net.minecraft.client.gui.FontRenderer; import nova.core.render.Color; import nova.core.util.math.MathUtil; import nova.gui.render.text.FormattedText; import nova.gui.render.text.TextRenderer; -import nova.gui.wrapper.mc18.MCCanvas; -import nova.gui.wrapper.mc18.text.IText.Text; +import nova.gui.wrapper.mc.forge.v1_8.MCCanvas; +import nova.gui.wrapper.mc.forge.v1_8.text.IText.Text; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import org.lwjgl.opengl.GL11; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/Paragraph.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/Paragraph.java old mode 100755 new mode 100644 similarity index 96% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/Paragraph.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/Paragraph.java index 115e520..6d3d559 --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/Paragraph.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/Paragraph.java @@ -1,4 +1,4 @@ -package nova.gui.wrapper.mc17.text; +package nova.gui.wrapper.mc.forge.v1_8.text; import com.google.common.collect.Lists; import net.minecraft.client.gui.FontRenderer; @@ -6,7 +6,7 @@ import nova.gui.render.text.FormattedText.TextFormat; import nova.gui.render.text.TextRenderer; import nova.gui.render.text.TextRenderer.RenderedText; -import nova.gui.wrapper.mc17.text.IText.Word; +import nova.gui.wrapper.mc.forge.v1_8.text.IText.Word; import org.lwjgl.opengl.GL11; import java.util.List; diff --git a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/SimpleParagraph.java b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/SimpleParagraph.java old mode 100755 new mode 100644 similarity index 94% rename from minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/SimpleParagraph.java rename to minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/SimpleParagraph.java index 73f21b6..4532eda --- a/minecraft/1.7/src/main/java/nova/gui/wrapper/mc17/text/SimpleParagraph.java +++ b/minecraft/1.8/src/main/java/nova/gui/wrapper/mc/forge/v1_8/text/SimpleParagraph.java @@ -1,11 +1,11 @@ -package nova.gui.wrapper.mc17.text; +package nova.gui.wrapper.mc.forge.v1_8.text; import net.minecraft.client.gui.FontRenderer; import nova.gui.render.text.FormattedText; import nova.gui.render.text.FormattedText.TextFormat; import nova.gui.render.text.TextRenderer; import nova.gui.render.text.TextRenderer.RenderedText; -import nova.gui.wrapper.mc17.text.IText.Text; +import nova.gui.wrapper.mc.forge.v1_8.text.IText.Text; import org.lwjgl.opengl.GL11; class SimpleParagraph extends AbstractParagraph implements RenderedText { diff --git a/minecraft/build.gradle b/minecraft/build.gradle index 2f4e064..905f27d 100644 --- a/minecraft/build.gradle +++ b/minecraft/build.gradle @@ -1,16 +1,19 @@ -buildscript{ - repositories{ - mavenCentral() - maven { - name "forge" - url "http://files.minecraftforge.net/maven" +subprojects { + buildscript { + repositories { + mavenCentral() + maven { + name "forge" + url "http://files.minecraftforge.net/maven" + } + maven { + name "sonatype" + url "https://oss.sonatype.org/content/repositories/snapshots/" + } } - maven { - name "sonatype" - url "https://oss.sonatype.org/content/repositories/snapshots/" + dependencies { + // Minecraft 1.11 requires newer ForgeGradle, while 1.7 and 1.8 require older. + classpath 'net.minecraftforge.gradle:ForgeGradle:' + property('forgeGradleVersion') } } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } } diff --git a/src/main/java/nova/gui/AbstractGuiContainer.java b/src/main/java/nova/gui/AbstractGuiContainer.java index fde7bd6..21de0a4 100644 --- a/src/main/java/nova/gui/AbstractGuiContainer.java +++ b/src/main/java/nova/gui/AbstractGuiContainer.java @@ -184,6 +184,7 @@ public O add(GuiComponent component, Object... properties) { /** * Resets the GuiContainer, removing all the components and layouts */ + @SuppressWarnings("unchecked") public void reset() { ((HashMap>) children.clone()).values().forEach(this::removeElement); } @@ -202,7 +203,7 @@ public O removeElement(GuiComponent component) { throw new GuiComponentException("Component couldn't be removed from parent container as it wasn't a child."); } component.triggerEvent(new ComponentEvent.RemoveEvent(component, this)); - children.remove(component); + children.remove(component.getID()); layout.remove(component); component.updateQualifiedName(); getNative().removeElement(component); diff --git a/src/main/java/nova/gui/ComponentEvent.java b/src/main/java/nova/gui/ComponentEvent.java index 8102e96..f6a177c 100644 --- a/src/main/java/nova/gui/ComponentEvent.java +++ b/src/main/java/nova/gui/ComponentEvent.java @@ -1,8 +1,8 @@ package nova.gui; -import nova.core.event.CancelableEvent; -import nova.core.event.EventListener; -import nova.core.event.SidedEventBus.SidedEvent; +import nova.core.event.bus.CancelableEvent; +import nova.core.event.bus.EventListener; +import nova.core.event.bus.SidedEventBus.SidedEvent; import nova.core.network.NetworkTarget.Side; import nova.core.network.Sync; import nova.gui.factory.GuiEventFactory; @@ -10,7 +10,7 @@ /** * Event created by {@link GuiComponent}. These events, opposed to * {@link GuiEvent}, aren't propagated to the child components. - * + * * @see SidedComponentEvent * @see ComponentEventListener * @see GuiComponent#triggerEvent(ComponentEvent) @@ -30,7 +30,7 @@ public ComponentEvent(GuiComponent component) { /** * Specify to indicate which id {@link Sync} will use when getting * serialized to a packet. - * + * * @return sync id */ public int getSyncID() { @@ -40,9 +40,9 @@ public int getSyncID() { /** * {@link EventListener} interface used by {@link GuiComponent} to specify * the component type. Preferred over using {@link #component} directly. - * + * * @author Vic Nightfall - * + * * @param * @param * @see GuiComponent#onEvent(ComponentEventListener, Class) @@ -65,7 +65,7 @@ public default void onEvent(EVENT event) { * {@link ComponentEvent} which can be sent over the network. Has to be * registered with * {@link GuiEventFactory#registerNetworkEvent(java.util.function.Function)} - * + * * @author Vic Nightfall */ public static class SidedComponentEvent extends ComponentEvent implements SidedEvent { diff --git a/src/main/java/nova/gui/Gui.java b/src/main/java/nova/gui/Gui.java index 91634b0..e28d6cb 100644 --- a/src/main/java/nova/gui/Gui.java +++ b/src/main/java/nova/gui/Gui.java @@ -2,8 +2,8 @@ import nova.core.entity.Entity; import nova.core.entity.component.Player; -import nova.core.inventory.Inventory; -import nova.core.inventory.component.InventoryPlayer; +import nova.core.component.inventory.Inventory; +import nova.core.component.inventory.InventoryPlayer; import nova.core.network.NetworkTarget.Side; import nova.core.network.Packet; import nova.gui.component.inventory.Slot; @@ -81,7 +81,7 @@ protected void dispatchNetworkEvent(ComponentEvent.SidedComponentEvent event, Gu */ public void bind(Entity entity, Vector3D position) { inventoryMap.clear(); - playerInventory = entity.get(Player.class).getInventory(); + playerInventory = entity.components.get(Player.class).getInventory(); onEvent(new GuiEvent.BindEvent(this, entity, position)); repaint(); } diff --git a/src/main/java/nova/gui/GuiComponent.java b/src/main/java/nova/gui/GuiComponent.java index 678d14b..0949184 100644 --- a/src/main/java/nova/gui/GuiComponent.java +++ b/src/main/java/nova/gui/GuiComponent.java @@ -1,9 +1,9 @@ package nova.gui; -import nova.core.event.EventBus; -import nova.core.event.EventListener; -import nova.core.event.SidedEventBus; -import nova.core.event.SidedEventBus.SidedEvent; +import nova.core.event.bus.EventBus; +import nova.core.event.bus.EventListener; +import nova.core.event.bus.SidedEventBus; +import nova.core.event.bus.SidedEventBus.SidedEvent; import nova.core.network.NetworkTarget.Side; import nova.core.network.Syncable; import nova.core.util.Identifiable; @@ -318,7 +318,7 @@ public void triggerEvent(ComponentEvent event) { // Internal listener public O onGuiEvent(EventListener listener, Class clazz) { - guiEventBus.add(listener, clazz); + guiEventBus.on(clazz).bind(listener); return (O) this; } @@ -328,7 +328,7 @@ public O onEvent(ComponentEvent.ComponentEventLis if (side == Side.SERVER && !hasIdentifierRecursive()) { throw new GuiComponentException("Components without unique identifier can't recieve events on the server side!"); } - componentEventBus.add(listener, clazz, side); + componentEventBus.on(clazz).bind(listener); return (O) this; } @@ -340,7 +340,7 @@ public O onEvent(EventListener listener, C if (side == Side.SERVER && !hasIdentifierRecursive()) { throw new GuiComponentException("Components without unique identifier can't recieve events on the server side!"); } - componentEventBus.add(listener, clazz, side); + componentEventBus.on(clazz).bind(listener); return (O) this; } diff --git a/src/main/java/nova/gui/GuiComponentException.java b/src/main/java/nova/gui/GuiComponentException.java index 2467db6..249f056 100644 --- a/src/main/java/nova/gui/GuiComponentException.java +++ b/src/main/java/nova/gui/GuiComponentException.java @@ -1,6 +1,8 @@ package nova.gui; public class GuiComponentException extends GuiException { + private static final long serialVersionUID = 2017_01_22L; + public GuiComponentException() { super(); } diff --git a/src/main/java/nova/gui/GuiEvent.java b/src/main/java/nova/gui/GuiEvent.java index 264207c..351073a 100644 --- a/src/main/java/nova/gui/GuiEvent.java +++ b/src/main/java/nova/gui/GuiEvent.java @@ -3,7 +3,7 @@ import nova.core.block.Block; import nova.core.entity.Entity; import nova.core.entity.component.Player; -import nova.core.event.CancelableEvent; +import nova.core.event.bus.CancelableEvent; import nova.core.game.InputManager; import nova.core.world.World; import nova.gui.render.Graphics; @@ -100,7 +100,7 @@ public BindEvent(Gui gui, Entity entity, Vector3D position) { this.gui = gui; this.entity = entity; this.position = position; - this.player = entity.get(Player.class); + this.player = entity.components.get(Player.class); this.world = entity.world(); this.block = world.getBlock(position); } diff --git a/src/main/java/nova/gui/GuiException.java b/src/main/java/nova/gui/GuiException.java index e86fb7a..ba2b7b2 100644 --- a/src/main/java/nova/gui/GuiException.java +++ b/src/main/java/nova/gui/GuiException.java @@ -1,8 +1,10 @@ package nova.gui; -import nova.core.util.NovaException; +import nova.core.util.exception.NovaException; public class GuiException extends NovaException { + private static final long serialVersionUID = 2017_01_22L; + public GuiException() { super(); } diff --git a/src/main/java/nova/gui/component/Button.java b/src/main/java/nova/gui/component/Button.java index fbf14df..59a83fa 100644 --- a/src/main/java/nova/gui/component/Button.java +++ b/src/main/java/nova/gui/component/Button.java @@ -34,6 +34,7 @@ private void onMousePressed(GuiEvent.MouseEvent event) { if (isMouseOver()) { triggerEvent(new ComponentEvent.ActionEvent(this)); } + break; default: break; } diff --git a/src/main/java/nova/gui/component/inventory/PlayerInventory.java b/src/main/java/nova/gui/component/inventory/PlayerInventory.java index 80edafa..0ffc551 100644 --- a/src/main/java/nova/gui/component/inventory/PlayerInventory.java +++ b/src/main/java/nova/gui/component/inventory/PlayerInventory.java @@ -1,6 +1,6 @@ package nova.gui.component.inventory; -import nova.core.inventory.component.InventoryPlayer; +import nova.core.component.inventory.InventoryPlayer; import nova.gui.GuiComponent; import nova.gui.GuiEvent; import nova.gui.nativeimpl.NativePlayerInventory; @@ -9,7 +9,7 @@ * Defines the standard player inventory. It automatically gets wrapped to the * player inventory and its appearance, size, and other properties might differ * from wrapper to wrapper. - * + * * @author Vic Nightfall */ public class PlayerInventory extends GuiComponent { diff --git a/src/main/java/nova/gui/component/inventory/Slot.java b/src/main/java/nova/gui/component/inventory/Slot.java index 806a62f..98bebff 100644 --- a/src/main/java/nova/gui/component/inventory/Slot.java +++ b/src/main/java/nova/gui/component/inventory/Slot.java @@ -1,8 +1,8 @@ package nova.gui.component.inventory; -import nova.core.inventory.Inventory; -import nova.core.inventory.InventoryException; -import nova.core.inventory.ItemFilter; +import nova.core.component.inventory.Inventory; +import nova.core.component.inventory.InventoryException; +import nova.core.component.inventory.ItemFilter; import nova.core.item.Item; import nova.gui.Gui; import nova.gui.GuiComponent; diff --git a/src/main/java/nova/gui/factory/GuiEventFactory.java b/src/main/java/nova/gui/factory/GuiEventFactory.java index 526feee..1501af5 100644 --- a/src/main/java/nova/gui/factory/GuiEventFactory.java +++ b/src/main/java/nova/gui/factory/GuiEventFactory.java @@ -1,6 +1,6 @@ package nova.gui.factory; -import nova.core.event.EventException; +import nova.core.event.bus.EventException; import nova.core.network.Packet; import nova.gui.ComponentEvent; import nova.gui.Gui; diff --git a/src/main/java/nova/gui/factory/GuiFactory.java b/src/main/java/nova/gui/factory/GuiFactory.java index 7d9c047..c617b59 100644 --- a/src/main/java/nova/gui/factory/GuiFactory.java +++ b/src/main/java/nova/gui/factory/GuiFactory.java @@ -1,22 +1,23 @@ package nova.gui.factory; -import nova.core.util.Factory; +import nova.core.util.registry.Factory; import nova.gui.Gui; import java.util.function.Function; import java.util.function.Supplier; -public class GuiFactory extends Factory { +public class GuiFactory extends Factory { - public GuiFactory(Function constructor) { - super(constructor); + public GuiFactory(String id, Supplier constructor) { + super(id, constructor); } - public GuiFactory(Supplier supplier) { - super(o -> supplier.get()); + public GuiFactory(String id, Supplier constructor, Function processor) { + super(id, constructor, processor); } - public Gui makeGUI(Object... args) { - return constructor.apply(args); + @Override + protected GuiFactory selfConstructor(String id, Supplier constructor, Function processor) { + return new GuiFactory(id, constructor, processor); } } diff --git a/src/main/java/nova/gui/factory/GuiManager.java b/src/main/java/nova/gui/factory/GuiManager.java index 6f07779..b17f5fd 100755 --- a/src/main/java/nova/gui/factory/GuiManager.java +++ b/src/main/java/nova/gui/factory/GuiManager.java @@ -1,13 +1,14 @@ package nova.gui.factory; import nova.core.entity.Entity; +import nova.core.event.bus.GlobalEvents; import nova.core.loader.Mod; import nova.core.network.NetworkTarget.IllegalSideException; import nova.core.network.NetworkTarget.Side; import nova.core.network.Sided; -import nova.core.util.Manager; -import nova.core.util.RegistrationException; -import nova.core.util.Registry; +import nova.core.util.exception.RegistrationException; +import nova.core.util.registry.FactoryManager; +import nova.core.util.registry.Registry; import nova.gui.Gui; import nova.gui.GuiEvent; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; @@ -19,13 +20,15 @@ import java.util.function.Function; import java.util.function.Supplier; -public abstract class GuiManager extends Manager { +public abstract class GuiManager extends FactoryManager { // TODO Move this into a seperate manager protected EnumMap> overlayRegistry = new EnumMap<>(GuiType.class); + private final GlobalEvents events; - public GuiManager() { + public GuiManager(GlobalEvents events) { super(new Registry<>()); + this.events = events; } @Deprecated @@ -36,14 +39,13 @@ public void registerOverlay(Gui gui, GuiType guiType) { overlayRegistry.get(guiType).add(gui); } - public GuiFactory register(Supplier supplier) { - return register(new GuiFactory(supplier)); + @Override + public GuiFactory register(String id, Supplier constructor) { + return register(new GuiFactory(id, constructor)); } - @Override - @Deprecated - public GuiFactory register(Function constructor) { - return register(new GuiFactory(constructor)); + public GuiFactory register(String id, Supplier constructor, Function processor) { + return register(new GuiFactory(id, constructor, processor)); } /** @@ -63,8 +65,8 @@ public GuiFactory register(Function constructor) { * @see #showGui(Gui, Entity, Vector3D) */ public void showGui(String identifier, Entity entity, Vector3D position) { - GuiFactory factory = getFactory(identifier).orElseThrow(() -> new RegistrationException(String.format("No GUI called %s registered!", identifier))); - showGui(factory.makeGUI(), entity, position); + GuiFactory factory = registry.get(identifier).orElseThrow(() -> new RegistrationException(String.format("No GUI called %s registered!", identifier))); + showGui(factory.build(), entity, position); } /** @@ -149,6 +151,17 @@ public GuiType getActiveGuiType() { return getActiveGui().isPresent() ? GuiType.CUSTOM : GuiType.NATIVE; } + @Override + public void init() { + this.events.publish(new Init(this)); + } + + public class Init extends ManagerEvent { + public Init(GuiManager manager) { + super(manager); + } + } + public static enum GuiType { INGAME, TITLE, OPTIONS, INGAME_OPTIONS, CRAFTING, NATIVE, CUSTOM } diff --git a/src/main/java/nova/gui/launch/NovaGui.java b/src/main/java/nova/gui/launch/NovaGui.java index c5e4c06..d79c317 100755 --- a/src/main/java/nova/gui/launch/NovaGui.java +++ b/src/main/java/nova/gui/launch/NovaGui.java @@ -3,7 +3,7 @@ import nova.core.game.InputManager; import nova.core.loader.Mod; import nova.core.network.NetworkManager; -import nova.core.util.LanguageManager; +import nova.core.util.registry.LanguageManager; import nova.gui.factory.GuiComponentFactory; /** diff --git a/src/main/java/nova/gui/layout/LayoutException.java b/src/main/java/nova/gui/layout/LayoutException.java index 8dbe25a..3a09fb7 100644 --- a/src/main/java/nova/gui/layout/LayoutException.java +++ b/src/main/java/nova/gui/layout/LayoutException.java @@ -1,8 +1,10 @@ package nova.gui.layout; -import nova.core.util.NovaException; +import nova.core.util.exception.NovaException; public class LayoutException extends NovaException { + private static final long serialVersionUID = 2017_01_22L; + public LayoutException() { super(); } diff --git a/src/main/java/nova/gui/render/Vertex2D.java b/src/main/java/nova/gui/render/Vertex2D.java index 2c06586..450892c 100644 --- a/src/main/java/nova/gui/render/Vertex2D.java +++ b/src/main/java/nova/gui/render/Vertex2D.java @@ -3,6 +3,7 @@ import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; public class Vertex2D extends Vector2D { + private static final long serialVersionUID = 2017_01_22L; public final boolean uv; public final double u, v;