Skip to content

Commit

Permalink
Begin porting to 1.12.2
Browse files Browse the repository at this point in the history
~40% done. There are some problems with porting the GL code, serious problems with the RenderType code, and problems with the matrix code.

GUI code inspired by Angelica
  • Loading branch information
Asek3 committed Apr 3, 2024
1 parent a2ed799 commit fd885da
Show file tree
Hide file tree
Showing 252 changed files with 3,836 additions and 3,449 deletions.
123 changes: 50 additions & 73 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
plugins {
id 'dev.architectury.loom' version '0.10.0-SNAPSHOT'
id "java-library"
id "com.gtnewhorizons.retrofuturagradle" version "1.3.26"
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'maven-publish'
}

loom {
silentMojangMappingsLicense()

forge {
mixinConfigs = [
"mixins.oculus.json",
"mixins.oculus.fantastic.json",
"mixins.oculus.vertexformat.json",
"mixins.oculus.bettermipmaps.json",
"mixins.oculus.fixes.maxfpscrash.json",
"mixins.oculus.optimized-stitching.json",
"oculus-batched-entity-rendering.mixins.json",
"mixins.oculus.compat.sodium.json",
"mixins.oculus.compat.json"
]
}
mixin.defaultRefmapName = "oculus-mixins-refmap.json"
archivesBaseName = "${project.mod_id}-mc${project.minecraft_version}-${project.mod_version}"

// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
// Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64
vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL)
}
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
minecraft {
mcVersion.set(minecraft_version)
username.set("Developer")

archivesBaseName = "${project.archives_base_name}-mc${project.minecraft_version}"
version = project.mod_version
group = project.maven_group
injectedTags.put("MOD_VERSION", mod_version)
injectedTags.put("MOD_NAME", "Vintagium")
}

tasks.injectTags.outputClassName.set("${mod_base_package}.Tags")

tasks.deobfuscateMergedJarToSrg.configure {accessTransformerFiles.from("src/main/resources/META-INF/oculus_at.cfg")}

repositories {
mavenLocal()
maven { url "https://maven.cleanroommc.com" }
maven {
name 'SpongePowered Maven'
url 'https://repo.spongepowered.org/maven'
}
maven {
name = "CurseForge"
url = "https://cursemaven.com"
Expand All @@ -49,15 +51,18 @@ repositories {
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

modCompileOnly "maven.modrinth:rubidium:0.2.13"
//modCompileOnly "me.jellysquid.mods:Rubidium:0.2.13"
modCompileOnly "curse.maven:epic-fight-mod-405076:4029362"

modRuntimeOnly "curse.maven:lazydfu-460819:3249059"
def mixinBooter = modUtils.enableMixins("zone.rong:mixinbooter:8.9", "oculus-mixins-refmap.json")
api (mixinBooter) {
transitive = false
}
annotationProcessor "org.ow2.asm:asm-debug-all:5.2"
annotationProcessor "com.google.guava:guava:32.1.2-jre"
annotationProcessor "com.google.code.gson:gson:2.8.9"
annotationProcessor (mixinBooter) {
transitive = false
}

//modCompileOnly "maven.modrinth:rubidium:0.2.13"

implementation(shadow(project(path: ":glsl-relocated", configuration: "bundledJar"))) {
transitive = false
Expand All @@ -66,27 +71,20 @@ dependencies {
transitive = false
}
shadow("org.slf4j:slf4j-api:1.7.12") // for jcpp
}

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

filesMatching("META-INF/mods.toml") {
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"

def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
}

java {
withSourcesJar()
processResources {
filesMatching("mcmod.info") { fcd ->
fcd.expand(
'mod_id': project.mod_id,
'mod_name': project.mod_name,
'mod_version': project.mod_version,
'mod_description': project.mod_description,
'minecraft_version': project.minecraft_version
)
}
}

shadowJar {
Expand All @@ -105,25 +103,4 @@ shadowJar {
'Main-Class': 'net.coderbot.iris.LaunchWarn'
)
}
}

remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
}

publishing {
publications {
mavenJava(MavenPublication) {
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}

repositories {
}
}
}
28 changes: 13 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx6G
org.gradle.jvmargs=-Xmx3G

# Fabric Properties
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.10
loader_version=0.13.2
minecraft_version=1.12.2
minecraft_version_range=[1.12,1.13)
forge_version=14.23.5.2860
forge_version_range=[23,)
loader_version_range=[23,)
mappings_channel=stable
mappings_version=39-1.12

# Mod Properties
mod_version = 1.4.8
maven_group = net.coderbot
archives_base_name = oculus

forge_version=36.2.29

loom.platform=forge

# Dependencies
fabric_version=0.42.0+1.16
mod_id=oculus
mod_name=Oculus
mod_main_class=Iris
mod_version = 1.4.7
mod_base_package = net.coderbot.iris
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-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Binary file added libs/vintagium-mc1.12.2-0.1-dev.jar
Binary file not shown.
24 changes: 18 additions & 6 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://gitlab.com/api/v4/projects/26758973/packages/maven' }
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
// RetroFuturaGradle
name = "GTNH Maven"
url = uri("http://jenkins.usrv.eu:8081/nexus/content/groups/public/")
allowInsecureProtocol = true
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroup("com.gtnewhorizons.retrofuturagradle")
}
}
maven { url "https://maven.architectury.dev/" }
maven { url "https://files.minecraftforge.net/maven/" }
gradlePluginPortal()
}
}

include("glsl-relocated")
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
}


rootProject.name = "${mod_name}"

include("glsl-relocated")
79 changes: 79 additions & 0 deletions src/main/java/it/unimi/dsi/fastutil/SafeMath.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package it.unimi.dsi.fastutil;

public final class SafeMath {
private SafeMath() {
}

public static char safeIntToChar(int value) {
if (value >= 0 && 65535 >= value) {
return (char)value;
} else {
throw new IllegalArgumentException(value + " can't be represented as char");
}
}

public static byte safeIntToByte(int value) {
if (value >= -128 && 127 >= value) {
return (byte)value;
} else {
throw new IllegalArgumentException(value + " can't be represented as byte (out of range)");
}
}

public static short safeIntToShort(int value) {
if (value >= -32768 && 32767 >= value) {
return (short)value;
} else {
throw new IllegalArgumentException(value + " can't be represented as short (out of range)");
}
}

public static char safeLongToChar(long value) {
if (value >= 0L && 65535L >= value) {
return (char)((int)value);
} else {
throw new IllegalArgumentException(value + " can't be represented as int (out of range)");
}
}

public static byte safeLongToByte(long value) {
if (value >= -128L && 127L >= value) {
return (byte)((int)value);
} else {
throw new IllegalArgumentException(value + " can't be represented as int (out of range)");
}
}

public static short safeLongToShort(long value) {
if (value >= -32768L && 32767L >= value) {
return (short)((int)value);
} else {
throw new IllegalArgumentException(value + " can't be represented as int (out of range)");
}
}

public static int safeLongToInt(long value) {
if (value >= -2147483648L && 2147483647L >= value) {
return (int)value;
} else {
throw new IllegalArgumentException(value + " can't be represented as int (out of range)");
}
}

public static float safeDoubleToFloat(double value) {
if (Double.isNaN(value)) {
return Float.NaN;
} else if (Double.isInfinite(value)) {
return value < 0.0 ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
} else if (!(value < -Float.MAX_VALUE) && !(Float.MAX_VALUE < value)) {
float floatValue = (float)value;
if ((double)floatValue != value) {
throw new IllegalArgumentException(value + " can't be represented as float (imprecise)");
} else {
return floatValue;
}
} else {
throw new IllegalArgumentException(value + " can't be represented as float (out of range)");
}
}
}
22 changes: 22 additions & 0 deletions src/main/java/it/unimi/dsi/fastutil/booleans/BooleanConsumer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package it.unimi.dsi.fastutil.booleans;

import java.util.Objects;
import java.util.function.Consumer;

@FunctionalInterface
public interface BooleanConsumer extends Consumer<Boolean> {
void accept(boolean var1);

@Deprecated
default void accept(Boolean t) {
this.accept(t.booleanValue());
}

default BooleanConsumer andThen(BooleanConsumer after) {
Objects.requireNonNull(after);
return t -> {
this.accept(t);
after.accept(t);
};
}
}
33 changes: 33 additions & 0 deletions src/main/java/it/unimi/dsi/fastutil/floats/FloatConsumer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package it.unimi.dsi.fastutil.floats;

import it.unimi.dsi.fastutil.SafeMath;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.DoubleConsumer;

@FunctionalInterface
public interface FloatConsumer extends Consumer<Float>, DoubleConsumer {
void accept(float var1);

@Deprecated
default void accept(double t) {
this.accept(SafeMath.safeDoubleToFloat(t));
}

@Deprecated
default void accept(Float t) {
this.accept(t.floatValue());
}

default FloatConsumer andThen(FloatConsumer after) {
Objects.requireNonNull(after);
return t -> {
this.accept(t);
after.accept(t);
};
}

default FloatConsumer andThen(DoubleConsumer after) {
return this.andThen(after instanceof FloatConsumer ? (FloatConsumer)after : after::accept);
}
}
Loading

1 comment on commit fd885da

@xJon
Copy link

@xJon xJon commented on fd885da Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Please sign in to comment.