Fix glass rendering not connecting to enlightened versions

Fix config
This commit is contained in:
tterrag1098 committed 2014-11-19 17:45:57 -05:00
1 parent 3c781798f6
commit 807c3bb6ca
6 files changed
+55 -16

No files matched your search

@@ -880,7 +880,7 @@ public final class Config {
"The distance from which XP will be gathered to each side of Joe.").getDouble(killerJoeHooverXpLength);
killerJoeHooverXpWidth = config.get(sectionKiller.name, "killerJoeHooverXpWidth", killerJoeHooverXpWidth,
"The distance from which XP will be gathered in front of Joe.").getDouble(killerJoeHooverXpWidth);
killerJoeMaxXpLevel = config.get("killerJoeMaxXpLevel", sectionMisc.name, killerJoeMaxXpLevel, "Maximum level of XP the killer joe can contain.").getInt();
killerJoeMaxXpLevel = config.get(sectionMisc.name, "killerJoeMaxXpLevel", killerJoeMaxXpLevel, "Maximum level of XP the killer joe can contain.").getInt();
isGasConduitEnabled = config.getString("isGasConduitEnabled", sectionItems.name, isGasConduitEnabled,
"Can be set to 'auto', 'true' or 'false'. When set to auto the gas conduit will only be enabled when Mekanism is installed.");
@@ -921,7 +921,7 @@ public final class Config {
soulBinderEnderRailLevels = config.get(sectionSoulBinder.name, "soulBinderEnderRailLevels", soulBinderEnderRailLevels,
"The number of levels required to create an ender rail.").getInt(soulBinderEnderRailLevels);
soulBinderMaxXpLevel = config.get("soulBinder", sectionMisc.name, soulBinderMaxXpLevel, "Maximum level of XP the soul binder can contain.").getInt();
soulBinderMaxXpLevel = config.get(sectionSoulBinder.name, "soulBinderMaxXPLevel", soulBinderMaxXpLevel, "Maximum level of XP the soul binder can contain.").getInt();
sliceAndSpliceLevelOnePowerPerTickRF = config.get(sectionPower.name, "sliceAndSpliceLevelOnePowerPerTickRF", sliceAndSpliceLevelOnePowerPerTickRF,
@@ -990,10 +990,10 @@ public final class Config {
dumpMobNames = config.getBoolean("dumpMobNames", sectionMobConfig.name, dumpMobNames,
"When set to true a list of all registered mobs will be dumped to config/enderio/mobTypes.txt The names are in the format required by EIOs mob blacklists.");
xpObeliskMaxXpLevel = config.get("xpObeliskMaxXpLevel", sectionMisc.name, xpObeliskMaxXpLevel, "Maximum level of XP the xp obelisk can contain.").getInt();
xpObeliskMaxXpLevel = config.get(sectionMisc.name, "xpObeliskMaxXpLevel", xpObeliskMaxXpLevel, "Maximum level of XP the xp obelisk can contain.").getInt();
clearGlassSameTexture = config.get("clearGlassSameTexture", sectionMisc.name, clearGlassSameTexture, "If true, quite clear glass will use the fused quartz border texture for the block instead of the white border.").getBoolean();
clearGlassConnectToFusedQuartz = config.get("clearGlassConnectToFusedQuartz", sectionMisc.name, clearGlassConnectToFusedQuartz, "If true, quite clear glass will connect textures with fused quartz.").getBoolean();
clearGlassSameTexture = config.getBoolean("clearGlassSameTexture", sectionMisc.name, clearGlassSameTexture, "If true, quite clear glass will use the fused quartz border texture for the block instead of the white border.");
clearGlassConnectToFusedQuartz = config.getBoolean("clearGlassConnectToFusedQuartz", sectionMisc.name, clearGlassConnectToFusedQuartz, "If true, quite clear glass will connect textures with fused quartz.");
}
private Config() {
@@ -48,7 +48,25 @@ public class BlockFusedQuartz extends BlockEio {
this.blockIcon = blockIcon;
this.itemIcon = itemIcon;
}
public boolean connectTo(int otherMeta) {
if (otherMeta == this.ordinal()) {
return true;
}
switch(this) {
case FUSED_QUARTZ:
return otherMeta == ENLIGHTENED_FUSED_QUARTZ.ordinal();
case ENLIGHTENED_FUSED_QUARTZ:
return otherMeta == FUSED_QUARTZ.ordinal();
case GLASS:
return otherMeta == ENLIGHTENED_GLASS.ordinal();
case ENLIGHTENED_GLASS:
return otherMeta == GLASS.ordinal();
}
return false;
}
}
public static BlockFusedQuartz create() {
@@ -23,7 +23,17 @@ public class FusedQuartzRenderer implements ISimpleBlockRenderingHandler {
static int renderPass;
private ConnectedTextureRenderer connectedTextureRenderer = new ConnectedTextureRenderer();
private ConnectedTextureRenderer connectedTextureRenderer = new ConnectedTextureRenderer() {
@Override
public boolean matchesMetadata(int meta1, int meta2) {
if (super.matchesMetadata(meta1, meta2)) {
return true;
}
BlockFusedQuartz.Type type = BlockFusedQuartz.Type.values()[meta1];
return type.connectTo(meta2);
}
};
public FusedQuartzRenderer() {
connectedTextureRenderer.setMatchMeta(!Config.clearGlassConnectToFusedQuartz);
@@ -15,7 +15,7 @@ import crazypants.vecmath.Vector3d;
import crazypants.vecmath.Vector4f;
import crazypants.vecmath.Vertex;
public class ConnectedTextureRenderer implements IRenderFace {
public class ConnectedTextureRenderer implements IRenderFace, IConnectedTextureRenderer {
public static interface TextureCallback {
public IIcon getTextureForFace(ForgeDirection dir);
@@ -86,7 +86,11 @@ public class ConnectedTextureRenderer implements IRenderFace {
public void setMatchMeta(boolean matchMetaData) {
this.matchMetaData = matchMetaData;
}
@Override
public boolean matchesMetadata(int meta1, int meta2) {
return !this.matchMetaData || meta1 == meta2;
}
@Override
public void renderFace(CustomRenderBlocks rb, ForgeDirection face, Block par1Block, double x, double y, double z, IIcon texture, List<Vertex> refVertices,
@@ -103,7 +107,7 @@ public class ConnectedTextureRenderer implements IRenderFace {
if(forceAllEdges) {
edges = RenderUtil.getEdgesForFace(face);
} else {
edges = RenderUtil.getNonConectedEdgesForFace(rb.blockAccess, (int) x, (int) y, (int) z, face, matchMetaData);
edges = RenderUtil.getNonConectedEdgesForFace(rb.blockAccess, (int) x, (int) y, (int) z, face, this);
}
List<ForgeDirection> allEdges = RenderUtil.getEdgesForFace(face);
@@ -256,11 +260,11 @@ public class ConnectedTextureRenderer implements IRenderFace {
BlockCoord bc = new BlockCoord((int) x, (int) y, (int) z);
BlockCoord testLoc = bc.getLocation(dir);
if(RenderUtil.getNonConectedEdgesForFace(blockAccess, testLoc.x, testLoc.y, testLoc.z, face, matchMetaData).contains(dir2)) {
if(RenderUtil.getNonConectedEdgesForFace(blockAccess, testLoc.x, testLoc.y, testLoc.z, face, this).contains(dir2)) {
return true;
}
testLoc = bc.getLocation(dir2);
if(RenderUtil.getNonConectedEdgesForFace(blockAccess, testLoc.x, testLoc.y, testLoc.z, face, matchMetaData).contains(dir)) {
if(RenderUtil.getNonConectedEdgesForFace(blockAccess, testLoc.x, testLoc.y, testLoc.z, face, this).contains(dir)) {
return true;
}
return false;
@@ -0,0 +1,7 @@
package crazypants.render;
public interface IConnectedTextureRenderer {
boolean matchesMetadata(int meta1, int meta2);
}
@@ -370,10 +370,10 @@ public class RenderUtil {
}
public static List<ForgeDirection> getNonConectedEdgesForFace(IBlockAccess blockAccess, int x, int y, int z, ForgeDirection face) {
return getNonConectedEdgesForFace(blockAccess, x, y, z, face, false);
return getNonConectedEdgesForFace(blockAccess, x, y, z, face, null);
}
public static List<ForgeDirection> getNonConectedEdgesForFace(IBlockAccess blockAccess, int x, int y, int z, ForgeDirection face, boolean matchMetaData) {
public static List<ForgeDirection> getNonConectedEdgesForFace(IBlockAccess blockAccess, int x, int y, int z, ForgeDirection face, IConnectedTextureRenderer render) {
Block block = blockAccess.getBlock(x, y, z);
if(block == null) {
@@ -391,8 +391,8 @@ public class RenderUtil {
List<ForgeDirection> result = new ArrayList<ForgeDirection>(4);
for (EdgeNeighbour edge : edges) {
boolean matchingNeighbour = blockAccess.getBlock(edge.bc.x, edge.bc.y, edge.bc.z) == block;
if(matchingNeighbour && matchMetaData) {
matchingNeighbour = blockAccess.getBlockMetadata(x, y, z) == blockAccess.getBlockMetadata(edge.bc.x, edge.bc.y, edge.bc.z);
if(matchingNeighbour && render != null) {
matchingNeighbour = render.matchesMetadata(blockAccess.getBlockMetadata(x, y, z), blockAccess.getBlockMetadata(edge.bc.x, edge.bc.y, edge.bc.z));
}
if(!matchingNeighbour) {
result.add(edge.dir);