Compare commits

..
Author SHA1 Message Date
Jason Mitchell 956f9e344e Update the tesselator checks to allow for non main instance tesselators while still on the main thread (#106) 2023-12-30 13:00:59 -08:00
Darren Eberly acc1f58778 Round texture coordinates instead of truncating (#105)
Backported fix from embeddium: https://github.com/embeddedt/embeddium/commit/a82950cf8e77ce78d9c3dacbfa509900f3a224ca
2023-12-30 12:25:33 -08:00
Caedis 1a38bd1a00 Move mod checks to their own static class (#103) 2023-12-30 13:21:58 -06:00
Jason Mitchell cfc19bb35e Repo cleanup
* Remove (currently) unused covers maven
* Limit FP maven to com.falsepattern to limit requests going that way
2023-12-30 10:51:54 -08:00
mist475 446c8e74ee replace lotr blockrendering hashmap with concurrent version (#98) 2023-12-30 10:39:34 -08:00
FalsePatternandDarren Eberly 74cdc561e6 Preliminary ChunkAPI/EndlessIDs compatibility (#94)
* Preliminary ChunkAPI compatibility
* endlessids biome array crash fix
* Ensure skylight array is not null when hasSky is set

---------

Co-authored-by: Darren Eberly <[email protected]>
2023-12-30 10:26:03 -08:00
Caedis 67fbcc8ff0 Add debug logging option (#97)
* add debug logging option

* remove the deobf check
2023-12-29 01:54:58 -06:00
Jason Mitchell d19b8d5302 Handle bad matrix modes (#93)
* Handle common incorrect modes for glMatrixMode
* Handle matrix stack over/under flow
2023-12-28 21:05:11 -05:00
14 changed files with 136 additions and 53 deletions

No files matched your search

+1 -1
View File
@@ -798,7 +798,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.4.3')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.4.4')
}
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
+2
View File
@@ -75,6 +75,8 @@ dependencies {
compileOnly("com.github.GTNewHorizons:twilightforest:2.5.1:dev") {transitive = false }
compileOnly(rfg.deobf('curse.maven:witchery-69673:2234410'))
compileOnly("com.falsepattern:chunkapi-mc1.7.10:0.5.0:api")
compileOnly("com.falsepattern:endlessids-mc1.7.10:1.5-beta0002:dev")
compileOnly(rfg.deobf("curse.maven:extrautils-225561:2264383"))
compileOnly(rfg.deobf("curse.maven:dynamiclights-227874:2337326"))
+4 -5
View File
@@ -2,11 +2,10 @@
repositories {
maven {
name = 'covers1624 maven'
url = 'https://nexus.covers1624.net/repository/maven-hosted/'
metadataSources {
mavenPom()
artifact()
name = 'mavenpattern'
url = 'https://mvn.falsepattern.com/releases'
content {
includeGroup "com.falsepattern"
}
}
mavenLocal()
@@ -1,9 +1,9 @@
package com.gtnewhorizons.angelica;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.proxy.CommonProxy;
import com.gtnewhorizons.angelica.utils.AnimationMode;
import com.gtnewhorizons.angelica.utils.ManagedEnum;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -20,18 +20,14 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
public class AngelicaMod {
@SidedProxy(clientSide = "com.gtnewhorizons.angelica.proxy.ClientProxy", serverSide = "com.gtnewhorizons.angelica.proxy.CommonProxy")
public static CommonProxy proxy;
/** Mixin Version */
public static boolean isNEIDLoaded;
/** ASM Version */
public static boolean isOldNEIDLoaded;
public static final boolean lwjglDebug = Boolean.parseBoolean(System.getProperty("org.lwjgl.util.Debug", "false"));
public static final ManagedEnum<AnimationMode> animationsMode = new ManagedEnum<>(AnimationMode.VISIBLE_ONLY);
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
isNEIDLoaded = Loader.isModLoaded("neid");
isOldNEIDLoaded = Loader.isModLoaded("notenoughIDs");
ModStatus.preInit();
proxy.preInit(event);
}
@@ -1,9 +1,11 @@
package com.gtnewhorizons.angelica.compat;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.falsepattern.chunk.api.DataRegistry;
import com.gtnewhorizons.angelica.mixins.early.sodium.MixinExtendedBlockStorage;
import com.gtnewhorizons.angelica.mixins.interfaces.ExtendedNibbleArray;
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;
@@ -16,44 +18,51 @@ public class ExtendedBlockStorageExt extends ExtendedBlockStorage {
this.hasSky = hasSky;
}
public ExtendedBlockStorageExt(ExtendedBlockStorage storage) {
public ExtendedBlockStorageExt(Chunk chunk, ExtendedBlockStorage storage) {
super(((MixinExtendedBlockStorage) storage).getYBase(), storage.getSkylightArray() != null);
int arrayLen;
if (AngelicaMod.isNEIDLoaded){
final short[] block16BArray = ((IExtendedBlockStorageMixin)(Object)this).getBlock16BArray();
System.arraycopy(((IExtendedBlockStorageMixin)(Object)storage).getBlock16BArray(), 0, block16BArray, 0, block16BArray.length);
if(storage.getBlockMSBArray() != null) {
this.setBlockMSBArray(new NibbleArray(block16BArray.length, 4));
copyNibbleArray((ExtendedNibbleArray) storage.getBlockMSBArray(), (ExtendedNibbleArray) this.getBlockMSBArray());
if (ModStatus.isChunkAPILoaded) {
if (storage.getSkylightArray() != null) {
hasSky = true;
}
arrayLen = block16BArray.length;
}
else if (AngelicaMod.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);
if(storage.getBlockMSBArray() != null) {
this.setBlockMSBArray(new NibbleArray(blockLSBArray.length, 4));
copyNibbleArray((ExtendedNibbleArray) storage.getBlockMSBArray(), (ExtendedNibbleArray) this.getBlockMSBArray());
DataRegistry.cloneSubChunk(chunk, storage, this);
} else {
int arrayLen;
if (ModStatus.isNEIDLoaded){
final short[] block16BArray = ((IExtendedBlockStorageMixin)(Object)this).getBlock16BArray();
System.arraycopy(((IExtendedBlockStorageMixin)(Object)storage).getBlock16BArray(), 0, block16BArray, 0, block16BArray.length);
if(storage.getBlockMSBArray() != null) {
this.setBlockMSBArray(new NibbleArray(block16BArray.length, 4));
copyNibbleArray((ExtendedNibbleArray) storage.getBlockMSBArray(), (ExtendedNibbleArray) this.getBlockMSBArray());
}
arrayLen = block16BArray.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);
if(storage.getBlockMSBArray() != null) {
this.setBlockMSBArray(new NibbleArray(blockLSBArray.length, 4));
copyNibbleArray((ExtendedNibbleArray) storage.getBlockMSBArray(), (ExtendedNibbleArray) this.getBlockMSBArray());
}
arrayLen = blockLSBArray.length;
}
arrayLen = blockLSBArray.length;
}
copyNibbleArray((ExtendedNibbleArray) storage.getMetadataArray(), (ExtendedNibbleArray)this.getMetadataArray());
copyNibbleArray((ExtendedNibbleArray) storage.getBlocklightArray(), (ExtendedNibbleArray)this.getBlocklightArray());
if(storage.getSkylightArray() != null) {
hasSky = true;
if(this.getSkylightArray() == null) {
this.setSkylightArray(new NibbleArray(arrayLen, 4));
copyNibbleArray((ExtendedNibbleArray) storage.getMetadataArray(), (ExtendedNibbleArray)this.getMetadataArray());
copyNibbleArray((ExtendedNibbleArray) storage.getBlocklightArray(), (ExtendedNibbleArray)this.getBlocklightArray());
if(storage.getSkylightArray() != null) {
hasSky = true;
if(this.getSkylightArray() == null) {
this.setSkylightArray(new NibbleArray(arrayLen, 4));
}
copyNibbleArray((ExtendedNibbleArray) storage.getSkylightArray(), (ExtendedNibbleArray) this.getSkylightArray());
}
copyNibbleArray((ExtendedNibbleArray) storage.getSkylightArray(), (ExtendedNibbleArray) this.getSkylightArray());
}
((MixinExtendedBlockStorage) this).setBlockRefCount(((MixinExtendedBlockStorage) storage).getBlockRefCount());
}
@@ -0,0 +1,25 @@
package com.gtnewhorizons.angelica.compat;
import cpw.mods.fml.common.Loader;
public class ModStatus {
/**
* Mixin Version
*/
public static boolean isNEIDLoaded;
/**
* ASM Version
*/
public static boolean isOldNEIDLoaded;
public static boolean isLotrLoaded;
public static boolean isChunkAPILoaded;
public static boolean isEIDBiomeLoaded;
public static void preInit(){
isNEIDLoaded = Loader.isModLoaded("neid");
isOldNEIDLoaded = Loader.isModLoaded("notenoughIDs");
isLotrLoaded = Loader.isModLoaded("lotr");
isChunkAPILoaded = Loader.isModLoaded("chunkapi");
isEIDBiomeLoaded = Loader.isModLoaded("endlessids_biome");
}
}
@@ -78,4 +78,14 @@ public class AngelicaConfig {
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean optimizeJabbaGetInteger;
@Config.Comment("Fix thread-safety in lotrs rendering")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixLotrSodiumCompat;
@Config.Comment("Enable Debug Logging")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean enableDebugLogging;
}
@@ -16,6 +16,7 @@ import com.gtnewhorizons.angelica.glsm.states.Color4;
import com.gtnewhorizons.angelica.glsm.states.TextureBinding;
import com.gtnewhorizons.angelica.glsm.states.TextureUnitArray;
import com.gtnewhorizons.angelica.hudcaching.HUDCaching;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntStack;
import lombok.Getter;
@@ -828,12 +829,24 @@ public class GLStateManager {
}
public static void glPushMatrix() {
GL11.glPushMatrix();
getMatrixStack().pushMatrix();
try {
getMatrixStack().pushMatrix();
} catch(IllegalStateException ignored) {
// Ignore
if(AngelicaMod.lwjglDebug)
AngelicaTweaker.LOGGER.warn("Matrix stack overflow ", new Throwable());
}
}
public static void glPopMatrix() {
GL11.glPopMatrix();
getMatrixStack().popMatrix();
try {
getMatrixStack().popMatrix();
} catch(IllegalStateException ignored) {
// Ignore
if(AngelicaMod.lwjglDebug)
AngelicaTweaker.LOGGER.warn("Matrix stack underflow ", new Throwable());
}
}
private static final Matrix4f perspectiveMatrix = new Matrix4f();
@@ -17,7 +17,7 @@ public class TessellatorManager {
}
public static boolean isMainInstance(Object instance) {
return instance == Tessellator.instance;
return instance == Tessellator.instance || isOnMainThread();
}
static {
@@ -9,6 +9,12 @@ public class MatrixMode implements ISettableState<MatrixMode> {
protected int mode = GL11.GL_MODELVIEW;
public void setMode(int mode) {
if(mode != GL11.GL_MODELVIEW && mode != GL11.GL_PROJECTION && mode != GL11.GL_TEXTURE && mode != GL11.GL_COLOR) {
// Invalid mode, do nothing on the cache, but pass it along to OGL
GL11.glMatrixMode(mode);
return;
}
if(this.mode != mode || GLStateManager.BYPASS_CACHE) {
this.mode = mode;
GL11.glMatrixMode(mode);
@@ -43,7 +43,9 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration config = ctx.getConfiguration();
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
loggerConfig.setLevel(Level.DEBUG);
if (AngelicaConfig.enableDebugLogging) {
loggerConfig.setLevel(Level.DEBUG);
}
ctx.updateLoggers();
} catch (ConfigException e) {
throw new RuntimeException(e);
@@ -1,6 +1,7 @@
package com.gtnewhorizons.angelica.proxy;
import com.google.common.base.Objects;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.hudcaching.HUDCaching;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
@@ -11,6 +12,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.ReflectionHelper;
import me.jellysquid.mods.sodium.client.SodiumDebugScreenHandler;
import net.coderbot.iris.Iris;
import net.coderbot.iris.client.IrisDebugScreenHandler;
@@ -32,6 +34,7 @@ import net.minecraftforge.common.MinecraftForge;
import java.lang.management.ManagementFactory;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
public class ClientProxy extends CommonProxy {
@@ -62,7 +65,17 @@ public class ClientProxy extends CommonProxy {
@Override
public void postInit(FMLPostInitializationEvent event) {
// Nothing to do here (yet)
if (ModStatus.isLotrLoaded && AngelicaConfig.enableSodium && AngelicaConfig.fixLotrSodiumCompat) {
try {
Class<?> lotrRendering = Class.forName("lotr.common.coremod.LOTRReplacedMethods$BlockRendering");
ReflectionHelper.setPrivateValue(lotrRendering,null,new ConcurrentHashMap<>(),"naturalBlockClassTable");
ReflectionHelper.setPrivateValue(lotrRendering,null,new ConcurrentHashMap<>(),"naturalBlockTable");
ReflectionHelper.setPrivateValue(lotrRendering,null,new ConcurrentHashMap<>(),"cachedNaturalBlocks");
}
catch (ClassNotFoundException e) {
AngelicaTweaker.LOGGER.error("Could net replace LOTR handle render code with thread safe version");
}
}
}
float lastIntegratedTickTime;
@@ -19,7 +19,7 @@ public class ModelVertexUtil {
* @return The resulting de-normalized unsigned short
*/
public static short denormalizeVertexTextureFloatAsShort(float value) {
return (short) (Math.min(0.99999997F, value) * 32768.0f);
return (short) (Math.round(value * 32768.0F) & 0xFFFF);
}
/**
@@ -1,6 +1,8 @@
package me.jellysquid.mods.sodium.client.world.cloned;
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
import com.gtnewhorizons.angelica.compat.ExtendedBlockStorageExt;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
import com.gtnewhorizons.angelica.compat.mojang.ChunkSectionPos;
import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
@@ -56,9 +58,15 @@ public class ClonedChunkSection {
}
this.pos = pos;
this.data = new ExtendedBlockStorageExt(section);
this.data = new ExtendedBlockStorageExt(chunk, section);
this.biomeData = new BiomeGenBase[chunk.getBiomeArray().length];
int bArrLength;
if (ModStatus.isEIDBiomeLoaded) {
bArrLength = ((ChunkBiomeHook)chunk).getBiomeShortArray().length;
} else {
bArrLength = chunk.getBiomeArray().length;
}
this.biomeData = new BiomeGenBase[bArrLength];
StructureBoundingBox box = new StructureBoundingBox(pos.getMinX(), pos.getMinY(), pos.getMinZ(), pos.getMaxX(), pos.getMaxY(), pos.getMaxZ());