Skip to content

Commit 72aea12

Browse files
Merge remote-tracking branch 'origin/1.19.4-forge' into 1.20.1-forge
2 parents b0f70f9 + 6ab535f commit 72aea12

11 files changed

Lines changed: 150 additions & 104 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repositories {
3434
}
3535
}
3636

37-
String umcVersion = "1.2.3"
37+
String umcVersion = "1.2.4"
3838
if (!"release".equalsIgnoreCase(System.getProperty("target"))) {
3939
try {
4040
umcVersion += "-" + 'git rev-parse --verify --short=7 HEAD'.execute().text.trim()

src/main/java/cam72cam/mod/ModCore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
public class ModCore {
6161
public static final String MODID = "universalmodcore";
6262
public static final String NAME = "UniversalModCore";
63-
public static final String VERSION = "1.2.3";
63+
public static final String VERSION = "1.2.4";
6464
public static ModCore instance;
6565
public static boolean hasResources;
6666
private static boolean isInReload;

src/main/java/cam72cam/mod/entity/sync/EntitySync.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ public void send() throws SerializationException {
6363
.collect(Object2IntOpenHashMap::new,
6464
(m, f) -> {
6565
TagSync tag = f.getAnnotation(TagSync.class);
66-
TagField tagField = f.getAnnotation(TagField.class);
66+
String name = f.getAnnotation(TagField.class).value();
67+
if("".equals(name)) {
68+
name = f.getName();
69+
}
6770
Class<?> type = f.getType();
6871

6972
if (type == float.class || type == Float.class) {
70-
m.put(tagField.value(), Math.max(0, Math.min(tag.floatPrecision(), 8)));
73+
m.put(name, Math.max(0, Math.min(tag.floatPrecision(), 8)));
7174
} else if (type == double.class || type == Double.class) {
72-
m.put(tagField.value(), Math.max(0, Math.min(tag.doublePrecision(), 8)));
75+
m.put(name, Math.max(0, Math.min(tag.doublePrecision(), 8)));
7376
}
7477
},
7578
Object2IntOpenHashMap::putAll);

src/main/java/cam72cam/mod/render/SpriteSheet.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private void allocateSheet() {
6060
*/
6161
public void setSprite(Identifier id, ByteBuffer pixels) {
6262
if (!sprites.containsKey(id)) {
63-
if (unallocated.size() == 0) {
63+
if (unallocated.isEmpty()) {
6464
allocateSheet();
6565
}
6666
sprites.put(id, unallocated.remove(0));
@@ -90,17 +90,11 @@ public void renderSprite(Identifier id, RenderState state) {
9090
.rotate(180, 1, 0, 0)
9191
.translate(0, -1, 0);
9292
DirectDraw buffer = new DirectDraw();
93-
94-
try (With ctx = RenderContext.apply(state)) {
95-
buffer.vertex(0, 0, 0).color(1, 1, 1, 1).uv(sprite.uMin, sprite.vMin);
96-
buffer.vertex(0, 1, 0).color(1, 1, 1, 1).uv(sprite.uMin, sprite.vMax);
97-
buffer.vertex(1, 1, 0).color(1, 1, 1, 1).uv(sprite.uMax, sprite.vMax);
98-
buffer.vertex(1, 0, 0).color(1, 1, 1, 1).uv(sprite.uMax, sprite.vMin);
99-
}
100-
;
93+
buffer.vertex(0, 0, 0).color(1, 1, 1, 1).uv(sprite.uMin, sprite.vMin);
94+
buffer.vertex(0, 1, 0).color(1, 1, 1, 1).uv(sprite.uMin, sprite.vMax);
95+
buffer.vertex(1, 1, 0).color(1, 1, 1, 1).uv(sprite.uMax, sprite.vMax);
96+
buffer.vertex(1, 0, 0).color(1, 1, 1, 1).uv(sprite.uMax, sprite.vMin);
10197
buffer.draw(state);
102-
103-
10498
}
10599

106100
/**

src/main/java/cam72cam/mod/render/opengl/RenderContext.java

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
import net.minecraft.client.renderer.ShaderInstance;
1515
import org.joml.Matrix4f;
1616
import org.lwjgl.opengl.GL11;
17+
import org.lwjgl.opengl.GL20;
1718
import org.lwjgl.opengl.GL32;
1819
import util.Matrix4;
1920

21+
import java.nio.ByteBuffer;
22+
import java.nio.ByteOrder;
23+
import java.nio.IntBuffer;
2024
import java.util.*;
2125

2226
import static cam72cam.mod.render.opengl.Texture.NO_TEXTURE;
@@ -28,6 +32,8 @@ public class RenderContext {
2832
//Modified from rendertype_entity_cutout, fix model normal
2933
public static ShaderInstance UMC_CORE;
3034

35+
private static IntBuffer fourIntBuffer;
36+
3137
public static float lastLightX;
3238
public static float lastLightY;
3339

@@ -153,19 +159,31 @@ public static With apply(RenderState state) {
153159
restore.add(state.blend.apply());
154160
}
155161

156-
//Always assume scissor test is disabled
157-
if (state.scissor_test != null && state.scissor_test && state.scissor_range != null) {
158-
int scaleFactor = (int) Minecraft.getInstance().getWindow().getGuiScale();
159-
int screenHeight = GUIHelpers.getScreenHeight() * scaleFactor;
160-
161-
int x = (int) state.scissor_range.getMinX() * scaleFactor;
162-
int y = (int) state.scissor_range.getMinY() * scaleFactor;
163-
int width = (int) state.scissor_range.getWidth() * scaleFactor;
164-
int height = (int) state.scissor_range.getHeight() * scaleFactor;
162+
if (state.scissor_test != null) {
163+
boolean oldValue = GL11.glGetBoolean(GL11.GL_SCISSOR_TEST);
164+
applyBool(GL11.GL_SCISSOR_TEST, state.scissor_test);
165+
if (state.scissor_test && state.scissor_range != null) {
166+
int scaleFactor = (int) Minecraft.getInstance().getWindow().getGuiScale();
167+
int screenHeight = GUIHelpers.getScreenHeight() * scaleFactor;
168+
169+
int x = (int) state.scissor_range.getMinX() * scaleFactor;
170+
int y = (int) state.scissor_range.getMinY() * scaleFactor;
171+
int width = (int) state.scissor_range.getWidth() * scaleFactor;
172+
int height = (int) state.scissor_range.getHeight() * scaleFactor;
173+
174+
if (fourIntBuffer == null) {
175+
//16 ints in case it overflows...
176+
fourIntBuffer = ByteBuffer.allocateDirect(64).order(ByteOrder.nativeOrder()).asIntBuffer();
177+
}
178+
fourIntBuffer.position(0);
179+
GL11.glGetIntegerv(GL11.GL_SCISSOR_BOX, fourIntBuffer);
180+
int[] oldScissor = new int[]{fourIntBuffer.get(0), fourIntBuffer.get(1), fourIntBuffer.get(2), fourIntBuffer.get(3)};
181+
restore.add(() -> GL11.glScissor(oldScissor[0], oldScissor[1], oldScissor[2], oldScissor[3]));
165182

166-
//We set origin point at Top-Left corner but OpenGL takes Bottom-Left corner, so wraps y
167-
RenderSystem.enableScissor(x, screenHeight - y - height, width, height);
168-
restore.add(RenderSystem::disableScissor);
183+
//We set origin point at Top-Left corner but OpenGL takes Bottom-Left corner, so wraps y
184+
GL11.glScissor(x, screenHeight - y - height, width, height);
185+
}
186+
restore.add(() -> applyBool(GL11.GL_SCISSOR_TEST, oldValue));
169187
}
170188

171189
if (state.stage == Stage.ITEM_SPRITE_TEX) {

src/main/resources/META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license="LGPL"
55

66
[[mods]]
77
modId="universalmodcore"
8-
version="1.2.3"
8+
version="1.2.4"
99
displayName="Universal Mod Core"
1010
displayURL="https://github.com/TeamOpenIndustry/UniversalModCore"
1111
authors="cam72cam"

src/main/resources/mixins.feat.universalmodcore.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"minVersion": "0.8.2",
88
"compatibilityLevel": "JAVA_17",
99
"mixinPriority": 1300,
10+
"mixinextras": {
11+
"minVersion": "0.5.0"
12+
},
1013
"mixins": [
1114
"data_registry.MixinAdvancement",
1215
"data_registry.MixinMinecraftServer",

src/main/resources/mixins.fix.universalmodcore.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"minVersion": "0.8.2",
77
"compatibilityLevel": "JAVA_8",
88
"mixinPriority": 1301,
9+
"mixinextras": {
10+
"minVersion": "0.5.0"
11+
},
912
"mixins": [
1013
"always_shown_tab.MixinCreativeModeTab",
1114
"custom_bb_collision.MixinVoxelShapes",
Lines changed: 80 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,103 @@
11
//BUILDSCRIPT//
2-
buildscript {
3-
repositories {
4-
maven { url = "https://maven.minecraftforge.net/" }
5-
mavenCentral()
6-
}
7-
dependencies {
8-
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.69', changing: true
9-
}
2+
plugins {
3+
id 'java'
4+
id 'eclipse'
5+
//A customized fork for better support on Cleanroom
6+
id 'xyz.wagyourtail.unimined' version "1.4.18-kappa"
7+
id 'com.gradleup.shadow' version "9.4.1"
8+
id "maven-publish"
9+
id 'xyz.wagyourtail.jvmdowngrader' version '1.3.6'
10+
}
11+
configurations {
12+
umcShade
13+
modImplementation.extendsFrom umcShade
1014
}
1115

1216
//PLUGINS//
13-
apply plugin: 'net.minecraftforge.gradle'
14-
apply plugin: 'eclipse'
1517

1618
//MINECRAFT//
17-
sourceSets {
18-
main {
19-
resources {
20-
srcDirs = [
21-
"$rootDir/src/main/resources",
22-
"$rootDir/src/generated/resources"
23-
]
24-
}
19+
java {
20+
toolchain {
21+
languageVersion = JavaLanguageVersion.of(25)
2522
}
23+
24+
withSourcesJar()
25+
}
26+
27+
tasks.withType(JavaCompile).configureEach {
28+
options.release = 25
2629
}
27-
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
28-
29-
minecraft {
30-
mappings channel: 'official', version: '1.20.1'
31-
runs {
32-
client {
33-
workingDirectory project.file('run')
34-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
35-
property 'forge.logging.console.level', 'debug'
36-
mods {
37-
#ID# {
38-
source sourceSets.main
39-
}
40-
}
41-
}
42-
43-
server {
44-
workingDirectory project.file('run')
45-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
46-
property 'forge.logging.console.level', 'debug'
47-
mods {
48-
#ID# {
49-
source sourceSets.main
50-
}
51-
}
52-
}
53-
54-
data {
55-
workingDirectory project.file('run')
56-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
57-
property 'forge.logging.console.level', 'debug'
58-
args '--mod', '#ID#', '--all', '--output', file('src/generated/resources/')
59-
mods {
60-
#ID# {
61-
source sourceSets.main
62-
}
63-
}
64-
}
30+
31+
jvmdg {
32+
quiet = false
33+
downgradeTo = JavaVersion.VERSION_1_8
34+
multiReleaseOriginal = true
35+
shadeInlining = false
36+
dg(configurations.umcShade, false)
37+
//MR-JAR uses a Incremental Update-like strategy, so add versions here won't cause too much waste
38+
multiReleaseVersions = [
39+
JavaVersion.VERSION_1_8, // 1.16 and below
40+
JavaVersion.VERSION_16, // 1.17
41+
JavaVersion.VERSION_17, // 1.18 - 1.20
42+
JavaVersion.VERSION_21, // 1.21
43+
JavaVersion.VERSION_25 // 26.1 and beyond as well as modern 1.7.10/1.12.2
44+
].toSet()
45+
}
46+
47+
unimined.minecraft {
48+
version "1.20.1"
49+
50+
mappings {
51+
mojmap()
52+
parchment("1.20.1", "2023.09.03")
53+
}
54+
55+
minecraftForge {
56+
loader("47.4.20")
6557
}
58+
59+
defaultRemapJar = true
6660
}
6761

6862
//DEPENDENCIES//
6963
#UMC_REPO#
7064

7165
dependencies {
72-
minecraft 'net.minecraftforge:forge:1.20.1-47.1.46'
7366
implementation group: 'javax.vecmath', name: 'vecmath', version: '1.5.2'
74-
// No need in FG3+
75-
// runtime "net.minecrell:terminalconsoleappender:1.3.0"
76-
implementation fg.deobf(#UMC_DEPENDENCY#)
67+
modImplementation #UMC_DEPENDENCY#
7768
}
7869

7970
//JAR//
8071
jar {
81-
manifest {
82-
attributes([
83-
"Specification-Title": "#ID#",
84-
"Specification-Vendor": "#ID#",
85-
"Specification-Version": "1", // We are version 1 of ourselves
86-
"Implementation-Title": project.name,
87-
"Implementation-Version": "${version}",
88-
"Implementation-Vendor" :"#ID#",
89-
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
90-
])
91-
}
72+
enabled = false
9273
}
93-
jar.finalizedBy('reobfJar')
9474

95-
tasks.withType(JavaCompile).configureEach {
96-
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
75+
shadowJar {
76+
configurations = [project.configurations.umcShade]
77+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
78+
mergeServiceFiles()
79+
archiveClassifier = 'shadow'
80+
}
81+
82+
remapJar {
83+
inputFile = tasks.shadeDowngradedApi.archiveFile
84+
dependsOn(tasks.named("shadowJar"))
85+
archiveClassifier = ''
86+
}
87+
88+
tasks.named("assemble") {
89+
dependsOn(tasks.named("remapJar"))
90+
}
91+
92+
processResources {
93+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
94+
inputs.property "version", project.version
95+
inputs.property "mcversion", "#MINECRAFT#"
96+
from(sourceSets.main.resources.srcDirs) {
97+
include 'mcmod.info'
98+
expand 'version':project.version, 'mcversion':"#MINECRAFT#"
99+
}
100+
from(sourceSets.main.resources.srcDirs) {
101+
exclude 'mcmod.info'
102+
}
97103
}

src/main/resources/template/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip

0 commit comments

Comments
 (0)