mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-20 04:19:40 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51a6a72ae5 |
No files matched your search
+5
@@ -18,4 +18,9 @@ public class MixinChunkCache implements ITexturesCache {
|
||||
public HashSet<IIcon> getRenderedTextures() {
|
||||
return renderedIcons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableTextureTracking() {
|
||||
|
||||
}
|
||||
}
|
||||
+18
-7
@@ -2,7 +2,7 @@ package com.gtnewhorizons.angelica.mixins.early.angelica.animation;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
|
||||
import com.gtnewhorizons.angelica.utils.AnimationsRenderUtils;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFire;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -27,7 +27,8 @@ public class MixinRenderBlocks implements ITexturesCache {
|
||||
@Shadow
|
||||
public IIcon overrideBlockTexture;
|
||||
|
||||
private Set<IIcon> renderedSprites = new ObjectOpenHashSet<>();
|
||||
private Set<IIcon> renderedSprites = new ReferenceOpenHashSet<>();
|
||||
private boolean enableSpriteTracking;
|
||||
|
||||
/**
|
||||
* @author laetansky Here where things get very tricky. We can't just mark blocks textures for update because this
|
||||
@@ -46,14 +47,17 @@ public class MixinRenderBlocks implements ITexturesCache {
|
||||
|
||||
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
|
||||
|
||||
this.renderedSprites.add(icon);
|
||||
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) {
|
||||
this.renderedSprites.add(instance.getFireIcon(0));
|
||||
this.renderedSprites.add(instance.getFireIcon(1));
|
||||
if(this.enableSpriteTracking) {
|
||||
this.renderedSprites.add(instance.getFireIcon(0));
|
||||
this.renderedSprites.add(instance.getFireIcon(1));
|
||||
}
|
||||
AnimationsRenderUtils.markBlockTextureForUpdate(instance.getFireIcon(0), blockAccess);
|
||||
AnimationsRenderUtils.markBlockTextureForUpdate(instance.getFireIcon(1), blockAccess);
|
||||
}
|
||||
@@ -62,7 +66,8 @@ public class MixinRenderBlocks implements ITexturesCache {
|
||||
public IIcon angelica$markFluidAnimationForUpdate(IIcon icon) {
|
||||
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
|
||||
|
||||
this.renderedSprites.add(icon);
|
||||
if(this.enableSpriteTracking)
|
||||
this.renderedSprites.add(icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
@@ -72,11 +77,17 @@ public class MixinRenderBlocks implements ITexturesCache {
|
||||
CallbackInfo ci) {
|
||||
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
|
||||
|
||||
this.renderedSprites.add(icon);
|
||||
if(this.enableSpriteTracking)
|
||||
this.renderedSprites.add(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<IIcon> getRenderedTextures() {
|
||||
return renderedSprites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableTextureTracking() {
|
||||
enableSpriteTracking = true;
|
||||
}
|
||||
}
|
||||
+6
@@ -26,6 +26,7 @@ public class MixinWorldRenderer implements ITexturesCache {
|
||||
|
||||
@ModifyArg(method = "updateRenderer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;<init>(Lnet/minecraft/world/IBlockAccess;)V"))
|
||||
private IBlockAccess angelica$onUpdateRenderer(IBlockAccess chunkCache) {
|
||||
((ITexturesCache) chunkCache).enableTextureTracking();
|
||||
renderedIcons = ((ITexturesCache) chunkCache).getRenderedTextures();
|
||||
return chunkCache;
|
||||
}
|
||||
@@ -43,4 +44,9 @@ public class MixinWorldRenderer implements ITexturesCache {
|
||||
public Set<IIcon> getRenderedTextures() {
|
||||
return renderedIcons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableTextureTracking() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,5 @@ import java.util.Set;
|
||||
public interface ITexturesCache {
|
||||
|
||||
Set<IIcon> getRenderedTextures();
|
||||
void enableTextureTracking();
|
||||
}
|
||||
+2
@@ -116,6 +116,7 @@ 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();
|
||||
|
||||
final int baseX = this.render.getOriginX();
|
||||
final int baseY = this.render.getOriginY();
|
||||
@@ -246,6 +247,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
|
||||
final int baseZ = this.render.getOriginZ();
|
||||
final BlockPosImpl renderOffset = this.offset;
|
||||
final RenderBlocks rb = new RenderBlocks(slice.getWorld());
|
||||
if(rb instanceof ITexturesCache) ((ITexturesCache)rb).enableTextureTracking();
|
||||
while(!mainThreadBlocks.isEmpty()) {
|
||||
final long longPos = mainThreadBlocks.dequeueLong();
|
||||
if (cancellationSource.isCancelled()) {
|
||||
|
||||
Reference in new issue
Block a user