Compare commits

..
Author SHA1 Message Date
Jason Mitchell e9257b8739 Fixes (#1251) 2026-01-10 15:20:19 -08:00
Jason Mitchell 3984225faa Better OSX J8 Support (#1248) 2026-01-09 12:58:42 -08:00
Jason Mitchell 52db6b56d6 Fix GLSL 120 support (#1243) 2026-01-08 21:34:40 -08:00
Jason Mitchell 34bfe513f1 Maybe less deadlock-y (#1241) 2026-01-08 20:53:32 -08:00
Jason Mitchell 42d7ed58aa 2.0.0 Alpha1 Fixes (#1240) 2026-01-08 19:26:56 -08:00
16 changed files with 168 additions and 35 deletions

No files matched your search

+8 -2
View File
@@ -55,6 +55,12 @@ configurations {
testCompileClasspath.extendsFrom(embedOnly)
}
// Exclude self-reference from all configurations - prevents transitive Angelica deps from resolving against this project
configurations.all {
exclude group: "com.github.GTNewHorizons", module: "Angelica"
}
dependencies {
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.14:dev")
@@ -74,8 +80,8 @@ dependencies {
compileOnly "org.apache.ant:ant:1.8.2"
// Celeritas (transitive=false: deps provided by GTNHLib/runtime)
embedOnly("org.embeddedt.celeritas:celeritas-common:2.5.0-GTNH") { transitive = false }
embedOnly("org.embeddedt.celeritas:celeritas-lwjgl2-service:2.5.0-GTNH") { transitive = false }
embedOnly("org.embeddedt.celeritas:celeritas-common:2.5.1-GTNH") { transitive = false }
embedOnly("org.embeddedt.celeritas:celeritas-lwjgl2-service:2.5.1-GTNH") { transitive = false }
// Because who doesn't want NEI
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.35-GTNH:dev')
+32 -2
View File
@@ -39,11 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jvmDowngrader
jvmDowngraderStubsProvider = gtnhlib
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
jvmDowngraderMultiReleaseVersions = 17, 21, 25
#forceToolchainVersion = 25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
jvmDowngraderStubsProvider = gtnhlib
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
@@ -57,6 +79,14 @@ generateGradleTokenClass = com.gtnewhorizons.angelica.Tags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = VERSION
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
# replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
Binary file not shown.
Vendored
+2 -5
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+1 -2
View File
@@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line
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 %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
+1 -1
View File
@@ -16,5 +16,5 @@ pluginManagement {
}
plugins {
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.11")
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.13")
}
@@ -369,6 +369,8 @@ public class DisplayListManager {
// Flush any pending delta, then record pop.
flushMatrix();
currentRecorder.recordPopMatrix();
// Invalidate cached transform
matrixGeneration++;
}
public static void recordViewport(int x, int y, int width, int height) {
@@ -3,6 +3,9 @@ package com.gtnewhorizons.angelica.mixins.interfaces;
import it.unimi.dsi.fastutil.longs.Long2ReferenceMap;
import org.embeddedt.embeddium.impl.render.chunk.RenderSection;
import java.util.concurrent.ConcurrentLinkedDeque;
public interface RenderSectionManagerAccessor {
Long2ReferenceMap<RenderSection> angelica$getSectionByPosition();
ConcurrentLinkedDeque<Runnable> angelica$getAsyncSubmittedTasks();
}
@@ -38,12 +38,17 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<ChunkBuildOutput> {
protected final RenderSection render;
protected final int buildTime;
protected final Vector3d camera;
private static final long DEFERRED_BLOCK_TIMEOUT_MS = 10_000; // 10 seconds
private static final int MAX_RETRIES = 2;
protected record DeferredBlock(int x, int y, int z, Block block, int meta, int pass) {}
public AngelicaChunkBuilderMeshingTask(RenderSection render, int time, Vector3d camera) {
@@ -225,10 +230,11 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
}
setRenderPass(pass);
// Trigger side effects from canRenderInPass (some ISBRHs like BuildCraft set global state in this method that gets read elsewhere renderWorldBlock)
block.canRenderInPass(pass);
tessellator.startDrawingQuads();
renderBlocks.renderBlockByRenderType(block, x, y, z);
buildContext.copyRawBuffer(tessellator.rawBuffer, tessellator.vertexCount, buffers,
passMaterial, originX, originY, originZ);
buildContext.copyRawBuffer(tessellator.rawBuffer, tessellator.vertexCount, buffers, passMaterial, originX, originY, originZ);
tessellator.reset();
tessellator.isDrawing = false;
@@ -255,13 +261,29 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
mainTessellator.setTranslation(0, 0, 0);
}, AngelicaRenderQueue.executor());
try {
future.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted during deferred block rendering", e);
} catch (ExecutionException e) {
throw new RuntimeException("Error during main thread deferred block rendering", e);
if (Thread.currentThread().isInterrupted()) {
return;
}
int retries = 0;
while (retries < MAX_RETRIES) {
try {
future.get(DEFERRED_BLOCK_TIMEOUT_MS, TimeUnit.MILLISECONDS);
return;
} catch (TimeoutException e) {
retries++;
if (Thread.currentThread().isInterrupted()) {
return;
}
if (retries >= MAX_RETRIES) {
return;
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
} catch (ExecutionException e) {
throw new RuntimeException("Error during main thread deferred block rendering", e);
}
}
}
@@ -32,6 +32,8 @@ import com.gtnewhorizons.angelica.mixins.interfaces.RenderSectionManagerAccessor
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.locks.LockSupport;
import java.util.function.BooleanSupplier;
public class AngelicaRenderSectionManager extends RenderSectionManager {
private boolean initialCameraSectionReady = false;
@@ -197,4 +199,25 @@ public class AngelicaRenderSectionManager extends RenderSectionManager {
}
super.renderLayer(matrices, pass, occlusionCamera, camera);
}
/**
* Process both asyncSubmittedTasks and AngelicaRenderQueue.TASKS.
*/
@Override
public void managedBlock(BooleanSupplier isDone) {
final RenderSectionManagerAccessor accessor = (RenderSectionManagerAccessor) this;
while (!isDone.getAsBoolean()) {
Runnable task = accessor.angelica$getAsyncSubmittedTasks().poll();
if (task != null) {
task.run();
continue;
}
if (AngelicaRenderQueue.processTasks(1) > 0) {
continue;
}
LockSupport.parkNanos("Wait", 100000L);
}
}
}
@@ -258,13 +258,14 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
@Override
public BiomeGenBase getBiomeGenForCoords(int x, int z) {
if (!blockBoxContains(this.volume, x, volume.minY, z)) {
return BiomeGenBase.plains;
}
final int relX = x - this.baseX;
final int relZ = z - this.baseZ;
final int sectionGridBlocks = SECTION_LENGTH << 4;
if (relX < 0 || relX >= sectionGridBlocks || relZ < 0 || relZ >= sectionGridBlocks) {
return BiomeGenBase.plains;
}
final BiomeGenBase biome = this.biomeData[getLocalSectionIndex(relX >> 4, 0, relZ >> 4)]
[(x & 15) | (z & 15) << 4];
return biome == null ? BiomeGenBase.plains : biome;
@@ -10,6 +10,7 @@ import net.coderbot.iris.shaderpack.StringPair;
import net.coderbot.iris.texture.format.TextureFormat;
import net.coderbot.iris.texture.format.TextureFormatLoader;
import net.coderbot.iris.uniforms.VanillaBiomeList;
import net.minecraft.world.biome.BiomeGenBase;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20;
@@ -318,6 +319,10 @@ public class StandardMacros {
}
}
// Modern biome name aliases - map modern names to 1.7.10 equivalents(ish)
addModernBiomeAlias(defines, "SWAMP", BiomeGenBase.swampland);
addModernBiomeAlias(defines, "SWAMP_HILLS", BiomeGenBase.swampland); // No hills variant in 1.7.10
// Modern biomes that don't exist in 1.7.10 - add dummy IDs that will never match
// This allows shader expressions to parse without errors while always evaluating to false/0
// Using negative IDs to avoid conflicts with actual biome IDs
@@ -331,4 +336,10 @@ public class StandardMacros {
return defines;
}
private static void addModernBiomeAlias(Map<String, String> defines, String modernName, BiomeGenBase biome) {
if (biome != null) {
defines.put("BIOME_" + modernName, String.valueOf(biome.biomeID));
}
}
}
@@ -19,6 +19,7 @@ public class PipelineManager {
private final Function<DimensionId, WorldRenderingPipeline> pipelineFactory;
private final Map<DimensionId, WorldRenderingPipeline> pipelinesPerDimension = new HashMap<>();
private WorldRenderingPipeline pipeline = new FixedFunctionWorldRenderingPipeline();
private DimensionId lastPreparedDimension = null;
@Getter
private int versionCounterForSodiumShaderReload = 0;
@@ -27,6 +28,13 @@ public class PipelineManager {
}
public WorldRenderingPipeline preparePipeline(DimensionId currentDimension) {
// Detect dimension change and do full teardown/recreation
if (lastPreparedDimension != null && lastPreparedDimension != currentDimension) {
Iris.logger.info("Dimension changed from {} to {}, reloading pipeline", lastPreparedDimension, currentDimension);
destroyPipeline();
}
lastPreparedDimension = currentDimension;
if (!pipelinesPerDimension.containsKey(currentDimension)) {
SystemTimeUniforms.COUNTER.reset();
SystemTimeUniforms.TIMER.reset();
@@ -71,6 +79,7 @@ public class PipelineManager {
pipelinesPerDimension.clear();
pipeline = null;
lastPreparedDimension = null;
versionCounterForSodiumShaderReload++;
}
@@ -28,6 +28,8 @@ import java.util.regex.Pattern;
public class ShaderTransformer {
private static final Pattern versionPattern = Pattern.compile("#version\\s+(\\d+)(?:\\s+(\\w+))?");
private static final Pattern inOutVaryingPattern = Pattern.compile("(?m)^\\s*(in|out)(\\s+)");
private static final Pattern inPattern = Pattern.compile("(?m)^\\s*(in)(\\s+)");
private static final Pattern outPattern = Pattern.compile("(?m)^\\s*(out)(\\s+)");
private static final int CACHE_SIZE = 100;
private static final Object2ObjectLinkedOpenHashMap<TransformKey<?>, Map<PatchShaderType, String>> shaderTransformationCache = new Object2ObjectLinkedOpenHashMap<>();
@@ -244,11 +246,20 @@ public class ShaderTransformer {
parts[1] = "#extension GL_EXT_gpu_shader4 : require\n" + parts[1];
formattedShader = parts[0] + "\n" + parts[1];
// Kind of GLSL 120 supports in/out specifiers, but also kind of not, and is driver dependent
// and also depends on the types of the variables, doesn't work with integers for example(at least on Nvidia)
// So we are replacing all in/out usage with varying.
Matcher inOutVaryingMatcher = inOutVaryingPattern.matcher(formattedShader);
formattedShader = inOutVaryingMatcher.replaceAll("varying$2");
// GLSL 120 compatibility for in/out specifiers:
// - Vertex shaders: "in" = vertex attribute input -> "attribute", "out" = to fragment -> "varying"
// - Fragment shaders: "in" = from vertex -> "varying", "out" = color output -> handled elsewhere
if (entry.getKey() == PatchShaderType.VERTEX) {
// In vertex shaders, "in" declarations are vertex attributes, not varyings
Matcher inMatcher = inPattern.matcher(formattedShader);
formattedShader = inMatcher.replaceAll("attribute$2");
Matcher outMatcher = outPattern.matcher(formattedShader);
formattedShader = outMatcher.replaceAll("varying$2");
} else {
// In fragment (and geometry) shaders, both in/out become varying
Matcher inOutVaryingMatcher = inOutVaryingPattern.matcher(formattedShader);
formattedShader = inOutVaryingMatcher.replaceAll("varying$2");
}
}
result.put(entry.getKey(), formattedShader);
@@ -348,16 +359,16 @@ public class ShaderTransformer {
.build();
final String chunkVertexHeader = org.embeddedt.embeddium.impl.gl.shader.ShaderParser.parseShader(
ShaderLoader.getShaderSource("sodium:include/chunk_vertex.glsl"),
ShaderLoader::getShaderSource,
constants);
ShaderLoader.getShaderSource("sodium:include/chunk_vertex.glsl"), ShaderLoader::getShaderSource, constants)
.replace("_get_relative_chunk_coord(pos) * vec3(16.0)", "vec3(_get_relative_chunk_coord(pos)) * 16.0");
return "\n\n" + chunkVertexHeader + "\n\n";
}
public static String getFormattedShader(ParseTree tree, String string) {
StringBuilder sb = new StringBuilder(string + "\n");
String[] tabHolder = {""};
final StringBuilder sb = new StringBuilder(string + "\n");
final String[] tabHolder = {""};
getFormattedShader(tree, sb, tabHolder);
return sb.toString();
}
@@ -5,6 +5,7 @@ import com.gtnewhorizons.angelica.compat.mojang.GameModeUtil;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.mixins.interfaces.IRenderGlobalExt;
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
import com.gtnewhorizons.angelica.rendering.RenderingState;
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
import com.gtnewhorizons.angelica.rendering.celeritas.CeleritasWorldRenderer;
import net.coderbot.iris.Iris;
@@ -54,6 +55,7 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
@Unique private CeleritasWorldRenderer celeritas$renderer;
@Unique private int celeritas$frame;
@Unique private float celeritas$lastFov;
@Unique
private boolean angelica$isSpectatorMode() {
@@ -183,6 +185,12 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
final double camY = viewEntity.posY + viewEntity.getEyeHeight();
final double camZ = viewEntity.posZ;
final float currentFov = RenderingState.INSTANCE.getFov();
if (currentFov != this.celeritas$lastFov) {
this.celeritas$renderer.scheduleTerrainUpdate();
this.celeritas$lastFov = currentFov;
}
final SimpleWorldRenderer.CameraState cameraState = new SimpleWorldRenderer.CameraState(
camX, camY, camZ,
viewEntity.rotationPitch, viewEntity.rotationYaw, fogDistance
@@ -8,6 +8,8 @@ import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.concurrent.ConcurrentLinkedDeque;
@Mixin(value = RenderSectionManager.class, remap = false)
public class MixinRenderSectionManager implements RenderSectionManagerAccessor {
@@ -15,8 +17,17 @@ public class MixinRenderSectionManager implements RenderSectionManagerAccessor {
@Final
private Long2ReferenceMap<RenderSection> sectionByPosition;
@Shadow
@Final
private ConcurrentLinkedDeque<Runnable> asyncSubmittedTasks;
@Override
public Long2ReferenceMap<RenderSection> angelica$getSectionByPosition() {
return sectionByPosition;
}
@Override
public ConcurrentLinkedDeque<Runnable> angelica$getAsyncSubmittedTasks() {
return asyncSubmittedTasks;
}
}