Compare commits

...
Author SHA1 Message Date
063b2242e8 Initial FluidLogged compat (#985)
* Initial FluidLogged compat

* FluidLogged works(probably mostly)

* Make FluidLogged optional

* Remove a leftover print

* Fix fluidlogged fluids rendering incorrectly with shaders on

* Rmemove unused code

* Cleanup unused imports

---------

Co-authored-by: embeddedt <[email protected]>
Co-authored-by: Jason Mitchell <[email protected]>
2025-07-09 10:31:45 -04:00
Rad 577f905dc5 Update README.MD (#981) 2025-07-06 13:56:20 -07:00
Jason MitchellandAlexdoru 071d2d4a39 Add a guard to only init once (#984)
Co-authored-by: Alexdoru <[email protected]>
2025-07-01 10:33:49 -07:00
Alexdoru 891715b113 limit the amount of dropped items rendered exactly to the config value (#973) 2025-06-16 07:55:28 +02:00
jss2a98aj 30a35ef25e Misc. CTM resource tweaks 2025-06-13 18:04:31 -07:00
jss2a98aj 33453b3b8c Fix crash with OpenAutism
Brandyyn says this fixes the crash but I have not tested it myself.
2025-06-13 18:04:31 -07:00
jss2a98aj 62e699f6d0 Remove unneeded debug print 2025-06-13 18:04:31 -07:00
Jason Mitchell f107d173b7 Stop loading HoloInventory too early in the compat class, which was causing fake fluids to not render properly. 2025-06-09 14:22:12 -07:00
glowredman d0948b36f3 No longer use Reflection for SplashProgress.fontRenderer (#966)
* Access SplashProgress font renderer via mixins

* Use AT
2025-06-07 12:07:14 +02:00
22 changed files with 255 additions and 72 deletions

No files matched your search

+2 -2
View File
@@ -36,7 +36,7 @@
* FastCraft [Disabled, won't fix]
* BetterFPS [Disabled, won't fix]
* OptimizationsAndTweaks [Disabled, won't fix]
* [Amazing Trophies 1.2.1 and below](https://github.com/GTNewHorizons/Amazing-Trophies/releases) - use 1.2.2+
* [Amazing Trophies 1.2.1 and below](https://github.com/GTNewHorizons/Amazing-Trophies/releases) - Use 1.2.2+
* [LWJGL3ify 1.5.4 and below](https://github.com/GTNewHorizons/lwjgl3ify/releases/) - Use the latest version available, 1.5.7+
* [ArchaicFix 0.6.2 and below](https://www.curseforge.com/minecraft/mc-mods/archaicfix/files/all?page=1&pageSize=20) - Use 0.7.0 or above
* [Hodgepodge 2.4.3 and below](https://github.com/GTNewHorizons/Hodgepodge/releases) - Use 0.4.5 or above
@@ -65,7 +65,7 @@
* Makamys for [Neodymium](https://github.com/makamys/Neodymium) - Various Tessellator -> Quad functionality taken under the LGPL 3
* MCPatcherForge
* Original [MCPatcher](https://bitbucket.org/prupe/mcpatcher/src/master/): Paul Rupe
* [Forge version](https://bitbucket.org/prupe/mcpatcher/src/master/): Mist475 under LGPL 3.0 with default ctm textures for glass and bookshelves by DarkBum under CC-BY-SA
* [Forge version](https://github.com/mist475/MCPatcherForge): Mist475 under LGPL 3.0 with default ctm textures for glass and bookshelves by DarkBum under CC-BY-SA
* HUDCaching
* Created by [Moulberry](https://github.com/Moulberry/MCHUDCaching), backported from [Patcher](https://github.com/Sk1erLLC/Patcher) mod by Alexdoru under the CC-BY-SA-NC 4.0 license
* Angelica
+2
View File
@@ -113,4 +113,6 @@ dependencies {
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation("org.mockito:mockito-core:3.+")
testImplementation("org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209")
compileOnly("mega:fluidlogged-mc1.7.10:0.1.2")
}
+7
View File
@@ -8,6 +8,13 @@ repositories {
includeGroup 'com.falsepattern'
}
}
maven {
name = 'mega'
url = 'https://mvn.falsepattern.com/gtmega_releases/'
content {
includeGroup 'mega'
}
}
exclusiveContent {
forRepository {
ivy {
@@ -15,8 +15,13 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
modid = "angelica",
name = "Angelica",
version = Tags.VERSION,
dependencies = " before:lwjgl3ify@[1.5.3,);" + " after:hodgepodge@[2.4.4,);" + " after:CodeChickenCore@[1.2.0,);"
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.6.6,);",
dependencies = """
required-after:gtnhlib@[0.6.6,);\
before:lwjgl3ify@[1.5.3,);\
after:hodgepodge@[2.4.4,);\
after:CodeChickenCore@[1.2.0,);\
after:archaicfix@[0.7.0,);\
""",
acceptedMinecraftVersions = "[1.7.10]",
acceptableRemoteVersions = "*",
guiFactory = "com.gtnewhorizons.angelica.config.AngelicaGuiConfigFactory")
@@ -1,7 +1,6 @@
package com.gtnewhorizons.angelica.compat;
import com.gtnewhorizons.angelica.compat.backhand.BackhandReflectionCompat;
import com.gtnewhorizons.angelica.compat.holoinventory.HoloInventoryReflectionCompat;
import com.gtnewhorizons.angelica.helpers.LoadControllerHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
@@ -33,6 +32,7 @@ public class ModStatus {
public static boolean isThaumcraftLoaded;
public static boolean isThaumicHorizonsLoaded;
public static boolean isBaublesLoaded;
public static boolean isFluidLoggedLoaded;
public static void preInit(){
isBackhandLoaded = Loader.isModLoaded("backhand");
@@ -52,10 +52,9 @@ public class ModStatus {
isThaumcraftLoaded = Loader.isModLoaded("Thaumcraft");
isThaumicHorizonsLoaded = Loader.isModLoaded("ThaumicHorizons");
isBaublesLoaded = Loader.isModLoaded("Baubles");
isFluidLoggedLoaded = Loader.isModLoaded("fluidlogged");
if (isHoloInventoryLoaded) {
isHoloInventoryLoaded = HoloInventoryReflectionCompat.isHoloInventoryLoaded();
}
isHoloInventoryLoaded = Loader.isModLoaded("holoinventory");
// remove compat with original release of BG2
if (isBattlegearLoaded){
@@ -67,10 +67,6 @@ public class HoloInventoryReflectionCompat {
angelicaOverrideSetter = angelicaOverrideSetterTemp;
}
public static boolean isHoloInventoryLoaded() {
return isLoaded;
}
public static void renderEvent(RenderGameOverlayEvent event) {
if (!isLoaded) return;
try {
@@ -86,7 +86,7 @@ public enum Mixins {
// Not compatible with the lwjgl debug callbacks, so disable if that's enabled
ARCHAIC_SPLASH(new Builder("ArchaicFix Splash").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.showSplashMemoryBar && !AngelicaMod.lwjglDebug).addMixinClasses(
"angelica.archaic.MixinSplashProgress"
"angelica.archaic.MixinSplashProgress$3"
,"angelica.archaic.AccessorSplashProgress"
)
),
@@ -104,7 +104,7 @@ public enum Mixins {
IRIS_STARTUP(new Builder("Start Iris").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses(
"shaders.startup.MixinGameSettings"
,"shaders.startup.MixinGuiMainMenu"
,"shaders.startup.MixinMinecraft"
,"shaders.startup.MixinInitRenderer"
,"shaders.startup.MixinAbstractTexture"
,"shaders.startup.MixinTextureAtlasSprite"
@@ -2,6 +2,7 @@ package me.jellysquid.mods.sodium.client.render.chunk.tasks;
import com.gtnewhorizon.gtnhlib.blockpos.BlockPos;
import com.gtnewhorizon.gtnhlib.client.renderer.util.WorldUtil;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.mojang.ChunkOcclusionDataBuilder;
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
@@ -36,6 +37,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import org.joml.Vector3d;
import java.util.Map;
@@ -155,6 +157,11 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
for (int relZ = 0; relZ < 16; relZ++) {
for (int relX = 0; relX < 16; relX++) {
Fluid fluid = null;
if (ModStatus.isFluidLoggedLoaded) {
fluid = slice.getFluidRelative(relX + 16, relY + 16, relZ + 16);
}
final Block block = slice.getBlockRelative(relX + 16, relY + 16, relZ + 16);
// If the block is vanilla air, assume it renders nothing. Don't use isAir because mods
@@ -172,10 +179,18 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
if (rendersOffThread(block)) {
// Do regular block rendering
final long seed = MathUtil.hashPos(pos.x, pos.y, pos.z);
for (BlockRenderPass pass : BlockRenderPass.VALUES) {
if (ModStatus.isFluidLoggedLoaded) {
if (fluid != null && canRenderInPass(fluid.getBlock(), pass)) {
ChunkRenderManager.setWorldRenderPass(pass);
if(AngelicaConfig.enableIris) buffers.iris$setMaterialId(fluid.getBlock(), ExtendedDataHelper.FLUID_RENDER_TYPE);
cache.getBlockRenderer().renderFluidLogged(fluid, renderBlocks, pos, buffers.get(pass), seed);
}
}
if (canRenderInPass(block, pass) && !shouldUseSodiumFluidRendering(block)) {
ChunkRenderManager.setWorldRenderPass(pass);
final long seed = MathUtil.hashPos(pos.x, pos.y, pos.z);
if(AngelicaConfig.enableIris) buffers.iris$setMaterialId(block, ExtendedDataHelper.BLOCK_RENDER_TYPE);
if (cache.getBlockRenderer().renderModel(cache.getWorldSlice(), renderBlocks, block, meta, pos, buffers.get(pass), true, seed)) {
@@ -183,6 +198,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
}
}
}
} else {
mainThreadBlocks.enqueue(pos.asLong());
hasMainThreadBlocks = true;
@@ -339,6 +355,6 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
}
private static boolean shouldUseSodiumFluidRendering(Block block) {
return AngelicaConfig.enableSodiumFluidRendering && WorldUtil.isFluidBlock(block);
return AngelicaConfig.enableSodiumFluidRendering && WorldUtil.isFluidBlock(block) && !ModStatus.isFluidLoggedLoaded;
}
}
@@ -32,6 +32,7 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import java.util.List;
import java.util.Random;
@@ -62,13 +63,54 @@ public class BlockRenderer {
this.occlusionCache = new BlockOcclusionCache();
}
public boolean renderFluidLogged(Fluid fluid, RenderBlocks renderBlocks, BlockPos pos, ChunkModelBuffers buffers, long seed) {
if (fluid == null) {
return false;
}
Block block = fluid.getBlock();
if (block == null) {
return false;
}
boolean rendered = false;
try {
final LightMode mode = LightMode.SMOOTH; // TODO: this.getLightingMode(block); is what was previously used. The flat pipeline is busted and was only an optimization for very few blocks.
final LightPipeline lighter = this.lighters.getLighter(mode);
TessellatorManager.startCapturing();
final CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get();
tess.startDrawingQuads();
// Use setTranslation rather than setOffset so that the float data written to the internal buffer
// is done in subchunk-relative coordinates
tess.setOffset(POS_ZERO);
tess.setTranslation(-pos.x, -pos.y, -pos.z);
renderBlocks.renderBlockByRenderType(block, pos.x, pos.y, pos.z);
final List<QuadView> quads = TessellatorManager.stopCapturingToPooledQuads();
tess.resetOffset();
for (ModelQuadFacing facing : ModelQuadFacing.VALUES) {
this.random.setSeed(seed);
this.renderQuadList(pos, lighter, buffers, quads, facing, (this.useAmbientOcclusion && this.useSodiumAO));
}
if (!quads.isEmpty()) rendered = true;
} finally {
TessellatorManager.cleanup();
}
return rendered;
}
public boolean renderModel(IBlockAccess world, RenderBlocks renderBlocks, Block block, int meta, BlockPos pos, ChunkModelBuffers buffers, boolean cull, long seed) {
final LightMode mode = LightMode.SMOOTH; // TODO: this.getLightingMode(block); is what was previously used. The flat pipeline is busted and was only an optimization for very few blocks.
final LightPipeline lighter = this.lighters.getLighter(mode);
boolean rendered = false;
this.useSeparateAo = AngelicaConfig.enableIris && BlockRenderingSettings.INSTANCE.shouldUseSeparateAo();
boolean rendered = false;
final QuadProvider model = ((ModeledBlock) block).getModel();
if (model != null) {
@@ -3,13 +3,16 @@ package me.jellysquid.mods.sodium.client.world;
import java.util.Arrays;
import com.gtnewhorizons.angelica.api.IBlockAccessExtended;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.mojang.ChunkSectionPos;
import com.gtnewhorizons.angelica.compat.mojang.CompatMathHelper;
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
import cpw.mods.fml.common.Optional;
import lombok.Getter;
import me.jellysquid.mods.sodium.client.world.cloned.ChunkRenderContext;
import me.jellysquid.mods.sodium.client.world.cloned.ClonedChunkSection;
import me.jellysquid.mods.sodium.client.world.cloned.ClonedChunkSectionCache;
import mega.fluidlogged.api.FLBlockAccess;
import net.minecraft.block.Block;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.init.Blocks;
@@ -24,6 +27,8 @@ import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import org.jetbrains.annotations.Nullable;
/**
* Takes a slice of world state (block states, biome and light data arrays) and copies the data for use in off-thread
@@ -35,7 +40,8 @@ import net.minecraftforge.common.util.ForgeDirection;
*
* Object pooling should be used to avoid huge allocations as this class contains many large arrays.
*/
public class WorldSlice implements IBlockAccessExtended {
@Optional.Interface(iface = "mega.fluidlogged.api.FLBlockAccess", modid = "fluidlogged")
public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
private static final EnumSkyBlock[] LIGHT_TYPES = EnumSkyBlock.values();
// The number of blocks on each axis in a section.
@@ -68,6 +74,7 @@ public class WorldSlice implements IBlockAccessExtended {
// Local Section->BlockState table.
private final Block[][] blockArrays;
private final Fluid[][] fluidArrays;
private final int[][] metadataArrays;
// Local Section->Light table
@@ -145,6 +152,12 @@ public class WorldSlice implements IBlockAccessExtended {
this.biomeData = new BiomeGenBase[SECTION_TABLE_ARRAY_SIZE][];
this.lightArrays = new NibbleArray[SECTION_TABLE_ARRAY_SIZE][LIGHT_TYPES.length];
if (ModStatus.isFluidLoggedLoaded) {
this.fluidArrays = new Fluid[SECTION_TABLE_ARRAY_SIZE][];
} else {
this.fluidArrays = null;
}
for (int x = 0; x < SECTION_LENGTH; x++) {
for (int y = 0; y < SECTION_LENGTH; y++) {
for (int z = 0; z < SECTION_LENGTH; z++) {
@@ -152,6 +165,10 @@ public class WorldSlice implements IBlockAccessExtended {
this.blockArrays[i] = new Block[SECTION_BLOCK_COUNT];
Arrays.fill(this.blockArrays[i], Blocks.air);
this.metadataArrays[i] = new int[SECTION_BLOCK_COUNT];
if (ModStatus.isFluidLoggedLoaded && this.fluidArrays != null) {
this.fluidArrays[i] = new Fluid[SECTION_BLOCK_COUNT];
}
}
}
}
@@ -175,6 +192,11 @@ public class WorldSlice implements IBlockAccessExtended {
final ClonedChunkSection section = this.sections[idx];
this.unpackBlockData(this.blockArrays[idx], this.metadataArrays[idx], section, context.getVolume());
if (ModStatus.isFluidLoggedLoaded) {
this.unpackFluidLoggedData(this.fluidArrays[idx], section, context.getVolume());
}
this.biomeData[idx] = section.getBiomeData();
this.lightArrays[idx][EnumSkyBlock.Block.ordinal()] = section.getLightArray(EnumSkyBlock.Block);
@@ -191,8 +213,8 @@ public class WorldSlice implements IBlockAccessExtended {
return (15 << 20) | (min << 4);
}
final int skyBrightness = this.getSkyBlockTypeBrightness(net.minecraft.world.EnumSkyBlock.Sky, x, y, z);
int blockBrightness = this.getSkyBlockTypeBrightness(net.minecraft.world.EnumSkyBlock.Block, x, y, z);
final int skyBrightness = this.getSkyBlockTypeBrightness(EnumSkyBlock.Sky, x, y, z);
int blockBrightness = this.getSkyBlockTypeBrightness(EnumSkyBlock.Block, x, y, z);
if (blockBrightness < min) {
blockBrightness = min;
@@ -265,6 +287,14 @@ public class WorldSlice implements IBlockAccessExtended {
return getBlock(x, y, z).isSideSolid(this, x, y, z, side);
}
private void unpackFluidLoggedData(Fluid[] fluids, ClonedChunkSection section, StructureBoundingBox box) {
if (this.origin.equals(section.getPosition())) {
this.unpackFluidLoggedDataZ(fluids, section);
} else {
this.unpackFluidLoggedDataR(fluids, section, box);
}
}
private void unpackBlockData(Block[] blocks, int[] metas, ClonedChunkSection section, StructureBoundingBox box) {
if (this.origin.equals(section.getPosition())) {
this.unpackBlockDataZ(blocks, metas, section);
@@ -273,6 +303,48 @@ public class WorldSlice implements IBlockAccessExtended {
}
}
private void unpackFluidLoggedDataR(Fluid[] fluids, ClonedChunkSection section, StructureBoundingBox box) {
final ChunkSectionPos pos = section.getPosition();
final int minBlockX = Math.max(box.minX, pos.getMinX());
final int maxBlockX = Math.min(box.maxX, pos.getMaxX());
final int minBlockY = Math.max(box.minY, pos.getMinY());
final int maxBlockY = Math.min(box.maxY, pos.getMaxY());
final int minBlockZ = Math.max(box.minZ, pos.getMinZ());
final int maxBlockZ = Math.min(box.maxZ, pos.getMaxZ());
copyFluids(fluids, section, minBlockY, maxBlockY, minBlockZ, maxBlockZ, minBlockX, maxBlockX);
}
private void unpackFluidLoggedDataZ(Fluid[] fluids, ClonedChunkSection section) {
// TODO: Look into a faster copy for this?
final ChunkSectionPos pos = section.getPosition();
final int minBlockX = pos.getMinX();
final int maxBlockX = pos.getMaxX();
final int minBlockY = pos.getMinY();
final int maxBlockY = pos.getMaxY();
final int minBlockZ = pos.getMinZ();
final int maxBlockZ = pos.getMaxZ();
// TODO: Can this be optimized?
copyFluids(fluids, section, minBlockY, maxBlockY, minBlockZ, maxBlockZ, minBlockX, maxBlockX);
}
private static void copyFluids(Fluid[] fluids, ClonedChunkSection section, int minBlockY, int maxBlockY, int minBlockZ, int maxBlockZ, int minBlockX, int maxBlockX) {
for (int y = minBlockY; y <= maxBlockY; y++) {
for (int z = minBlockZ; z <= maxBlockZ; z++) {
for (int x = minBlockX; x <= maxBlockX; x++) {
final int blockIdx = getLocalBlockIndex(x & 15, y & 15, z & 15);
fluids[blockIdx] = section.getFluid(x & 15, y & 15, z & 15);
}
}
}
}
private static void copyBlocks(Block[] blocks, int[] metas, ClonedChunkSection section, int minBlockY, int maxBlockY, int minBlockZ, int maxBlockZ, int minBlockX, int maxBlockX) {
for (int y = minBlockY; y <= maxBlockY; y++) {
@@ -419,4 +491,23 @@ public class WorldSlice implements IBlockAccessExtended {
z >= box.minZ &&
z <= box.maxZ;
}
public @Nullable Fluid fl$getFluid(int x, int y, int z) {
if (!blockBoxContains(this.volume, x, y, z)) {
return null;
}
final int relX = x - this.baseX;
final int relY = y - this.baseY;
final int relZ = z - this.baseZ;
return this.fluidArrays[getLocalSectionIndex(relX >> 4, relY >> 4, relZ >> 4)][getLocalBlockIndex(relX & 15, relY & 15, relZ & 15)];
}
public Fluid getFluidRelative(int x, int y, int z) {
return this.fluidArrays[getLocalSectionIndex(x >> 4, y >> 4, z >> 4)][getLocalBlockIndex(x & 15, y & 15, z & 15)];
}
public void fl$setFluid(int x, int y, int z, @Nullable Fluid fluid) {
throw new UnsupportedOperationException("Cannot set fluids in a world slice. WorldSlice is read-only");
}
}
@@ -7,6 +7,7 @@ import com.gtnewhorizons.angelica.compat.mojang.ChunkSectionPos;
import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
import lombok.Getter;
import mega.fluidlogged.internal.mixin.hook.FLSubChunk;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.EnumSkyBlock;
@@ -15,6 +16,7 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.fluids.Fluid;
import java.util.concurrent.atomic.AtomicInteger;
@@ -102,6 +104,14 @@ public class ClonedChunkSection {
return data.getBlockByExtId(x, y, z);
}
public Fluid getFluid(int x, int y, int z) {
if (ModStatus.isFluidLoggedLoaded) {
return ((FLSubChunk) data).fl$getFluid(x, y, z);
}
return null;
}
public int getBlockMetadata(int x, int y, int z) {
return data.getExtBlockMetadata(x, y, z);
}
@@ -68,4 +68,6 @@ public net.minecraft.client.renderer.EntityRenderer field_78510_Z #renderEndNano
public net.minecraft.client.multiplayer.PlayerControllerMP field_78779_k #currentGameType
public net.minecraft.world.World field_72993_I # activeChunkSet
public net.minecraft.world.World field_72993_I # activeChunkSet
public cpw.mods.fml.client.SplashProgress$SplashFontRenderer
Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 852 B

@@ -1,6 +1,8 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.archaic;
import cpw.mods.fml.client.SplashProgress;
import cpw.mods.fml.client.SplashProgress.SplashFontRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@@ -12,12 +14,19 @@ public interface AccessorSplashProgress {
static int getBarBorderColor() {
throw new AssertionError();
}
@Accessor(remap = false)
static int getBarBackgroundColor() {
throw new AssertionError();
}
@Accessor(remap = false)
static int getFontColor() {
throw new AssertionError();
}
@Accessor(remap = false)
static SplashFontRenderer getFontRenderer() {
throw new AssertionError();
}
}
@@ -5,9 +5,9 @@ package com.gtnewhorizons.angelica.mixins.early.angelica.archaic;
import com.gtnewhorizons.angelica.Tags;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import cpw.mods.fml.client.SplashProgress;
import net.minecraft.client.gui.FontRenderer;
import cpw.mods.fml.client.SplashProgress.SplashFontRenderer;
import org.apache.commons.lang3.StringUtils;
import org.lwjgl.opengl.Display;
import org.spongepowered.asm.mixin.Final;
@@ -18,8 +18,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.lang.reflect.Field;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
@@ -30,29 +28,19 @@ import static org.lwjgl.opengl.GL11.glTranslatef;
@SuppressWarnings("deprecation")
@Mixin(targets = { "cpw/mods/fml/client/SplashProgress$3" })
public class MixinSplashProgress {
private static final int memoryGoodColor = 0x78CB34;
private static final int memoryWarnColor = 0xE6E84A;
private static final int memoryLowColor = 0xE42F2F;
public class MixinSplashProgress$3 {
private static final int MEMORY_GOOD_COLOR = 0x78CB34;
private static final int MEMORY_WARN_COLOR = 0xE6E84A;
private static final int MEMORY_LOW_COLOR = 0xE42F2F;
private static float memoryColorPercent;
private static long memoryColorChangeTime;
private static FontRenderer fontRenderer = null;
@Unique
private static Boolean angelica$isArchaicFixPresent = null;
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 1, remap = false, shift = At.Shift.AFTER), remap = false, require = 0)
private void injectDrawMemoryBar(CallbackInfo ci) {
// NOTE: Disable this if you're checking for off thread GL calls via `-Dangelica.assertMainThread=true`
if(fontRenderer == null) {
try {
Field f = SplashProgress.class.getDeclaredField("fontRenderer");
f.setAccessible(true);
fontRenderer = (FontRenderer)f.get(null);
} catch(ReflectiveOperationException e) {
AngelicaTweaker.LOGGER.error(e);
return;
}
}
// This runs before Loader.isModLoaded() works
if (angelica$isArchaicFixPresent == null) {
try {
@@ -68,7 +56,7 @@ public class MixinSplashProgress {
glTranslatef(320 - Display.getWidth() / 2 + 4, 240 + Display.getHeight() / 2 - textHeight2, 0);
glScalef(2, 2, 1);
glEnable(GL_TEXTURE_2D);
fontRenderer.drawString("Angelica " + Tags.VERSION, 0, angelica$isArchaicFixPresent ? -10 : 0, 0x000000);
AccessorSplashProgress.getFontRenderer().drawString("Angelica " + Tags.VERSION, 0, angelica$isArchaicFixPresent ? -10 : 0, 0x000000);
glDisable(GL_TEXTURE_2D);
glPopMatrix();
if(AngelicaConfig.showSplashMemoryBar) {
@@ -95,6 +83,7 @@ public class MixinSplashProgress {
final int freeMemory = bytesToMb(Runtime.getRuntime().freeMemory());
final int usedMemory = totalMemory - freeMemory;
final float usedMemoryPercent = usedMemory / (float) maxMemory;
final SplashFontRenderer fontRenderer = AccessorSplashProgress.getFontRenderer();
glPushMatrix();
// title - message
@@ -123,13 +112,13 @@ public class MixinSplashProgress {
final int memoryBarColor;
if (memoryColorPercent < 0.75f) {
memoryBarColor = memoryGoodColor;
memoryBarColor = MEMORY_GOOD_COLOR;
} else if (memoryColorPercent < 0.85f) {
memoryBarColor = memoryWarnColor;
memoryBarColor = MEMORY_WARN_COLOR;
} else {
memoryBarColor = memoryLowColor;
memoryBarColor = MEMORY_LOW_COLOR;
}
setColor(memoryLowColor);
setColor(MEMORY_LOW_COLOR);
glPushMatrix();
glTranslatef((barWidth - 2) * (totalMemory) / (maxMemory) - 2, 0, 0);
drawBox(2, barHeight - 2);
@@ -17,16 +17,19 @@ public class MixinRenderGlobal_ItemRenderDist {
@Unique private static final int[] sodium$entityItemCount = new int[256];
@Unique private static int sodium$itemRenderDist = 255;
@Unique private static int sodium$itemRenderedCount;
@Unique private static int sodium$itemLimit = Integer.MAX_VALUE;
@Inject(method = "renderEntities", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderGlobal;countEntitiesRendered:I", ordinal = 0))
private void sodium$resetEntitycount(CallbackInfo ci) {
sodium$itemRenderedCount = 0;
int entityCount = 0;
boolean reachedLimit = false;
final int itemLimit = AngelicaConfig.droppedItemLimit == 2048 ? Integer.MAX_VALUE : AngelicaConfig.droppedItemLimit;
sodium$itemLimit = AngelicaConfig.droppedItemLimit == 2048 ? Integer.MAX_VALUE : AngelicaConfig.droppedItemLimit;
for (int i = 0; i < sodium$entityItemCount.length; i++) {
entityCount += sodium$entityItemCount[i];
sodium$entityItemCount[i] = 0;
if (!reachedLimit && entityCount > itemLimit) {
if (!reachedLimit && entityCount > sodium$itemLimit) {
reachedLimit = true;
sodium$itemRenderDist = i == 0 ? 1 : i;
}
@@ -45,7 +48,9 @@ public class MixinRenderGlobal_ItemRenderDist {
if (flag && entity instanceof EntityItem) {
final int i = Math.min((int) (entity.getDistanceSq(d0, d1, d2) / 4.0D), 255);
sodium$entityItemCount[i]++;
return i <= sodium$itemRenderDist;
final boolean doRender = i <= sodium$itemRenderDist && sodium$itemRenderedCount < sodium$itemLimit;
if (doRender) sodium$itemRenderedCount++;
return doRender;
}
return flag;
}
@@ -30,7 +30,6 @@ public abstract class MixinEntityLivingBase extends Entity {
vec31.rotateAroundX(-rotationPitch * 3.1415927F / 180.0F);
vec31.rotateAroundY(-rotationYaw * 3.1415927F / 180.0F);
vec31 = vec31.addVector(posX, posY + (double)getEyeHeight(), posZ);
NotFine.logger.info("Item broken, calling IWorldSpawnItemBreakParticle spawnItemBreakParticle");
((IWorldSpawnItemBreakParticle)worldObj).spawnItemBreakParticle(itemStack,
"iconcrack_" + Item.getIdFromItem(itemStack.getItem()),
vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05, vec3.zCoord);
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(value = RenderItem.class)
@Mixin(value = RenderItem.class, priority = 900)
public abstract class MixinRenderItem {
/**
@@ -1,18 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.shaders.startup;
import net.coderbot.iris.Iris;
import net.minecraft.client.gui.GuiMainMenu;
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;
@Mixin(GuiMainMenu.class)
public class MixinGuiMainMenu {
@Inject(method = "initGui", at = @At("RETURN"))
public void angelica$shadersOnLoadingComplete(CallbackInfo ci) {
Iris.onLoadingComplete();
}
}
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.shaders.startup;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import net.coderbot.iris.Iris;
import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MixinMinecraft {
@Unique
private static boolean angelica$hasFirstInit;
@Inject(method = "startGame",
at = @At(value = "INVOKE",
remap = false,
shift = At.Shift.BEFORE,
target = "Lcpw/mods/fml/client/SplashProgress;clearVanillaResources(Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/util/ResourceLocation;)V"))
public void angelica$shadersOnLoadingComplete(CallbackInfo ci) {
if (!angelica$hasFirstInit && GLStateManager.isMainThread()) {
angelica$hasFirstInit = true;
Iris.onLoadingComplete();
}
}
}