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
20 changed files with 384 additions and 210 deletions

No files matched your search

+2
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 }
@@ -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);
@@ -1,7 +1,6 @@
package com.gtnewhorizons.angelica.mixins;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
@@ -272,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)
@@ -288,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)
@@ -319,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")
@@ -522,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")
;
@@ -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];
}
@@ -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;
@@ -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;
}
}