Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
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")
}
"1_11" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.11:$nova_version"
runtime project(":minecraft:1.11")
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions minecraft/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
!/build.gradle
!/.gitignore

!/1.11
!/1.8
!/1.7
17 changes: 17 additions & 0 deletions minecraft/1.11/.gitignore
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
73 changes: 73 additions & 0 deletions minecraft/1.11/build.gradle
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_20161111'
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"
}
}
10 changes: 10 additions & 0 deletions minecraft/1.11/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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
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();
}
}
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);
}
}
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);
}
}
}
Loading