Skip to content

Commit

Permalink
Merge pull request #19 from LQ1234/1.19
Browse files Browse the repository at this point in the history
Update to 1.19
  • Loading branch information
segovo authored Jun 24, 2022
2 parents f0ebc93 + 588c78e commit 8ad1474
Show file tree
Hide file tree
Showing 10 changed files with 251 additions and 234 deletions.
79 changes: 31 additions & 48 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@






plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
// uncomment to publish to the local maven
// mavenLocal()
mavenCentral()
maven {
url = "https://maven.modmuss50.me/"
Expand All @@ -23,83 +27,62 @@ repositories {
}

dependencies {
//to change the versions see the gradle.properties file
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

//Client Commands
modApi "io.github.cottonmc:cotton-client-commands:${project.cotton_client_command_version}"
include "io.github.cottonmc:cotton-client-commands:${project.cotton_client_command_version}"

//Line Drawing
modApi "me.shedaniel.cloth.api:cloth-api:${project.cloth_api_version}"
include "me.shedaniel.cloth.api:cloth-api:${project.cloth_api_version}"
include "me.shedaniel.cloth.api:cloth-client-events-v0:${project.cloth_api_version}"

//Config
//Config
modApi "com.electronwill.night-config:json:${project.night_config_version}"
include "com.electronwill.night-config:json:${project.night_config_version}"
modApi "com.electronwill.night-config:core:${project.night_config_version}"
include "com.electronwill.night-config:core:${project.night_config_version}"


// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them. me.shedaniel.cloth.api.client.events.v0.ClothClientHooks;
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching("fabric.mod.json") {
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
from components.java
}
}

// select the repositories you want to publish to
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// uncomment to publish to the local maven
// mavenLocal()
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
12 changes: 5 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.7
loader_version=0.10.8
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6

# Mod Properties
mod_version = 1.0.12
mod_version = 1.1.1
maven_group = net.fabricmc
archives_base_name = TrajectoryFabric

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.28.1+1.16
cloth_api_version=1.2.0
fabric_version=0.55.1+1.19
night_config_version=3.6.3
cotton_client_command_version=1.0.1+1.16-rc1
# cloth_events_version=1.2.0
# cloth_config_version=4.5.6
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
34 changes: 34 additions & 0 deletions src/main/java/net/Segovo/TrajectoryFabric/RenderUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.Segovo.TrajectoryFabric;

//shamelessly ripped from https://github.com/ate47/Xray/blob/fabric-1.19/src/main/java/fr/atesab/xray/utils/RenderUtils.java
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Matrix3f;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Vec3f;

public class RenderUtils {

public static void renderSingleLine(MatrixStack stack, VertexConsumer buffer, float x1, float y1, float z1,
float x2, float y2,
float z2, float r, float g, float b, float a) {
Vec3f normal = new Vec3f(x2 - x1, y2 - y1, z2 - z1);
normal.normalize();
renderSingleLine(stack, buffer, x1, y1, z1, x2, y2, z2, r, g, b, a, normal.getX(), normal.getY(),
normal.getZ());
}

public static void renderSingleLine(MatrixStack stack, VertexConsumer buffer, float x1, float y1, float z1,
float x2, float y2,
float z2, float r, float g, float b, float a, float normalX, float normalY, float normalZ) {
Matrix4f matrix4f = stack.peek().getPositionMatrix();
Matrix3f matrix3f = stack.peek().getNormalMatrix();
buffer.vertex(matrix4f, x1, y1, z1).color(r, g, b, a)
.normal(matrix3f, normalX, normalY, normalZ).next();
buffer.vertex(matrix4f, x2, y2, z2).color(r, g, b, a)
.normal(matrix3f, normalX, normalY, normalZ).next();
}

private RenderUtils() {
}
}
Loading

0 comments on commit 8ad1474

Please sign in to comment.