mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-27 23:46:01 +00:00
Fix underwater lighting on QuadProviders
This commit is contained in:
1 parent
c5bda3b19c
commit
9710801cb1
3 files changed
+43
-8
No files matched your search
@@ -37,6 +37,8 @@ import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
@@ -195,12 +197,20 @@ public class ClientProxy extends CommonProxy {
|
||||
default -> throw new RuntimeException();
|
||||
};
|
||||
event.left.set(i, String.format("XYZ: %.3f / %.5f / %.3f", mc.thePlayer.posX, mc.thePlayer.boundingBox.minY, mc.thePlayer.posZ));
|
||||
int blockX = MathHelper.floor_double(mc.thePlayer.posX);
|
||||
int blockY = MathHelper.floor_double(mc.thePlayer.boundingBox.minY);
|
||||
int blockZ = MathHelper.floor_double(mc.thePlayer.posZ);
|
||||
event.left.set(i + 1, String.format("Block: %d %d %d [%d %d %d]", blockX, blockY, blockZ, blockX & 15, blockY & 15, blockZ & 15));
|
||||
event.left.set(i + 2, String.format("Chunk: %d %d %d", blockX >> 4, blockY >> 4, blockZ >> 4));
|
||||
int bX = MathHelper.floor_double(mc.thePlayer.posX);
|
||||
int bY = MathHelper.floor_double(mc.thePlayer.boundingBox.minY);
|
||||
int bZ = MathHelper.floor_double(mc.thePlayer.posZ);
|
||||
event.left.set(i + 1, String.format("Block: %d %d %d [%d %d %d]", bX, bY, bZ, bX & 15, bY & 15, bZ & 15));
|
||||
event.left.set(i + 2, String.format("Chunk: %d %d %d", bX >> 4, bY >> 4, bZ >> 4));
|
||||
event.left.set(i + 3, String.format("Facing: %s (%s) (%.1f / %.1f)", Direction.directions[heading].toLowerCase(Locale.ROOT), heading_str, MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw), MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationPitch)));
|
||||
|
||||
Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(bX, bZ);
|
||||
event.left.set(i + 4, String.format("lc: %d b: %s bl: %d sl: %d rl: %d",
|
||||
chunk.getTopFilledSegment() + 15,
|
||||
chunk.getBiomeGenForWorldCoords(bX & 15, bZ & 15, mc.theWorld.getWorldChunkManager()).biomeName,
|
||||
chunk.getSavedLightValue(EnumSkyBlock.Block, bX & 15, bY, bZ & 15),
|
||||
chunk.getSavedLightValue(EnumSkyBlock.Sky, bX & 15, bY, bZ & 15),
|
||||
chunk.getBlockLightValue(bX & 15, bY, bZ & 15, 0)));
|
||||
}
|
||||
}
|
||||
event.setCanceled(true);
|
||||
|
||||
+4
-3
@@ -1,6 +1,7 @@
|
||||
package me.jellysquid.mods.sodium.client.model.light.data;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
|
||||
import me.jellysquid.mods.sodium.client.util.StateUtil;
|
||||
import me.jellysquid.mods.sodium.client.world.WorldSlice;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -63,11 +64,11 @@ public abstract class LightDataAccess {
|
||||
em = true;
|
||||
}
|
||||
|
||||
// First is shouldBlockVision, but I can't find if any transparent objects set it
|
||||
final boolean op = /*state.shouldBlockVision(world, pos) ||*/ block.getLightOpacity() == 0;
|
||||
// First is shouldBlockVision on modern
|
||||
final boolean op = !block.isOpaqueCube() || block.getLightOpacity() == 0;
|
||||
final boolean fo = block.isOpaqueCube();
|
||||
// Should be isFullCube, but this is probably close enough
|
||||
final boolean fc = block.renderAsNormalBlock();
|
||||
final boolean fc = StateUtil.areBoundsFullCube(block);
|
||||
|
||||
// OPTIMIZE: Do not calculate lightmap data if the block is full and opaque.
|
||||
// FIX: Calculate lightmap data for light-emitting or emissive blocks, even though they are full and opaque.
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package me.jellysquid.mods.sodium.client.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class StateUtil {
|
||||
|
||||
public static boolean areBoundsFullCube(Block b) {
|
||||
|
||||
if (b.getBlockBoundsMaxX() < 1)
|
||||
return false;
|
||||
if (b.getBlockBoundsMinX() > 0)
|
||||
return false;
|
||||
if (b.getBlockBoundsMaxY() < 1)
|
||||
return false;
|
||||
if (b.getBlockBoundsMinY() > 0)
|
||||
return false;
|
||||
if (b.getBlockBoundsMaxZ() < 1)
|
||||
return false;
|
||||
if (b.getBlockBoundsMinZ() > 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user