mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-18 11:29:08 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36d98fcb22 | ||
|
|
44c5b9617a | ||
|
|
f3f1677db8 | ||
|
|
d396b611ad | ||
|
|
08f4c0f9db | ||
|
|
50b0d22dc2 |
No files matched your search
+1
-1
@@ -16,5 +16,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.13")
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.18")
|
||||
}
|
||||
@@ -314,7 +314,7 @@ public enum Mixins implements IMixins {
|
||||
.setPhase(Phase.LATE)
|
||||
.addRequiredMod(TargetedMod.NTM_SPACE)
|
||||
.setApplyIf(() -> CompatConfig.fixNTMSpace && AngelicaConfig.enableIris)
|
||||
.addClientMixins("client.ntmSpace.MixinSkyProviderCelestial_ShaderCompat")),
|
||||
.addClientMixins("client.ntmSpace.MixinSkyProviderCelestial_ShaderCompat", "client.ntmSpace.MixinSkyProviderLaytheSunset")),
|
||||
|
||||
SPEEDUP_CAMPFIRE_BACKPORT_ANIMATIONS(new MixinBuilder("Add animation speedup support to Campfire Backport")
|
||||
.setPhase(Phase.LATE)
|
||||
|
||||
+9
-6
@@ -132,6 +132,14 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
int ptr = 0;
|
||||
final int numQuads = vertexCount / 4;
|
||||
|
||||
final int blockX = blockRenderContext.localPosX;
|
||||
final int blockY = blockRenderContext.localPosY;
|
||||
final int blockZ = blockRenderContext.localPosZ;
|
||||
final int worldX = originX + blockX;
|
||||
final int worldY = originY + blockY;
|
||||
final int worldZ = originZ + blockZ;
|
||||
final boolean isEmissive = useAoCalculation && QuadLightingHelper.isBlockEmissive(worldSlice, worldX, worldY, worldZ);
|
||||
|
||||
for (int quadIdx = 0; quadIdx < numQuads; quadIdx++) {
|
||||
float uSum = 0, vSum = 0;
|
||||
|
||||
@@ -171,11 +179,6 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
}
|
||||
|
||||
if (useAoCalculation) {
|
||||
final int blockX = blockRenderContext.localPosX;
|
||||
final int blockY = blockRenderContext.localPosY;
|
||||
final int blockZ = blockRenderContext.localPosZ;
|
||||
|
||||
final boolean isEmissive = LightDataAccess.unpackEM(lightDataCache.get(originX + blockX, originY + blockY, originZ + blockZ));
|
||||
final boolean quadIsFullBright = QuadLightingHelper.isQuadFullBright(vertices);
|
||||
|
||||
if (isEmissive || quadIsFullBright) {
|
||||
@@ -192,7 +195,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
final ModelQuadFacing lightFace = quadView.getLightFace();
|
||||
final LightPipeline pipeline = blockAllowsSmoothLighting ? smoothLightPipeline : flatLightPipeline;
|
||||
final ModelQuadFacing cullFace = quadView.getCullFace();
|
||||
pipeline.calculate(quadView, originX + blockX, originY + blockY, originZ + blockZ, quadLightData, cullFace, lightFace, shade, true);
|
||||
pipeline.calculate(quadView, worldX, worldY, worldZ, quadLightData, cullFace, lightFace, shade, true);
|
||||
}
|
||||
|
||||
for (int vIdx = 0; vIdx < 4; vIdx++) {
|
||||
|
||||
+1
-12
@@ -35,17 +35,6 @@ public class LightDataCache extends LightDataAccess {
|
||||
// Opacity check - true if block is view-blocking (solid blocks)
|
||||
final boolean op = block.getMaterial().isOpaque() && block.getLightOpacity() > 0;
|
||||
|
||||
boolean em;
|
||||
if (lu > 0) {
|
||||
em = true;
|
||||
} else {
|
||||
try {
|
||||
em = block.getMixedBrightnessForBlock(EmptyBlockAccess.INSTANCE, x, y, z) == QuadLightingHelper.FULL_BRIGHT_15;
|
||||
} catch (Exception e) {
|
||||
em = false;
|
||||
}
|
||||
}
|
||||
|
||||
return packFC(fc) | packFO(fo) | packOP(op) | packEM(em) | packAO(ao) | packLU(lu) | packSL(sl) | packBL(bl);
|
||||
return packFC(fc) | packFO(fo) | packOP(op) | packAO(ao) | packLU(lu) | packSL(sl) | packBL(bl);
|
||||
}
|
||||
}
|
||||
+11
@@ -1,5 +1,7 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas.light;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkVertexEncoder;
|
||||
|
||||
public final class QuadLightingHelper {
|
||||
@@ -9,6 +11,15 @@ public final class QuadLightingHelper {
|
||||
public static final int FULL_BRIGHT_15 = (15 << 20) | (15 << 4); // 15728880
|
||||
public static final int FULL_BRIGHT_14 = (14 << 20) | (14 << 4); // 14680288
|
||||
|
||||
public static boolean isBlockEmissive(IBlockAccess world, int x, int y, int z) {
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
try {
|
||||
return block.getMixedBrightnessForBlock(EmptyBlockAccess.INSTANCE, x, y, z) == FULL_BRIGHT_15;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isQuadFullBright(ChunkVertexEncoder.Vertex[] vertices) {
|
||||
final int first = vertices[0].light;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.coderbot.iris.pipeline.transform.PatchShaderType;
|
||||
import net.coderbot.iris.rendertarget.RenderTargets;
|
||||
import net.coderbot.iris.uniforms.CommonUniforms;
|
||||
import net.coderbot.iris.uniforms.builtin.BuiltinReplacementUniforms;
|
||||
import net.coderbot.iris.shaderpack.ProgramSource;
|
||||
import net.coderbot.iris.uniforms.custom.CustomUniforms;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -60,124 +61,82 @@ public class CeleritasTerrainPipeline {
|
||||
IntFunction<ProgramImages> createTerrainImages,
|
||||
IntFunction<ProgramImages> createShadowImages,
|
||||
CustomUniforms customUniforms,
|
||||
String terrainSourceName,
|
||||
String translucentSourceName,
|
||||
String shadowSourceName,
|
||||
Optional<ProgramSource> terrainSource,
|
||||
Optional<ProgramSource> translucentSource,
|
||||
Optional<ProgramSource> shadowSource,
|
||||
CompletableFuture<Map<PatchShaderType, String>> terrainFuture,
|
||||
CompletableFuture<Map<PatchShaderType, String>> translucentFuture,
|
||||
CompletableFuture<Map<PatchShaderType, String>> shadowFuture,
|
||||
RenderTargets renderTargets,
|
||||
ImmutableSet<Integer> flippedAfterPrepare,
|
||||
ImmutableSet<Integer> flippedAfterTranslucent,
|
||||
@Nullable GlFramebuffer shadowFramebuffer,
|
||||
int[] terrainDrawBuffers
|
||||
@Nullable GlFramebuffer shadowFramebuffer
|
||||
) {
|
||||
this.customUniforms = customUniforms;
|
||||
|
||||
// Initialize PassInfo for each pass
|
||||
for (IrisTerrainPass pass : IrisTerrainPass.VALUES) {
|
||||
passInfoMap.put(pass, new PassInfo());
|
||||
}
|
||||
|
||||
// Process terrain shaders (used for GBUFFER_SOLID and GBUFFER_CUTOUT)
|
||||
if (terrainFuture != null) {
|
||||
try {
|
||||
final Map<PatchShaderType, String> result = terrainFuture.join();
|
||||
final PassInfo solidInfo = passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID);
|
||||
final PassInfo cutoutInfo = passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT);
|
||||
|
||||
solidInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
|
||||
solidInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
|
||||
solidInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
|
||||
|
||||
cutoutInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
|
||||
cutoutInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
|
||||
cutoutInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
|
||||
|
||||
PatchedShaderPrinter.debugPatchedShaders(terrainSourceName + "_celeritas",
|
||||
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
|
||||
} catch (Exception e) {
|
||||
Iris.logger.error("Failed to transform terrain shader for Celeritas: {}", terrainSourceName, e);
|
||||
throw new RuntimeException("Shader transformation failed for " + terrainSourceName, e);
|
||||
}
|
||||
}
|
||||
|
||||
// Process translucent shaders (used for GBUFFER_TRANSLUCENT)
|
||||
if (translucentFuture != null) {
|
||||
try {
|
||||
final Map<PatchShaderType, String> result = translucentFuture.join();
|
||||
final PassInfo translucentInfo = passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT);
|
||||
|
||||
translucentInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
|
||||
translucentInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
|
||||
translucentInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
|
||||
|
||||
PatchedShaderPrinter.debugPatchedShaders(translucentSourceName + "_celeritas",
|
||||
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
|
||||
} catch (Exception e) {
|
||||
Iris.logger.error("Failed to transform translucent shader for Celeritas: {}", translucentSourceName, e);
|
||||
throw new RuntimeException("Shader transformation failed for " + translucentSourceName, e);
|
||||
}
|
||||
}
|
||||
|
||||
// Process shadow shaders (used for SHADOW and SHADOW_CUTOUT)
|
||||
if (shadowFuture != null) {
|
||||
try {
|
||||
final Map<PatchShaderType, String> result = shadowFuture.join();
|
||||
final PassInfo shadowInfo = passInfoMap.get(IrisTerrainPass.SHADOW);
|
||||
final PassInfo shadowCutoutInfo = passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT);
|
||||
|
||||
shadowInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
|
||||
shadowInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
|
||||
shadowInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
|
||||
|
||||
shadowCutoutInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
|
||||
shadowCutoutInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
|
||||
shadowCutoutInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
|
||||
|
||||
PatchedShaderPrinter.debugPatchedShaders(shadowSourceName + "_celeritas",
|
||||
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
|
||||
} catch (Exception e) {
|
||||
Iris.logger.error("Failed to transform shadow shader for Celeritas: {}", shadowSourceName, e);
|
||||
throw new RuntimeException("Shader transformation failed for " + shadowSourceName, e);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up framebuffers for each pass
|
||||
// Shadow passes use the shadow framebuffer
|
||||
if (shadowFramebuffer != null) {
|
||||
passInfoMap.get(IrisTerrainPass.SHADOW).framebuffer = shadowFramebuffer;
|
||||
passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT).framebuffer = shadowFramebuffer;
|
||||
}
|
||||
|
||||
// GBuffer passes use render target framebuffers
|
||||
if (renderTargets != null && terrainDrawBuffers != null) {
|
||||
final GlFramebuffer solidFb = renderTargets.createGbufferFramebuffer(flippedAfterPrepare, terrainDrawBuffers);
|
||||
final GlFramebuffer translucentFb = renderTargets.createGbufferFramebuffer(flippedAfterTranslucent, terrainDrawBuffers);
|
||||
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID).framebuffer = solidFb;
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT).framebuffer = solidFb;
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT).framebuffer = translucentFb;
|
||||
}
|
||||
|
||||
// Set blend mode overrides
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID).blendModeOverride = BlendModeOverride.OFF;
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT).blendModeOverride = BlendModeOverride.OFF;
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT).blendModeOverride = null; // Default blending
|
||||
passInfoMap.get(IrisTerrainPass.SHADOW).blendModeOverride = BlendModeOverride.OFF;
|
||||
passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT).blendModeOverride = BlendModeOverride.OFF;
|
||||
|
||||
// Set alpha references
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID).alphaReference = 0.0f;
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT).alphaReference = 0.1f;
|
||||
passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT).alphaReference = 0.0f;
|
||||
passInfoMap.get(IrisTerrainPass.SHADOW).alphaReference = 0.0f;
|
||||
passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT).alphaReference = 0.1f;
|
||||
|
||||
this.createTerrainSamplers = createTerrainSamplers;
|
||||
this.createShadowSamplers = createShadowSamplers;
|
||||
this.createTerrainImages = createTerrainImages;
|
||||
this.createShadowImages = createShadowImages;
|
||||
|
||||
// Build program source map (local - only needed during construction)
|
||||
final EnumMap<IrisTerrainPass, Optional<ProgramSource>> gbufferProgramSource = new EnumMap<>(IrisTerrainPass.class);
|
||||
gbufferProgramSource.put(IrisTerrainPass.GBUFFER_SOLID, terrainSource);
|
||||
gbufferProgramSource.put(IrisTerrainPass.GBUFFER_CUTOUT, terrainSource);
|
||||
gbufferProgramSource.put(IrisTerrainPass.GBUFFER_TRANSLUCENT, translucentSource.isPresent() ? translucentSource : terrainSource);
|
||||
gbufferProgramSource.put(IrisTerrainPass.SHADOW, shadowSource);
|
||||
|
||||
// Initialize PassInfo, framebuffers, blend modes, and alpha in single pass
|
||||
for (IrisTerrainPass pass : IrisTerrainPass.VALUES) {
|
||||
PassInfo passInfo = new PassInfo();
|
||||
passInfoMap.put(pass, passInfo);
|
||||
|
||||
// Set up framebuffer
|
||||
if (pass == IrisTerrainPass.SHADOW || pass == IrisTerrainPass.SHADOW_CUTOUT) {
|
||||
passInfo.framebuffer = shadowFramebuffer;
|
||||
} else if (renderTargets != null) {
|
||||
ImmutableSet<Integer> flipped = pass == IrisTerrainPass.GBUFFER_TRANSLUCENT ? flippedAfterTranslucent : flippedAfterPrepare;
|
||||
|
||||
Optional<ProgramSource> programSource = gbufferProgramSource.get(pass);
|
||||
programSource.ifPresentOrElse(source -> passInfo.framebuffer = renderTargets.createGbufferFramebuffer(flipped, source.getDirectives().getDrawBuffers()), () -> passInfo.framebuffer = renderTargets.createGbufferFramebuffer(flipped, new int[] {0}));
|
||||
}
|
||||
|
||||
// Set blend mode override
|
||||
passInfo.blendModeOverride = switch (pass) {
|
||||
case GBUFFER_TRANSLUCENT -> null; // Default blending
|
||||
default -> BlendModeOverride.OFF;
|
||||
};
|
||||
|
||||
// Set alpha reference
|
||||
passInfo.alphaReference = switch (pass) {
|
||||
case GBUFFER_CUTOUT, SHADOW_CUTOUT -> 0.1f;
|
||||
default -> 0.0f;
|
||||
};
|
||||
}
|
||||
|
||||
// Process and apply shader sources
|
||||
processShaderFuture(terrainFuture, terrainSource, passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID), passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT));
|
||||
processShaderFuture(translucentFuture, translucentSource, passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT));
|
||||
processShaderFuture(shadowFuture, shadowSource, passInfoMap.get(IrisTerrainPass.SHADOW), passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT));
|
||||
}
|
||||
|
||||
private void processShaderFuture(@Nullable CompletableFuture<Map<PatchShaderType, String>> future, Optional<ProgramSource> source, PassInfo... targets) {
|
||||
if (future == null || source.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final String sourceName = source.get().getName();
|
||||
try {
|
||||
final Map<PatchShaderType, String> result = future.join();
|
||||
for (PassInfo target : targets) {
|
||||
target.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
|
||||
target.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
|
||||
target.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
|
||||
}
|
||||
PatchedShaderPrinter.debugPatchedShaders(sourceName + "_celeritas",
|
||||
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
|
||||
} catch (Exception e) {
|
||||
Iris.logger.error("Failed to transform shader for Celeritas: {}", sourceName, e);
|
||||
throw new RuntimeException("Shader transformation failed for " + sourceName, e);
|
||||
}
|
||||
}
|
||||
|
||||
public PassInfo getPassInfo(IrisTerrainPass pass) {
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float delta) {
|
||||
GLStateManager.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
if(dirty) {
|
||||
dirty = false;
|
||||
this.initGui();
|
||||
@@ -174,7 +174,7 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
|
||||
} else {
|
||||
this.fontRendererObj.drawStringWithShadow(irisTextComponent, 2, this.height - 10, 0xFFFFFF);
|
||||
}
|
||||
|
||||
|
||||
GLStateManager.glPopAttrib();
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
|
||||
}
|
||||
|
||||
public boolean isDisplayingComment() {
|
||||
return this.hoveredElementCommentTimer > 20 &&
|
||||
return this.hoveredElementCommentTimer > 10 &&
|
||||
this.hoveredElementCommentTitle.isPresent() &&
|
||||
!this.hoveredElementCommentBody.isEmpty();
|
||||
}
|
||||
|
||||
@@ -524,19 +524,16 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
final GlFramebuffer celeritasShadowFb = (shadowRenderTargets != null && shadowRenderer != null)
|
||||
? shadowRenderTargets.createShadowFramebuffer(shadowRenderTargets.snapshot(), new int[] {0, 1})
|
||||
: null;
|
||||
final int[] celeritasTerrainDrawBuffers = terrainSource
|
||||
.map(source -> source.getDirectives().getDrawBuffers())
|
||||
.orElse(new int[] {0});
|
||||
|
||||
this.celeritasTerrainPipeline = new CeleritasTerrainPipeline(createTerrainSamplers,
|
||||
shadowRenderer == null ? null : createShadowTerrainSamplers, createTerrainImages,
|
||||
shadowRenderer == null ? null : createShadowTerrainImages, this.customUniforms,
|
||||
terrainSource.map(ProgramSource::getName).orElse(null),
|
||||
translucentSource.map(ProgramSource::getName).orElse(null),
|
||||
shadowSource.map(ProgramSource::getName).orElse(null),
|
||||
terrainSource,
|
||||
translucentSource,
|
||||
shadowSource,
|
||||
celeritasTerrainFuture, celeritasTranslucentFuture, celeritasShadowFuture,
|
||||
renderTargets, flippedAfterPrepare, flippedAfterTranslucent,
|
||||
celeritasShadowFb, celeritasTerrainDrawBuffers);
|
||||
celeritasShadowFb);
|
||||
|
||||
this.dhCompat = new DHCompat();
|
||||
}
|
||||
|
||||
@@ -203,7 +203,14 @@ public class ShaderPack {
|
||||
this.shaderPackOptions = new ShaderPackOptions(graph, changedConfigs);
|
||||
graph = this.shaderPackOptions.getIncludes();
|
||||
|
||||
Iterable<StringPair> finalEnvironmentDefines = environmentDefines;
|
||||
List<StringPair> finalEnvironmentDefines = new ArrayList<>();
|
||||
environmentDefines.forEach(finalEnvironmentDefines::add);
|
||||
for (FeatureFlags flag : FeatureFlags.values()) {
|
||||
if (flag.isUsable()) {
|
||||
finalEnvironmentDefines.add(new StringPair("IRIS_FEATURE_" + flag.name(), ""));
|
||||
}
|
||||
}
|
||||
|
||||
this.shaderProperties = Optional.ofNullable(readProperties(root, "shaders.properties"))
|
||||
.map(source -> new ShaderProperties(source, shaderPackOptions, finalEnvironmentDefines))
|
||||
.orElseGet(ShaderProperties::empty);
|
||||
@@ -220,15 +227,6 @@ public class ShaderPack {
|
||||
IrisApi.getInstance().getConfig().setShadersEnabledAndApply(false);
|
||||
}
|
||||
|
||||
List<String> optionalFeatureFlags = shaderProperties.getOptionalFeatureFlags().stream().filter(flag -> !FeatureFlags.isInvalid(flag)).collect(Collectors.toList());
|
||||
|
||||
if (!optionalFeatureFlags.isEmpty()) {
|
||||
List<StringPair> newEnvDefines = new ArrayList<>();
|
||||
environmentDefines.forEach(newEnvDefines::add);
|
||||
optionalFeatureFlags.forEach(flag -> newEnvDefines.add(new StringPair("IRIS_FEATURE_" + flag, "")));
|
||||
environmentDefines = ImmutableList.copyOf(newEnvDefines);
|
||||
}
|
||||
|
||||
ProfileSet profiles = ProfileSet.fromTree(shaderProperties.getProfiles(), this.shaderPackOptions.getOptionSet());
|
||||
this.profile = profiles.scan(this.shaderPackOptions.getOptionSet(), this.shaderPackOptions.getOptionValues());
|
||||
|
||||
|
||||
@@ -26,10 +26,11 @@ public class ItemMaterialHelper {
|
||||
|
||||
/**
|
||||
* Get the material ID for an ItemStack.
|
||||
* Checks item.properties first, then block.properties if the item is an ItemBlock.
|
||||
* For ItemBlock: checks block.properties first, then item.properties.
|
||||
* For other items: checks item.properties only.
|
||||
*
|
||||
* @param itemStack The item stack to get material ID for
|
||||
* @return The material ID, or -1 if not found in either map
|
||||
* @return The material ID, or -1 if not found
|
||||
*/
|
||||
public static int getMaterialId(ItemStack itemStack) {
|
||||
if (itemStack == null || itemStack.getItem() == null) {
|
||||
@@ -68,50 +69,42 @@ public class ItemMaterialHelper {
|
||||
|
||||
/**
|
||||
* Perform the actual material ID lookup without caching.
|
||||
*
|
||||
* For block items (ItemBlock): use block.properties first, then fall back to item.properties.
|
||||
* For non-block items: use item.properties only.
|
||||
*
|
||||
* This matches modern Iris behavior where block items use block IDs and non-block items use item IDs.
|
||||
*/
|
||||
private static int lookupMaterialId(Item item, int metadata) {
|
||||
String itemIdString = (String) Item.itemRegistry.getNameForObject(item);
|
||||
if (itemIdString == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ResourceLocation itemId = new ResourceLocation(itemIdString);
|
||||
NamespacedId namespacedId = new NamespacedId(itemId.getResourceDomain(), itemId.getResourcePath());
|
||||
|
||||
// First, check item.properties
|
||||
Object2IntFunction<NamespacedId> itemIds = BlockRenderingSettings.INSTANCE.getItemIds();
|
||||
if (itemIds != null) {
|
||||
int id = itemIds.applyAsInt(namespacedId);
|
||||
if (id != -1) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
// Second, check block.properties if this is an ItemBlock
|
||||
// For ItemBlock: check block.properties first
|
||||
if (item instanceof ItemBlock) {
|
||||
ItemBlock itemBlock = (ItemBlock) item;
|
||||
Block block = itemBlock.field_150939_a; // The block this item places
|
||||
final ItemBlock itemBlock = (ItemBlock) item;
|
||||
final Block block = itemBlock.field_150939_a; // The block this item places
|
||||
|
||||
if (block == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Convert item damage to block metadata
|
||||
int blockMeta = itemBlock.getMetadata(metadata);
|
||||
|
||||
Reference2ObjectMap<Block, Int2IntMap> blockMetaMatches = BlockRenderingSettings.INSTANCE.getBlockMetaMatches();
|
||||
if (blockMetaMatches != null) {
|
||||
Int2IntMap metaMap = blockMetaMatches.get(block);
|
||||
if (metaMap != null) {
|
||||
int id = metaMap.get(blockMeta);
|
||||
if (id != -1) {
|
||||
return id;
|
||||
if (block != null) {
|
||||
Reference2ObjectMap<Block, Int2IntMap> blockMetaMatches = BlockRenderingSettings.INSTANCE.getBlockMetaMatches();
|
||||
if (blockMetaMatches != null) {
|
||||
Int2IntMap metaMap = blockMetaMatches.get(block);
|
||||
if (metaMap != null) {
|
||||
int id = metaMap.get(itemBlock.getMetadata(metadata));
|
||||
if (id != -1) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Not found in either map
|
||||
// Fall back to item.properties
|
||||
Object2IntFunction<NamespacedId> itemIds = BlockRenderingSettings.INSTANCE.getItemIds();
|
||||
if (itemIds != null) {
|
||||
String itemIdString = (String) Item.itemRegistry.getNameForObject(item);
|
||||
if (itemIdString != null) {
|
||||
ResourceLocation itemId = new ResourceLocation(itemIdString);
|
||||
return itemIds.applyAsInt(new NamespacedId(itemId.getResourceDomain(), itemId.getResourcePath()));
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+11
@@ -20,6 +20,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(RendererLivingEntity.class)
|
||||
public class MixinRendererLivingEntity {
|
||||
/**
|
||||
* Reset currentRenderedItemId at the start of rendering each living entity, otherwise entity materials don't apply.
|
||||
*/
|
||||
@Inject(
|
||||
method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void iris$resetItemIdAtStart(EntityLivingBase entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(0);
|
||||
}
|
||||
|
||||
@WrapOperation(
|
||||
method="doRender",
|
||||
at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;getColorMultiplier(Lnet/minecraft/entity/EntityLivingBase;FF)I")
|
||||
|
||||
+25
-5
@@ -30,10 +30,29 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(value = SkyProviderCelestial.class, priority = 100)
|
||||
public class MixinSkyProviderCelestial_ShaderCompat {
|
||||
|
||||
/// Simple white 2x2 texture
|
||||
@Unique
|
||||
private static ResourceLocation GL_TEXTURE_2D_WORKAROUND = new ResourceLocation("angelica:textures/shaders_workaround.png"); /// Simple white 2x2 texture
|
||||
private static ResourceLocation GL_TEXTURE_2D_WORKAROUND = new ResourceLocation("angelica:textures/shaders_workaround.png");
|
||||
|
||||
/// Fixes
|
||||
// Fixes
|
||||
|
||||
/**
|
||||
* Disables {@link GL11#glDisable(int GL_TEXTURE_2D)} call
|
||||
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
|
||||
*/
|
||||
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 0), remap = false)
|
||||
private boolean iris$sunset$revertTextureDisable(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables {@link GL11#glEnable(int GL_TEXTURE_2D)} call
|
||||
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
|
||||
*/
|
||||
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 0), remap = false)
|
||||
private boolean iris$sunsetBlend$revertTextureEnable(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces sunset to render with the default program
|
||||
@@ -41,13 +60,14 @@ public class MixinSkyProviderCelestial_ShaderCompat {
|
||||
* Fixes sunset not rendering at all with shaders enabled
|
||||
*/
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;)V"), remap = false)
|
||||
public void iris$sunset$renderInDefaultProgram(CallbackInfo ci, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
|
||||
public void iris$sunset$renderInDefaultProgram(CallbackInfo ci, @Local(argsOnly = true) Minecraft mc, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
|
||||
sunset$previousProgram.set(GLStateManager.getActiveProgram());
|
||||
GLStateManager.glUseProgram(0);
|
||||
mc.getTextureManager().bindTexture(GL_TEXTURE_2D_WORKAROUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the program back before {@link #iris$sunset$renderInDefaultProgram(CallbackInfo, LocalIntRef)} call
|
||||
* Sets the program back before {@link #iris$sunset$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)} call
|
||||
*/
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;)V", shift = At.Shift.AFTER), remap = false)
|
||||
public void iris$sunset$restorePreviousProgram(CallbackInfo ci, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
|
||||
@@ -200,7 +220,7 @@ public class MixinSkyProviderCelestial_ShaderCompat {
|
||||
GLStateManager.glUseProgram(ringsFront$previousProgram.get());
|
||||
}
|
||||
|
||||
/// Pipeline setup
|
||||
// Pipeline setup
|
||||
|
||||
@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/Tessellator;instance:Lnet/minecraft/client/renderer/Tessellator;"))
|
||||
private void iris$renderSky$beginNormalSky(CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.gtnewhorizons.angelica.mixins.late.client.ntmSpace;
|
||||
|
||||
import com.hbm.dim.laythe.SkyProviderLaytheSunset;
|
||||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@Mixin(value = SkyProviderLaytheSunset.class, priority = 100)
|
||||
public class MixinSkyProviderLaytheSunset {
|
||||
|
||||
/**
|
||||
* Disables {@link GL11#glDisable(int GL_TEXTURE_2D)} call
|
||||
*/
|
||||
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 0), remap = false)
|
||||
private boolean iris$sunset$revertTextureDisable(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables {@link GL11#glEnable(int GL_TEXTURE_2D)} call
|
||||
*/
|
||||
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 0), remap = false)
|
||||
private boolean iris$sunsetBlend$revertTextureEnable(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user