Compare commits

..
Author SHA1 Message Date
jss2a98aj 894b9573db Natura + Tinker's Construct berry bush leaf mode support 2024-05-05 13:42:36 -07:00
jss2a98aj d8d8cd93c5 Leaf render mode edge case handling 2024-05-05 13:42:36 -07:00
jss2a98aj 986f1bd6a1 NotFine 0.2.2 sync (#462)
* Slight cleanup in ColorizeBlock

* Don't call System.gc

* Add toggle for Renderpass (forced to false)
2024-05-03 23:54:02 -04:00
jss2a98aj e85ca85027 Small NotFine style settings menu fix (#457)
* Fix allowToggle3DAnaglyph

* Remove unused import
2024-05-01 07:26:18 -07:00
Raven Szewczyk d96023f36c Fix FontRenderer intel issue (#456) 2024-04-30 17:55:03 +00:00
Jason Mitchell 203b552993 Attempt at BetterCrashes Compat
- clean up the CapturingTessellator
- clean up GLStateManager
2024-04-29 10:50:56 -07:00
Jason Mitchell 96e2f42251 Update Mixins.java (#447)
Move some Notfine guarded mixins to enableMCPatcherForgeFeatures
2024-04-28 15:06:23 -07:00
Raven Szewczyk 9a73dc9bfd Fix glMultMatrix using the wrong variable for multiplication (#444)
* Fix glMultMatrix using the wrong variable for multiplication

* Fix "conersion" typo
2024-04-27 18:46:35 +00:00
Darren Eberly f01cdfda4b Thread safe ISBRH compatibility with Extra Utilities 2 (#439)
* Initial ASM stuff for Extra Utils thread safety

* Thread safety for connected textures

* More thread-safe blocks

* Remove EU2 references, combine ASM transformers

* Remove unusued ModStatus check for Extra Utils
2024-04-25 12:56:24 -07:00
Caedis daa1405ba4 Only disable holoinventory when hudcaching is enabled 2024-04-25 08:14:24 -07:00
jss2a98aj 846d70f0c0 Fix NotFine Twilight Forest compat mixins builder 2024-04-19 11:35:56 -07:00
47 changed files with 817 additions and 226 deletions

No files matched your search

+5
View File
@@ -75,6 +75,8 @@ dependencies {
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Baubles:1.0.4:dev")
compileOnly("com.github.GTNewHorizons:twilightforest:2.5.16:dev") { transitive = false }
compileOnly(rfg.deobf('curse.maven:witchery-69673:2234410'))
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.12.0-GTNH:dev")
compileOnly("com.github.GTNewHorizons:Natura:2.6.1:dev")
compileOnly("com.falsepattern:chunkapi-mc1.7.10:0.5.0:api") { transitive = false }
compileOnly("com.falsepattern:endlessids-mc1.7.10:1.5-beta0002:dev") { transitive = false }
@@ -97,6 +99,9 @@ dependencies {
// Hodgepodge
transformedMod("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
// Better Crashes
compileOnly("com.github.GTNewHorizons:BetterCrashes:1.4.0-GTNH:dev")
// Tests
testImplementation(platform('org.junit:junit-bom:5.9.2'))
@@ -258,7 +258,6 @@ public class BatchingFontRenderer {
GLStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
GLStateManager.glShadeModel(GL_FLAT);
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
glTexCoordPointer(2, 0, batchVtxTexCoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, batchVtxColors);
@@ -289,7 +288,9 @@ public class BatchingFontRenderer {
glDrawElements(GL_TRIANGLES, batchIndices);
}
glPopClientAttrib();
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
if (isTextureEnabledBefore) {
GLStateManager.glEnable(GL11.GL_TEXTURE_2D);
@@ -16,6 +16,7 @@ public class ModStatus {
*/
public static boolean isOldNEIDLoaded;
public static boolean isBetterCrashesLoaded;
public static boolean isNEIDMetadataExtended;
public static boolean isLotrLoaded;
public static boolean isChunkAPILoaded;
@@ -24,6 +25,7 @@ public class ModStatus {
public static boolean isHoloInventoryLoaded;
public static void preInit(){
isBetterCrashesLoaded = Loader.isModLoaded("bettercrashes");
isNEIDLoaded = Loader.isModLoaded("neid");
isOldNEIDLoaded = Loader.isModLoaded("notenoughIDs");
isLotrLoaded = Loader.isModLoaded("lotr");
@@ -0,0 +1,34 @@
package com.gtnewhorizons.angelica.compat.bettercrashes;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.mixins.interfaces.IRenderGlobalExt;
import cpw.mods.fml.common.Optional;
import net.minecraft.client.Minecraft;
import vfyjxf.bettercrashes.utils.StateManager;
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
@Optional.Interface(modid = "angelica", iface = "vfyjxf.bettercrashes.utils.StateManager.IResettable")
public class BetterCrashesCompat implements StateManager.IResettable {
private static BetterCrashesCompat INSTANCE;
public static void init() {
if (INSTANCE == null) {
INSTANCE = new BetterCrashesCompat();
}
}
public BetterCrashesCompat() {
LOGGER.info("BetterCrashesCompat initialized");
this.register();
}
@Override
public void resetState() {
LOGGER.info("Reloading SodiumRenderer");
((IRenderGlobalExt) Minecraft.getMinecraft().renderGlobal).reload();
LOGGER.info("Resetting GLStateManager");
GLStateManager.reset();
}
}
@@ -101,6 +101,11 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static boolean fixLotrSodiumCompat;
@Config.Comment("Fix thread-safety in Extra Utilities rendering")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixExtraUtilsSodiumCompat;
@Config.Comment("Enable Debug Logging")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
@@ -105,7 +105,6 @@ public class GLStateManager {
@Getter protected static final DepthStateStack depthState = new DepthStateStack();
@Getter protected static final BooleanStateStack depthTest = new BooleanStateStack(GL11.GL_DEPTH_TEST);
// @Getter private static final FogState fogState = new FogState();
@Getter protected static final FogStateStack fogState = new FogStateStack();
@Getter protected static final BooleanStateStack fogMode = new BooleanStateStack(GL11.GL_FOG);
@Getter protected static final Color4Stack color = new Color4Stack();
@@ -125,6 +124,19 @@ public class GLStateManager {
@Getter protected static final ViewPortStateStack viewportState = new ViewPortStateStack();
public static void reset() {
runningSplash = true;
while(!attribs.isEmpty()) {
attribs.popInt();
}
for(IStateStack<?> stack : Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS)) {
while(!stack.isEmpty()) {
stack.pop();
}
}
modelViewMatrix.clear();
projectionMatrix.clear();
}
// Iris Listeners
private static Runnable blendFuncListener = null;
@@ -1112,8 +1124,8 @@ public class GLStateManager {
}
public static void glLoadMatrix(DoubleBuffer m) {
conersionMatrix4d.set(m);
getMatrixStack().set(conersionMatrix4d);
conversionMatrix4d.set(m);
getMatrixStack().set(conversionMatrix4d);
GL11.glLoadMatrix(m);
}
@@ -1160,16 +1172,16 @@ public class GLStateManager {
public static void glMultMatrix(FloatBuffer floatBuffer) {
GL11.glMultMatrix(floatBuffer);
tempMatrix4f.set(floatBuffer);
getMatrixStack().mul(conersionMatrix4f);
getMatrixStack().mul(tempMatrix4f);
}
public static final Matrix4d conersionMatrix4d = new Matrix4d();
public static final Matrix4f conersionMatrix4f = new Matrix4f();
public static final Matrix4d conversionMatrix4d = new Matrix4d();
public static final Matrix4f conversionMatrix4f = new Matrix4f();
public static void glMultMatrix(DoubleBuffer matrix) {
GL11.glMultMatrix(matrix);
conersionMatrix4d.set(matrix);
conersionMatrix4f.set(conersionMatrix4d);
getMatrixStack().mul(conersionMatrix4f);
conversionMatrix4d.set(matrix);
conversionMatrix4f.set(conversionMatrix4d);
getMatrixStack().mul(conversionMatrix4f);
}
private static final Vector3f rotation = new Vector3f();
@@ -34,4 +34,7 @@ public class AlphaStateStack extends AlphaState implements IStateStack<AlphaStat
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class BlendStateStack extends BlendState implements IStateStack<BlendStat
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -39,4 +39,7 @@ public class BooleanStateStack extends BooleanState implements IStateStack<Boole
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -39,4 +39,7 @@ public class Color4Stack extends Color4 implements IStateStack<Color4Stack> {
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class ColorMaskStack extends ColorMask implements IStateStack<ColorMaskSt
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class DepthStateStack extends DepthState implements IStateStack<DepthStat
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class FogStateStack extends FogState implements IStateStack<FogStateStack
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -6,4 +6,6 @@ public interface IStateStack<T>{
T pop();
boolean isEmpty();
}
@@ -39,4 +39,7 @@ public class IntegerStateStack extends IntegerState implements IStateStack<Integ
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class MatrixModeStack extends MatrixMode implements IStateStack<MatrixMod
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -37,4 +37,8 @@ public class TextureBindingStack extends TextureBinding implements IStateStack<T
public TextureBinding peek() {
return stack[pointer];
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -32,4 +32,8 @@ public class Vector3dStack extends Vector3d implements IStateStack<Vector3dStack
set(stack[--pointer]);
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class ViewPortStateStack extends ViewportState implements IStateStack<Vie
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -248,7 +248,7 @@ public class HUDCaching {
// moved to here due to the method being called from a mixin
public static void disableHoloInventory() {
if (ModStatus.isHoloInventoryLoaded){
Renderer.INSTANCE.angelicaOverride = true;
Renderer.INSTANCE.angelicaOverride = isEnabled;
}
}
@@ -7,6 +7,7 @@ import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.mixins.Mixins;
import com.gtnewhorizons.angelica.mixins.TargetedMod;
import com.gtnewhorizons.angelica.transform.compat.CompatASMTransformers;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import jss.notfine.asm.AsmTransformers;
import jss.notfine.asm.mappings.Namer;
@@ -19,6 +20,8 @@ import org.apache.logging.log4j.core.config.LoggerConfig;
import org.spongepowered.asm.launch.GlobalProperties;
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -67,10 +70,17 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
}
// Return any others here
if (transformerClasses == null) {
//Mod Compat transformers
List<String> transformers = new ArrayList<String>();
transformers.addAll(CompatASMTransformers.getTransformers());
//NotFine transformers
Namer.initNames();
transformerClasses = AsmTransformers.getTransformers();
transformers.addAll(Arrays.asList(AsmTransformers.getTransformers()));
transformerClasses = transformers.toArray(new String[0]);
}
return transformerClasses;
}
@@ -183,6 +183,14 @@ public enum Mixins {
"angelica.animation.MixinWorldRenderer",
"angelica.animation.MixinRenderItem")),
EXTRA_UTILITIES_THREAD_SAFETY(new Builder("Enable thread safety fixes in Extra Utilities").setPhase(Phase.LATE)
.addTargetedMod(TargetedMod.EXTRAUTILS).setSide(Side.CLIENT)
.setApplyIf(() -> AngelicaConfig.fixExtraUtilsSodiumCompat)
.addMixinClasses(
"client.extrautils.MixinRenderBlockConnectedTextures",
"client.extrautils.MixinRenderBlockConnectedTexturesEthereal",
"client.extrautils.MixinIconConnectedTexture")),
SPEEDUP_CAMPFIRE_BACKPORT_ANIMATIONS(new Builder("Add animation speedup support to Campfire Backport").setPhase(Phase.LATE)
.addTargetedMod(TargetedMod.CAMPFIRE_BACKPORT).setSide(Side.CLIENT)
.setApplyIf(() -> AngelicaConfig.speedupAnimations)
@@ -263,6 +271,15 @@ public enum Mixins {
"MixinRenderItem"
))
),
NOTFINE_NATURA(new Builder("NotFine Natura compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.NATURA)
.addMixinClasses(addPrefix("notfine.leaves.natura.",
"MixinBerryBush",
"MixinNetherBerryBush"
))
),
NOTFINE_THAUMCRAFT(new Builder("NotFine Thaumcraft compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
@@ -279,6 +296,12 @@ public enum Mixins {
"MixinBlockTable"
))
),
NOTFINE_TINKERS_CONSTRUCT(new Builder("NotFine Tinker's Construct compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.TINKERS_CONSTRUCT)
.addMixinClasses("notfine.leaves.tconstruct.MixinOreberryBush")
),
NOTFINE_WITCHERY(new Builder("NotFine Witchery compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
@@ -289,7 +312,7 @@ public enum Mixins {
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.TWILIGHT_FOREST)
.addMixinClasses(addPrefix("notfine.leaves.twilightforest",
.addMixinClasses(addPrefix("notfine.leaves.twilightforest.",
"MixinBlockTFLeaves",
"MixinBlockTFLeaves3",
// TODO: Verify 2.3.8.18 or later to support non NH builds?
@@ -310,12 +333,17 @@ public enum Mixins {
"base.MixinSimpleReloadableResourceManager",
"base.MixinMinecraft"
// TODO merge renderpass changes into Sodium renderer
// "renderpass.MixinEntityRenderer",
// "renderpass.MixinRenderBlocks",
// "renderpass.MixinRenderGlobal",
// "renderpass.MixinWorldRenderer"
))
),
MCPATCHER_FORGE_RENDERPASS(new Builder("MCPatcher Forge Renderpass")
.setPhase(Phase.EARLY)
.setApplyIf(() -> NotFineConfig.renderPass)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.",
"renderpass.MixinEntityRenderer",
"renderpass.MixinRenderBlocks",
"renderpass.MixinRenderGlobal",
"renderpass.MixinWorldRenderer"
))
),
MCPATCHER_FORGE_CUSTOM_COLORS(new Builder("MCP:F Custom Colors")
@@ -376,7 +404,7 @@ public enum Mixins {
),
MCPATCHER_FORGE_CUSTOM_ITEM_TEXTURES(new Builder("MCP:F Custom Item Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.cit.",
"client.renderer.entity.MixinRenderBiped",
@@ -401,7 +429,7 @@ public enum Mixins {
),
MCPATCHER_FORGE_EXTENDED_HD(new Builder("MCP:F Extended hd")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.hd.",
"MixinTextureClock",
@@ -411,7 +439,7 @@ public enum Mixins {
),
MCPATCHER_FORGE_EXTENDED_HD_FONT(new Builder("MCP:F Extended HD Font")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> (AngelicaConfig.enableNotFineFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled && MCPatcherForgeConfig.instance().hdFont))
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled && MCPatcherForgeConfig.instance().hdFont))
.addTargetedMod(TargetedMod.VANILLA)
.addExcludedMod(TargetedMod.COFHCORE)
.addMixinClasses("mcpatcherforge.hd.MixinFontRenderer")
@@ -513,10 +541,6 @@ public enum Mixins {
public static List<String> getEarlyMixins(Set<String> loadedCoreMods) {
NotFineConfig.loadSettings();
//These will probably break hard with Angelica.
//AdvancedOpenGL even breaks hard on its own.
NotFineConfig.allowAdvancedOpenGL = false;
NotFineConfig.allowToggleFBO = false;
//This may be possible to handle differently or fix.
if(loadedCoreMods.contains("cofh.asm.LoadingPlugin")) {
MCPatcherForgeConfig.instance().hdFont = false;
@@ -21,9 +21,11 @@ public enum TargetedMod {
, JOURNEYMAP("JourneyMap", null, "journeymap")
, LWJGL3IFY("lwjgl3ify", "me.eigenraven.lwjgl3ify.core.Lwjgl3ifyCoremod", "lwjgl3ify")
, MRTJPCORE("MrTJPCore", null, "MrTJPCoreMod")
, NATURA("Natura", null, "Natura")
, PROJECTRED_ILLUMINATION("ProjectRed Illumination", null, "ProjRed|Illumination")
, SMART_RENDER("Smart Render", null, "SmartRender")
, THAUMCRAFT("Thaumcraft", null, "Thaumcraft")
, TINKERS_CONSTRUCT("Tinker's Construct", null, "TConstruct")
, TWILIGHT_FOREST("TwilightForest", null, "TwilightForest")
, WITCHERY("Witchery", null, "witchery")
;
@@ -254,6 +254,10 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
@Inject(method = "loadRenderers", at = @At("RETURN"))
private void onReload(CallbackInfo ci) {
reload();
}
public void reload() {
RenderDevice.enterManagedCode();
try {
@@ -2,5 +2,6 @@ package com.gtnewhorizons.angelica.mixins.interfaces;
public interface IRenderGlobalExt {
void scheduleTerrainUpdate();
void reload();
}
@@ -0,0 +1,96 @@
package com.gtnewhorizons.angelica.mixins.late.client.extrautils;
import com.rwtema.extrautils.block.IconConnectedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.IIcon;
import org.spongepowered.asm.mixin.Final;
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(IconConnectedTexture.class)
public class MixinIconConnectedTexture {
@Final
@Shadow(remap = false)
public IIcon[] icons;
@Unique
private ThreadLocal<Integer> newN = ThreadLocal.withInitial(() -> 0);
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@Overwrite(remap = false)
public void setType(int i) {
this.newN.set(i);
}
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@Overwrite
public float getMinU() {
return this.icons[newN.get()].getMinU();
}
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@Overwrite
public float getMaxU() {
return this.icons[newN.get()].getMaxU();
}
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@Overwrite
public float getMinV() {
return this.icons[newN.get()].getMinV();
}
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@Overwrite
public float getMaxV() {
return this.icons[newN.get()].getMaxV();
}
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@Overwrite
public String getIconName() {
return this.icons[newN.get()].getIconName();
}
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@SideOnly(Side.CLIENT)
@Overwrite
public int getIconWidth() {
return this.icons[newN.get()].getIconWidth();
}
/**
* @author Cleptomania
* @reason Supper thread-safety for connected textures
*/
@SideOnly(Side.CLIENT)
@Overwrite
public int getIconHeight() {
return this.icons[newN.get()].getIconHeight();
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.late.client.extrautils;
import com.rwtema.extrautils.block.render.FakeRenderBlocks;
import com.rwtema.extrautils.block.render.RenderBlockConnectedTextures;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Unique;
@Mixin(RenderBlockConnectedTextures.class)
public class MixinRenderBlockConnectedTextures {
@Unique
private FakeRenderBlocks newFakeRender = new FakeRenderBlocks();
/**
* @author Cleptomania
* @reason Thread safety compat (don't use static FakeRenderBlocks anymore)
*/
@Overwrite(remap = false)
public FakeRenderBlocks getFakeRender() {
return newFakeRender;
}
}
@@ -0,0 +1,44 @@
package com.gtnewhorizons.angelica.mixins.late.client.extrautils;
import com.rwtema.extrautils.block.render.FakeRenderBlocks;
import com.rwtema.extrautils.block.render.FakeRenderEtherealBlocks;
import com.rwtema.extrautils.block.render.RenderBlockConnectedTextures;
import com.rwtema.extrautils.block.render.RenderBlockConnectedTexturesEthereal;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Unique;
@Mixin(RenderBlockConnectedTexturesEthereal.class)
public abstract class MixinRenderBlockConnectedTexturesEthereal extends RenderBlockConnectedTextures{
@Unique
private FakeRenderEtherealBlocks newFakeRenderEthereal = new FakeRenderEtherealBlocks();
/**
* @author Cleptomania
* @reason Thread safety fixes for ethereal connected textures. The way the subclassing
* works for this system means overwriting this function to use our new non-static
* FakeRenderEtherealBlocks field is about the only way to do it.
*/
@Overwrite(remap = false)
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
if (renderer.hasOverrideBlockTexture())
return renderer.renderStandardBlock(block, x, y, z);
getFakeRender().setWorld(renderer.blockAccess);
getFakeRender().curBlock = world.getBlock(x, y, z);
getFakeRender().curMeta = world.getBlockMetadata(x, y, z);
block.setBlockBoundsBasedOnState(getFakeRender().blockAccess, x, y, z);
getFakeRender().setRenderBoundsFromBlock(block);
boolean render = getFakeRender().renderStandardBlock(block, x, y, z);
newFakeRenderEthereal.setWorld(renderer.blockAccess);
newFakeRenderEthereal.curBlock = fakeRender.curBlock;
newFakeRenderEthereal.curMeta = fakeRender.curMeta;
double h = 0.05D;
newFakeRenderEthereal.setRenderBounds(h, h, h, 1.0D - h, 1.0D - h, 1.0D - h);
render &= newFakeRenderEthereal.renderStandardBlock(block, x, y, z);
return render;
}
}
@@ -0,0 +1,78 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.natura;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.IFaceObstructionCheckHelper;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import mods.natura.blocks.crops.BerryBush;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(value = BerryBush.class)
public abstract class MixinBerryBush extends Block implements IFaceObstructionCheckHelper, ILeafBlock {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
final int metadata = world.getBlockMetadata(x, y, z);
int maskedMeta = metadata % 4 + (metadata < 12 ? 0 : 4);
boolean renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
if(metadata < 8) {
renderMode = false;
} else {
x += Facing.offsetsXForSide[side];
y += Facing.offsetsYForSide[side];
z += Facing.offsetsZForSide[side];
final Block otherBlock = world.getBlock(x, y, z);
renderMode = otherBlock instanceof ILeafBlock leafBlock && leafBlock.isFullLeaf(world, x, y, z);
}
} else {
renderMode = SettingsManager.leavesOpaque;
}
maskedMeta = maskedMeta >= (renderMode ? fastIcons : fancyIcons).length ? 0 : maskedMeta;
return (renderMode ? fastIcons : fancyIcons)[maskedMeta];
}
/**
* @author jss2a98aj
* @reason Support new leaf rendering modes on Natura leaves.
*/
@Overwrite
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
if (side != 0 && maxY < 1f) {
return true;
}
return LeafRenderUtil.shouldSideBeRendered(world, x, y, z, side);
}
@Override
public boolean isFaceNonObstructing(IBlockAccess world, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(world.getBlockMetadata(x ,y, z) < 8) {
return true;
}
return LeafRenderUtil.isFaceNonObstructing(world, x, y, z);
}
@Override
public boolean isFullLeaf(IBlockAccess world, int x, int y, int z) {
return world.getBlockMetadata(x ,y, z) >= 8;
}
@Shadow(remap = false)
public IIcon[] fastIcons;
@Shadow(remap = false)
public IIcon[] fancyIcons;
private MixinBerryBush(Material materialIn) {
super(materialIn);
}
}
@@ -0,0 +1,78 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.natura;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.IFaceObstructionCheckHelper;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import mods.natura.blocks.crops.NetherBerryBush;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(value = NetherBerryBush.class)
public abstract class MixinNetherBerryBush extends Block implements IFaceObstructionCheckHelper, ILeafBlock {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
final int metadata = world.getBlockMetadata(x, y, z);
int maskedMeta = metadata % 4 + (metadata < 12 ? 0 : 4);
boolean renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
if(metadata < 8) {
renderMode = false;
} else {
x += Facing.offsetsXForSide[side];
y += Facing.offsetsYForSide[side];
z += Facing.offsetsZForSide[side];
final Block otherBlock = world.getBlock(x, y, z);
renderMode = otherBlock instanceof ILeafBlock leafBlock && leafBlock.isFullLeaf(world, x, y, z);
}
} else {
renderMode = SettingsManager.leavesOpaque;
}
maskedMeta = maskedMeta >= (renderMode ? fastIcons : fancyIcons).length ? 0 : maskedMeta;
return (renderMode ? fastIcons : fancyIcons)[maskedMeta];
}
/**
* @author jss2a98aj
* @reason Support new leaf rendering modes on Natura leaves.
*/
@Overwrite
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
if (side != 0 && maxY < 1f) {
return true;
}
return LeafRenderUtil.shouldSideBeRendered(world, x, y, z, side);
}
@Override
public boolean isFaceNonObstructing(IBlockAccess world, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(world.getBlockMetadata(x ,y, z) < 8) {
return true;
}
return LeafRenderUtil.isFaceNonObstructing(world, x, y, z);
}
@Override
public boolean isFullLeaf(IBlockAccess world, int x, int y, int z) {
return world.getBlockMetadata(x ,y, z) >= 8;
}
@Shadow(remap = false)
public IIcon[] fastIcons;
@Shadow(remap = false)
public IIcon[] fancyIcons;
private MixinNetherBerryBush(Material materialIn) {
super(materialIn);
}
}
@@ -0,0 +1,78 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.tconstruct;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.IFaceObstructionCheckHelper;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import tconstruct.world.blocks.OreberryBush;
@Mixin(value = OreberryBush.class)
public abstract class MixinOreberryBush extends Block implements IFaceObstructionCheckHelper, ILeafBlock {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
final int metadata = world.getBlockMetadata(x, y, z);
int maskedMeta = metadata % 4 + (metadata < 12 ? 0 : 4);
boolean renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
if(metadata < 8) {
renderMode = false;
} else {
x += Facing.offsetsXForSide[side];
y += Facing.offsetsYForSide[side];
z += Facing.offsetsZForSide[side];
final Block otherBlock = world.getBlock(x, y, z);
renderMode = otherBlock instanceof ILeafBlock leafBlock && leafBlock.isFullLeaf(world, x, y, z);
}
} else {
renderMode = SettingsManager.leavesOpaque;
}
maskedMeta = maskedMeta >= (renderMode ? fastIcons : fancyIcons).length ? 0 : maskedMeta;
return (renderMode ? fastIcons : fancyIcons)[maskedMeta];
}
/**
* @author jss2a98aj
* @reason Support new leaf rendering modes on Tinker's Construct leaves.
*/
@Overwrite
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
if (side != 0 && maxY < 1f) {
return true;
}
return LeafRenderUtil.shouldSideBeRendered(world, x, y, z, side);
}
@Override
public boolean isFaceNonObstructing(IBlockAccess world, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(world.getBlockMetadata(x ,y, z) < 8) {
return true;
}
return LeafRenderUtil.isFaceNonObstructing(world, x, y, z);
}
@Override
public boolean isFullLeaf(IBlockAccess world, int x, int y, int z) {
return world.getBlockMetadata(x ,y, z) >= 8;
}
@Shadow(remap = false)
public IIcon[] fastIcons;
@Shadow(remap = false)
public IIcon[] fancyIcons;
private MixinOreberryBush(Material material) {
super(material);
}
}
@@ -1,13 +1,10 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.thaumcraft;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.IFaceObstructionCheckHelper;
import jss.notfine.util.ILeafBlock;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@@ -16,21 +13,12 @@ import org.spongepowered.asm.mixin.Shadow;
import thaumcraft.common.blocks.BlockMagicalLeaves;
@Mixin(value = BlockMagicalLeaves.class)
public abstract class MixinBlockMagicalLeaves extends Block implements ILeafBlock {
public abstract class MixinBlockMagicalLeaves extends Block implements IFaceObstructionCheckHelper, ILeafBlock {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
int renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
renderMode = world.getBlock(
x + Facing.offsetsXForSide[side],
y + Facing.offsetsYForSide[side],
z + Facing.offsetsZForSide[side]
) instanceof ILeafBlock ? 1 : 0;
} else {
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
}
final int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
return icon[renderMode + maskedMeta * 2];
}
@@ -44,6 +32,11 @@ public abstract class MixinBlockMagicalLeaves extends Block implements ILeafBloc
return LeafRenderUtil.shouldSideBeRendered(world, x, y, z, side);
}
@Override()
public boolean isFaceNonObstructing(IBlockAccess world, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
return LeafRenderUtil.isFaceNonObstructing(world, x, y, z);
}
private MixinBlockMagicalLeaves(Material material) {
super(material);
}
@@ -1,12 +1,8 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.twilightforest;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.BlockLeaves;
import net.minecraft.init.Blocks;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@@ -18,16 +14,7 @@ public abstract class MixinBlockTFLeaves extends BlockLeaves {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
int renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
renderMode = world.getBlock(
x + Facing.offsetsXForSide[side],
y + Facing.offsetsYForSide[side],
z + Facing.offsetsZForSide[side]
) instanceof ILeafBlock ? 1 : 0;
} else {
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
}
int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
return Blocks.leaves.field_150129_M[renderMode][maskedMeta];
}
@@ -1,12 +1,8 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.twilightforest;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.BlockLeaves;
import net.minecraft.init.Blocks;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@@ -17,16 +13,7 @@ public abstract class MixinBlockTFLeaves3 extends BlockLeaves {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
renderMode = world.getBlock(
x + Facing.offsetsXForSide[side],
y + Facing.offsetsYForSide[side],
z + Facing.offsetsZForSide[side]
) instanceof ILeafBlock ? 1 : 0;
} else {
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
}
final int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
return Blocks.leaves.field_150129_M[renderMode][0];
}
@@ -1,11 +1,7 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.twilightforest;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.BlockLeaves;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@@ -17,21 +13,12 @@ public abstract class MixinBlockTFMagicLeaves extends BlockLeaves {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
int renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
renderMode = world.getBlock(
x + Facing.offsetsXForSide[side],
y + Facing.offsetsYForSide[side],
z + Facing.offsetsZForSide[side]
) instanceof ILeafBlock ? 1 : 0;
} else {
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
}
final boolean renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side);
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
return switch (maskedMeta) {
case 1 -> renderMode == 1 ? SPR_TRANSLEAVES_OPAQUE : SPR_TRANSLEAVES;
case 3 -> renderMode == 1 ? SPR_SORTLEAVES_OPAQUE : SPR_SORTLEAVES;
default -> renderMode == 1 ? SPR_TIMELEAVES_OPAQUE : SPR_TIMELEAVES;
case 1 -> renderMode ? SPR_TRANSLEAVES_OPAQUE : SPR_TRANSLEAVES;
case 3 -> renderMode ? SPR_SORTLEAVES_OPAQUE : SPR_SORTLEAVES;
default -> renderMode ? SPR_TIMELEAVES_OPAQUE : SPR_TIMELEAVES;
};
}
@@ -1,13 +1,10 @@
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.witchery;
import com.emoniph.witchery.blocks.BlockWitchLeaves;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@@ -29,16 +26,7 @@ public abstract class MixinBlockWitchLeaves extends BlockLeavesBase {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
int renderMode;
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
renderMode = world.getBlock(
x + Facing.offsetsXForSide[side],
y + Facing.offsetsYForSide[side],
z + Facing.offsetsZForSide[side]
) instanceof ILeafBlock ? 1 : 0;
} else {
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
}
final int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
return iconsForModes[renderMode][maskedMeta];
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.proxy;
import com.google.common.base.Objects;
import com.gtnewhorizons.angelica.common.BlockTest;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.bettercrashes.BetterCrashesCompat;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.glsm.debug.OpenGLDebugging;
@@ -81,7 +82,7 @@ public class ClientProxy extends CommonProxy {
if(AngelicaConfig.enableSodium) {
// Register all blocks. Because blockids are unique to a world, this must be done each load
GameData.getBlockRegistry().forEach(o -> {
final Block b = (Block) o;
AngelicaBlockSafetyRegistry.canBlockRenderOffThread(b, true, true);
AngelicaBlockSafetyRegistry.canBlockRenderOffThread(b, false, true);
@@ -119,6 +120,10 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.registerKeyBinding(glsmKeyBinding);
Loader.loadModels();
if(ModStatus.isBetterCrashesLoaded) {
BetterCrashesCompat.init();
}
}
private boolean wasGLSMKeyPressed;
@@ -30,7 +30,6 @@ import com.gtnewhorizons.angelica.glsm.TessellatorManager;
import com.gtnewhorizons.angelica.glsm.VBOManager;
import jss.notfine.core.Settings;
import jss.notfine.gui.options.named.GraphicsQualityOff;
import me.jellysquid.mods.sodium.client.SodiumClientMod;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -0,0 +1,55 @@
package com.gtnewhorizons.angelica.transform.compat;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
public enum CompatASMTransformers {
EXTRA_UTILITIES_ISBRH("RenderBlockColor Transformer", () -> AngelicaConfig.fixExtraUtilsSodiumCompat, Side.CLIENT,
"com.gtnewhorizons.angelica.transform.compat.ExtraUtilsTransformer"
);
private final Supplier<Boolean> applyIf;
private final Side side;
private final String[] transformerClasses;
CompatASMTransformers(String description, Supplier<Boolean> applyIf, Side side, String... transformers) {
this.applyIf = applyIf;
this.side = side;
this.transformerClasses = transformers;
}
private boolean shouldBeLoaded() { return applyIf.get() && shouldLoadSide(); }
private boolean shouldLoadSide() {
return side == Side.BOTH || (side == Side.SERVER && FMLLaunchHandler.side()
.isServer())
|| (side == Side.CLIENT && FMLLaunchHandler.side()
.isClient());
}
public static List<String> getTransformers() {
final List<String> list = new ArrayList<>();
for (CompatASMTransformers transformer : values()) {
if (transformer.shouldBeLoaded()) {
AngelicaTweaker.LOGGER.info("Loading transformer {}", (Object[]) transformer.transformerClasses);
list.addAll(Arrays.asList(transformer.transformerClasses));
} else {
AngelicaTweaker.LOGGER.info("Not loading transformer {}", (Object[]) transformer.transformerClasses);
}
}
return list;
}
private enum Side {
BOTH,
CLIENT,
SERVER
}
}
@@ -0,0 +1,74 @@
package com.gtnewhorizons.angelica.transform.compat;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import com.gtnewhorizons.angelica.transform.ClassConstantPoolParser;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ExtraUtilsTransformer implements IClassTransformer {
private static final String RenderBlockColor = "com.rwtema.extrautils.block.render.RenderBlockColor";
private static final String RenderBlockConnectedTextures = "com.rwtema.extrautils.block.render.RenderBlockConnectedTextures";
private static final String RenderBlockConnectedTexturesEthereal = "com.rwtema.extrautils.block.render.RenderBlockConnectedTexturesEthereal";
private static final String RenderBlockFullBright = "com.rwtema.extrautils.block.render.RenderBlockFullBright";
private static final String RenderBlockSpike = "com.rwtema.extrautils.block.render.RenderBlockSpike";
private static final List<String> transformedClasses = Arrays.asList(RenderBlockColor, RenderBlockConnectedTextures, RenderBlockConnectedTexturesEthereal, RenderBlockFullBright, RenderBlockSpike);
private static final Map<String, Boolean> perThreadMap = new HashMap<>();
static {
perThreadMap.put(RenderBlockColor, false);
perThreadMap.put(RenderBlockConnectedTextures, true);
perThreadMap.put(RenderBlockConnectedTexturesEthereal, true);
perThreadMap.put(RenderBlockFullBright, false);
perThreadMap.put(RenderBlockSpike, false);
}
@Override
public byte[] transform(final String className, String transformedName, byte[] basicClass) {
if (basicClass == null) return null;
if (!transformedClasses.contains(transformedName)) {
return basicClass;
}
AngelicaTweaker.LOGGER.info("Adding ThreadSafeISBRH for Extra Utilities to: {}", transformedName);
final ClassReader cr = new ClassReader(basicClass);
final ClassNode cn = new ClassNode();
cr.accept(cn, 0);
addThreadSafeISBRHAnnotation(transformedName, cn);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cn.accept(cw);
return cw.toByteArray();
}
public void addThreadSafeISBRHAnnotation(String transformedName, ClassNode cn) {
AnnotationNode isbrhAnnotation = new AnnotationNode("Lcom/gtnewhorizons/angelica/api/ThreadSafeISBRH;");
Boolean perThread = perThreadMap.get(transformedName);
if (perThread == null) {
perThread = false;
AngelicaTweaker.LOGGER.info("Tried to add ThreadSafeISBRH annotation to {} which is missing from perThreadMap. Using false for perThread.", transformedName);
}
isbrhAnnotation.values = Arrays.asList("perThread", perThread);
if (cn.visibleAnnotations == null) {
cn.visibleAnnotations = new ArrayList<>();
}
cn.visibleAnnotations.add(isbrhAnnotation);
}
}
@@ -40,8 +40,8 @@ public class ColorizeBlock {
private static final boolean useStemColors = MCPatcherForgeConfig.instance().ccStem;
private static final boolean useBlockColors = MCPatcherForgeConfig.instance().ccOtherBlocks;
static final boolean enableSmoothBiomes = MCPatcherForgeConfig.instance().smoothBiomes;
static final boolean enableTestColorSmoothing = MCPatcherForgeConfig.instance().testColorSmoothing;
private static final boolean enableSmoothBiomes = MCPatcherForgeConfig.instance().smoothBiomes;
private static final boolean enableTestColorSmoothing = MCPatcherForgeConfig.instance().testColorSmoothing;
private static final ResourceLocation REDSTONE_COLORS = TexturePackAPI
.newMCPatcherResourceLocation("colormap/redstone.png");
@@ -59,7 +59,8 @@ public class ColorizeBlock {
"minecraft:textures/colormap/grass.png");
private static final ResourceLocation DEFAULT_FOLIAGECOLOR = new ResourceLocation(
"minecraft:textures/colormap/foliage.png");
private static final ResourceLocation PINECOLOR = TexturePackAPI.newMCPatcherResourceLocation("colormap/pine.png");
private static final ResourceLocation PINECOLOR = TexturePackAPI
.newMCPatcherResourceLocation("colormap/pine.png");
private static final ResourceLocation BIRCHCOLOR = TexturePackAPI
.newMCPatcherResourceLocation("colormap/birch.png");
private static final ResourceLocation WATERCOLOR = TexturePackAPI
@@ -67,9 +68,6 @@ public class ColorizeBlock {
private static final String PALETTE_BLOCK_KEY = "palette.block.";
private static Block waterBlock;
private static Block staticWaterBlock;
// bitmaps from palette.block.*
private static final Map<Block, List<BlockStateMatcher>> blockColorMaps = new IdentityHashMap<>();
private static IColorMap waterColorMap;
@@ -137,9 +135,6 @@ public class ColorizeBlock {
}
static void reset() {
waterBlock = Blocks.flowing_water;
staticWaterBlock = Blocks.water;
blockColorMaps.clear();
waterColorMap = null;
resetVertexColors();
@@ -360,10 +355,10 @@ public class ColorizeBlock {
public static boolean colorizeBlock(Block block, IBlockAccess blockAccess, int x, int y, int z) {
IColorMap colorMap = findColorMap(block, blockAccess, x, y, z);
return colorizeBlock(block, blockAccess, colorMap, x, y, z);
return colorizeBlock(blockAccess, colorMap, x, y, z);
}
private static boolean colorizeBlock(Block block, IBlockAccess blockAccess, IColorMap colorMap, int x, int y,
private static boolean colorizeBlock(IBlockAccess blockAccess, IColorMap colorMap, int x, int y,
int z) {
if (colorMap == null) {
return false;
@@ -394,7 +389,7 @@ public class ColorizeBlock {
}
public static void colorizeWaterBlockGL(Block block) {
if (block == waterBlock || block == staticWaterBlock) {
if (block == Blocks.flowing_water || block == Blocks.water) {
float[] waterColor;
if (waterColorMap == null) {
waterColor = ColorizeEntity.waterBaseColor;
@@ -578,4 +573,5 @@ public class ColorizeBlock {
colorGreenTopLeft = colorGreenBottomLeft = colorGreenBottomRight = colorGreenTopRight = g;
colorBlueTopLeft = colorBlueBottomLeft = colorBlueBottomRight = colorBlueTopRight = b;
}
}
@@ -139,7 +139,6 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
}
}
System.gc();
long timeDiff = System.currentTimeMillis() - startTime;
Runtime runtime = Runtime.getRuntime();
long memDiff = runtime.totalMemory() - runtime.freeMemory() - startMem;
@@ -10,6 +10,7 @@ import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import jss.notfine.config.MCPatcherForgeConfig;
import jss.notfine.config.NotFineConfig;
/**
* Adapted from Hodgepodge
@@ -19,7 +20,7 @@ public enum AsmTransformers {
RENDERBLOCKS("RenderBlocks transformer", () -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().customColorsEnabled,
Side.CLIENT, "jss.notfine.asm.RenderBlocksTransformer"),
WORLDRENDERER("WorldRenderer transformer", () -> AngelicaConfig.enableMCPatcherForgeFeatures, Side.CLIENT,
WORLDRENDERER("WorldRenderer transformer", () -> NotFineConfig.renderPass, Side.CLIENT,
"jss.notfine.asm.WorldRendererTransformer");
private final Supplier<Boolean> applyIf;
@@ -8,34 +8,46 @@ import java.io.File;
public class NotFineConfig {
public static final String CATEGORY_GENERAL = "general";
public static final String CATEGORY_TOGGLE = "toggle";
private static final String CATEGORY_GENERAL = "general";
private static final String CATEGORY_TOGGLE = "toggle";
private static final String CATEGORY_UNFINISHED = "unfinished";
public static boolean allowAdvancedOpenGL;
public static boolean allowToggle3DAnaglyph;
public static boolean allowToggleFBO;
public static boolean betterBlockFaceCulling;
public static boolean renderPass;
public static void loadSettings() {
File configFile = new File(Launch.minecraftHome + File.separator + "config" + File.separator + NotFine.MODID + File.separator + "notfine.cfg");
Configuration notFineConfig = new Configuration(configFile);
Configuration config = new Configuration(configFile);
allowAdvancedOpenGL = notFineConfig.getBoolean("allowAdvancedOpenGL", CATEGORY_GENERAL, false,
allowAdvancedOpenGL = config.getBoolean("allowAdvancedOpenGL", CATEGORY_GENERAL, false,
"Allow Advanced OpenGL to be enabled when it might be supported.");
allowToggle3DAnaglyph = notFineConfig.getBoolean("allowToggle3DAnaglyph", CATEGORY_GENERAL, true,
allowToggle3DAnaglyph = config.getBoolean("allowToggle3DAnaglyph", CATEGORY_GENERAL, true,
"Allow 3D Anaglyph to be enabled.");
allowToggleFBO = notFineConfig.getBoolean("allowToggleFBO", CATEGORY_GENERAL, false,
allowToggleFBO = config.getBoolean("allowToggleFBO", CATEGORY_GENERAL, false,
"Allow FBOs to be disabled.");
notFineConfig.setCategoryComment(CATEGORY_TOGGLE, "Enable or disable various mod features.");
betterBlockFaceCulling = notFineConfig.getBoolean("betterBlockFaceCulling", CATEGORY_TOGGLE, true,
config.setCategoryComment(CATEGORY_TOGGLE, "Toggle mod features.");
betterBlockFaceCulling = config.getBoolean("betterBlockFaceCulling", CATEGORY_TOGGLE, true,
"Use more accurate block face culling when building chunk meshes.");
config.setCategoryComment(CATEGORY_TOGGLE, "Enable or disable various mod features.");
if(notFineConfig.hasChanged()) {
notFineConfig.save();
config.setCategoryComment(CATEGORY_UNFINISHED, "Toggle mod features that are unfinished or require compatibility improvements.");
renderPass = config.getBoolean("renderPass", CATEGORY_UNFINISHED, false,
"Allows resource pack artists to add block textures to be rendered during additional passes.");
if(config.hasChanged()) {
config.save();
}
//These will probably break hard with Angelica.
//AdvancedOpenGL even breaks hard on its own.
allowAdvancedOpenGL = false;
allowToggleFBO = false;
renderPass = false;
}
}
@@ -257,7 +257,7 @@ public class NotFineGameOptionPages {
.setBinding((opts, value) -> opts.anaglyph = value, opts -> opts.anaglyph)
.setImpact(OptionImpact.HIGH)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.setEnabled(NotFineConfig.allowAdvancedOpenGL)
.setEnabled(NotFineConfig.allowToggle3DAnaglyph)
.build())
.add(OptionImpl.createBuilder(boolean.class, vanillaOpts)
.setName(I18n.format("options.showCape"))
+3 -35
View File
@@ -1,43 +1,11 @@
package jss.notfine.util;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import jss.notfine.gui.options.named.LeavesQuality;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
public interface ILeafBlock extends IFaceObstructionCheckHelper {
public interface ILeafBlock {
@Override()
default boolean isFaceNonObstructing(IBlockAccess worldIn, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
Block otherBlock;
otherBlock = worldIn.getBlock(x + 1, y, z);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
return true;
}
otherBlock = worldIn.getBlock(x - 1, y, z);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
return true;
}
otherBlock = worldIn.getBlock(x, y + 1, z);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
return true;
}
otherBlock = worldIn.getBlock(x, y - 1, z);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
return true;
}
otherBlock = worldIn.getBlock(x, y, z + 1);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
return true;
}
otherBlock = worldIn.getBlock(x, y, z - 1);
return !(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube());
} else {
return !SettingsManager.leavesOpaque;
}
default boolean isFullLeaf(IBlockAccess world, int x, int y, int z) {
return true;
}
}
@@ -25,12 +25,12 @@ public class LeafRenderUtil {
5, 4, 1, 0, 3, 2
};
public static boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
Block otherBlock = worldIn.getBlock(x, y, z);
public static boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
final Block otherBlock = world.getBlock(x, y, z);
if(otherBlock.isOpaqueCube()) {
return false;
}
if(otherBlock instanceof ILeafBlock) {
if(otherBlock instanceof ILeafBlock otherLeaf && otherLeaf.isFullLeaf(world, x, y, z)) {
switch ((LeavesQuality)Settings.MODE_LEAVES.option.getStore()) {
case FAST, SMART -> {
return false;
@@ -40,76 +40,33 @@ public class LeafRenderUtil {
y -= Facing.offsetsYForSide[side];
z -= Facing.offsetsZForSide[side];
int renderCheck = 0;
otherBlock = worldIn.getBlock(x + 1, y, z);
if(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube()) {
renderCheck++;
}
otherBlock = worldIn.getBlock(x - 1, y, z);
if(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube()) {
renderCheck++;
}
otherBlock = worldIn.getBlock(x, y + 1, z);
if(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube()) {
renderCheck++;
}
otherBlock = worldIn.getBlock(x, y - 1, z);
if(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube()) {
renderCheck++;
}
otherBlock = worldIn.getBlock(x, y, z + 1);
if(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube()) {
renderCheck++;
}
otherBlock = worldIn.getBlock(x, y, z - 1);
if(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube()) {
renderCheck++;
}
renderCheck += ignoreWhenCulling(world, x + 1, y, z) ? 0 : 1;
renderCheck += ignoreWhenCulling(world, x - 1, y, z) ? 0 : 1;
renderCheck += ignoreWhenCulling(world, x, y + 1, z) ? 0 : 1;
renderCheck += ignoreWhenCulling(world, x, y - 1, z) ? 0 : 1;
renderCheck += ignoreWhenCulling(world, x, y, z + 1) ? 0 : 1;
renderCheck += ignoreWhenCulling(world, x, y, z - 1) ? 0 : 1;
boolean renderSide = renderCheck == 6;
if (renderSide) {
x += 2 * Facing.offsetsXForSide[side];
y += 2 * Facing.offsetsYForSide[side];
z += 2 * Facing.offsetsZForSide[side];
otherBlock = worldIn.getBlock(x, y, z);
if(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube()) {
if(!ignoreWhenCulling(world, x, y, z)) {
renderSide = false;
}
x -= Facing.offsetsXForSide[side];
y -= Facing.offsetsYForSide[side];
z -= Facing.offsetsZForSide[side];
int nextSide = relativeADirections[side];
otherBlock = worldIn.getBlock(
x + Facing.offsetsXForSide[nextSide],
y + Facing.offsetsYForSide[nextSide],
z + Facing.offsetsZForSide[nextSide]
);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
if(ignoreWhenCulling(world, x, y, z, relativeADirections[side])) {
return true;
}
nextSide = relativeBDirections[side];
otherBlock = worldIn.getBlock(
x + Facing.offsetsXForSide[nextSide],
y + Facing.offsetsYForSide[nextSide],
z + Facing.offsetsZForSide[nextSide]
);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
if(ignoreWhenCulling(world, x, y, z, relativeBDirections[side])) {
return true;
}
nextSide = relativeCDirections[side];
otherBlock = worldIn.getBlock(
x + Facing.offsetsXForSide[nextSide],
y + Facing.offsetsYForSide[nextSide],
z + Facing.offsetsZForSide[nextSide]
);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
if(ignoreWhenCulling(world, x, y, z, relativeCDirections[side])) {
return true;
}
nextSide = relativeDDirections[side];
otherBlock = worldIn.getBlock(
x + Facing.offsetsXForSide[nextSide],
y + Facing.offsetsYForSide[nextSide],
z + Facing.offsetsZForSide[nextSide]
);
if(!(otherBlock instanceof ILeafBlock || otherBlock.isOpaqueCube())) {
if(ignoreWhenCulling(world, x, y, z, relativeDDirections[side])) {
return true;
}
}
@@ -122,9 +79,55 @@ public class LeafRenderUtil {
}
//Check for IFaceObstructionCheckHelper
if(otherBlock instanceof IFaceObstructionCheckHelper target) {
return target.isFaceNonObstructing(worldIn, x, y, z, side, 0D, 0D, 0D, 1D, 1D, 1D);
return target.isFaceNonObstructing(world, x, y, z, side, 0D, 0D, 0D, 1D, 1D, 1D);
}
return true;
}
public static boolean isFaceNonObstructing(IBlockAccess world, int x, int y, int z) {
if(Settings.MODE_LEAVES.option.getStore() != LeavesQuality.SHELLED_FAST) {
return !SettingsManager.leavesOpaque;
}
if(ignoreWhenCulling(world, x + 1, y, z)) {
return true;
}
if(ignoreWhenCulling(world, x - 1, y, z)) {
return true;
}
if(ignoreWhenCulling(world, x, y + 1, z)) {
return true;
}
if(ignoreWhenCulling(world, x, y - 1, z)) {
return true;
}
if(ignoreWhenCulling(world, x, y, z + 1)) {
return true;
}
return ignoreWhenCulling(world, x, y, z - 1);
}
public static boolean ignoreWhenCulling(IBlockAccess world, int x, int y, int z) {
Block otherBlock = world.getBlock(x, y, z);
return !(otherBlock instanceof ILeafBlock leafBlock && leafBlock.isFullLeaf(world, x, y, z) || otherBlock.isOpaqueCube());
}
public static boolean ignoreWhenCulling(IBlockAccess world, int x, int y, int z, int side) {
x += Facing.offsetsXForSide[side];
y += Facing.offsetsYForSide[side];
z += Facing.offsetsZForSide[side];
final Block otherBlock = world.getBlock(x, y, z);
return !(otherBlock instanceof ILeafBlock leafBlock && leafBlock.isFullLeaf(world, x, y, z) || otherBlock.isOpaqueCube());
}
public static boolean selectRenderMode(IBlockAccess world, int x, int y, int z, int side) {
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
x += Facing.offsetsXForSide[side];
y += Facing.offsetsYForSide[side];
z += Facing.offsetsZForSide[side];
final Block otherBlock = world.getBlock(x, y, z);
return otherBlock instanceof ILeafBlock leafBlock && leafBlock.isFullLeaf(world, x, y, z);
}
return SettingsManager.leavesOpaque;
}
}