-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,633 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
!/build.gradle | ||
!/.gitignore | ||
|
||
!/1.11 | ||
!/1.8 | ||
!/1.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Ignore All | ||
/* | ||
|
||
# Sources | ||
!/src | ||
|
||
# github | ||
!/.gitignore | ||
!/README.md | ||
|
||
# gradle | ||
!/build.gradle | ||
!/build.properties | ||
!/settings.gradle | ||
!/gradle.properties | ||
!/gradlew* | ||
!/gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apply plugin: "maven-publish" | ||
apply plugin: "com.jfrog.artifactory" | ||
apply from: "https://raw.githubusercontent.com/NOVA-Team/NOVA-Gradle/master/shared-scripts/java.gradle" | ||
|
||
idea.module.name = "GUI-MC-1.11" | ||
archivesBaseName = "NOVA-GUI-Wrapper-MC1.11" | ||
|
||
publishing { | ||
publications { | ||
main(MavenPublication) { | ||
from components.java | ||
|
||
artifactId "NOVA-GUI-Wrapper-MC1.11" | ||
|
||
artifact sourcesJar | ||
artifact javadocJar | ||
|
||
pom.withXml(writePom(project.properties)) | ||
} | ||
} | ||
} | ||
|
||
artifactory { | ||
publish { | ||
defaults { | ||
publications("main") | ||
publishPom = true | ||
} | ||
} | ||
} | ||
|
||
task deobfJar(type: Jar) { | ||
from sourceSets.main.output | ||
classifier = 'deobf' | ||
} | ||
|
||
artifacts { | ||
archives jar | ||
archives deobfJar | ||
} | ||
|
||
apply plugin: 'net.minecraftforge.gradle.forge' | ||
|
||
minecraft { | ||
version = property("minecraft.version") + "-" + property("forge.version") | ||
mappings = 'snapshot_20161220' | ||
runDir = "run" | ||
} | ||
|
||
dependencies { | ||
compile rootProject | ||
compile group: "nova.core", name: "NOVA-Core", version: property("nova_version"), changing: true | ||
compile "nova.core:NOVA-Core-Wrapper-MC1.11:0.1.0-SNAPSHOT:deobf" | ||
} | ||
|
||
processResources { | ||
// this will ensure that this task is redone when the versions change. | ||
inputs.property "version", project.version | ||
inputs.property "mcversion", project.minecraft.version | ||
|
||
// replace stuff in mcmod.info, nothing else | ||
from(sourceSets.main.resources.srcDirs) { | ||
include "mcmod.info" | ||
|
||
// replace version and mcversion | ||
expand "version": project.version, "mcversion": project.minecraft.version | ||
} | ||
|
||
// copy everything else, thats not the mcmod.info | ||
from(sourceSets.main.resources.srcDirs) { | ||
exclude "mcmod.info" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
group = nova.gui | ||
|
||
minecraft.version = 1.11 | ||
forge.version = 13.19.1.2189 | ||
forgeGradleVersion = 2.2-SNAPSHOT | ||
|
||
packaging = jar | ||
info.inceptionYear = 2016 | ||
info.description = The NOVA-GUI Minecraft 1.11 wrapper.info.organization.name = NOVA |
21 changes: 21 additions & 0 deletions
21
minecraft/1.11/src/main/java/nova/gui/wrapper/mc/forge/v1_11/DrawableGuiComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package nova.gui.wrapper.mc.forge.v1_11; | ||
|
||
import nova.gui.nativeimpl.NativeGuiComponent; | ||
import nova.gui.render.Graphics; | ||
|
||
public interface DrawableGuiComponent extends NativeGuiComponent { | ||
|
||
public void draw(int mouseX, int mouseY, float partial, Graphics graphics); | ||
|
||
public default void onAddedToContainer(MCGui.MCContainer container) { | ||
|
||
} | ||
|
||
public default MCCanvas getCanvas() { | ||
return getGui().getCanvas(); | ||
} | ||
|
||
public default MCGui getGui() { | ||
return (MCGui) getComponent().getParentGui().get().getNative(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
minecraft/1.11/src/main/java/nova/gui/wrapper/mc/forge/v1_11/GuiUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package nova.gui.wrapper.mc.forge.v1_11; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.util.ResourceLocation; | ||
import nova.core.wrapper.mc.forge.v1_11.launcher.NovaMinecraft; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
public class GuiUtils { | ||
|
||
public static final ResourceLocation RESOURCE_GUI_CONTROLS = new ResourceLocation(NovaMinecraft.id, "textures/gui/controls.png"); | ||
|
||
public static void drawGUIWindow(int xOffset, int yOffset, int width, int height) { | ||
GL11.glTranslatef(xOffset, yOffset, 0); | ||
|
||
Gui.drawRect(3, 3, width - 3, height - 3, 0xFFC6C6C6); | ||
Gui.drawRect(4, 0, width - 4, 1, 0xFF000000); | ||
Gui.drawRect(4, 1, width - 4, 3, 0xFFFFFFFF); | ||
Gui.drawRect(4, height - 1, width - 4, height, 0xFF000000); | ||
Gui.drawRect(4, height - 3, width - 4, height - 1, 0xFF555555); | ||
Gui.drawRect(0, 4, 1, height - 4, 0xFF000000); | ||
Gui.drawRect(1, 4, 3, height - 4, 0xFFFFFFFF); | ||
Gui.drawRect(width - 1, 4, width, height - 4, 0xFF000000); | ||
Gui.drawRect(width - 3, 4, width - 1, height - 4, 0xFF555555); | ||
|
||
Minecraft.getMinecraft().renderEngine.bindTexture(RESOURCE_GUI_CONTROLS); | ||
GL11.glColor4f(1, 1, 1, 1); | ||
Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 4, 4, 32, 32); | ||
Gui.drawModalRectWithCustomSizedTexture(width - 4, 0, 4, 0, 4, 4, 32, 32); | ||
Gui.drawModalRectWithCustomSizedTexture(width - 4, height - 4, 4, 4, 4, 4, 32, 32); | ||
Gui.drawModalRectWithCustomSizedTexture(0, height - 4, 0, 4, 4, 4, 32, 32); | ||
GL11.glTranslatef(-xOffset, -yOffset, 0); | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
minecraft/1.11/src/main/java/nova/gui/wrapper/mc/forge/v1_11/MCButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package nova.gui.wrapper.mc.forge.v1_11; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.FontRenderer; | ||
import net.minecraftforge.fml.client.config.GuiButtonExt; | ||
import net.minecraftforge.fml.common.FMLCommonHandler; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
import nova.gui.GuiEvent.MouseEvent; | ||
import nova.gui.GuiEvent.MouseEvent.EnumMouseState; | ||
import nova.gui.Outline; | ||
import nova.gui.component.Button; | ||
import nova.gui.nativeimpl.NativeButton; | ||
import nova.gui.render.Graphics; | ||
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
import java.util.Optional; | ||
|
||
public class MCButton extends MCGuiComponent<Button> implements NativeButton, DrawableGuiComponent { | ||
|
||
@SideOnly(Side.CLIENT) | ||
private MCGuiButton button; | ||
|
||
public MCButton(Button component) { | ||
super(component); | ||
|
||
if (FMLCommonHandler.instance().getSide().isClient()) { | ||
button = new MCGuiButton(); | ||
} | ||
|
||
component.onGuiEvent(this::onMousePressed, MouseEvent.class); | ||
} | ||
|
||
@Override | ||
public void setOutline(Outline outline) { | ||
button.width = outline.getWidth(); | ||
button.height = outline.getHeight(); | ||
button.xPosition = outline.minXi(); | ||
button.yPosition = outline.minYi(); | ||
super.setOutline(outline); | ||
} | ||
|
||
@Override | ||
public String getText() { | ||
return button.displayString; | ||
} | ||
|
||
@Override | ||
public void setText(String text) { | ||
if (FMLCommonHandler.instance().getSide().isClient()) { | ||
button.displayString = text; | ||
} | ||
} | ||
|
||
@Override | ||
public Optional<Vector2D> getMinimumSize() { | ||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; | ||
return fontRenderer != null ? Optional.of(new Vector2D(fontRenderer.getStringWidth(button.displayString) + 10, fontRenderer.FONT_HEIGHT + 10)) : Optional.empty(); | ||
} | ||
|
||
@Override | ||
public boolean isPressed() { | ||
// TODO | ||
return false; | ||
} | ||
|
||
@Override | ||
public void setPressed(boolean isPressed) { | ||
// TODO | ||
} | ||
|
||
@Override | ||
public void draw(int mouseX, int mouseY, float partial, Graphics graphics) { | ||
button.drawButton(Minecraft.getMinecraft(), mouseX, mouseY); | ||
super.draw(mouseX, mouseY, partial, graphics); | ||
} | ||
|
||
public void onMousePressed(MouseEvent event) { | ||
if (event.state == EnumMouseState.DOWN) { | ||
if (getComponent().isMouseOver()) { | ||
button.playPressSound(Minecraft.getMinecraft().getSoundHandler()); | ||
} | ||
} | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
public class MCGuiButton extends GuiButtonExt { | ||
|
||
public MCGuiButton() { | ||
super(0, 0, 0, ""); | ||
} | ||
|
||
@Override | ||
public void drawButton(Minecraft mc, int mouseX, int mouseY) { | ||
GL11.glTranslatef(-xPosition, -yPosition, 0); | ||
super.drawButton(mc, mouseX + xPosition, mouseY + yPosition); | ||
GL11.glTranslatef(xPosition, yPosition, 0); | ||
} | ||
} | ||
} |
Oops, something went wrong.