mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-24 06:04:27 +00:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5c9fa3301 | ||
|
|
d6a6d3b525 | ||
|
|
f079bed977 | ||
|
|
c9ec40e94b | ||
|
|
8380f3853d | ||
|
|
534ae6b05c | ||
|
|
68d523d3df | ||
|
|
2f22a7b3ad | ||
|
|
7b79b90dd6 | ||
|
|
417f23f826 | ||
|
|
ca3c46c873 | ||
|
|
82fa9ade2b | ||
|
|
aaab8fd0bc | ||
|
|
bd56ccc4b8 |
No files matched your search
+3
-4
@@ -71,7 +71,7 @@ dependencies {
|
||||
|
||||
// Iris Shaders
|
||||
compileOnly('org.jetbrains:annotations:26.0.2')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.9:dev")
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.10:dev")
|
||||
|
||||
shadowImplementation("org.anarres:jcpp:1.4.14") // Apache 2.0
|
||||
shadowImplementation("org.taumc:glsl-transformation-lib:0.2.0-26.g5ee7d96-GTNH") {
|
||||
@@ -108,8 +108,7 @@ dependencies {
|
||||
|
||||
compileOnly("curse.maven:minefactory-reloaded-66672:2277486")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughIds:2.1.10:dev") // Mixin Version
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughIds-Legacy:1.4.7:dev") // ASM Version
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughIds:2.1.10:dev")
|
||||
|
||||
compileOnly(rfg.deobf("maven.modrinth:ntmspace:X5593_H261"))
|
||||
|
||||
@@ -126,7 +125,7 @@ dependencies {
|
||||
transformedMod("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
|
||||
|
||||
// Better Crashes
|
||||
compileOnly("com.github.GTNewHorizons:BetterCrashes:1.4.0-GTNH:dev")
|
||||
compileOnly("com.github.GTNewHorizons:BetterCrashes:1.4.1-GTNH:dev")
|
||||
|
||||
afterEvaluate {
|
||||
dependencies {
|
||||
|
||||
@@ -75,11 +75,9 @@ public class BatchingFontRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
public BatchingFontRenderer(FontRenderer underlying, int[] charWidth, byte[] glyphWidth,
|
||||
int[] colorCode, ResourceLocation locationFontTexture) {
|
||||
public BatchingFontRenderer(FontRenderer underlying, int[] charWidth, int[] colorCode, ResourceLocation locationFontTexture) {
|
||||
this.underlying = underlying;
|
||||
this.charWidth = charWidth;
|
||||
this.glyphWidth = glyphWidth;
|
||||
this.colorCode = colorCode;
|
||||
this.locationFontTexture = locationFontTexture;
|
||||
|
||||
@@ -92,7 +90,6 @@ public class BatchingFontRenderer {
|
||||
|
||||
FontProviderMC.get(this.isSGA).charWidth = this.charWidth;
|
||||
FontProviderMC.get(this.isSGA).locationFontTexture = this.locationFontTexture;
|
||||
FontProviderUnicode.get().glyphWidth = this.glyphWidth;
|
||||
|
||||
//noinspection deprecation
|
||||
fontShaderId = FontAAShader.getProgram().getProgramId();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gtnewhorizons.angelica.client.font;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||
import com.gtnewhorizons.angelica.config.FontConfig;
|
||||
import lombok.Setter;
|
||||
import lombok.Value;
|
||||
@@ -46,7 +45,7 @@ public final class FontProviderCustom implements FontProvider {
|
||||
default -> null;
|
||||
};
|
||||
if (Objects.equals(myFontName, "(none)")) {
|
||||
font = null;
|
||||
this.font = null;
|
||||
return;
|
||||
}
|
||||
int fontPos = -1;
|
||||
@@ -58,10 +57,10 @@ public final class FontProviderCustom implements FontProvider {
|
||||
}
|
||||
if (fontPos == -1) {
|
||||
LOGGER.info("Could not find previously set font \"{}\". ", myFontName);
|
||||
font = null;
|
||||
this.font = null;
|
||||
return;
|
||||
}
|
||||
font = availableFonts[fontPos].deriveFont(currentFontQuality);
|
||||
this.font = availableFonts[fontPos].deriveFont(this.currentFontQuality);
|
||||
}
|
||||
private static class InstLoader {
|
||||
static final FontProviderCustom instance0 = new FontProviderCustom((byte)0);
|
||||
@@ -71,8 +70,8 @@ public final class FontProviderCustom implements FontProvider {
|
||||
public static FontProviderCustom getFallback() { return InstLoader.instance1; }
|
||||
|
||||
public void reloadFont(int fontID) {
|
||||
currentFontQuality = FontConfig.customFontQuality;
|
||||
font = FontStrategist.getAvailableFonts()[fontID].deriveFont(currentFontQuality);
|
||||
this.currentFontQuality = FontConfig.customFontQuality;
|
||||
this.font = FontStrategist.getAvailableFonts()[fontID].deriveFont(this.currentFontQuality);
|
||||
|
||||
File[] files = new File(getFontDir()).listFiles();
|
||||
if (files != null) {
|
||||
@@ -94,7 +93,7 @@ public final class FontProviderCustom implements FontProvider {
|
||||
}
|
||||
}
|
||||
|
||||
fontAtlases = new FontAtlas[ATLAS_COUNT];
|
||||
this.fontAtlases = new FontAtlas[ATLAS_COUNT];
|
||||
}
|
||||
|
||||
private String getFontDir() {
|
||||
@@ -134,50 +133,44 @@ public final class FontProviderCustom implements FontProvider {
|
||||
}
|
||||
|
||||
void construct(Font font) {
|
||||
float separator = currentFontQuality / 3f;
|
||||
int atlasChars = 0;
|
||||
for (int i = 0; i < ATLAS_SIZE; i++) {
|
||||
final char ch = (char) (i + ATLAS_SIZE * this.id);
|
||||
if (font.canDisplay(ch)) { atlasChars++; }
|
||||
}
|
||||
if (atlasChars == 0) { return; }
|
||||
|
||||
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2d = image.createGraphics();
|
||||
g2d.setFont(font);
|
||||
FontMetrics fm = g2d.getFontMetrics();
|
||||
g2d.dispose();
|
||||
int width = 0;
|
||||
int actualChars = 0;
|
||||
for (int i = 0; i < ATLAS_SIZE; i++) {
|
||||
final char ch = (char)(i + ATLAS_SIZE * this.id);
|
||||
if (font.canDisplay(ch)) {
|
||||
width += (int) (separator + fm.charWidth(ch));
|
||||
actualChars++;
|
||||
}
|
||||
}
|
||||
if (actualChars == 0) {
|
||||
return;
|
||||
}
|
||||
final int atlasTilesX = (int) Math.ceil(Math.sqrt(actualChars) * 1.5f);
|
||||
final int atlasTilesY = (int) Math.ceil((double) actualChars / atlasTilesX);
|
||||
LOGGER.info("constructing custom font atlas (ID {}) of nominal size {} chars, actual: {}, {} rows by {} columns",
|
||||
this.id, ATLAS_SIZE, actualChars, atlasTilesX, atlasTilesY);
|
||||
width = 0;
|
||||
actualChars = 0;
|
||||
|
||||
final int atlasTilesX = (int) Math.ceil(Math.sqrt(atlasChars) * 1.5f);
|
||||
final int atlasTilesY = (int) Math.ceil((double) atlasChars / atlasTilesX);
|
||||
final float charSeparator = currentFontQuality / 3f;
|
||||
int rowWidth = 0;
|
||||
int maxRowWidth = 0;
|
||||
atlasChars = 0;
|
||||
|
||||
for (int i = 0; i < ATLAS_SIZE; i++) {
|
||||
if (actualChars % atlasTilesX == 0) {
|
||||
maxRowWidth = Math.max(maxRowWidth, width);
|
||||
width = 0;
|
||||
if (atlasChars % atlasTilesX == 0) {
|
||||
maxRowWidth = Math.max(maxRowWidth, rowWidth);
|
||||
rowWidth = 0;
|
||||
}
|
||||
final char ch = (char)(i + ATLAS_SIZE * this.id);
|
||||
if (font.canDisplay(ch)) {
|
||||
width += (int) (separator + fm.charWidth(ch));
|
||||
actualChars++;
|
||||
rowWidth += (int) (charSeparator + fm.charWidth(ch));
|
||||
atlasChars++;
|
||||
}
|
||||
}
|
||||
maxRowWidth = Math.max(maxRowWidth, width);
|
||||
maxRowWidth = Math.max(maxRowWidth, rowWidth);
|
||||
|
||||
final int lineHeight = fm.getHeight();
|
||||
final float desc = fm.getDescent();
|
||||
|
||||
final int imageWidth = (int) (maxRowWidth + separator);
|
||||
final int imageHeight = (int) ((separator + lineHeight) * atlasTilesY + separator);
|
||||
final int imageWidth = (int) (maxRowWidth + charSeparator);
|
||||
final int imageHeight = (int) ((charSeparator + lineHeight) * atlasTilesY + charSeparator);
|
||||
|
||||
image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_ARGB);
|
||||
g2d = image.createGraphics();
|
||||
@@ -192,35 +185,34 @@ public final class FontProviderCustom implements FontProvider {
|
||||
fm = g2d.getFontMetrics();
|
||||
|
||||
int tileX = 0, tileY = 0; // position in atlas tiles
|
||||
int imgX = (int) separator; // position in pixels
|
||||
int imgX = (int) charSeparator; // position in pixels
|
||||
|
||||
for (int i = 0; i < ATLAS_SIZE; i++) {
|
||||
final char ch = (char)(i + ATLAS_SIZE * this.id);
|
||||
final char ch = (char) (i + ATLAS_SIZE * this.id);
|
||||
if (!font.canDisplay(ch)) { continue; }
|
||||
|
||||
if (tileX >= atlasTilesX) {
|
||||
tileX = 0;
|
||||
imgX = (int) separator;
|
||||
imgX = (int) charSeparator;
|
||||
tileY++;
|
||||
}
|
||||
|
||||
final int charWidth = fm.charWidth(ch);
|
||||
final float charAspectRatio = (float) charWidth / lineHeight;
|
||||
final float inset = currentFontQuality / 16;
|
||||
g2d.drawString(Character.toString(ch), imgX, (lineHeight + separator) * (tileY + 1) - desc);
|
||||
g2d.drawString(Character.toString(ch), imgX, (lineHeight + charSeparator) * (tileY + 1) - desc);
|
||||
final float uStart = (float) (imgX - inset * charAspectRatio) / imageWidth;
|
||||
final float vStart = ((lineHeight + separator) * (tileY + 1) - lineHeight - inset) / imageHeight;
|
||||
final float vStart = ((lineHeight + charSeparator) * (tileY + 1) - lineHeight - inset) / imageHeight;
|
||||
final float xAdvance = charAspectRatio * 8 * charWidth / (charWidth + 2 * inset * charAspectRatio);
|
||||
final float glyphW = charAspectRatio * 8 + 1;
|
||||
final float uSz = (float) (charWidth + 2 * inset * charAspectRatio) / imageWidth;
|
||||
final float vSz = (float) (lineHeight + 2 * inset) / imageHeight;
|
||||
glyphData[i] = new GlyphData(uStart, vStart, xAdvance, glyphW, uSz, vSz);
|
||||
imgX += (int) (charWidth + separator);
|
||||
this.glyphData[i] = new GlyphData(uStart, vStart, xAdvance, glyphW, uSz, vSz);
|
||||
imgX += (int) (charWidth + charSeparator);
|
||||
tileX++;
|
||||
}
|
||||
g2d.dispose();
|
||||
try {
|
||||
LOGGER.info("writing custom font atlas texture ({}x{} px) to {}", imageWidth, imageHeight, getAtlasFullPath(this.id));
|
||||
Files.createDirectories(Paths.get(getFontDir()));
|
||||
ImageIO.write(image, "png", new File(getAtlasFullPath(this.id)));
|
||||
} catch (IOException e) {
|
||||
@@ -232,18 +224,18 @@ public final class FontProviderCustom implements FontProvider {
|
||||
|
||||
private FontAtlas getAtlas(char chr) {
|
||||
int id = chr / ATLAS_SIZE;
|
||||
FontAtlas fa = fontAtlases[id];
|
||||
FontAtlas fa = this.fontAtlases[id];
|
||||
if (fa == null) {
|
||||
fa = new FontAtlas(id);
|
||||
fa.construct(font);
|
||||
fa.construct(this.font);
|
||||
this.fontAtlases[id] = fa;
|
||||
}
|
||||
fontAtlases[id] = fa;
|
||||
return fa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlyphAvailable(char chr) {
|
||||
if (font == null) { return false; }
|
||||
if (this.font == null) { return false; }
|
||||
return (getAtlas(chr).glyphData[chr % ATLAS_SIZE] != null);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,31 @@
|
||||
package com.gtnewhorizons.angelica.client.font;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.FontConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public final class FontProviderUnicode implements FontProvider {
|
||||
|
||||
private FontProviderUnicode() {}
|
||||
private FontProviderUnicode() {
|
||||
try {
|
||||
InputStream inputstream = Minecraft.getMinecraft().getResourceManager()
|
||||
.getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream();
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
inputstream.read(this.glyphWidth);
|
||||
}
|
||||
catch (IOException ioexception) {
|
||||
throw new RuntimeException(ioexception);
|
||||
}
|
||||
}
|
||||
|
||||
private static class InstLoader { static final FontProviderUnicode instance = new FontProviderUnicode(); }
|
||||
public static FontProviderUnicode get() { return FontProviderUnicode.InstLoader.instance; }
|
||||
|
||||
private static final ResourceLocation[] unicodePageLocations = new ResourceLocation[256];
|
||||
public byte[] glyphWidth;
|
||||
private final byte[] glyphWidth = new byte[65536];
|
||||
|
||||
private ResourceLocation getUnicodePageLocation(int page) {
|
||||
final ResourceLocation lookup = unicodePageLocations[page];
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.gtnewhorizons.neid.mixins.interfaces.IExtendedBlockStorageMixin;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.NibbleArray;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import ru.fewizz.idextender.Hooks;
|
||||
|
||||
public class ExtendedBlockStorageExt extends ExtendedBlockStorage {
|
||||
public boolean hasSky;
|
||||
@@ -39,12 +38,6 @@ public class ExtendedBlockStorageExt extends ExtendedBlockStorage {
|
||||
System.arraycopy(((IExtendedBlockStorageMixin)(Object)storage).getBlock16BMetaArray(), 0, block16BMetaArray, 0, block16BMetaArray.length);
|
||||
}
|
||||
}
|
||||
else if (ModStatus.isOldNEIDLoaded){
|
||||
final short[] blockLSBArray = Hooks.get(this);
|
||||
System.arraycopy(Hooks.get(storage), 0, blockLSBArray, 0, blockLSBArray.length);
|
||||
// getBlockMSBArray is nuked in asm version
|
||||
arrayLen = blockLSBArray.length;
|
||||
}
|
||||
else {
|
||||
final byte[] blockLSBArray = this.getBlockLSBArray();
|
||||
System.arraycopy(storage.getBlockLSBArray(), 0, blockLSBArray, 0, blockLSBArray.length);
|
||||
|
||||
@@ -12,15 +12,8 @@ public class ModStatus {
|
||||
public static final Logger LOGGER = LogManager.getLogger("ModCompat");
|
||||
|
||||
public static BackhandReflectionCompat backhandCompat;
|
||||
/**
|
||||
* Mixin Version
|
||||
*/
|
||||
public static boolean isNEIDLoaded;
|
||||
/**
|
||||
* ASM Version
|
||||
*/
|
||||
public static boolean isOldNEIDLoaded;
|
||||
public static boolean isBetterCrashesLoaded;
|
||||
public static boolean isNEIDLoaded;
|
||||
public static boolean isNEIDMetadataExtended;
|
||||
public static boolean isLotrLoaded;
|
||||
public static boolean isChunkAPILoaded;
|
||||
@@ -42,7 +35,6 @@ public class ModStatus {
|
||||
|
||||
isBetterCrashesLoaded = Loader.isModLoaded("bettercrashes");
|
||||
isNEIDLoaded = Loader.isModLoaded("neid");
|
||||
isOldNEIDLoaded = Loader.isModLoaded("notenoughIDs");
|
||||
isLotrLoaded = Loader.isModLoaded("lotr");
|
||||
isChunkAPILoaded = Loader.isModLoaded("chunkapi");
|
||||
isEIDBiomeLoaded = Loader.isModLoaded("endlessids_biome");
|
||||
|
||||
@@ -88,12 +88,16 @@ public class AngelicaConfig {
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableHudCachingEventTransformer;
|
||||
|
||||
@Config.Comment("Enable HUD Caching at runtime. Requires enableHudCaching to be on at startup. [Experimental]")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean hudCachingActive;
|
||||
|
||||
@Config.Comment("The amount of frames to wait before updating the HUD elements. [Experimental]")
|
||||
@Config.DefaultInt(20)
|
||||
@Config.RangeInt(min = 1, max = 60)
|
||||
public static int hudCachingFPS = 20;
|
||||
|
||||
@Config.Comment("Batch drawScreen fonts [Experimental]")
|
||||
@Config.Comment("Batch drawScreen fonts")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableFontRenderer;
|
||||
@@ -210,6 +214,8 @@ public class AngelicaConfig {
|
||||
"shukaro.artifice.block.world.BlockOre",
|
||||
"bartworks.system.material.BWMetaGeneratedOres",
|
||||
"gtPlusPlus.core.block.base.BlockBaseOre",
|
||||
"org.pfaa.geologica.block.BrokenGeoBlock",
|
||||
"org.pfaa.geologica.block.BrickGeoBlock",
|
||||
})
|
||||
public static String[] blockCrackFixRenderPassWhitelist__;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.glsm;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO;
|
||||
import com.mitchej123.glsm.GLStateManagerService;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -149,17 +150,17 @@ public class AngelicaGLStateManagerService implements GLStateManagerService {
|
||||
|
||||
@Override
|
||||
public int glGenVertexArrays() {
|
||||
return GL30.glGenVertexArrays();
|
||||
return UniversalVAO.genVertexArrays();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindVertexArray(int array) {
|
||||
GL30.glBindVertexArray(array);
|
||||
GLStateManager.glBindVertexArray(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteVertexArrays(int array) {
|
||||
GL30.glDeleteVertexArrays(array);
|
||||
UniversalVAO.deleteVertexArrays(array);
|
||||
}
|
||||
|
||||
// ===================== BUFFER OPERATIONS =====================
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.APPLEVertexArrayObject;
|
||||
import com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO;
|
||||
import org.lwjgl.opengl.ARBMultitexture;
|
||||
import org.lwjgl.opengl.ContextCapabilities;
|
||||
import org.lwjgl.opengl.Display;
|
||||
@@ -3778,20 +3778,12 @@ public class GLStateManager {
|
||||
}
|
||||
if (boundVAO != array) {
|
||||
boundVAO = array;
|
||||
GL30.glBindVertexArray(array);
|
||||
UniversalVAO.bindVertexArray(array);
|
||||
}
|
||||
}
|
||||
|
||||
public static void glBindVertexArrayAPPLE(int array) {
|
||||
if (DisplayListManager.isRecording()) {
|
||||
DisplayListManager.recordBindVAO(array);
|
||||
// Since the vao needs to be bound to do stuff like state setup & data upload, it'll still execute the bind call.
|
||||
// This is technically wrong, but I'm not sure if there's a better solution here.
|
||||
}
|
||||
if (boundVAO != array) {
|
||||
boundVAO = array;
|
||||
APPLEVertexArrayObject.glBindVertexArrayAPPLE(array);
|
||||
}
|
||||
glBindVertexArray(array);
|
||||
}
|
||||
|
||||
public static boolean isVBOBound() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.glsm.recording;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.VAOManager;
|
||||
import com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.VertexFlags;
|
||||
import com.gtnewhorizons.angelica.glsm.DisplayListManager;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
@@ -519,7 +519,7 @@ public final class CommandBufferExecutor {
|
||||
ptr += 4;
|
||||
}
|
||||
case GLCommand.BIND_VAO -> {
|
||||
VAOManager.VAO.glBindVertexArray(memGetInt(ptr));
|
||||
UniversalVAO.bindVertexArray(memGetInt(ptr));
|
||||
ptr += 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class HUDCaching {
|
||||
XaeroMinimapCore.beforeIngameGuiRender(partialTicks);
|
||||
}
|
||||
|
||||
if (!GLStateManager.isFramebufferEnabled()) {
|
||||
if (!AngelicaConfig.hudCachingActive || !GLStateManager.isFramebufferEnabled()) {
|
||||
ingame.renderGameOverlay(partialTicks, hasScreen, mouseX, mouseY);
|
||||
return;
|
||||
}
|
||||
|
||||
+57
-2
@@ -54,6 +54,18 @@ public final class AngelicaRedirector {
|
||||
private static final String OpenGlHelper = "net/minecraft/client/renderer/OpenGlHelper";
|
||||
private static final String EXTBlendFunc = "org/lwjgl/opengl/EXTBlendFuncSeparate";
|
||||
private static final String ARBMultiTexture = "org/lwjgl/opengl/ARBMultitexture";
|
||||
|
||||
// Redirect VAO related calls from NHLib and LWJGLService
|
||||
private static final String UniversalVAO = "com/gtnewhorizon/gtnhlib/client/opengl/UniversalVAO";
|
||||
private static final String UniversalVAODot = "com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO";
|
||||
private static final String VaoFunctions = "com/gtnewhorizon/gtnhlib/client/renderer/vao/VaoFunctions";
|
||||
private static final String LWJGLService = "com/mitchej123/lwjgl/LWJGLService";
|
||||
|
||||
// Don't redirect these items inside of UniversalVAO, since we might be delegating to them
|
||||
private static final Set<String> UniversalVAOSkippedMethods = ImmutableSet.of(
|
||||
"glBindVertexArray", "glGenVertexArrays", "glDeleteVertexArrays", "glIsVertexArray"
|
||||
);
|
||||
|
||||
private static final String MinecraftClient = "net.minecraft.client";
|
||||
private static final String SplashProgress = "cpw.mods.fml.client.SplashProgress";
|
||||
private static final Set<String> ExcludedMinecraftMainThreadChecks = ImmutableSet.of(
|
||||
@@ -63,6 +75,7 @@ public final class AngelicaRedirector {
|
||||
|
||||
private static final ClassConstantPoolParser cstPoolParser = new ClassConstantPoolParser(GL11, GL12, GL13, GL14, GL20, OpenGlHelper, EXTBlendFunc, ARBMultiTexture, Project);
|
||||
private static final Map<String, Map<String, String>> methodRedirects = new HashMap<>();
|
||||
private static final Map<String, Map<String, String>> interfaceRedirects = new HashMap<>();
|
||||
private static final Map<Integer, String> glCapRedirects = new HashMap<>();
|
||||
|
||||
static {
|
||||
@@ -270,12 +283,29 @@ public final class AngelicaRedirector {
|
||||
|
||||
// APPLE
|
||||
methodRedirects.put(APPLEVertexArrayObject, RedirectMap.newMap()
|
||||
.add("glBindVertexArrayAPPLE")
|
||||
.add("glBindVertexArrayAPPLE", "glBindVertexArray")
|
||||
);
|
||||
|
||||
// GTNHLib VAO
|
||||
methodRedirects.put(UniversalVAO, RedirectMap.newMap()
|
||||
.add("bindVertexArray", "glBindVertexArray")
|
||||
);
|
||||
|
||||
// OTHER
|
||||
methodRedirects.put(Project, RedirectMap.newMap().add("gluPerspective"));
|
||||
|
||||
// Interface/virtual redirects — callers invoke these on a receiver object
|
||||
interfaceRedirects.put(VaoFunctions, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
);
|
||||
interfaceRedirects.put(LWJGLService, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
);
|
||||
|
||||
cstPoolParser.addString(UniversalVAO);
|
||||
cstPoolParser.addString(VaoFunctions);
|
||||
cstPoolParser.addString(LWJGLService);
|
||||
|
||||
final String glPrefix = "org/lwjgl/opengl/GL";
|
||||
for (var entry : new HashMap<>(methodRedirects).entrySet()) {
|
||||
if (entry.getKey().startsWith(glPrefix)) {
|
||||
@@ -356,7 +386,8 @@ public final class AngelicaRedirector {
|
||||
final Map<String, String> redirects = methodRedirects.get(mNode.owner);
|
||||
if (redirects != null) {
|
||||
final String glsmName = redirects.get(mNode.name);
|
||||
if (glsmName != null) {
|
||||
// Skip VAO method redirects inside UniversalVAO
|
||||
if (glsmName != null && !(transformedName.startsWith(UniversalVAODot) && UniversalVAOSkippedMethods.contains(glsmName))) {
|
||||
if (LOG_SPAM) {
|
||||
final String shortOwner = mNode.owner.substring(mNode.owner.lastIndexOf("/") + 1);
|
||||
LOGGER.info("Redirecting call in {} from {}.{}{} to GLStateManager.{}{}", transformedName, shortOwner, mNode.name, mNode.desc, glsmName, mNode.desc);
|
||||
@@ -367,6 +398,30 @@ public final class AngelicaRedirector {
|
||||
redirectInMethod = true;
|
||||
}
|
||||
}
|
||||
// Interface/virtual redirects: rewrite receiver-based calls to static GLStateManager calls
|
||||
if ((mNode.getOpcode() == Opcodes.INVOKEINTERFACE || mNode.getOpcode() == Opcodes.INVOKEVIRTUAL) && mNode.desc.equals("(I)V")) {
|
||||
final Map<String, String> ifaceRedirects = interfaceRedirects.get(mNode.owner);
|
||||
if (ifaceRedirects != null) {
|
||||
final String glsmName = ifaceRedirects.get(mNode.name);
|
||||
if (glsmName != null && !(transformedName.startsWith(UniversalVAODot) && UniversalVAOSkippedMethods.contains(glsmName))) {
|
||||
if (LOG_SPAM) {
|
||||
final String shortOwner = mNode.owner.substring(mNode.owner.lastIndexOf("/") + 1);
|
||||
LOGGER.info("Redirecting interface call in {} from {}.{}{} to GLStateManager.{}{}", transformedName, shortOwner, mNode.name, mNode.desc, glsmName, "(I)V");
|
||||
}
|
||||
// Stack is: [receiver, int_arg]. We need just [int_arg] for static call.
|
||||
// Insert SWAP + POP before the call to remove the receiver.
|
||||
mn.instructions.insertBefore(mNode, new InsnNode(Opcodes.SWAP));
|
||||
mn.instructions.insertBefore(mNode, new InsnNode(Opcodes.POP));
|
||||
mNode.setOpcode(Opcodes.INVOKESTATIC);
|
||||
mNode.owner = GLStateManager;
|
||||
mNode.name = glsmName;
|
||||
mNode.desc = "(I)V";
|
||||
mNode.itf = false;
|
||||
changed = true;
|
||||
redirectInMethod = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,6 +162,7 @@ public enum Mixins implements IMixins {
|
||||
, "rendering.MixinPlayerManager"
|
||||
, "rendering.MixinRenderBlocks"
|
||||
, "rendering.MixinRenderingRegistry"
|
||||
, "rendering.MixinTessellator"
|
||||
, "rendering.MixinTileEntity"
|
||||
, "rendering.MixinTileEntityMobSpawner"
|
||||
, "rendering.MixinTileEntityRendererDispatcher"
|
||||
@@ -178,6 +179,8 @@ public enum Mixins implements IMixins {
|
||||
, "celeritas.terrain.MixinRenderGlobal"
|
||||
, "celeritas.terrain.MixinRenderSectionManager"
|
||||
, "celeritas.terrain.MixinWorldClient"
|
||||
, "celeritas.frustum.MixinClippingHelper"
|
||||
, "celeritas.frustum.MixinClippingHelperImpl"
|
||||
, "celeritas.frustum.MixinFrustrum"
|
||||
, "celeritas.features.culling.MixinEffectRenderer"
|
||||
, "celeritas.features.mipmaps.MixinTextureAtlasSprite"
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
import org.joml.FrustumIntersection;
|
||||
|
||||
public interface ClippingHelperExt {
|
||||
FrustumIntersection celeritas$getFrustumIntersection();
|
||||
void celeritas$updateFrustumIntersection();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.gtnewhorizons.angelica.rendering;
|
||||
|
||||
public interface StateAwareTessellator {
|
||||
/**
|
||||
* True if the vertex originated from a RenderBlocks method call with the enableAO flag set.
|
||||
*/
|
||||
int RENDERED_WITH_VANILLA_AO = 0x1;
|
||||
|
||||
void angelica$setAppliedAo(boolean flag);
|
||||
|
||||
int[] angelica$getVertexStates();
|
||||
}
|
||||
+10
-8
@@ -26,27 +26,29 @@ public final class TileEntityRenderBoundsRegistry {
|
||||
|
||||
public static boolean isAlwaysInfiniteExtent(TileEntity te) {
|
||||
final Class<? extends TileEntity> clazz = te.getClass();
|
||||
byte result = classRegistry.getByte(clazz);
|
||||
|
||||
if (result != UNKNOWN) {
|
||||
return result == INFINITE;
|
||||
synchronized (classRegistry) {
|
||||
final byte result = classRegistry.getByte(clazz);
|
||||
if (result != UNKNOWN) return result == INFINITE;
|
||||
}
|
||||
|
||||
return probeAndCache(te, clazz);
|
||||
}
|
||||
|
||||
private static boolean probeAndCache(TileEntity te, Class<? extends TileEntity> clazz) {
|
||||
boolean isInfinite = false;
|
||||
try {
|
||||
AxisAlignedBB aabb = te.getRenderBoundingBox();
|
||||
final AxisAlignedBB aabb = te.getRenderBoundingBox();
|
||||
isInfinite = isInfiniteExtentsBox(aabb);
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
classRegistry.put(clazz, isInfinite ? INFINITE : FINITE);
|
||||
synchronized (classRegistry) {
|
||||
classRegistry.put(clazz, isInfinite ? INFINITE : FINITE);
|
||||
}
|
||||
return isInfinite;
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
classRegistry.clear();
|
||||
synchronized (classRegistry) {
|
||||
classRegistry.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-33
@@ -3,10 +3,10 @@ package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightSource;
|
||||
import com.gtnewhorizons.angelica.rendering.StateAwareTessellator;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.iris.BlockRenderContext;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.iris.IrisExtendedChunkVertexEncoder;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.light.LightDataCache;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.light.QuadLightingHelper;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.light.VanillaDiffuseProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.WorldSlice;
|
||||
import lombok.Getter;
|
||||
@@ -110,7 +110,8 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void copyRawBuffer(int[] rawBuffer, int vertexCount, ChunkBuildBuffers buffers, Material material, boolean isShaderPackOverride,
|
||||
public void copyRawBuffer(int[] rawBuffer, int vertexCount, int[] vertexStates,
|
||||
ChunkBuildBuffers buffers, Material material, boolean isShaderPackOverride,
|
||||
boolean blockAllowsSmoothLighting) {
|
||||
if (vertexCount == 0) {
|
||||
return;
|
||||
@@ -127,8 +128,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
final boolean celeritasSmoothLighting = AngelicaMod.options().quality.useCeleritasSmoothLighting;
|
||||
final boolean shaderActive = IrisApi.getInstance().isShaderPackInUse();
|
||||
final boolean useAoCalculation = lightPipelineReady && (separateAo || celeritasSmoothLighting || shaderActive);
|
||||
final boolean stripDiffuse = shaderActive && BlockRenderingSettings.INSTANCE.shouldDisableDirectionalShading();
|
||||
final boolean shade = false; // Vanilla bakes it, or we remove it - so no need to shade
|
||||
final boolean shouldApplyDiffuse = !BlockRenderingSettings.INSTANCE.shouldDisableDirectionalShading();
|
||||
final ChunkColorWriter colorEncoder = separateAo ? ChunkColorWriter.SEPARATE_AO : ChunkColorWriter.EMBEDDIUM;
|
||||
|
||||
int ptr = 0;
|
||||
@@ -140,11 +140,14 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
final int worldX = originX + blockX;
|
||||
final int worldY = originY + blockY;
|
||||
final int worldZ = originZ + blockZ;
|
||||
final boolean isEmissive = useAoCalculation && QuadLightingHelper.isBlockEmissive(blockAccess, worldX, worldY, worldZ);
|
||||
|
||||
int stateIdx = 0;
|
||||
|
||||
for (int quadIdx = 0; quadIdx < numQuads; quadIdx++) {
|
||||
float uSum = 0, vSum = 0;
|
||||
|
||||
int quadState = -1;
|
||||
|
||||
for (int vIdx = 0; vIdx < 4; vIdx++) {
|
||||
final var vertex = vertices[vIdx];
|
||||
vertex.x = Float.intBitsToFloat(rawBuffer[ptr++]);
|
||||
@@ -161,6 +164,8 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
vertex.color = rawBuffer[ptr++];
|
||||
vertex.vanillaNormal = rawBuffer[ptr++];
|
||||
vertex.light = rawBuffer[ptr++];
|
||||
|
||||
quadState &= vertexStates[stateIdx++];
|
||||
}
|
||||
|
||||
final int trueNormal = QuadUtil.calculateNormal(vertices);
|
||||
@@ -171,34 +176,16 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
animatedSprites.add(sprite);
|
||||
}
|
||||
|
||||
// Strip vanilla's baked diffuse when shaders want oldLighting=false - multiply by an inversion factor
|
||||
// instead of attempting to mixin/asm all the places that bake it in
|
||||
if (stripDiffuse) {
|
||||
final float inverseDiffuse = VanillaDiffuseProvider.INSTANCE.getInverseDiffuse(facing);
|
||||
for (int vIdx = 0; vIdx < 4; vIdx++) {
|
||||
vertices[vIdx].color = VanillaDiffuseProvider.multiplyColor(vertices[vIdx].color, inverseDiffuse);
|
||||
}
|
||||
}
|
||||
|
||||
if (useAoCalculation) {
|
||||
final boolean quadIsFullBright = QuadLightingHelper.isQuadFullBright(vertices);
|
||||
|
||||
if (isEmissive || quadIsFullBright) {
|
||||
Arrays.fill(quadLightData.br, 1.0f);
|
||||
if (isEmissive) {
|
||||
Arrays.fill(quadLightData.lm, LightDataAccess.FULL_BRIGHT);
|
||||
} else {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
quadLightData.lm[i] = vertices[i].light;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
quadView.setup(trueNormal, blockX, blockY, blockZ);
|
||||
final ModelQuadFacing lightFace = quadView.getLightFace();
|
||||
final LightPipeline pipeline = blockAllowsSmoothLighting ? smoothLightPipeline : flatLightPipeline;
|
||||
final ModelQuadFacing cullFace = quadView.getCullFace();
|
||||
pipeline.calculate(quadView, worldX, worldY, worldZ, quadLightData, cullFace, lightFace, shade, true);
|
||||
}
|
||||
// If block used vanilla AO, then we can safely compute our own lighting data and ignore what vanilla
|
||||
// computed. We suppress vanilla emitting the brightness/color in MixinRenderBlocks.
|
||||
// Otherwise, we need to use the block's lightmap values as they are as the ISBRH may have
|
||||
// specified its own lightmaps for visual purposes (e.g. fullbright)
|
||||
if (useAoCalculation && (quadState & StateAwareTessellator.RENDERED_WITH_VANILLA_AO) != 0) {
|
||||
quadView.setup(trueNormal, blockX, blockY, blockZ);
|
||||
final ModelQuadFacing lightFace = quadView.getLightFace();
|
||||
final LightPipeline pipeline = blockAllowsSmoothLighting ? smoothLightPipeline : flatLightPipeline;
|
||||
final ModelQuadFacing cullFace = quadView.getCullFace();
|
||||
pipeline.calculate(quadView, worldX, worldY, worldZ, quadLightData, cullFace, lightFace, shouldApplyDiffuse, true);
|
||||
|
||||
for (int vIdx = 0; vIdx < 4; vIdx++) {
|
||||
final var vertex = vertices[vIdx];
|
||||
@@ -207,6 +194,14 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
vertex.light = quadLightData.lm[vIdx];
|
||||
}
|
||||
} else {
|
||||
if (!shouldApplyDiffuse) {
|
||||
// Calculate the inverse of the expected diffuse constant and apply it to the color to fake
|
||||
// diffuse not having been applied
|
||||
final float inverseDiffuse = VanillaDiffuseProvider.INSTANCE.getInverseDiffuse(facing);
|
||||
for (int vIdx = 0; vIdx < 4; vIdx++) {
|
||||
vertices[vIdx].color = VanillaDiffuseProvider.multiplyColor(vertices[vIdx].color, inverseDiffuse);
|
||||
}
|
||||
}
|
||||
for (int vIdx = 0; vIdx < 4; vIdx++) {
|
||||
vertices[vIdx].trueNormal = trueNormal;
|
||||
}
|
||||
|
||||
+8
-10
@@ -2,6 +2,8 @@ package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.blockpos.BlockPos;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
|
||||
import com.gtnewhorizons.angelica.rendering.StateAwareTessellator;
|
||||
import com.gtnewhorizons.angelica.rendering.TileEntityRenderBoundsRegistry;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHolder;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.iris.BlockRenderContext;
|
||||
@@ -135,8 +137,8 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
|
||||
|
||||
if (block.hasTileEntity(meta)) {
|
||||
final TileEntity tileEntity = region.getTileEntity(x, y, z);
|
||||
if (TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileEntity)) {
|
||||
renderData.globalBlockEntities.add(tileEntity);
|
||||
if (tileEntity != null && TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileEntity)) {
|
||||
(TileEntityRenderBoundsRegistry.isAlwaysInfiniteExtent(tileEntity) ? renderData.globalBlockEntities : renderData.culledBlockEntities).add(tileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,15 +250,11 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
|
||||
block.canRenderInPass(pass);
|
||||
tessellator.startDrawingQuads();
|
||||
renderBlocks.renderBlockByRenderType(block, x, y, z);
|
||||
// In modern versions, block models can specify whether to enable AO or not, but here we must
|
||||
// rely on render ID heuristics to figure out which models would have turned it off
|
||||
int vanillaRenderId = block.getRenderType();
|
||||
boolean blockAllowsSmoothLighting = Minecraft.isAmbientOcclusionEnabled() // smooth lighting on
|
||||
&& block.getLightValue() == 0 // does not emit real block light
|
||||
&& vanillaRenderId != 1 // is not a "cross" block
|
||||
&& vanillaRenderId != 40; // is not a double plant block
|
||||
buildContext.copyRawBuffer(tessellator.rawBuffer, tessellator.vertexCount, buffers, passMaterial,
|
||||
isShaderPackOverride, blockAllowsSmoothLighting);
|
||||
&& block.getLightValue() == 0; // does not emit real block light
|
||||
buildContext.copyRawBuffer(tessellator.rawBuffer, tessellator.vertexCount,
|
||||
((StateAwareTessellator)tessellator).angelica$getVertexStates(),
|
||||
buffers, passMaterial, isShaderPackOverride, blockAllowsSmoothLighting);
|
||||
tessellator.reset();
|
||||
tessellator.isDrawing = false;
|
||||
|
||||
|
||||
+25
-1
@@ -1,11 +1,17 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHolder;
|
||||
import org.embeddedt.embeddium.impl.gl.device.RenderDevice;
|
||||
import org.embeddedt.embeddium.impl.gl.shader.GlProgram;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.MultiDrawMode;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.DefaultChunkRenderer;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.RenderPassConfiguration;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.DirectMultiDrawEmitter;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.IndirectMultiDrawEmitter;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.MultiDrawEmitter;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.shader.ChunkShaderInterface;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.shader.ChunkShaderTextureSlot;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass;
|
||||
@@ -15,7 +21,7 @@ class AngelicaChunkRenderer extends DefaultChunkRenderer {
|
||||
private boolean usingIrisProgram;
|
||||
|
||||
public AngelicaChunkRenderer(RenderDevice device, RenderPassConfiguration<?> renderPassConfiguration) {
|
||||
super(device, renderPassConfiguration);
|
||||
super(device, renderPassConfiguration, createEmitter());
|
||||
|
||||
final IrisShaderProvider provider = IrisShaderProviderHolder.getProvider();
|
||||
if (provider != null) {
|
||||
@@ -23,6 +29,24 @@ class AngelicaChunkRenderer extends DefaultChunkRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private static MultiDrawEmitter createEmitter() {
|
||||
MultiDrawMode mode = AngelicaMod.options().advanced.multiDrawMode;
|
||||
|
||||
if (mode == MultiDrawMode.INDIRECT) {
|
||||
boolean supported = GLStateManager.capabilities != null && (GLStateManager.capabilities.OpenGL43 || GLStateManager.capabilities.GL_ARB_multi_draw_indirect);
|
||||
if (!supported) {
|
||||
AngelicaMod.LOGGER.warn("Indirect multi-draw not supported (requires GL 4.3 / ARB_multi_draw_indirect), falling back to Direct");
|
||||
mode = MultiDrawMode.DIRECT;
|
||||
}
|
||||
}
|
||||
|
||||
return switch (mode) {
|
||||
case DIRECT -> new DirectMultiDrawEmitter();
|
||||
case INDIRECT -> new IndirectMultiDrawEmitter();
|
||||
case INDIVIDUAL -> new IndividualDrawEmitter();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void begin(TerrainRenderPass pass) {
|
||||
final IrisShaderProvider provider = IrisShaderProviderHolder.getProvider();
|
||||
|
||||
+1
-1
@@ -28,9 +28,9 @@ public class AngelicaMainThreadMeshingTask extends AngelicaChunkBuilderMeshingTa
|
||||
final int minZ = this.render.getOriginZ();
|
||||
|
||||
final var world = Minecraft.getMinecraft().theWorld;
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
this.biomeColorCache = ((WorldClientExtension) world).celeritas$getSmoothBiomeColorCache();
|
||||
this.biomeColorCache.update(new SectionPos(this.render.getChunkX(), this.render.getChunkY(), this.render.getChunkZ()));
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+145
-1
@@ -21,6 +21,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.embeddedt.embeddium.impl.gl.device.CommandList;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.ChunkRenderMatrices;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.RenderSection;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.data.MinecraftBuiltRenderSectionData;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.lists.ChunkRenderList;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.lists.SortedRenderLists;
|
||||
@@ -31,6 +32,8 @@ import org.embeddedt.embeddium.impl.render.viewport.Viewport;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,6 +51,12 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
|
||||
// the volume of a section multiplied by the number of sections to be checked at most
|
||||
private static final double MAX_ENTITY_CHECK_VOLUME = 16 * 16 * 16 * 15;
|
||||
|
||||
// For sorting transparent TESRs
|
||||
private RenderSectionOrderer renderSectionOrderer = new RenderSectionOrderer();
|
||||
private TileEntityOrderer tileEntityOrderer = new TileEntityOrderer();
|
||||
private ArrayList<RenderSection> sortedRenderSections = new ArrayList<>();
|
||||
private ArrayList<TileEntity> sortedTileEntities = new ArrayList<>();
|
||||
|
||||
private CeleritasWorldRenderer(Minecraft mc) {
|
||||
// Private constructor for singleton
|
||||
this.mc = mc;
|
||||
@@ -219,9 +228,97 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
|
||||
GLStateManager.glColor4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
private int renderCulledTileEntities(TileEntityRenderContext renderContext) {
|
||||
int count = 0;
|
||||
SortedRenderLists renderLists = renderSectionManager.getRenderLists();
|
||||
Iterator<ChunkRenderList> renderListIterator = renderLists.iterator();
|
||||
|
||||
while (renderListIterator.hasNext()) {
|
||||
var renderList = renderListIterator.next();
|
||||
|
||||
var renderRegion = renderList.getRegion();
|
||||
var renderSectionIterator = renderList.sectionsWithEntitiesIterator();
|
||||
|
||||
if (renderSectionIterator == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
while (renderSectionIterator.hasNext()) {
|
||||
var renderSectionId = renderSectionIterator.nextByteAsInt();
|
||||
var renderSection = renderRegion.getSection(renderSectionId);
|
||||
|
||||
if (renderSection == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var context = renderSection.getBuiltContext();
|
||||
|
||||
if (!(context instanceof MinecraftBuiltRenderSectionData<?, ?> mcData)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// noinspection unchecked
|
||||
var blockEntities = (List<TileEntity>) mcData.culledBlockEntities;
|
||||
|
||||
if (blockEntities.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (TileEntity te : blockEntities) {
|
||||
if (te.shouldRenderInPass(renderContext.pass)) sortedTileEntities.add(te);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sortedTileEntities.sort(tileEntityOrderer.setLastCameraState(lastCameraState));
|
||||
this.renderBlockEntityList(sortedTileEntities, renderContext);
|
||||
|
||||
return sortedTileEntities.size();
|
||||
}
|
||||
|
||||
private int renderGlobalTileEntities(TileEntityRenderContext renderContext) {
|
||||
int count = 0;
|
||||
sortedRenderSections.clear();
|
||||
sortedRenderSections.addAll(renderSectionManager.getSectionsWithGlobalEntities());
|
||||
sortedRenderSections.sort(renderSectionOrderer.setLastCameraState(lastCameraState));
|
||||
for (var renderSection : sortedRenderSections) {
|
||||
sortedTileEntities.clear();
|
||||
var builtContext = renderSection.getBuiltContext();
|
||||
|
||||
if (!(builtContext instanceof MinecraftBuiltRenderSectionData<?, ?> mcData)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// noinspection unchecked
|
||||
var blockEntities = (List<TileEntity>) mcData.globalBlockEntities;
|
||||
|
||||
if (blockEntities.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (TileEntity te : blockEntities) {
|
||||
if (te.shouldRenderInPass(renderContext.pass)) sortedTileEntities.add(te);
|
||||
}
|
||||
|
||||
count += sortedTileEntities.size();
|
||||
|
||||
sortedTileEntities.sort(tileEntityOrderer.setLastCameraState(lastCameraState));
|
||||
this.renderBlockEntityList(sortedTileEntities, renderContext);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public int renderBlockEntities(float partialTicks) {
|
||||
final int pass = MinecraftForgeClient.getRenderPass();
|
||||
return super.renderBlockEntities(teRenderContext.set(partialTicks, pass));
|
||||
teRenderContext.set(partialTicks, pass);
|
||||
if (pass == 0 || !AngelicaMod.options().performance.translucencySorting) {
|
||||
return super.renderBlockEntities(teRenderContext);
|
||||
}
|
||||
int count = 0;
|
||||
count += this.renderCulledTileEntities(teRenderContext);
|
||||
count += this.renderGlobalTileEntities(teRenderContext);
|
||||
return count;
|
||||
}
|
||||
|
||||
private void renderTE(TileEntity tileEntity, int pass, float partialTicks) {
|
||||
@@ -284,4 +381,51 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RenderSectionOrderer implements Comparator<RenderSection> {
|
||||
|
||||
public CameraState lastCameraState;
|
||||
|
||||
public RenderSectionOrderer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public RenderSectionOrderer setLastCameraState(CameraState lastCameraState) {
|
||||
this.lastCameraState = lastCameraState;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(RenderSection render1, RenderSection render2) {
|
||||
final float x = (float) this.lastCameraState.x();
|
||||
final float y = (float) this.lastCameraState.y();
|
||||
final float z = (float) this.lastCameraState.z();
|
||||
final float d1 = render1.getSquaredDistance(x, y, z);
|
||||
final float d2 = render2.getSquaredDistance(x, y, z);
|
||||
return Float.compare(d2, d1);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TileEntityOrderer implements Comparator<TileEntity> {
|
||||
public CameraState lastCameraState;
|
||||
|
||||
public TileEntityOrderer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TileEntityOrderer setLastCameraState(CameraState lastCameraState) {
|
||||
this.lastCameraState = lastCameraState;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(TileEntity te1, TileEntity te2) {
|
||||
final double x = this.lastCameraState.x();
|
||||
final double y = this.lastCameraState.y();
|
||||
final double z = this.lastCameraState.z();
|
||||
final double d1 = te1.getDistanceFrom(x, y, z);
|
||||
final double d2 = te2.getDistanceFrom(x, y, z);
|
||||
return Double.compare(d2, d1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import static com.mitchej123.lwjgl.LWJGLServiceProvider.LWJGL;
|
||||
import static com.mitchej123.lwjgl.LWJGLServiceProvider.POINTER_SIZE;
|
||||
|
||||
import org.embeddedt.embeddium.impl.gl.device.CommandList;
|
||||
import org.embeddedt.embeddium.impl.gl.device.DrawCommandList;
|
||||
import org.embeddedt.embeddium.impl.gl.device.MultiDrawBatch;
|
||||
import org.embeddedt.embeddium.impl.gl.tessellation.GlIndexType;
|
||||
import org.embeddedt.embeddium.impl.gl.tessellation.GlPrimitiveType;
|
||||
import org.embeddedt.embeddium.impl.gl.tessellation.GlTessellation;
|
||||
import org.embeddedt.embeddium.impl.model.quad.properties.ModelQuadFacing;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.data.SectionRenderDataUnsafe;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.MultiDrawEmitter;
|
||||
|
||||
public record IndividualDrawEmitter(MultiDrawBatch batch) implements MultiDrawEmitter {
|
||||
public IndividualDrawEmitter() {
|
||||
this(new MultiDrawBatch(MAX_COMMAND_COUNT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("IntegerMultiplicationImplicitCastToLong")
|
||||
public void addDrawCommands(long pMeshData, int mask, int indexPointerMask) {
|
||||
var batch = this.batch;
|
||||
final var pBaseVertex = batch.pBaseVertex;
|
||||
final var pElementCount = batch.pElementCount;
|
||||
final var pElementPointer = batch.pElementPointer;
|
||||
|
||||
int size = batch.size;
|
||||
|
||||
for (int facing = 0; facing < ModelQuadFacing.COUNT; facing++) {
|
||||
LWJGL.memPutInt(pBaseVertex + (size << 2), SectionRenderDataUnsafe.getVertexOffset(pMeshData, facing));
|
||||
LWJGL.memPutInt(pElementCount + (size << 2), SectionRenderDataUnsafe.getElementCount(pMeshData, facing));
|
||||
LWJGL.memPutAddress(pElementPointer + (size << 3), SectionRenderDataUnsafe.getIndexOffset(pMeshData, facing) & indexPointerMask);
|
||||
|
||||
size += (mask >> facing) & 1;
|
||||
}
|
||||
|
||||
batch.size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeBatch(CommandList commandList, GlTessellation tessellation, GlPrimitiveType primitiveType) {
|
||||
try (DrawCommandList _ = commandList.beginTessellating(tessellation)) {
|
||||
final int mode = primitiveType.getId();
|
||||
final int type = GlIndexType.UNSIGNED_INT.getFormatId();
|
||||
|
||||
for (int i = 0; i < batch.size; i++) {
|
||||
final int count = LWJGL.memGetInt(batch.pElementCount + (long) i * Integer.BYTES);
|
||||
if (count > 0) {
|
||||
LWJGL.glDrawElementsBaseVertex(mode, count, type, LWJGL.memGetAddress(batch.pElementPointer + (long) i * POINTER_SIZE), LWJGL.memGetInt(batch.pBaseVertex + (long) i * Integer.BYTES));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndexBufferSize() {
|
||||
return this.batch.getIndexBufferSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.batch.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.batch.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
this.batch.delete();
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
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 {
|
||||
private QuadLightingHelper() {}
|
||||
|
||||
// Known emissive brightness values set by mods/vanilla
|
||||
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;
|
||||
|
||||
// Must be a known emissive brightness value
|
||||
if (first != FULL_BRIGHT_15 && first != FULL_BRIGHT_14) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// All 4 vertices must have the same value
|
||||
for (int i = 1; i < 4; i++) {
|
||||
if (vertices[i].light != first) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -54,15 +54,14 @@ public class ThreadedAngelicaChunkBuilderMeshingTask extends AngelicaChunkBuilde
|
||||
final WorldSlice worldSlice = buildContext.getWorldSlice();
|
||||
worldSlice.copyData(this.renderContext);
|
||||
this.blockAccess = worldSlice;
|
||||
this.biomeColorCache = new SmoothBiomeColorCache(worldSlice);
|
||||
this.biomeColorCache.update(new SectionPos(this.render.getChunkX(), this.render.getChunkY(), this.render.getChunkZ()));
|
||||
this.biomeColorCache = worldSlice.getBiomeColorCache();
|
||||
buildContext.setupLightPipeline(minX, minY, minZ);
|
||||
} else {
|
||||
// Fallback: direct world access (main thread only)
|
||||
final var world = Minecraft.getMinecraft().theWorld;
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
this.biomeColorCache = ((WorldClientExtension) world).celeritas$getSmoothBiomeColorCache();
|
||||
this.biomeColorCache.update(new SectionPos(this.render.getChunkX(), this.render.getChunkY(), this.render.getChunkZ()));
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
buildContext.setupLightPipeline(this.blockAccess, minX, minY, minZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,13 @@ import com.gtnewhorizons.angelica.compat.mojang.ChunkSectionPos;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.CompatMathHelper;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightSource;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.SmoothBiomeColorCache;
|
||||
|
||||
import java.util.List;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.cloned.ChunkRenderContext;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.cloned.ClonedChunkSection;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.cloned.ClonedChunkSectionCache;
|
||||
import org.embeddedt.embeddium.impl.util.position.SectionPos;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import mega.fluidlogged.api.FLBlockAccess;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -98,6 +100,8 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
private ChunkSectionPos origin;
|
||||
private StructureBoundingBox volume;
|
||||
|
||||
private final SmoothBiomeColorCache biomeColorCache;
|
||||
|
||||
private List<IDynamicLightSource> chunkLightSources;
|
||||
private DynamicLights dynamicLightsInstance;
|
||||
|
||||
@@ -175,6 +179,8 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.biomeColorCache = new SmoothBiomeColorCache(this);
|
||||
}
|
||||
|
||||
public void copyData(ChunkRenderContext context) {
|
||||
@@ -182,6 +188,8 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
this.sections = context.getSections();
|
||||
this.volume = context.getVolume();
|
||||
|
||||
this.biomeColorCache.update(new SectionPos(origin.x, origin.y, origin.z));
|
||||
|
||||
this.baseX = (this.origin.x - NEIGHBOR_CHUNK_RADIUS) << 4;
|
||||
this.baseY = (this.origin.y - NEIGHBOR_CHUNK_RADIUS) << 4;
|
||||
this.baseZ = (this.origin.z - NEIGHBOR_CHUNK_RADIUS) << 4;
|
||||
@@ -221,6 +229,10 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
return this.origin;
|
||||
}
|
||||
|
||||
public SmoothBiomeColorCache getBiomeColorCache() {
|
||||
return this.biomeColorCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int min) {
|
||||
if (y < 0 || y >= 256 || x < -30_000_000 || z < -30_000_000 || x >= 30_000_000 || z >= 30_000_000) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CyclingControlElement<T extends Enum<T>> extends NotFineControlElem
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
if(super.mousePressed(mc, mouseX, mouseY)) {
|
||||
currentIndex = (option.getValue().ordinal() + 1) % allowedValues.length;
|
||||
currentIndex = (currentIndex + 1) % allowedValues.length;
|
||||
option.setValue(allowedValues[currentIndex]);
|
||||
onOptionValueChanged();
|
||||
return true;
|
||||
|
||||
@@ -18,6 +18,7 @@ import me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.GraphicsMode;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.GraphicsQuality;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.LightingQuality;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.MultiDrawMode;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.ParticleMode;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.storage.AngelicaOptionsStorage;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.storage.MinecraftOptionsStorage;
|
||||
@@ -266,6 +267,19 @@ public class SodiumGameOptionPages {
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.setImpact(OptionImpact.LOW)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(MultiDrawMode.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.multidraw_mode.name"))
|
||||
.setTooltip(I18n.format("sodium.options.multidraw_mode.tooltip"))
|
||||
.setControl(o -> {
|
||||
boolean indirectSupported = GLStateManager.capabilities != null && (GLStateManager.capabilities.OpenGL43 || GLStateManager.capabilities.GL_ARB_multi_draw_indirect);
|
||||
MultiDrawMode[] allowed = indirectSupported ? MultiDrawMode.values() : new MultiDrawMode[]{MultiDrawMode.DIRECT, MultiDrawMode.INDIVIDUAL};
|
||||
return new CyclingControl<>(o, MultiDrawMode.class, allowed);
|
||||
})
|
||||
.setBinding((opts, value) -> opts.advanced.multiDrawMode = value, opts -> opts.advanced.multiDrawMode)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.setImpact(OptionImpact.VARIES)
|
||||
.setEnabled(GLStateManager.capabilities != null)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
@@ -440,6 +454,14 @@ public class SodiumGameOptionPages {
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(boolean.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.hudCaching"))
|
||||
.setTooltip(I18n.format("options.angelica.hudCaching.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> AngelicaConfig.hudCachingActive = value, opts -> AngelicaConfig.hudCachingActive)
|
||||
.setEnabled(AngelicaConfig.enableHudCaching)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.droppedItemLimit"))
|
||||
.setTooltip(I18n.format("options.angelica.droppedItemLimit.tooltip"))
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.google.gson.JsonSyntaxException;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.GraphicsQuality;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.MultiDrawMode;
|
||||
import net.coderbot.iris.Iris;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.occlusion.AsyncOcclusionMode;
|
||||
|
||||
@@ -27,6 +28,7 @@ public class SodiumGameOptions {
|
||||
public static class AdvancedSettings {
|
||||
public boolean useVertexArrayObjects = true;
|
||||
public boolean useChunkMultidraw = true;
|
||||
public MultiDrawMode multiDrawMode = MultiDrawMode.DIRECT;
|
||||
|
||||
public boolean useParticleCulling = true;
|
||||
public boolean allowDirectMemoryAccess = true;
|
||||
@@ -96,6 +98,10 @@ public class SodiumGameOptions {
|
||||
config.performance.cpuRenderAheadLimit = 0;
|
||||
}
|
||||
|
||||
if (config.advanced.multiDrawMode == MultiDrawMode.INDIRECT && (GLStateManager.capabilities == null || (!GLStateManager.capabilities.OpenGL43 && !GLStateManager.capabilities.GL_ARB_multi_draw_indirect))) {
|
||||
config.advanced.multiDrawMode = MultiDrawMode.DIRECT;
|
||||
}
|
||||
|
||||
try {
|
||||
if(resaveConfig)
|
||||
config.writeChanges();
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ public class SodiumControlElementFactory implements ControlElementFactory {
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if(AngelicaConfig.enableReesesSodiumOptions) {
|
||||
if (this.option.isAvailable() && this.dim.containsCursor(mouseX, mouseY) && (button == 0 || button == 1)) {
|
||||
this.currentIndex = Math.floorMod(this.option.getValue().ordinal() + (button == 0 ? 1 : -1), this.allowedValues.length);
|
||||
this.currentIndex = Math.floorMod(this.currentIndex + (button == 0 ? 1 : -1), this.allowedValues.length);
|
||||
this.option.setValue(this.allowedValues[this.currentIndex]);
|
||||
this.playClickSound();
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SodiumControlElementFactory implements ControlElementFactory {
|
||||
}
|
||||
} else {
|
||||
if (this.option.isAvailable() && button == 0 && this.dim.containsCursor(mouseX, mouseY)) {
|
||||
this.currentIndex = (this.option.getValue().ordinal() + 1) % this.allowedValues.length;
|
||||
this.currentIndex = (this.currentIndex + 1) % this.allowedValues.length;
|
||||
this.option.setValue(this.allowedValues[this.currentIndex]);
|
||||
this.playClickSound();
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.options.named;
|
||||
|
||||
public enum MultiDrawMode implements NamedState {
|
||||
DIRECT("sodium.options.multidraw_mode.direct"),
|
||||
INDIRECT("sodium.options.multidraw_mode.indirect"),
|
||||
INDIVIDUAL("sodium.options.multidraw_mode.individual");
|
||||
|
||||
private final String key;
|
||||
|
||||
MultiDrawMode(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
@@ -689,7 +689,7 @@ public class ShadowRenderer {
|
||||
// Render all opaque terrain unless pack requests not to
|
||||
if (shouldRenderTerrain) {
|
||||
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
rg.sortAndRender(mc.thePlayer, 0, playerCamera.getPartialTicks());
|
||||
rg.sortAndRender(mc.renderViewEntity, 0, playerCamera.getPartialTicks());
|
||||
}
|
||||
|
||||
// Reset viewport in case terrain rendering changed it
|
||||
@@ -746,7 +746,7 @@ public class ShadowRenderer {
|
||||
// It doesn't matter a ton, since this just means that they won't be sorted in the getNormal rendering pass.
|
||||
// Just something to watch out for, however...
|
||||
if (shouldRenderTranslucent) {
|
||||
rg.sortAndRender(mc.thePlayer, 1, playerCamera.getPartialTicks());
|
||||
rg.sortAndRender(mc.renderViewEntity, 1, playerCamera.getPartialTicks());
|
||||
}
|
||||
|
||||
// Note: Apparently tripwire isn't rendered in the shadow pass.
|
||||
|
||||
@@ -201,6 +201,8 @@ options.angelica.fontconfig.glyph_spacing.tooltip=The spacing between each indiv
|
||||
options.angelica.fontconfig.font_aa_strength.tooltip=The spacing of samples used in font antialiasing. High values may cause fonts to look blurry, low values may cause aliasing. See what works best with your settings.
|
||||
options.angelica.fontconfig.aamode.tooltip=The font antialiasing mode. Can significantly improve the appearance and readability of text that's being scaled or viewed at oblique angles, at the expense of some performance.
|
||||
options.angelica.fontconfig.custom_font_scale.tooltip=A multiplier that affects the scale of custom fonts. Adjust this if text in your font of choice looks under-/over-sized relative to text that does not use custom fonts.
|
||||
options.angelica.hudCaching=HUD Caching
|
||||
options.angelica.hudCaching.tooltip=Caches the HUD to a framebuffer and reuses it across frames to reduce rendering overhead. Requires HUD Caching to be enabled at startup. [Experimental]
|
||||
options.angelica.droppedItemLimit=Dropped Item Render Limit
|
||||
options.angelica.droppedItemLimit.tooltip=The maximum number of dropped items that will be rendered. Lower values can improve performance.
|
||||
options.angelica.mobSpawnerRenderDistance=Mob spawner render distance
|
||||
@@ -224,3 +226,9 @@ options.angelica.aggressiveChunkLoading=Aggressive Chunk Loading
|
||||
options.angelica.aggressiveChunkLoading.tooltip=Renders chunks immediately when loaded, even if neighbors aren't ready yet. Improves perceived loading speed at render distance edges. Chunks rebuild automatically when neighbors load. Useful for low render distance servers.
|
||||
options.angelica.disablef3=Disable F3 Additions
|
||||
options.angelica.disablef3.tooltip=Disables Angelica's additions to the F3 debug screen.
|
||||
|
||||
sodium.options.multidraw_mode.name=Multi-Draw Mode
|
||||
sodium.options.multidraw_mode.tooltip=Controls how draw commands are dispatched for terrain rendering. §lDirect§r uses glMultiDrawElementsBaseVertex (default, GL 3.2+). §lIndirect§r uses GPU indirect rendering (GL 4.3+), may reduce CPU overhead on some hardware. §lIndividual§r issues individual draw calls.
|
||||
sodium.options.multidraw_mode.direct=Direct
|
||||
sodium.options.multidraw_mode.indirect=Indirect
|
||||
sodium.options.multidraw_mode.individual=Individual
|
||||
+1
-1
@@ -120,7 +120,7 @@ public abstract class MixinFontRenderer implements FontRendererAccessor, IFontPa
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void angelica$injectBatcher(GameSettings settings, ResourceLocation fontLocation, TextureManager texManager,
|
||||
boolean unicodeMode, CallbackInfo ci) {
|
||||
angelica$batcher = new BatchingFontRenderer((FontRenderer) (Object) this, this.charWidth, this.glyphWidth, this.colorCode, this.locationFontTexture);
|
||||
angelica$batcher = new BatchingFontRenderer((FontRenderer) (Object) this, this.charWidth, this.colorCode, this.locationFontTexture);
|
||||
}
|
||||
|
||||
@Unique
|
||||
|
||||
+10
-3
@@ -13,17 +13,24 @@ public abstract class MixinTextureAtlasSprite implements SpriteExtension {
|
||||
|
||||
@Override
|
||||
public void celeritas$markActive() {
|
||||
((IPatchedTextureAtlasSprite) this).markNeedsAnimationUpdate();
|
||||
if (this instanceof IPatchedTextureAtlasSprite patched) {
|
||||
patched.markNeedsAnimationUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean celeritas$shouldUpdate() {
|
||||
return ((IPatchedTextureAtlasSprite) this).needsAnimationUpdate();
|
||||
if (this instanceof IPatchedTextureAtlasSprite patched) {
|
||||
return patched.needsAnimationUpdate();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ModifyReturnValue(method = {"getMinU", "getInterpolatedU"}, at = @At("RETURN"))
|
||||
private float celeritas$markActiveOnUVAccess(float original) {
|
||||
((IPatchedTextureAtlasSprite) this).markNeedsAnimationUpdate();
|
||||
if (this instanceof IPatchedTextureAtlasSprite patched) {
|
||||
patched.markNeedsAnimationUpdate();
|
||||
}
|
||||
return original;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.celeritas.frustum;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ClippingHelperExt;
|
||||
import net.minecraft.client.renderer.culling.ClippingHelper;
|
||||
import org.joml.FrustumIntersection;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
@Mixin(ClippingHelper.class)
|
||||
public class MixinClippingHelper implements ClippingHelperExt {
|
||||
|
||||
@Shadow public float[] projectionMatrix;
|
||||
@Shadow public float[] modelviewMatrix;
|
||||
|
||||
@Unique private final FrustumIntersection celeritas$frustumIntersection = new FrustumIntersection();
|
||||
@Unique private final Matrix4f celeritas$projMatrix = new Matrix4f();
|
||||
@Unique private final Matrix4f celeritas$mvMatrix = new Matrix4f();
|
||||
|
||||
@Override
|
||||
public FrustumIntersection celeritas$getFrustumIntersection() {
|
||||
return this.celeritas$frustumIntersection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void celeritas$updateFrustumIntersection() {
|
||||
this.celeritas$projMatrix.set(this.projectionMatrix);
|
||||
this.celeritas$mvMatrix.set(this.modelviewMatrix);
|
||||
this.celeritas$frustumIntersection.set(this.celeritas$projMatrix.mul(this.celeritas$mvMatrix));
|
||||
}
|
||||
|
||||
/**
|
||||
* @author mitchej123
|
||||
* @reason Replace vanilla frustum check with JOML
|
||||
*/
|
||||
@Overwrite
|
||||
public boolean isBoxInFrustum(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
if (Double.isInfinite(minX) || Double.isInfinite(minY) || Double.isInfinite(minZ)
|
||||
|| Double.isInfinite(maxX) || Double.isInfinite(maxY) || Double.isInfinite(maxZ)) {
|
||||
return true;
|
||||
}
|
||||
return this.celeritas$frustumIntersection.testAab(
|
||||
(float) minX, (float) minY, (float) minZ,
|
||||
(float) maxX, (float) maxY, (float) maxZ
|
||||
);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.celeritas.frustum;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ClippingHelperExt;
|
||||
import net.minecraft.client.renderer.culling.ClippingHelperImpl;
|
||||
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(ClippingHelperImpl.class)
|
||||
public class MixinClippingHelperImpl {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void celeritas$runUpdateFrustumIntersection(CallbackInfo ci) {
|
||||
((ClippingHelperExt) this).celeritas$updateFrustumIntersection();
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.celeritas.frustum;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ClippingHelperExt;
|
||||
import net.minecraft.client.renderer.culling.ClippingHelper;
|
||||
import net.minecraft.client.renderer.culling.Frustrum;
|
||||
import org.embeddedt.embeddium.impl.render.viewport.Viewport;
|
||||
@@ -19,7 +20,7 @@ public abstract class MixinFrustrum implements ViewportProvider {
|
||||
// Shadow frustum subclasses override this via their own ViewportProvider impl.
|
||||
// This default handles vanilla Frustrum only.
|
||||
return new Viewport(
|
||||
this.clippingHelper::isBoxInFrustum,
|
||||
((ClippingHelperExt) this.clippingHelper).celeritas$getFrustumIntersection()::testAab,
|
||||
new Vector3d(this.xPosition, this.yPosition, this.zPosition)
|
||||
);
|
||||
}
|
||||
|
||||
+55
-4
@@ -3,6 +3,9 @@ package com.gtnewhorizons.angelica.mixins.early.rendering;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.common.BlockError;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import com.gtnewhorizons.angelica.rendering.StateAwareTessellator;
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
@@ -11,16 +14,23 @@ import net.coderbot.iris.block_rendering.BlockRenderingSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
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 org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(RenderBlocks.class)
|
||||
public abstract class MixinRenderBlocks {
|
||||
@Shadow
|
||||
public abstract boolean renderStandardBlockWithColorMultiplier(Block p_147736_1_, int p_147736_2_, int p_147736_3_, int p_147736_4_, float p_147736_5_, float p_147736_6_, float p_147736_7_);
|
||||
|
||||
@Unique
|
||||
private static final ObjectOpenHashSet<String> isbrhExceptionCache = new ObjectOpenHashSet<>();
|
||||
@@ -36,6 +46,8 @@ public abstract class MixinRenderBlocks {
|
||||
@Unique
|
||||
private boolean isRenderingByType = false;
|
||||
|
||||
private boolean applyingCeleritasAO = false;
|
||||
|
||||
@Inject(method = "renderBlockByRenderType", at = @At("HEAD"))
|
||||
private void renderingByTypeEnable(CallbackInfoReturnable<Boolean> ci) {
|
||||
this.isRenderingByType = true;
|
||||
@@ -84,14 +96,37 @@ public abstract class MixinRenderBlocks {
|
||||
return handleISBRHException(rb, world, x, y, z, block, modelId);
|
||||
}
|
||||
|
||||
@Redirect(method = "renderStandardBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isAmbientOcclusionEnabled()Z"))
|
||||
private boolean checkAOEnabled() {
|
||||
/**
|
||||
* @author embeddedt
|
||||
* @reason When vanilla would render with AO, hijack the rendering logic and render using flat lighting instead.
|
||||
*/
|
||||
@Inject(method = { "renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial" }, at = @At("HEAD"), cancellable = true)
|
||||
private void handleCeleritasAo(Block block, int x, int y, int z, float r, float g, float b, CallbackInfoReturnable<Boolean> cir) {
|
||||
if ((this.isRenderingByType && Minecraft.isAmbientOcclusionEnabled() && AngelicaMod.options().quality.useCeleritasSmoothLighting) ||
|
||||
(Iris.enabled && BlockRenderingSettings.INSTANCE.shouldUseSeparateAo())) {
|
||||
return false; // Force sodium pipeline with Iris or for standard blocks rendered from renderBlockByRenderType when using AO
|
||||
this.applyingCeleritasAO = true;
|
||||
try {
|
||||
cir.setReturnValue(this.renderStandardBlockWithColorMultiplier(block, x, y, z, r, g, b));
|
||||
} finally {
|
||||
this.applyingCeleritasAO = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Minecraft.isAmbientOcclusionEnabled();
|
||||
/* Disable diffuse when celeritas AO is in use */
|
||||
@ModifyExpressionValue(method = "renderStandardBlockWithColorMultiplier", at = @At(value = "CONSTANT", args = "floatValue=0.5", ordinal = 0))
|
||||
private float noBottomDiffuse(float original) {
|
||||
return this.applyingCeleritasAO ? 1.0f : original;
|
||||
}
|
||||
|
||||
@ModifyExpressionValue(method = "renderStandardBlockWithColorMultiplier", at = @At(value = "CONSTANT", args = "floatValue=0.6", ordinal = 0))
|
||||
private float noXDiffuse(float original) {
|
||||
return this.applyingCeleritasAO ? 1.0f : original;
|
||||
}
|
||||
|
||||
@ModifyExpressionValue(method = "renderStandardBlockWithColorMultiplier", at = @At(value = "CONSTANT", args = "floatValue=0.8", ordinal = 0))
|
||||
private float noZDiffuse(float original) {
|
||||
return this.applyingCeleritasAO ? 1.0f : original;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -113,4 +148,20 @@ public abstract class MixinRenderBlocks {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ModifyExpressionValue(method = { "renderFaceXPos", "renderFaceYPos", "renderFaceZPos",
|
||||
"renderFaceXNeg", "renderFaceYNeg", "renderFaceZNeg" },
|
||||
at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/renderer/RenderBlocks;enableAO:Z"))
|
||||
private boolean applyAOBrightness(boolean original, @Local(ordinal = 0) Tessellator tessellator) {
|
||||
((StateAwareTessellator)tessellator).angelica$setAppliedAo(this.applyingCeleritasAO);
|
||||
return original;
|
||||
}
|
||||
|
||||
@Inject(method = { "renderFaceXPos", "renderFaceYPos", "renderFaceZPos",
|
||||
"renderFaceXNeg", "renderFaceYNeg", "renderFaceZNeg" },
|
||||
at = @At("RETURN"))
|
||||
private void resetAOFlag(Block p_147764_1_, double p_147764_2_, double p_147764_4_, double p_147764_6_, IIcon p_147764_8_, CallbackInfo ci,
|
||||
@Local(ordinal = 0) Tessellator tessellator) {
|
||||
((StateAwareTessellator)tessellator).angelica$setAppliedAo(false);
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.rendering.StateAwareTessellator;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
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(Tessellator.class)
|
||||
public class MixinTessellator implements StateAwareTessellator {
|
||||
@Unique
|
||||
private final IntArrayList vertexStates = new IntArrayList();
|
||||
|
||||
@Unique
|
||||
private boolean appliedAo;
|
||||
|
||||
@Inject(method = "addVertex", at = @At("RETURN"))
|
||||
private void addElementState(CallbackInfo ci) {
|
||||
int state = 0;
|
||||
if (appliedAo) {
|
||||
state |= StateAwareTessellator.RENDERED_WITH_VANILLA_AO;
|
||||
}
|
||||
this.vertexStates.add(state);
|
||||
}
|
||||
|
||||
@Inject(method = "reset", at = @At("RETURN"))
|
||||
private void resetVertexStates(CallbackInfo ci) {
|
||||
this.vertexStates.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void angelica$setAppliedAo(boolean flag) {
|
||||
this.appliedAo = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] angelica$getVertexStates() {
|
||||
return this.vertexStates.elements();
|
||||
}
|
||||
}
|
||||
+24
-1
@@ -2,7 +2,10 @@ package com.gtnewhorizons.angelica.mixins.early.rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ITileEntityBoundingBoxCache;
|
||||
import com.gtnewhorizons.angelica.rendering.TileEntityRenderBoundsRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
@@ -20,7 +23,27 @@ public abstract class MixinTileEntity implements ITileEntityBoundingBoxCache {
|
||||
@Shadow public int yCoord;
|
||||
@Shadow public int zCoord;
|
||||
|
||||
@Shadow public abstract AxisAlignedBB getRenderBoundingBox();
|
||||
@Shadow(remap = false) public static final AxisAlignedBB INFINITE_EXTENT_AABB = null;
|
||||
|
||||
/**
|
||||
* @author mitchej123
|
||||
* @reason Less fallback to INFINITE_EXTENT_AABB for blocks like signs,
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
final Block type = getBlockType();
|
||||
AxisAlignedBB bb = INFINITE_EXTENT_AABB;
|
||||
if (type == Blocks.enchanting_table) {
|
||||
bb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
} else if (type == Blocks.chest || type == Blocks.trapped_chest) {
|
||||
bb = AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 2, zCoord + 2);
|
||||
} else if (type != null && type != Blocks.beacon) {
|
||||
final AxisAlignedBB cbb = type.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord, zCoord);
|
||||
bb = cbb != null ? cbb : AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Unique private int angelica$cachedBBX = Integer.MIN_VALUE;
|
||||
@Unique private int angelica$cachedBBY = Integer.MIN_VALUE;
|
||||
|
||||
Reference in new issue
Block a user