Compare commits

..
Author SHA1 Message Date
Caedis f118211257 Fix IC2 universal cell rendering w/offhand (#876) 2025-02-18 10:49:29 -08:00
RecursivePineapple 81d03ea552 Fix PBR specular & normal textures getting ignored (#874)
* Fix PBR textures not loading

- Stack was being overfilled by MemoryStack
- Added tons of logging for ignored important exceptions
- Added missing interface on mixin (should it be moved to gtnhlib?)

* Move PBR debug to angelica config

* Free malloc'd memory
2025-02-18 18:34:38 +00:00
RecursivePineapple 67c8628aeb Fix a handful of broken animations (#868)
* Fix warning

* Improve animated sprite tracking

* Fix NPE in animation code

* Fix animations for abnormally rendered items

* Swap Stack for ArrayDeque
2025-02-18 18:28:54 +00:00
embeddedt f9b9873637 Avoid checking frustum visibility of infinite bounding boxes 2025-02-18 10:24:09 -08:00
DarkShadow44 c66bf8658e Fix issue with dynamic lights world mixin not respecting opaque blocks (#872) 2025-02-17 10:36:34 -06:00
DarkShadow44 052824017d Fix crash when keycode is negative (#871) 2025-02-16 21:43:15 +00:00
Caedis 6a5d914a43 add offhand support via Backhand (up required version to 1.6.9) (#859) 2025-02-04 12:41:47 -05:00
Calvin Reveraster 208373deaa Fix any dimension without a sky getting flagged as the nether (#857)
* fix crash when connected textures are disabled, but custom colors are enabled.

* Dimension Check Fix

Dimension check set any dimension with no sky as the nether; this includes the end, and several custom dims such as Witchery's mirror dim, etc.
2025-02-01 09:18:29 -08:00
TotallyNotOndre f22a3f612b Fix slider dragging in iris options (#858) 2025-02-01 09:17:26 -08:00
33 changed files with 246 additions and 54 deletions

No files matched your search

+3 -3
View File
@@ -49,7 +49,7 @@ configurations {
}
dependencies {
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.22")
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.23")
compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:1.0.7") { transitive = false }
@@ -61,7 +61,7 @@ dependencies {
// Iris Shaders
compileOnly('org.jetbrains:annotations:26.0.2')
api("com.github.GTNewHorizons:GTNHLib:0.6.6:dev")
api("com.github.GTNewHorizons:GTNHLib:0.6.8:dev")
shadowImplementation("org.anarres:jcpp:1.4.14") // Apache 2.0
shadowImplementation("org.taumc:glsl-transformation-lib:0.2.0-4.g6b42bca") {
exclude module: "antlr4" // we only want to shadow the runtime module
@@ -84,7 +84,7 @@ dependencies {
compileOnly("com.github.GTNewHorizons:ThaumicHorizons:1.7.1:dev")
compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.2:dev") { transitive = false }
compileOnly(rfg.deobf('maven.modrinth:backhand:1.4.1')) { transitive = false }
compileOnly('com.github.GTNewHorizons:Backhand:1.6.9') { transitive = false }
compileOnly("com.falsepattern:chunkapi-mc1.7.10:0.5.1:api") { transitive = false }
compileOnly("com.falsepattern:endlessids-mc1.7.10:1.5-beta0003:dev") { transitive = false }
+1 -1
View File
@@ -16,5 +16,5 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.31'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.32'
}
@@ -62,7 +62,7 @@ public class ModStatus {
}
if (isBackhandLoaded){
isBackhandLoaded = new DefaultArtifactVersion("1.4.1")
isBackhandLoaded = new DefaultArtifactVersion("1.6.9")
.compareTo(
LoadControllerHelper.getOwningMod(Backhand.class).getProcessedVersion()
) <= 0;
@@ -1,10 +1,24 @@
package com.gtnewhorizons.angelica.compat.mojang;
import com.gtnewhorizons.angelica.compat.ModStatus;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import xonin.backhand.api.core.BackhandUtils;
public enum InteractionHand {
MAIN_HAND,
OFF_HAND;
InteractionHand() {
}
public ItemStack getItemInHand(EntityPlayer player){
if (ModStatus.isBackhandLoaded && this == InteractionHand.OFF_HAND){ // off hand (requires backhand)
return BackhandUtils.getOffhandItem(player);
}
else { // main hand
return player.getHeldItem();
}
}
}
@@ -11,6 +11,7 @@ import java.nio.IntBuffer;
import javax.imageio.ImageIO;
import com.gtnewhorizon.gtnhlib.bytebuf.MemoryStack;
import com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities;
import lombok.Getter;
import net.coderbot.iris.Iris;
import org.lwjgl.opengl.GL11;
@@ -61,15 +62,20 @@ public class NativeImage extends BufferedImage {
// final int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
// final int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
try (final MemoryStack stack = stackPush()) {
final IntBuffer buffer = stack.mallocInt(size);
final IntBuffer buffer = MemoryUtilities.memAllocInt(size);
try {
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, format.glFormat, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
int[] data = new int[size];
buffer.get(data);
setRGB(0, 0, width, height, data, 0, width);
} finally {
MemoryUtilities.memFree(buffer);
}
}
public void writeToFile(File file) throws IOException{
try {
ImageIO.write(this, "png", file);
@@ -133,6 +133,11 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static boolean enableDebugLogging;
@Config.Comment("Enables PBR atlas dumping")
@Config.DefaultBoolean(false)
@Config.Name("Enable PBR Debug")
public static boolean enablePBRDebug;
@Config.Comment("Enable Zoom")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
@@ -152,7 +152,6 @@ public enum Mixins {
,"shaders.MixinGuiIngameForge"
,"shaders.MixinFramebuffer"
,"shaders.MixinItem"
,"shaders.MixinItemRenderer"
,"shaders.MixinLocale"
,"shaders.MixinOpenGlHelper"
,"shaders.MixinRender"
@@ -162,6 +161,19 @@ public enum Mixins {
)
),
IRIS_RENDERING_NOBACKHAND(new Builder("Iris Hand Shaders").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addExcludedMod(TargetedMod.BACKHAND).addMixinClasses(
"shaders.MixinItemRenderer"
)
),
IRIS_RENDERING_BACKHAND(new Builder("Iris Hand Shaders (Backhand)").addTargetedMod(TargetedMod.VANILLA)
.addTargetedMod(TargetedMod.BACKHAND).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses(
"shaders.MixinItemRendererBackhand"
)
),
IRIS_ACCESSORS(new Builder("Iris Accessors").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses(
"shaders.accessors.MixinMinecraft"
@@ -8,6 +8,7 @@ public enum TargetedMod {
, FASTCRAFT("FastCraft", "fastcraft.Tweaker")
, OPTIFINE("Optifine", "optifine.OptiFineForgeTweaker", "Optifine")
, ARCHAICFIX("ArchaicFix", "org.embeddedt.archaicfix.ArchaicCore", "archaicfix")
, BACKHAND("Backhand","xonin.backhand.coremod.BackhandLoadingPlugin", "backhand")
, BOTANIA("Botania", null, "Botania")
, CAMPFIRE_BACKPORT("CampfireBackport", null, "campfirebackport")
, CHICKENCHUNKS("ChickenChunks", null, "ChickenChunks")
@@ -8,4 +8,5 @@ public interface ITexturesCache {
Set<IIcon> getRenderedTextures();
void enableTextureTracking();
void track(IPatchedTextureAtlasSprite sprite);
}
@@ -47,6 +47,7 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.util.Direction;
@@ -152,7 +153,7 @@ public class ClientProxy extends CommonProxy {
@SubscribeEvent
public void onKeypress(TickEvent.ClientTickEvent event) {
final boolean isPressed = glsmKeyBinding.getKeyCode() != 0 && Keyboard.isKeyDown(glsmKeyBinding.getKeyCode());
final boolean isPressed = glsmKeyBinding.getKeyCode() != 0 && GameSettings.isKeyDown(glsmKeyBinding);
if (isPressed && !wasGLSMKeyPressed) {
OpenGLDebugging.checkGLSM();
}
@@ -1,5 +1,7 @@
package com.gtnewhorizons.angelica.utils;
import java.util.ArrayDeque;
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
import net.minecraft.client.Minecraft;
@@ -28,4 +30,26 @@ public class AnimationsRenderUtils {
}
}
}
private final static ThreadLocal<ArrayDeque<ITexturesCache>> TEXTURE_CACHE_STACK = ThreadLocal.withInitial(ArrayDeque::new);
public static void onSpriteUsed(IPatchedTextureAtlasSprite sprite) {
ArrayDeque<ITexturesCache> stack = TEXTURE_CACHE_STACK.get();
if (stack == null || stack.isEmpty()) {
// icon was used outside of chunk building, it's probably an item in an inventory or something
sprite.markNeedsAnimationUpdate();
return;
}
stack.peek().track(sprite);
}
public static void pushCache(ITexturesCache cache) {
TEXTURE_CACHE_STACK.get().push(cache);
}
public static void popCache() {
TEXTURE_CACHE_STACK.get().pop();
}
}
@@ -348,7 +348,11 @@ public class SodiumWorldRenderer {
}
private boolean checkBEVisibility(TileEntity entity) {
return frustum.isBoundingBoxInFrustum(entity.getRenderBoundingBox());
var aabb = entity.getRenderBoundingBox();
if (aabb == TileEntity.INFINITE_EXTENT_AABB) {
return true;
}
return frustum.isBoundingBoxInFrustum(aabb);
}
private void renderTE(TileEntity tileEntity, int pass, float partialTicks) {
@@ -8,6 +8,7 @@ import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
import com.gtnewhorizons.angelica.rendering.AngelicaBlockSafetyRegistry;
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
import com.gtnewhorizons.angelica.utils.AnimationsRenderUtils;
import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue;
import me.jellysquid.mods.sodium.client.SodiumClientMod;
import me.jellysquid.mods.sodium.client.render.chunk.ChunkGraphicsState;
@@ -132,7 +133,10 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
final WorldSlice slice = cache.getWorldSlice();
final RenderBlocks renderBlocks = new RenderBlocks(slice);
if(renderBlocks instanceof ITexturesCache) ((ITexturesCache)renderBlocks).enableTextureTracking();
if(renderBlocks instanceof ITexturesCache textureCache) {
textureCache.enableTextureTracking();
AnimationsRenderUtils.pushCache(textureCache);
}
final int baseX = this.render.getOriginX();
final int baseY = this.render.getOriginY();
@@ -217,6 +221,10 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
}
}
if(renderBlocks instanceof ITexturesCache) {
AnimationsRenderUtils.popCache();
}
handleRenderBlocksTextures(renderBlocks, renderData);
if(hasMainThreadBlocks) {
@@ -263,7 +271,10 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
final int baseZ = this.render.getOriginZ();
final BlockPos renderOffset = this.offset;
final RenderBlocks rb = new RenderBlocks(slice.getWorld());
if(rb instanceof ITexturesCache) ((ITexturesCache)rb).enableTextureTracking();
if(rb instanceof ITexturesCache textureCache) {
textureCache.enableTextureTracking();
AnimationsRenderUtils.pushCache(textureCache);
}
while(!mainThreadBlocks.isEmpty()) {
final long longPos = mainThreadBlocks.dequeueLong();
if (cancellationSource.isCancelled()) {
@@ -303,6 +314,10 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
if(AngelicaConfig.enableIris) buffers.iris$resetBlockContext();
}
if(rb instanceof ITexturesCache) {
AnimationsRenderUtils.popCache();
}
handleRenderBlocksTextures(rb, renderData);
}
+1 -1
View File
@@ -537,7 +537,7 @@ public class Iris {
if (level != null) {
if (level.provider == null) return DimensionId.OVERWORLD;
if ((level.provider.isHellWorld || level.provider.hasNoSky) || level.provider.dimensionId == -1) {
if (level.provider.isHellWorld || level.provider.dimensionId == -1) {
return DimensionId.NETHER;
} else if (level.provider.dimensionId == 1) {
return DimensionId.END;
@@ -91,6 +91,17 @@ public class ShaderPackOptionList extends IrisGuiSlot {
final BaseEntry entry = this.entries.get(index);
return entry.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
public boolean mouseReleased( int mouseX, int mouseY, int button) {
final int relativeY = mouseY - this.top - this.headerPadding + (int) this.amountScrolled - 4;
final int index = relativeY / this.slotHeight;
if (index < 0 || index >= this.entries.size())
return false;
final BaseEntry entry = this.entries.get(index);
return entry.mouseReleased(mouseX, mouseY, button);
}
@Override
protected boolean isSelected(int idx) {
@@ -12,6 +12,7 @@ public abstract class BaseEntry {
}
public abstract boolean mouseClicked(int mouseX, int mouseY, int button);
public abstract boolean mouseReleased(int mouseX, int mouseY, int button);
public abstract void drawEntry(ShaderPackScreen screen, int index, int x, int y, int slotWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isMouseOver);
@@ -108,6 +108,11 @@ public class HeaderEntry extends BaseEntry {
return backButtonResult || utilButtonResult;
}
@Override
public boolean mouseReleased(int mouseX, int mouseY, int button) {
return false;
}
private boolean backButtonClicked(IrisElementRow.TextButtonElement button) {
this.navigation.back();
GuiUtil.playButtonClickSound();
@@ -78,9 +78,8 @@ public class HandRenderer {
}
public boolean isHandTranslucent(InteractionHand hand) {
// TODO: Offhand
// Item item = Minecraft.getMinecraft().thePlayer.getItemBySlot(hand == InteractionHand.OFF_HAND ? EquipmentSlot.OFFHAND : EquipmentSlot.MAINHAND).getItem();
ItemStack heldItem = Minecraft.getMinecraft().thePlayer.getHeldItem();
ItemStack heldItem = hand.getItemInHand(Minecraft.getMinecraft().thePlayer);
if (heldItem == null) {
return false;
}
@@ -1,9 +1,11 @@
package net.coderbot.iris.texture.pbr;
import com.gtnewhorizons.angelica.compat.mojang.AutoClosableAbstractTexture;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.mixins.interfaces.TextureAtlasSpriteAccessor;
import com.gtnewhorizons.angelica.mixins.interfaces.TextureMapAccessor;
import lombok.Getter;
import net.coderbot.iris.Iris;
import net.coderbot.iris.texture.util.TextureExporter;
import net.coderbot.iris.texture.util.TextureManipulationUtil;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@@ -88,7 +90,7 @@ public class PBRAtlasTexture extends AutoClosableAbstractTexture {
}
}
if (PBRTextureManager.DEBUG) {
if (AngelicaConfig.enablePBRDebug) {
TextureExporter.exportTextures("pbr_debug/atlas", id.getResourceDomain() + "_" + id.getResourcePath().replaceAll("/", "_"), glId, mipLevel, atlasWidth, atlasHeight);
}
}
@@ -98,6 +100,7 @@ public class PBRAtlasTexture extends AutoClosableAbstractTexture {
upload(atlasWidth, atlasHeight, mipLevel, anisotropicFiltering);
return true;
} catch (Throwable t) {
Iris.logger.error("Could not upload PBR texture", t);
return false;
}
}
@@ -18,8 +18,6 @@ import org.lwjgl.opengl.GL11;
public class PBRTextureManager {
public static final PBRTextureManager INSTANCE = new PBRTextureManager();
public static final boolean DEBUG = System.getProperty("iris.pbr.debug") != null;
// TODO: Figure out how to merge these two.
private static Runnable normalTextureChangeListener;
private static Runnable specularTextureChangeListener;
@@ -85,7 +83,7 @@ public class PBRTextureManager {
loader.load(texture, Minecraft.getMinecraft().getResourceManager(), consumer);
return consumer.toHolder();
} catch (Exception e) {
Iris.logger.debug("Failed to load PBR textures for texture " + id, e);
Iris.logger.error("Failed to load PBR textures for texture " + id, e);
} finally {
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, previousTextureBinding);
}
@@ -2,6 +2,8 @@ package net.coderbot.iris.texture.util;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.compat.mojang.NativeImage;
import net.coderbot.iris.Iris;
import net.minecraft.client.Minecraft;
import org.apache.commons.io.FilenameUtils;
import org.lwjgl.opengl.GL11;
@@ -28,6 +30,8 @@ public class TextureExporter {
try {
nativeImage.writeToFile(file);
} catch (Exception ignored) {}
} catch (Exception e) {
Iris.logger.error("Could not export texture", e);
}
}
}
@@ -76,9 +76,8 @@ public final class IdMapUniforms {
invalidate();
return;
}
// ItemStack heldStack = player.getItemInHand(hand);
// TODO: Offhand
ItemStack heldStack = player.getHeldItem();
ItemStack heldStack = hand.getItemInHand(player);
if (heldStack == null) {
invalidate();
@@ -106,9 +105,7 @@ public final class IdMapUniforms {
}
private IrisItemLightProvider applyOldHandLighting(@NotNull EntityPlayer player, IrisItemLightProvider existing) {
// TODO: Offhand
// ItemStack offHandStack = player.getItemInHand(InteractionHand.OFF_HAND);
ItemStack offHandStack = null;
ItemStack offHandStack = InteractionHand.OFF_HAND.getItemInHand(player);
if (offHandStack == null) {
return existing;
@@ -64,7 +64,7 @@ public abstract class MixinMinecraft {
angelica$lastFrameTime = time;
}
@WrapOperation(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;sync(I)V"))
@WrapOperation(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;sync(I)V", remap = false))
private void angelica$noopFPSLimiter(int fps, Operation<Void> original) {
if (AngelicaConfig.sleepBeforeSwap) return;
original.call(fps);
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.animation;
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
import net.minecraft.util.IIcon;
import net.minecraft.world.ChunkCache;
@@ -23,4 +24,9 @@ public class MixinChunkCache implements ITexturesCache {
public void enableTextureTracking() {
}
@Override
public void track(IPatchedTextureAtlasSprite sprite) {
}
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.animation;
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
import com.gtnewhorizons.angelica.utils.AnimationsRenderUtils;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
@@ -38,36 +39,36 @@ public class MixinRenderBlocks implements ITexturesCache {
* apply Occlusion Querry (Basically that means that we will only mark those textures for update that are
* visible (on the viewport) at the moment)
*/
@Inject(method = "*(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V", at = @At("HEAD"))
@Inject(method = {
"renderFaceYNeg",
"renderFaceYPos",
"renderFaceZNeg",
"renderFaceZPos",
"renderFaceXNeg",
"renderFaceXPos"
}, at = @At("HEAD"))
public void angelica$beforeRenderFace(Block p_147761_1_, double p_147761_2_, double p_147761_4_,
double p_147761_6_, IIcon icon, CallbackInfo ci) {
if (overrideBlockTexture != null) {
icon = overrideBlockTexture;
}
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
if (icon != null) {
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
if(this.enableSpriteTracking)
this.renderedSprites.add(icon);
}
@Inject(method = "renderBlockFire", at = @At("HEAD"))
public void angelica$markFireBlockAnimationForUpdate(BlockFire instance, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
if(this.enableSpriteTracking) {
this.renderedSprites.add(instance.getFireIcon(0));
this.renderedSprites.add(instance.getFireIcon(1));
if(this.enableSpriteTracking) {
this.renderedSprites.add(icon);
}
}
AnimationsRenderUtils.markBlockTextureForUpdate(instance.getFireIcon(0), blockAccess);
AnimationsRenderUtils.markBlockTextureForUpdate(instance.getFireIcon(1), blockAccess);
}
@ModifyReturnValue(method = "getBlockIconFromSideAndMetadata", at = @At("RETURN"))
public IIcon angelica$markBlockSideAnimationForUpdate(IIcon icon, Block p_147787_1_, int p_147787_2_, int p_147787_3_) {
@ModifyReturnValue(method = "getIconSafe", at = @At("RETURN"))
public IIcon angelica$markBlockSideAnimationForUpdate(IIcon icon) {
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
if(this.enableSpriteTracking)
if(this.enableSpriteTracking) {
this.renderedSprites.add(icon);
}
return icon;
}
@@ -81,4 +82,11 @@ public class MixinRenderBlocks implements ITexturesCache {
public void enableTextureTracking() {
enableSpriteTracking = true;
}
@Override
public void track(IPatchedTextureAtlasSprite sprite) {
if(this.enableSpriteTracking) {
renderedSprites.add((IIcon) sprite);
}
}
}
@@ -1,11 +1,17 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.animation;
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
import com.gtnewhorizons.angelica.mixins.interfaces.ISpriteExt;
import com.gtnewhorizons.angelica.utils.AnimationsRenderUtils;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.minecraft.block.BlockPortal;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.data.AnimationMetadataSection;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import java.util.List;
@@ -54,4 +60,13 @@ public abstract class MixinTextureAtlasSprite implements IPatchedTextureAtlasSpr
this.tickCounter = 0;
}
}
@ModifyReturnValue(method = "getMinU", at = @At("RETURN"))
private float angelica$onUVAccessed(float value) {
if (((ISpriteExt)this).isAnimation()) {
AnimationsRenderUtils.onSpriteUsed(this);
needsAnimationUpdate = true;
}
return value;
}
}
@@ -49,4 +49,9 @@ public class MixinWorldRenderer implements ITexturesCache {
public void enableTextureTracking() {
}
@Override
public void track(IPatchedTextureAtlasSprite sprite) {
}
}
@@ -29,9 +29,9 @@ public abstract class MixinWorld {
}
@ModifyReturnValue(method = "getLightBrightnessForSkyBlocks", at = @At(value = "RETURN"))
private int angelica$dynamiclights_getLightBrightnessForSkyBlocks(int lightmap, int p_72802_1_, int p_72802_2_, int p_72802_3_, int p_72802_4_){
if (DynamicLights.isEnabled()){
return DynamicLights.get().getLightmapWithDynamicLight(p_72802_1_, p_72802_2_, p_72802_3_, lightmap);
private int angelica$dynamiclights_getLightBrightnessForSkyBlocks(int lightmap, int x, int y, int z, int p_72802_4_){
if (DynamicLights.isEnabled() && !getBlock(x, y, z).isOpaqueCube()){
return DynamicLights.get().getLightmapWithDynamicLight(x, y, z, lightmap);
}
return lightmap;
}
@@ -1,6 +1,7 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.textures.ic2;
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import ic2.core.item.ItemFluidCell;
import ic2.core.item.RenderLiquidCell;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@@ -15,13 +16,19 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(RenderLiquidCell.class)
@Mixin(value = RenderLiquidCell.class, remap = false)
public class MixinRenderLiquidCell {
@Inject(at = @At(ordinal = 0, remap = false, shift = Shift.AFTER, target = "Lorg/lwjgl/opengl/GL11;glColor3ub(BBB)V", value = "INVOKE"), locals = LocalCapture.CAPTURE_FAILSOFT, method = "renderItem", remap = false)
@Inject(at = @At(ordinal = 0, shift = Shift.AFTER, target = "Lorg/lwjgl/opengl/GL11;glColor3ub(BBB)V", value = "INVOKE"), locals = LocalCapture.CAPTURE_FAILSOFT, method = "renderItem", remap = false)
private void angelica$markNeedsAnimationUpdate(ItemRenderType type, ItemStack item, Object[] data, CallbackInfo ci, ItemFluidCell cell, IIcon icon, FluidStack fs, IIcon windowIcon, IIcon fluidicon) {
if (fluidicon instanceof TextureAtlasSprite) {
((IPatchedTextureAtlasSprite) fluidicon).markNeedsAnimationUpdate();
}
}
// nop the disabling of the alpha test
@WrapWithCondition(method = "renderItem", at= @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 0))
private boolean angelica$renderItemGLDisable(int cap){
return false;
}
}
@@ -14,7 +14,6 @@ public class MixinItemRenderer {
@Inject(method = "renderItemInFirstPerson", at = @At("HEAD"), cancellable = true)
private void iris$skipTranslucentHands(float partialTicks, CallbackInfo ci) {
if (IrisApi.getInstance().isShaderPackInUse()) {
// TODO: Offhand
boolean isHandTranslucent = HandRenderer.INSTANCE.isHandTranslucent(InteractionHand.MAIN_HAND);
if (HandRenderer.INSTANCE.isRenderingSolid() && isHandTranslucent) {
ci.cancel();
@@ -0,0 +1,48 @@
package com.gtnewhorizons.angelica.mixins.early.shaders;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.mojang.InteractionHand;
import net.coderbot.iris.pipeline.HandRenderer;
import net.irisshaders.iris.api.v0.IrisApi;
import net.minecraft.client.renderer.ItemRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import xonin.backhand.client.hooks.ItemRendererHooks;
@Mixin(ItemRenderer.class)
public class MixinItemRendererBackhand {
@Inject(method = "renderItemInFirstPerson", at = @At("HEAD"), cancellable = true)
private void iris$skipTranslucentHands(float partialTicks, CallbackInfo ci) {
if (IrisApi.getInstance().isShaderPackInUse()) {
boolean isHandTranslucent = HandRenderer.INSTANCE.isHandTranslucent(InteractionHand.MAIN_HAND);
if (HandRenderer.INSTANCE.isRenderingSolid() && isHandTranslucent) {
ci.cancel();
if (ModStatus.isBackhandLoaded){
iris$skipTranslucentHandsBackhand(partialTicks, ci);
ItemRendererHooks.renderOffhandReturn(partialTicks);
}
} else if (!HandRenderer.INSTANCE.isRenderingSolid() && !isHandTranslucent) {
ci.cancel();
if (ModStatus.isBackhandLoaded){
iris$skipTranslucentHandsBackhand(partialTicks, ci);
ItemRendererHooks.renderOffhandReturn(partialTicks);
}
}
}
}
// change injection to before Backhand's inject
@Inject(method = "renderItemInFirstPerson", at = @At("RETURN"), cancellable = true, order = 900)
private void iris$skipTranslucentHandsBackhand(float partialTicks, CallbackInfo ci) {
if (ModStatus.isBackhandLoaded && IrisApi.getInstance().isShaderPackInUse()) {
boolean isHandTranslucent = HandRenderer.INSTANCE.isHandTranslucent(InteractionHand.OFF_HAND);
if (HandRenderer.INSTANCE.isRenderingSolid() && isHandTranslucent) {
ci.cancel();
} else if (!HandRenderer.INSTANCE.isRenderingSolid() && !isHandTranslucent) {
ci.cancel();
}
}
}
}
@@ -7,8 +7,10 @@ import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.Map;
import com.gtnewhorizons.angelica.mixins.interfaces.TextureMapAccessor;
@Mixin(TextureMap.class)
public abstract class MixinTextureMap {
public abstract class MixinTextureMap implements TextureMapAccessor {
@Accessor("mapUploadedSprites")
public abstract Map getMapUploadedSprites();
@@ -7,6 +7,7 @@ import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.culling.Frustrum;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -39,7 +40,7 @@ public class MixinEffectRenderer {
@Redirect(method = "renderParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/EntityFX;renderParticle(Lnet/minecraft/client/renderer/Tessellator;FFFFFF)V"))
private void renderParticles(EntityFX particle, Tessellator tessellator, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
if(cullingFrustum == null || cullingFrustum.isBoundingBoxInFrustum(particle.boundingBox)) {
if(cullingFrustum == null || particle.boundingBox == TileEntity.INFINITE_EXTENT_AABB || cullingFrustum.isBoundingBoxInFrustum(particle.boundingBox)) {
particle.renderParticle(tessellator, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
}
@@ -51,7 +52,7 @@ public class MixinEffectRenderer {
@Redirect(method = "renderLitParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/EntityFX;renderParticle(Lnet/minecraft/client/renderer/Tessellator;FFFFFF)V"))
private void renderLitParticles(EntityFX particle, Tessellator tessellator, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
if(cullingFrustum == null || cullingFrustum.isBoundingBoxInFrustum(particle.boundingBox)) {
if(cullingFrustum == null || particle.boundingBox == TileEntity.INFINITE_EXTENT_AABB || cullingFrustum.isBoundingBoxInFrustum(particle.boundingBox)) {
particle.renderParticle(tessellator, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
}