Skip to content

Commit

Permalink
v1.5.5
Browse files Browse the repository at this point in the history
Changes:
 * Added chemical bath and mixer additional recipes to GT5 Ore Processing diagram
 * Fixed clipping on left edge of NBT Viewer diagram
 * Uncommented Transcendent Plasma Mixer in GT5 Recipe Debugger diagram
 * Updated Gradle wrapper to 8.7
 * Overhauled build script and updated to use RetroFuturaGradle
 * Updated and cleaned up dependencies

Merged commits from downstream:
 * GTNewHorizons@916d2b3
 * GTNewHorizons#29
 * GTNewHorizons#28
 * GTNewHorizons#27
 * GTNewHorizons#26
 * GTNewHorizons#25

Co-Authored-By: Raven Szewczyk <[email protected]>
Co-Authored-By: Wilhelm Schuster <[email protected]>
Co-Authored-By: miozune <[email protected]>
Co-Authored-By: Martin Robertz <[email protected]>
  • Loading branch information
5 people committed Apr 22, 2024
1 parent 91c645a commit 4910c4b
Show file tree
Hide file tree
Showing 20 changed files with 216 additions and 216 deletions.
97 changes: 18 additions & 79 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
import net.minecraftforge.gradle.user.UserExtension

buildscript {
repositories {
maven("https://maven.minecraftforge.net") { name = "Forge" }
maven("http://jenkins.usrv.eu:8081/nexus/content/groups/public/") { name = "GTNH Maven" }
}
dependencies {
classpath("net.minecraftforge.gradle:ForgeGradle:1.2.13")
}
}

plugins {
idea
java
id("com.gtnewhorizons.retrofuturagradle") version "1.3.35"
}

apply(plugin = "forge")

idea {
module {
isDownloadJavadoc = true
Expand All @@ -38,34 +25,29 @@ group = "com.github.dcysteine.neicustomdiagram"
version = neiCustomDiagramVersion

val minecraftVersion: String by project
val forgeVersion: String by project
minecraft.version = "$minecraftVersion-$forgeVersion-$minecraftVersion"

configure<UserExtension> {
replacements.putAll(
mapOf(
Pair("@version@", project.version)
)
)
runDir = "run"
minecraft {
mcVersion.set(minecraftVersion)
}

val Project.minecraft: UserExtension
get() = extensions.getByName<UserExtension>("minecraft")

repositories {
maven("https://maven.minecraftforge.net") {
name = "Forge"
maven("https://nexus.gtnewhorizons.com/repository/public/") {
name = "GTNH Maven"
}
maven("https://cursemaven.com") { name = "Curse Maven" }
/*
* This repo seems to be broken...
maven("https://maven.ic2.player.to") {
name = "IC2 Maven"
metadataSources {
mavenPom()
artifact()
}
}
maven("http://jenkins.usrv.eu:8081/nexus/content/groups/public/") {
name = "GTNH Maven"
}
maven("https://maven.ic2.player.to") {
*/
maven("https://maven2.ic2.player.to") {
name = "IC2 Maven"
metadataSources {
mavenPom()
artifact()
}
}
Expand All @@ -78,37 +60,10 @@ dependencies {
annotationProcessor("com.google.auto.value:auto-value:$autoValueVersion")

val neiVersion: String by project
implementation("com.github.GTNewHorizons:NotEnoughItems:$neiVersion:dev")
implementation("com.github.GTNewHorizons:NotEnoughItems:$neiVersion:dev") {}

val gregTech5Version: String by project
implementation("com.github.GTNewHorizons:GT5-Unofficial:$gregTech5Version:dev") {
isTransitive = false
}
// The following are compile-time dependencies of GT5.
val industrialCraft2Version: String by project
compileOnly("net.industrial-craft:industrialcraft-2:$industrialCraft2Version-experimental:api") {
isTransitive = false
}
val forestryVersion: String by project
compileOnly("com.github.GTNewHorizons:ForestryMC:$forestryVersion:api") {
isTransitive = false
}
val railcraftVersion: String by project
compileOnly("com.github.GTNewHorizons:Railcraft:$railcraftVersion:api") {
isTransitive = false
}
val buildCraftVersion: String by project
compileOnly("com.github.GTNewHorizons:BuildCraft:$buildCraftVersion:api") {
isTransitive = false
}
val enderIoVersion: String by project
compileOnly("com.github.GTNewHorizons:EnderIO:$enderIoVersion:api") {
isTransitive = false
}
val projectRedVersion: String by project
compileOnly("com.github.GTNewHorizons:ProjectRed:$projectRedVersion:dev") {
isTransitive = false
}
implementation("com.github.GTNewHorizons:GT5-Unofficial:$gregTech5Version:dev")

val bartworksVersion: String by project
implementation("com.github.GTNewHorizons:bartworks:$bartworksVersion:dev") {
Expand Down Expand Up @@ -147,25 +102,9 @@ tasks.withType<Jar> {
expand(
mapOf(
"version" to project.version,
"mcversion" to project.minecraft.version
"mcversion" to minecraftVersion,
)
)
}
archiveBaseName.set("NEICustomDiagram")
}

val sourcesJar by tasks.creating(Jar::class) {
from(sourceSets.main.get().allSource)
from("$projectDir/LICENSE.md")
archiveClassifier.set("sources")
}

val devJar by tasks.creating(Jar::class) {
from(sourceSets.main.get().output)
archiveClassifier.set("dev")
}

artifacts {
archives(sourcesJar)
archives(devJar)
}
24 changes: 8 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
neiCustomDiagramVersion=1.5.4
neiCustomDiagramVersion=1.5.5

minecraftVersion=1.7.10
forgeVersion=10.13.4.1614

autoValueVersion=1.8.2

neiVersion=2.3.6-GTNH
neiVersion=2.5.4-GTNH

gregTech5Version=5.09.43.04
industrialCraft2Version=2.2.828
forestryVersion=4.4.14
railcraftVersion=9.13.10
buildCraftVersion=7.1.27
enderIoVersion=2.3.1.44
projectRedVersion=4.7.9-GTNH
gregTech5Version=5.09.45.25
bartworksVersion=0.9.4
gtPlusPlusVersion=1.11.13
detravScannerVersion=1.8.0
gtnhCoreModVersion=2.3.11

bartworksVersion=0.5.84
gtPlusPlusVersion=1.8.9
detravScannerVersion=1.6.9
gtnhCoreModVersion=2.0.7

enderStorageVersion=1.4.12
enderStorageVersion=1.5.0

#gregTech6Version=6.14.20
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 11 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pluginManagement {
repositories {
maven("https://nexus.gtnewhorizons.com/repository/public/") {
name = "GTNH Maven"
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void drawTooltip(GuiRecipe<?> gui, int recipe) {
}

protected Optional<Interactable> findHoveredInteractable(int recipe) {
if (!mouseInBounds()) {
if (!mouseInDiagramBounds()) {
return Optional.empty();
}

Expand All @@ -217,8 +217,8 @@ protected Optional<Interactable> findHoveredInteractable(int recipe) {
return Optional.empty();
}

public boolean mouseInBounds() {
return scrollManager.mouseInBounds();
public boolean mouseInDiagramBounds() {
return scrollManager.mouseInDiagramBounds();
}

public boolean interact(int recipe, Interactable.RecipeType recipeType) {
Expand Down Expand Up @@ -288,15 +288,15 @@ public boolean mouseClicked(GuiRecipe<?> gui, int button, int recipe) {
public boolean mouseScrolled(GuiRecipe<?> gui, int scroll, int recipe) {
ScrollDirection direction = scroll > 0 ? ScrollDirection.UP : ScrollDirection.DOWN;

if (mouseInBounds() && NEIClientUtils.shiftKey()) {
if (mouseInDiagramBounds() && NEIClientUtils.shiftKey()) {
diagramState.scroll(direction);
return true;
}

if (scrollManager.mouseScroll(direction)) {
return true;
} else {
return ConfigOptions.DISABLE_PAGE_SCROLL.get();
return mouseInDiagramBounds() && ConfigOptions.DISABLE_PAGE_SCROLL.get();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package com.github.dcysteine.neicustomdiagram.api.draw.scroll;

import codechicken.lib.gui.GuiDraw;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.recipe.GuiRecipe;
import com.github.dcysteine.neicustomdiagram.api.draw.Dimension;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.github.dcysteine.neicustomdiagram.main.Reflection;
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;

import java.nio.FloatBuffer;
import java.util.Optional;

/** Handles scrolling support, as well as finding the mouse position. */
Expand All @@ -20,6 +22,10 @@ public final class ScrollManager {
static final int BOTTOM_MARGIN = 5;
static final int SIDE_MARGIN = 4;

// Offsets for glScissor margins relative to the current GL_MODELVIEW translation.
static final int SCISSOR_MODELVIEW_OFFSET_X = -2;
static final int SCISSOR_MODELVIEW_OFFSET_Y = 32;

private final Scrollbar verticalScrollbar;
private final Scrollbar horizontalScrollbar;

Expand All @@ -39,7 +45,8 @@ public boolean keyboardScroll(Dimension diagramDimension, ScrollDirection direct

public boolean mouseScroll(ScrollDirection direction) {
// Horizontal scrolling is more rarely done, so we will scroll horizontally only if the
// mouse is directly over the horizontal scrollbar. Otherwise, we will default to vertical.
// mouse is directly over the horizontal scrollbar. Vertical scrolling is done either when
// the cursor is over the scrollbar or over the diagram itself.
if (horizontalScrollbar.mouseInScrollBounds()) {
ScrollDirection horizontalDirection;
switch (direction) {
Expand All @@ -59,9 +66,11 @@ public boolean mouseScroll(ScrollDirection direction) {
}
return horizontalScrollbar.scroll(
horizontalDirection, ConfigOptions.MOUSE_SCROLL_SPEED.get());
} else {
} else if (verticalScrollbar.mouseInScrollBounds() || mouseInDiagramBounds()) {
return verticalScrollbar.scroll(
direction, ConfigOptions.MOUSE_SCROLL_SPEED.get());
} else {
return false;
}
}

Expand All @@ -74,7 +83,7 @@ public boolean mouseClickScrollbar(MouseButton button) {
return handled;
}

public boolean mouseInBounds() {
public boolean mouseInDiagramBounds() {
Point mousePos = getAbsoluteMousePosition();
Point viewportPos = getViewportPosition();
int xDiff = mousePos.x() - viewportPos.x();
Expand All @@ -96,7 +105,12 @@ public Point getRelativeMousePosition(int recipe) {
// The GUI got closed already, or something.
return Point.create(0, 0);
}

GuiRecipe<?> gui = guiOptional.get();
if (gui.isLimitedToOneRecipe()) {
// Assume no mouse interaction when drawn as a widget.
return Point.create(0, 0);
}

java.awt.Point mouse = GuiDraw.getMousePosition();
java.awt.Point offset = gui.getRecipePosition(recipe);
Expand Down Expand Up @@ -146,12 +160,18 @@ private void setScissor() {
}
GuiRecipe<?> gui = guiOptional.get();

int left = Reflection.GUI_LEFT.get(gui) + SIDE_MARGIN;
int bottom =
gui.height - (Reflection.GUI_TOP.get(gui) + Reflection.Y_SIZE.get(gui))
+ BOTTOM_MARGIN;

Minecraft minecraft = Minecraft.getMinecraft();
// Get the current translation component to support the Gui being drawn at any position on
// the screen
FloatBuffer matBuf = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, matBuf);
final int guiLeft = (int) matBuf.get(12);
final int guiTop = (int) matBuf.get(13);
final int left = guiLeft + SIDE_MARGIN + SCISSOR_MODELVIEW_OFFSET_X;
final int bottom =
gui.height - (guiTop + Reflection.Y_SIZE.get(gui))
+ BOTTOM_MARGIN + SCISSOR_MODELVIEW_OFFSET_Y;

final Minecraft minecraft = Minecraft.getMinecraft();
ScaledResolution res =
new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
int scaleFactor = res.getScaleFactor();
Expand All @@ -167,12 +187,12 @@ private void setScissor() {

/** Returns empty {@link Optional} in cases such as the GUI being instantly closed. */
private Optional<GuiRecipe<?>> getGui() {
GuiContainerManager manager = GuiContainerManager.getManager();
if (manager == null || !(manager.window instanceof GuiRecipe)) {
final GuiScreen screen = Minecraft.getMinecraft().currentScreen;
if (!(screen instanceof GuiRecipe)) {
return Optional.empty();
}

return Optional.of((GuiRecipe<?>) manager.window);
return Optional.of((GuiRecipe<?>) screen);
}

public void tick() {
Expand All @@ -188,8 +208,8 @@ public void refreshState(Dimension diagramDimension) {

public void beforeDraw() {
GL11.glPushMatrix();
GL11.glTranslatef(-horizontalScrollbar.getScroll(), -verticalScrollbar.getScroll(), 0);
setScissor();
GL11.glTranslatef(-horizontalScrollbar.getScroll(), -verticalScrollbar.getScroll(), 0);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glColor4f(1, 1, 1, 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static Layout buildLayout(NBTTagCompound nbt) {
String nbtText = NbtUtil.prettyPrintNbt(nbt.toString());
Iterable<String> lines = Splitter.on('\n').split(nbtText);
layoutBuilder.addAllLabels(
Text.multiLineBuilder(Grid.GRID.grid(-1, 1), Grid.Direction.SE)
Text.multiLineBuilder(Grid.GRID.edge(0, 1, Grid.Direction.W), Grid.Direction.SE)
.setSmall(ConfigOptions.NBT_VIEWER_SMALL_TEXT.get())
.addAllLines(lines)
.build());
Expand Down
Loading

0 comments on commit 4910c4b

Please sign in to comment.