From 3f2e39ceb8a23e6effbeb88a098c36d8e9e57379 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 18 Feb 2015 15:27:57 -0500 Subject: [PATCH 01/16] Begin CTM refactor. Submaps working, lighting not so much --- .../chisel/api/carving/CarvingUtils.java | 33 +- .../chisel/api/carving/ICarvableHelper.java | 6 + .../chisel/carving/CarvableHelper.java | 536 ++++++++++++------ .../chisel/carving/CarvableVariation.java | 5 +- .../chisel/carving/ITextureVariation.java | 6 + .../render/BlockAdvancedMarbleRenderer.java | 7 +- .../render/BlockCTMNoLightRenderer.java | 6 +- .../render/BlockMarblePillarRenderer.java | 3 +- .../chisel/client/render/RenderBlocksCTM.java | 412 ++++++-------- .../client/render/RenderBlocksCTMCarpet.java | 9 - .../chisel/client/render/TextureSubmap.java | 1 - .../chisel/client/render/TextureVirtual.java | 41 +- 12 files changed, 638 insertions(+), 427 deletions(-) create mode 100644 src/main/java/com/cricketcraft/chisel/api/carving/ICarvableHelper.java create mode 100644 src/main/java/com/cricketcraft/chisel/carving/ITextureVariation.java diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java index d47676ef..0d687fa6 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java @@ -31,16 +31,20 @@ public class CarvingUtils { } private static Field _chisel; - private static boolean errored = false; + private static boolean registryErrored = false; private static final String CARVING_CLASS = "com.cricketcraft.chisel.carving.Carving"; + private static Class _carvableHelper; + private static boolean helperErrored = false; + private static final String CARVABLE_HELPER_CLASS = "com.cricketcraft.carving.CarvableHelper"; + /** * @return The instance of the chisel carving registry from the chisel mod. *

* If chisel is not installed or some other error occurs this will return null. */ public static ICarvingRegistry getChiselRegistry() { - if (errored) { + if (registryErrored) { return null; } @@ -51,8 +55,31 @@ public class CarvingUtils { return (ICarvingRegistry) _chisel.get(null); } catch (Exception e) { e.printStackTrace(); - errored = true; + registryErrored = true; return getChiselRegistry(); } } + + /** + * @return An instance of an {@link ICarvableHelper}. + *

+ * If chisel is not installed or some other error occurs this will return null. + */ + @SuppressWarnings("unchecked") + public static ICarvableHelper getCarvableHelperInstance() { + if (helperErrored) { + return null; + } + + try { + if (_carvableHelper == null) { + _carvableHelper = (Class) Class.forName(CARVABLE_HELPER_CLASS); + } + return _carvableHelper.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + helperErrored = true; + return getCarvableHelperInstance(); + } + } } diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvableHelper.java b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvableHelper.java new file mode 100644 index 00000000..9d47b4cc --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvableHelper.java @@ -0,0 +1,6 @@ +package com.cricketcraft.chisel.api.carving; + + +public interface ICarvableHelper { + +} diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index fe3e0ad5..bd36602f 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -8,6 +8,7 @@ import com.cricketcraft.chisel.compat.FMPIntegration; import com.cricketcraft.chisel.config.Configurations; import com.cricketcraft.chisel.item.ItemCarvable; import com.cricketcraft.chisel.utils.GeneralClient; + import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockPane; @@ -23,20 +24,288 @@ import java.util.*; public class CarvableHelper { - public static final int NORMAL = 0; - public static final int TOPSIDE = 1; - public static final int TOPBOTSIDE = 2; - public static final int CTM3 = 3; - public static final int CTMV = 4; - public static final int CTMH = 5; - public static final int V9 = 6; - public static final int V4 = 7; - public static final int CTMX = 8; - public static final int R16 = 9; - public static final int R9 = 10; - public static final int R4 = 11; + public interface ISubmapManager { - private static final Random rand = new Random(); + IIcon getIcon(int side, int meta); + + IIcon getIcon(IBlockAccess world, int x, int y, int z, int side); + + void registerIcons(String modName, Block block, IIconRegister register); + } + + public enum TextureType implements ISubmapManager { + + TOPSIDE("top", "side") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + TOPBOTSIDE("top", "bottom", "side") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + CTM3("ctm1", "ctm2", "ctm3") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + CTMV("ctmv", "top") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + CTMH("ctmh", "top") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + V9("v9") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + V4("v4") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + CTMX("", "ctm") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + R16("r16") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + R9("r9") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + R4("r4") { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }, + NORMAL { + + @Override + public IIcon getIcon(int side, int meta) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + // TODO Auto-generated method stub + + } + }; + + private String[] suffixes; + + private TextureType(String... suffixes) { + this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes; + } + + public static ISubmapManager getManagerFor(String path) { + for (TextureType t : values()) { + boolean matches = true; + for (String s : t.suffixes) { + String res = "".equals(s) ? path + ".png" : path + "-" + s + ".png"; + if (Chisel.class.getResource(res) == null) { + matches = false; + } + } + if (matches) { + return t; + } + } + return null; + } + + @Override + public abstract IIcon getIcon(int side, int meta); + + @Override + public abstract IIcon getIcon(IBlockAccess world, int x, int y, int z, int side); + } + + private static final Random rand = new Random(); public ArrayList variations = new ArrayList(); CarvableVariation[] map = new CarvableVariation[16]; @@ -75,53 +344,11 @@ public class CarvableHelper { if (texture != null) { variation.texture = texture; - String path = "/assets/" + Chisel.MOD_ID + "/textures/blocks/" + variation.texture; - - boolean any = Chisel.class.getResource(path + ".png") != null; - boolean ctm3 = Chisel.class.getResource(path + "-ctm1.png") != null && Chisel.class.getResource(path + "-ctm2.png") != null && Chisel.class.getResource(path + "-ctm3.png") != null; - boolean ctmv = Chisel.class.getResource(path + "-ctmv.png") != null; - boolean ctmh = Chisel.class.getResource(path + "-ctmh.png") != null; - boolean side = Chisel.class.getResource(path + "-side.png") != null; - boolean top = Chisel.class.getResource(path + "-top.png") != null; - boolean bot = Chisel.class.getResource(path + "-bottom.png") != null; - boolean v9 = Chisel.class.getResource(path + "-v9.png") != null; - boolean v4 = Chisel.class.getResource(path + "-v4.png") != null; - boolean ctmx = Chisel.class.getResource(path + "-ctm.png") != null; - boolean r16 = Chisel.class.getResource(path + "-r16.png") != null; - boolean r9 = Chisel.class.getResource(path + "-r9.png") != null; - boolean r4 = Chisel.class.getResource(path + "-r4.png") != null; - - if (ctm3) { - variation.kind = 3; - } else if (ctmh && top) { - variation.kind = 5; - } else if (ctmv && top) { - variation.kind = CTMV; - } else if (bot && top && side) { - variation.kind = 2; - } else if (top && side) { - variation.kind = 1; - } else if (v9) { - variation.kind = V9; - } else if (v4) { - variation.kind = V4; - } else if (any && ctmx && !Configurations.disableCTM) { - variation.kind = CTMX; - } else if (r16) { - variation.kind = R16; - } else if (r9) { - variation.kind = R9; - } else if (r4) { - variation.kind = R4; - } else if (any) { - variation.kind = 0; - } else { - throw new RuntimeException("No valid textures found for chisel block variation '" + description + "' (" + variation.texture + ")"); - } + variation.type = (TextureType) TextureType.getManagerFor(path); } else { variation.block = block; - variation.kind = 2; + variation.type = TextureType.TOPBOTSIDE; variation.blockMeta = blockMeta; } @@ -148,45 +375,45 @@ public class CarvableHelper { if (variation == null) return GeneralClient.getMissingIcon(); - switch (variation.kind) { - case NORMAL: - return variation.icon; - case TOPSIDE: - if (side == 0 || side == 1) - return variation.iconTop; - else - return variation.icon; - case TOPBOTSIDE: - if (side == 1) - return variation.iconTop; - else if (side == 0) - return variation.iconBot; - else - return variation.icon; - case CTM3: - return variation.ctm.seams[0].icons[0]; - case CTMV: - if (side < 2) - return variation.iconTop; - else - return variation.seamsCtmVert.icons[0]; - case CTMH: - if (side < 2) - return variation.iconTop; - else - return variation.seamsCtmVert.icons[0]; - case V9: - return variation.variations9.icons[4]; - case V4: - return variation.variations9.icons[0]; - case CTMX: - return variation.icon; - case R16: - return variation.variations9.icons[5]; - case R9: - return variation.variations9.icons[4]; - case R4: - return variation.variations9.icons[0]; + switch (variation.type) { + case NORMAL: + return variation.icon; + case TOPSIDE: + if (side == 0 || side == 1) + return variation.iconTop; + else + return variation.icon; + case TOPBOTSIDE: + if (side == 1) + return variation.iconTop; + else if (side == 0) + return variation.iconBot; + else + return variation.icon; + case CTM3: + return variation.ctm.seams[0].icons[0]; + case CTMV: + if (side < 2) + return variation.iconTop; + else + return variation.seamsCtmVert.icons[0]; + case CTMH: + if (side < 2) + return variation.iconTop; + else + return variation.seamsCtmVert.icons[0]; + case V9: + return variation.variations9.icons[4]; + case V4: + return variation.variations9.icons[0]; + case CTMX: + return variation.icon; + case R16: + return variation.variations9.icons[5]; + case R9: + return variation.variations9.icons[4]; + case R4: + return variation.variations9.icons[0]; } return GeneralClient.getMissingIcon(); @@ -202,7 +429,7 @@ public class CarvableHelper { if (variation == null) return GeneralClient.getMissingIcon(); - switch (variation.kind) { + switch (variation.type) { case NORMAL: case TOPSIDE: case TOPBOTSIDE: @@ -255,61 +482,59 @@ public class CarvableHelper { else if (n) return variation.seamsCtmVert.icons[reverse ? 3 : 2]; return variation.seamsCtmVert.icons[0]; - case V9: - case V4: - int variationSize = (variation.kind == V9) ? 3 : 2; + case V9: + case V4: + int variationSize = (variation.type == TextureType.V9) ? 3 : 2; - int xModulus = x % variationSize; - int zModulus = z % variationSize; - //This ensures that blocks placed near 0,0 or it's axis' do not misbehave - int textureX = (xModulus < 0) ? (xModulus + variationSize) : xModulus; - int textureZ = (zModulus < 0) ? (zModulus + variationSize) : zModulus; - //Always invert the y index - int textureY = (variationSize - (y % variationSize) - 1); + int xModulus = x % variationSize; + int zModulus = z % variationSize; + // This ensures that blocks placed near 0,0 or it's axis' do not misbehave + int textureX = (xModulus < 0) ? (xModulus + variationSize) : xModulus; + int textureZ = (zModulus < 0) ? (zModulus + variationSize) : zModulus; + // Always invert the y index + int textureY = (variationSize - (y % variationSize) - 1); - if (side == 2 || side == 5) { - //For WEST, SOUTH reverse the indexes for both X and Z - textureX = (variationSize - textureX - 1); - textureZ = (variationSize - textureZ - 1); - } else if (side == 0) { - //For DOWN, reverse the indexes for only Z - textureZ = (variationSize - textureZ - 1); - } + if (side == 2 || side == 5) { + // For WEST, SOUTH reverse the indexes for both X and Z + textureX = (variationSize - textureX - 1); + textureZ = (variationSize - textureZ - 1); + } else if (side == 0) { + // For DOWN, reverse the indexes for only Z + textureZ = (variationSize - textureZ - 1); + } - int index; - if (side == 0 || side == 1) { - // DOWN || UP - index = textureX + textureZ * variationSize; - } else if (side == 2 || side == 3) { - // NORTH || SOUTH - index = textureX + textureY * variationSize; - } else { - // WEST || EAST - index = textureZ + textureY * variationSize; - } + int index; + if (side == 0 || side == 1) { + // DOWN || UP + index = textureX + textureZ * variationSize; + } else if (side == 2 || side == 3) { + // NORTH || SOUTH + index = textureX + textureY * variationSize; + } else { + // WEST || EAST + index = textureZ + textureY * variationSize; + } - return variation.variations9.icons[index]; + return variation.variations9.icons[index]; case CTMX: return variation.icon; - case R16: - case R9: - case R4: + case R16: + case R9: + case R4: - int indexRan = x + y + z; - if ((side==2)||(side==5)) { - indexRan = -indexRan; - } - while (indexRan < 0) { - indexRan = indexRan+10000; - } + int indexRan = x + y + z; + if ((side == 2) || (side == 5)) { + indexRan = -indexRan; + } + while (indexRan < 0) { + indexRan = indexRan + 10000; + } - //rand.setSeed(indexRan); // Broken + // rand.setSeed(indexRan); // Broken - return variation.variations9.icons[ /*rand*/ indexRan % ((variation.kind == R9) ? 9 : 4)]; + return variation.variations9.icons[ /* rand */indexRan % ((variation.type == TextureType.R9) ? 9 : 4)]; } - - return GeneralClient.getMissingIcon(); } @@ -360,7 +585,7 @@ public class CarvableHelper { variation.iconBot = ((BlockPane) variation.block).getBlockTextureFromSide(0); } else { - switch (variation.kind) { + switch (variation.type) { case NORMAL: variation.icon = variation.block.getIcon(2, variation.blockMeta); break; @@ -376,7 +601,7 @@ public class CarvableHelper { } } } else { - switch (variation.kind) { + switch (variation.type) { case NORMAL: variation.icon = register.registerIcon(modName + ":" + variation.texture); break; @@ -415,15 +640,15 @@ public class CarvableHelper { variation.submap = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm"), 4, 4); variation.submapSmall = new TextureSubmap(variation.icon, 2, 2); break; - case R16: - variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r16"), 4, 4); - break; - case R9: - variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r9"), 3, 3); - break; - case R4: - variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r4"), 2, 2); - break; + case R16: + variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r16"), 4, 4); + break; + case R9: + variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r9"), 3, 3); + break; + case R4: + variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r4"), 2, 2); + break; } } } @@ -436,12 +661,7 @@ public class CarvableHelper { } public void setChiselBlockName(String name) { - blockName = name; - } - - public static Set getChiselBlockSet() { - HashSet tools = new HashSet(); - return tools; + blockName = name; } public void registerOre(String ore) { diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java index 65c5a06f..9d3254f4 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; import net.minecraft.util.IIcon; +import com.cricketcraft.chisel.carving.CarvableHelper.TextureType; import com.cricketcraft.chisel.client.render.TextureSubmap; public class CarvableVariation { @@ -11,7 +12,7 @@ public class CarvableVariation { public String blockName; public String descriptionUnloc; public int metadata; - public int kind; + public TextureType type = TextureType.NORMAL; public Block block; public int blockMeta; @@ -19,8 +20,8 @@ public class CarvableVariation { public String texture; public IIcon icon; - public IIcon iconTop; public IIcon iconBot; + public IIcon iconTop; public CarvableVariationCTM ctm; public TextureSubmap seamsCtmVert; diff --git a/src/main/java/com/cricketcraft/chisel/carving/ITextureVariation.java b/src/main/java/com/cricketcraft/chisel/carving/ITextureVariation.java new file mode 100644 index 00000000..78a25fdb --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/carving/ITextureVariation.java @@ -0,0 +1,6 @@ +package com.cricketcraft.chisel.carving; + + +public interface ITextureVariation { + +} diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java index 4eb8bbc8..4270ad76 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java @@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL11; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.ICarvable; import com.cricketcraft.chisel.carving.CarvableHelper; +import com.cricketcraft.chisel.carving.CarvableHelper.TextureType; import com.cricketcraft.chisel.carving.CarvableVariation; import com.cricketcraft.chisel.utils.Drawing; @@ -45,8 +46,8 @@ public class BlockAdvancedMarbleRenderer implements ISimpleBlockRenderingHandler return true; } - switch (var == null ? 0 : var.kind) { - case CarvableHelper.CTMX: + switch (var == null ? TextureType.NORMAL : var.type) { + case CTMX: rendererCTM.blockAccess = world; rendererCTM.renderMaxX = 1.0; rendererCTM.renderMaxY = 1.0; @@ -58,7 +59,7 @@ public class BlockAdvancedMarbleRenderer implements ISimpleBlockRenderingHandler rendererCTM.rendererOld = rendererOld; return rendererCTM.renderStandardBlock(block, x, y, z); - case CarvableHelper.CTMV: + case CTMV: rendererColumn.blockAccess = world; rendererColumn.renderMaxX = 1.0; rendererColumn.renderMaxY = 1.0; diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockCTMNoLightRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockCTMNoLightRenderer.java index 5426be51..f50eb46d 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/BlockCTMNoLightRenderer.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockCTMNoLightRenderer.java @@ -10,6 +10,7 @@ import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.ICarvable; import com.cricketcraft.chisel.carving.CarvableHelper; import com.cricketcraft.chisel.carving.CarvableVariation; +import com.cricketcraft.chisel.carving.CarvableHelper.TextureType; import com.cricketcraft.chisel.utils.Drawing; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; @@ -40,8 +41,7 @@ public class BlockCTMNoLightRenderer implements ISimpleBlockRenderingHandler { CarvableVariation var = ((ICarvable) block).getVariation(world, x, y, z, meta); - switch (var == null ? 0 : var.kind) { - case CarvableHelper.CTMX: + if (var != null && var.type == TextureType.CTMX) { rendererCTMNoLight.blockAccess = world; rendererCTMNoLight.renderMaxX = 1.0; rendererCTMNoLight.renderMaxY = 1.0; @@ -53,7 +53,7 @@ public class BlockCTMNoLightRenderer implements ISimpleBlockRenderingHandler { rendererCTMNoLight.rendererOld = rendererOld; return rendererCTMNoLight.renderStandardBlock(block, x, y, z); - default: + } else { return rendererOld.renderStandardBlock(block, x, y, z); } } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java index eb83808d..621a74c7 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java @@ -8,6 +8,7 @@ import org.lwjgl.opengl.GL11; import com.cricketcraft.chisel.block.BlockCarvablePillar; import com.cricketcraft.chisel.carving.CarvableHelper; +import com.cricketcraft.chisel.carving.CarvableHelper.TextureType; import com.cricketcraft.chisel.utils.Drawing; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; @@ -54,7 +55,7 @@ public class BlockMarblePillarRenderer implements ISimpleBlockRenderingHandler { metadata = block.carverHelper.variations.size() - 1; } else { - if (block.carverHelper.variations.get(metadata).kind != CarvableHelper.CTMV) { + if (block.carverHelper.variations.get(metadata).type != TextureType.CTMV) { block.sides[0] = block.carverHelper.getIcon(0, metadata); block.sides[1] = block.carverHelper.getIcon(1, metadata); block.sides[2] = block.carverHelper.getIcon(2, metadata); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index 4d7e72ff..005fabaa 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -5,8 +5,96 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; +import org.apache.commons.lang3.tuple.Triple; + +import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.Vert.*; +import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.SubSide.*; + public class RenderBlocksCTM extends RenderBlocks { + /** + * An enum for all possible 26 sub-side vertices. + *

+ * The naming scheme is as follows: + *

+ */ + enum Vert { + + ZERO(0, 0, 0), + ONE(1, 1, 1), + X(1, 0, 0), + Y(0, 1, 0), + Z(0, 0, 1), + XY(1, 1, 0), + YZ(0, 1, 1), + XZ(1, 0, 1), + X_HALF(0.5, 0, 0), + Y_HALF(0, 0.5, 0), + Z_HALF(0, 0, 0.5), + XY_HALF(0.5, 0.5, 0), + YZ_HALF(0, 0.5, 0.5), + XZ_HALF(0.5, 0, 0.5), + X_HALF_Y(0.5, 1, 0), + X_HALF_Z(0.5, 0, 1), + Y_HALF_X(1, 0.5, 0), + Y_HALF_Z(0, 0.5, 1), + Z_HALF_X(1, 0, 0.5), + Z_HALF_Y(0, 1, 0.5), + X_HALF_YZ(0.5, 1, 1), + Y_HALF_XZ(1, 0.5, 1), + Z_HALF_XY(1, 1, 0.5), + XY_HALF_Z(0.5, 0.5, 1), + YZ_HALF_X(1, 0.5, 0.5), + XZ_HALF_Y(0.5, 1, 0.5); + + private double x, y, z; + + private Vert(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + void render(RenderBlocksCTM inst, int cacheID) { + if (inst.enableAO) { + // inst.tessellator.setColorOpaque_F(inst.redCache[cacheID], inst.greenCache[cacheID], inst.blueCache[cacheID]); + inst.tessellator.setBrightness(inst.lightingCache[cacheID]); + } + + inst.tessellator.addVertexWithUV(x, y, z, inst.uCache[cacheID], inst.vCache[cacheID]); + } + } + + /** + * Each side is divided into 4 sub-sides. LB(left bottom), RB(right bottom), LT(right top), and RT(right top). + *

+ * Each sub-side contains 4 {@link Vert} objects representing its position on the block. + */ + enum SubSide { + XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y); + + private Vert xmin, xmax, ymin, ymax; + + SubSide(Vert xmin, Vert ymin, Vert ymax, Vert xmax) { + this.xmin = xmin; + this.ymin = ymin; + this.ymax = ymax; + this.xmax = xmax; + } + + void render(RenderBlocksCTM inst) { + xmin.render(inst, 0); + ymin.render(inst, 1); + ymax.render(inst, 2); + xmax.render(inst, 3); + } + } + // globals added to save the JVM some trouble. No need to constantly create // and destroy ints if we don't have to int blockLightBitChannel = 0; @@ -17,20 +105,15 @@ public class RenderBlocksCTM extends RenderBlocks { RenderBlocksCTM() { super(); - - resetVertices(); } Tessellator tessellator; - double[] X = new double[26]; - double[] Y = new double[26]; - double[] Z = new double[26]; - double[] U = new double[26]; - double[] V = new double[26]; - int[] L = new int[26]; - float[] R = new float[26]; - float[] G = new float[26]; - float[] B = new float[26]; + double[] uCache = new double[4]; + double[] vCache = new double[4]; + int[] lightingCache = new int[4]; + float[] redCache = new float[4]; + float[] greenCache = new float[4]; + float[] blueCache = new float[4]; TextureSubmap submap; TextureSubmap submapSmall; RenderBlocks rendererOld; @@ -55,66 +138,60 @@ public class RenderBlocksCTM extends RenderBlocks { return res; } - void setupSides(int a, int b, int c, int d, int xa, int xb, int xc, int xd, int e) { - L[a] = brightnessBottomLeft; - L[b] = brightnessBottomRight; - L[c] = brightnessTopRight; - L[d] = brightnessTopLeft; + void updateLighting() { + lightingCache[0] = brightnessBottomLeft; + lightingCache[1] = brightnessBottomRight; + lightingCache[2] = brightnessTopRight; + lightingCache[3] = brightnessTopLeft; - // Updated to safely average light and color channels - L[e] = averageBrightnessChannels(brightnessBottomLeft, brightnessTopLeft, brightnessTopRight, brightnessBottomRight); - L[xa] = averageBrightnessChannels(L[a], L[b]); - L[xb] = averageBrightnessChannels(L[b], L[c]); - L[xc] = averageBrightnessChannels(L[c], L[d]); - L[xd] = averageBrightnessChannels(L[d], L[a]); - - R[a] = colorRedBottomLeft; - R[b] = colorRedBottomRight; - R[c] = colorRedTopRight; - R[d] = colorRedTopLeft; - R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4; - R[xa] = (R[a] + R[b]) / 2; - R[xb] = (R[b] + R[c]) / 2; - R[xc] = (R[c] + R[d]) / 2; - R[xd] = (R[d] + R[a]) / 2; - - G[a] = colorGreenBottomLeft; - G[b] = colorGreenBottomRight; - G[c] = colorGreenTopRight; - G[d] = colorGreenTopLeft; - G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4; - G[xa] = (G[a] + G[b]) / 2; - G[xb] = (G[b] + G[c]) / 2; - G[xc] = (G[c] + G[d]) / 2; - G[xd] = (G[d] + G[a]) / 2; - - B[a] = colorBlueBottomLeft; - B[b] = colorBlueBottomRight; - B[c] = colorBlueTopRight; - B[d] = colorBlueTopLeft; - B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4; - B[xa] = (B[a] + B[b]) / 2; - B[xb] = (B[b] + B[c]) / 2; - B[xc] = (B[c] + B[d]) / 2; - B[xd] = (B[d] + B[a]) / 2; + // // Updated to safely average light and color channels + // L[e] = averageBrightnessChannels(brightnessBottomLeft, brightnessTopLeft, brightnessTopRight, brightnessBottomRight); + // L[xa] = averageBrightnessChannels(L[a], L[b]); + // L[xb] = averageBrightnessChannels(L[b], L[c]); + // L[xc] = averageBrightnessChannels(L[c], L[d]); + // L[xd] = averageBrightnessChannels(L[d], L[a]); + // + // Rcache[a] = colorRedBottomLeft; + // Rcache[b] = colorRedBottomRight; + // Rcache[c] = colorRedTopRight; + // Rcache[d] = colorRedTopLeft; + // Rcache[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4; + // Rcache[xa] = (Rcache[a] + Rcache[b]) / 2; + // Rcache[xb] = (Rcache[b] + Rcache[c]) / 2; + // Rcache[xc] = (Rcache[c] + Rcache[d]) / 2; + // Rcache[xd] = (Rcache[d] + Rcache[a]) / 2; + // + // Gcache[a] = colorGreenBottomLeft; + // Gcache[b] = colorGreenBottomRight; + // Gcache[c] = colorGreenTopRight; + // Gcache[d] = colorGreenTopLeft; + // Gcache[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4; + // Gcache[xa] = (Gcache[a] + Gcache[b]) / 2; + // Gcache[xb] = (Gcache[b] + Gcache[c]) / 2; + // Gcache[xc] = (Gcache[c] + Gcache[d]) / 2; + // Gcache[xd] = (Gcache[d] + Gcache[a]) / 2; + // + // Bcache[a] = colorBlueBottomLeft; + // Bcache[b] = colorBlueBottomRight; + // Bcache[c] = colorBlueTopRight; + // Bcache[d] = colorBlueTopLeft; + // Bcache[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4; + // Bcache[xa] = (Bcache[a] + Bcache[b]) / 2; + // Bcache[xb] = (Bcache[b] + Bcache[c]) / 2; + // Bcache[xc] = (Bcache[c] + Bcache[d]) / 2; + // Bcache[xd] = (Bcache[d] + Bcache[a]) / 2; } - /* - * Takes in a variable number of packed light-integers, and computes the - * average value of each 4 bit channel + /** + * Takes in a variable number of packed light-integers, and computes the average value of each 4 bit channel * - * For vanilla, these look like: (S = skylight and L = block light) 0000 - * 0000 SSSS 0000 0000 0000 LLLL 0000 With the Colored Light Core installed, - * these look like: (B = Blue, G = Green, R = Red) 0000 0000 SSSS BBBB GGGG - * RRRR LLLL 0000 + * For vanilla, these look like: (S = skylight and L = block light) 0000 0000 SSSS 0000 0000 0000 LLLL 0000 With the Colored Light Core installed, these look like: (B = Blue, G = Green, R = Red) + * 0000 0000 SSSS BBBB GGGG RRRR LLLL 0000 * - * This method will average all of the values appropriately for the more - * complex case, by separating each color channel into a running total, then - * it will combine the final results together using integer division and a - * lot of bit-cramming. + * This method will average all of the values appropriately for the more complex case, by separating each color channel into a running total, then it will combine the final results together using + * integer division and a lot of bit-cramming. * - * While slightly more complex, the runtime should not be drastically - * effected, and the averaging routine remains compatible with vanilla. + * While slightly more complex, the runtime should not be drastically effected, and the averaging routine remains compatible with vanilla. * * Authored: CptSpaceToaster - 12/19/2014 */ @@ -137,37 +214,25 @@ public class RenderBlocksCTM extends RenderBlocks { | ((blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000); } - void side(int a, int b, int c, int d, int iconIndex, boolean flip) { + void side(SubSide side, int iconIndex, boolean flip) { IIcon icon = iconIndex >= 16 ? submapSmall.icons[iconIndex - 16] : submap.icons[iconIndex]; - double u0 = icon.getMaxU(); - double u1 = icon.getMinU(); - double v0 = icon.getMaxV(); - double v1 = icon.getMinV(); + double umax = icon.getMaxU(); + double umin = icon.getMinU(); + double vmax = icon.getMaxV(); + double vmin = icon.getMinV(); - U[a] = flip ? u1 : u1; - U[b] = flip ? u0 : u1; - U[c] = flip ? u0 : u0; - U[d] = flip ? u1 : u0; + uCache[0] = flip ? umax : umin; + uCache[1] = umax; + uCache[2] = flip ? umin : umax; + uCache[3] = umin; - V[a] = flip ? v1 : v1; - V[b] = flip ? v1 : v0; - V[c] = flip ? v0 : v0; - V[d] = flip ? v0 : v1; + vCache[0] = flip ? vmin : vmax; + vCache[1] = vmax; + vCache[2] = flip ? vmax : vmin; + vCache[3] = vmin; - vert(a); - vert(b); - vert(c); - vert(d); - } - - void vert(int index) { - if (enableAO) { - tessellator.setColorOpaque_F(R[index], G[index], B[index]); - tessellator.setBrightness(L[index]); - } - - tessellator.addVertexWithUV(X[index], Y[index], Z[index], U[index], V[index]); + side.render(this); } @Override @@ -182,11 +247,11 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4); - setupSides(1, 0, 4, 5, 14, 19, 17, 23, 9); - side(1, 14, 9, 23, tex[0], false); - side(23, 9, 17, 5, tex[1], false); - side(9, 19, 4, 17, tex[3], false); - side(14, 0, 19, 9, tex[2], false); + updateLighting(); + side(XNEG_LB, tex[2], false); + side(XNEG_RB, tex[3], false); + side(XNEG_RT, tex[1], false); + side(XNEG_LT, tex[0], false); } } @@ -202,11 +267,11 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5); - setupSides(3, 2, 6, 7, 15, 25, 16, 21, 11); - side(11, 21, 3, 15, tex[3], false); - side(16, 7, 21, 11, tex[2], false); - side(25, 11, 15, 2, tex[1], false); - side(6, 16, 11, 25, tex[0], false); + updateLighting(); + // side(11, 21, 3, 15, tex[3], false); + // side(16, 7, 21, 11, tex[2], false); + // side(25, 11, 15, 2, tex[1], false); + // side(6, 16, 11, 25, tex[0], false); } } @@ -222,11 +287,11 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2); - setupSides(2, 3, 0, 1, 15, 18, 14, 22, 8); - side(2, 15, 8, 22, tex[0], false); - side(15, 3, 18, 8, tex[2], false); - side(8, 18, 0, 14, tex[3], false); - side(22, 8, 14, 1, tex[1], false); + updateLighting(); + // side(2, 15, 8, 22, tex[0], false); + // side(15, 3, 18, 8, tex[2], false); + // side(8, 18, 0, 14, tex[3], false); + // side(22, 8, 14, 1, tex[1], false); } } @@ -242,11 +307,11 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3); - setupSides(4, 7, 6, 5, 20, 16, 24, 17, 10); - side(17, 4, 20, 10, tex[2], false); - side(5, 17, 10, 24, tex[0], false); - side(24, 10, 16, 6, tex[1], false); - side(10, 20, 7, 16, tex[3], false); + updateLighting(); + // side(17, 4, 20, 10, tex[2], false); + // side(5, 17, 10, 24, tex[0], false); + // side(24, 10, 16, 6, tex[1], false); + // side(10, 20, 7, 16, tex[3], false); } } @@ -262,11 +327,11 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); - setupSides(0, 3, 7, 4, 18, 21, 20, 19, 13); - side(13, 21, 7, 20, tex[3], true); - side(19, 13, 20, 4, tex[2], true); - side(0, 18, 13, 19, tex[0], true); - side(18, 3, 21, 13, tex[1], true); + updateLighting(); + // side(13, 21, 7, 20, tex[3], true); + // side(19, 13, 20, 4, tex[2], true); + // side(0, 18, 13, 19, tex[0], true); + // side(18, 3, 21, 13, tex[1], true); } } @@ -282,117 +347,12 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1); - setupSides(2, 1, 5, 6, 22, 23, 24, 25, 12); - side(12, 24, 6, 25, tex[3], false); - side(22, 12, 25, 2, tex[1], false); - side(1, 23, 12, 22, tex[0], false); - side(23, 5, 24, 12, tex[2], false); + updateLighting(); + // side(12, 24, 6, 25, tex[3], false); + // side(22, 12, 25, 2, tex[1], false); + // side(1, 23, 12, 22, tex[0], false); + // side(23, 5, 24, 12, tex[2], false); } } - void resetVertices() { - X[0] = 0; - Z[0] = 0; - Y[0] = 0; - - X[1] = 0; - Z[1] = 0; - Y[1] = 1; - - X[2] = 1; - Z[2] = 0; - Y[2] = 1; - - X[3] = 1; - Z[3] = 0; - Y[3] = 0; - - X[4] = 0; - Z[4] = 1; - Y[4] = 0; - - X[5] = 0; - Z[5] = 1; - Y[5] = 1; - - X[6] = 1; - Z[6] = 1; - Y[6] = 1; - - X[7] = 1; - Z[7] = 1; - Y[7] = 0; - - X[8] = 0.5; - Z[8] = 0; - Y[8] = 0.5; - - X[9] = 0; - Z[9] = 0.5; - Y[9] = 0.5; - - X[10] = 0.5; - Z[10] = 1; - Y[10] = 0.5; - - X[11] = 1; - Z[11] = 0.5; - Y[11] = 0.5; - - X[12] = 0.5; - Z[12] = 0.5; - Y[12] = 1; - - X[13] = 0.5; - Z[13] = 0.5; - Y[13] = 0; - - X[14] = 0; - Z[14] = 0; - Y[14] = 0.5; - - X[15] = 1; - Z[15] = 0; - Y[15] = 0.5; - - X[16] = 1; - Z[16] = 1; - Y[16] = 0.5; - - X[17] = 0; - Z[17] = 1; - Y[17] = 0.5; - - X[18] = 0.5; - Z[18] = 0; - Y[18] = 0; - - X[19] = 0; - Z[19] = 0.5; - Y[19] = 0; - - X[20] = 0.5; - Z[20] = 1; - Y[20] = 0; - - X[21] = 1; - Z[21] = 0.5; - Y[21] = 0; - - X[22] = 0.5; - Z[22] = 0; - Y[22] = 1; - - X[23] = 0; - Z[23] = 0.5; - Y[23] = 1; - - X[24] = 0.5; - Z[24] = 1; - Y[24] = 1; - - X[25] = 1; - Z[25] = 0.5; - Y[25] = 1; - } } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMCarpet.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMCarpet.java index 4d226d3a..ebb6eda9 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMCarpet.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMCarpet.java @@ -9,15 +9,6 @@ public class RenderBlocksCTMCarpet extends RenderBlocksCTM { super(); } - @Override - void resetVertices() { - super.resetVertices(); - - for (int i = 0; i < Y.length; i++) { - Y[i] /= 16; - } - } - @Override public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { rendererOld.renderFaceXNeg(block, 0, 0, 0, submapSmall.icon); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/TextureSubmap.java b/src/main/java/com/cricketcraft/chisel/client/render/TextureSubmap.java index cb3e81b0..350b17fc 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/TextureSubmap.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/TextureSubmap.java @@ -29,5 +29,4 @@ public class TextureSubmap { } } } - } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/TextureVirtual.java b/src/main/java/com/cricketcraft/chisel/client/render/TextureVirtual.java index 15b81e5a..9cd28cb1 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/TextureVirtual.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/TextureVirtual.java @@ -6,59 +6,59 @@ import cpw.mods.fml.relauncher.SideOnly; public class TextureVirtual implements IIcon { - int ox, oy; - float u0, u1, v0, v1; - String name; - IIcon icon; + private int width, height; + private float umin, umax, vmin, vmax; + private String name; + private IIcon parentIcon; TextureVirtual(IIcon parent, int w, int h, int x, int y) { - icon = parent; + parentIcon = parent; - u0 = icon.getInterpolatedU(16.0 * (x) / w); - u1 = icon.getInterpolatedU(16.0 * (x + 1) / w); - v0 = icon.getInterpolatedV(16.0 * (y) / h); - v1 = icon.getInterpolatedV(16.0 * (y + 1) / h); + umin = parentIcon.getInterpolatedU(16.0 * (x) / w); + umax = parentIcon.getInterpolatedU(16.0 * (x + 1) / w); + vmin = parentIcon.getInterpolatedV(16.0 * (y) / h); + vmax = parentIcon.getInterpolatedV(16.0 * (y + 1) / h); - name = icon.getIconName() + "|" + x + "." + y; + name = parentIcon.getIconName() + "|" + x + "." + y; - ox = icon.getIconWidth(); - oy = icon.getIconHeight(); + width = parentIcon.getIconWidth(); + height = parentIcon.getIconHeight(); } @Override @SideOnly(Side.CLIENT) public float getMinU() { - return u0; + return umin; } @Override @SideOnly(Side.CLIENT) public float getMaxU() { - return u1; + return umax; } @Override @SideOnly(Side.CLIENT) public float getInterpolatedU(double d0) { - return (float) (u0 + (u1 - u0) * d0 / 16.0); + return (float) (umin + (umax - umin) * d0 / 16.0); } @Override @SideOnly(Side.CLIENT) public float getMinV() { - return v0; + return vmin; } @Override @SideOnly(Side.CLIENT) public float getMaxV() { - return v1; + return vmax; } @Override @SideOnly(Side.CLIENT) public float getInterpolatedV(double d0) { - return (float) (v0 + (v1 - v0) * d0 / 16.0); + return (float) (vmin + (vmax - vmin) * d0 / 16.0); } @Override @@ -70,13 +70,12 @@ public class TextureVirtual implements IIcon { @Override @SideOnly(Side.CLIENT) public int getIconWidth() { - return ox; + return width; } @Override @SideOnly(Side.CLIENT) public int getIconHeight() { - return oy; + return height; } - } From 46fe099fbfdff105dcf8b9bf18dd7b2ae07711e0 Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Fri, 20 Feb 2015 00:32:05 -0500 Subject: [PATCH 02/16] working on the CTM refactor --- build.gradle | 2 - .../chisel/client/render/RenderBlocksCTM.java | 170 ++++++++++-------- 2 files changed, 92 insertions(+), 80 deletions(-) diff --git a/build.gradle b/build.gradle index 9756c92b..391da333 100644 --- a/build.gradle +++ b/build.gradle @@ -165,5 +165,3 @@ curse { displayName = "Chisel 2 - ${mod_version}" additionalArtifact deobfJar, sourcesJar, apiJar } - -sourceSets { main { output.resourcesDir = output.classesDir } } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index 005fabaa..aa68563c 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -5,10 +5,9 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; -import org.apache.commons.lang3.tuple.Triple; - import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.Vert.*; import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.SubSide.*; +import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.Vert.Y_HALF_X; public class RenderBlocksCTM extends RenderBlocks { @@ -26,7 +25,7 @@ public class RenderBlocksCTM extends RenderBlocks { enum Vert { ZERO(0, 0, 0), - ONE(1, 1, 1), + XYZ(1, 1, 1), X(1, 0, 0), Y(0, 1, 0), Z(0, 0, 1), @@ -76,7 +75,13 @@ public class RenderBlocksCTM extends RenderBlocks { * Each sub-side contains 4 {@link Vert} objects representing its position on the block. */ enum SubSide { - XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y); + XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y), + XPOS_LB(XZ, Z_HALF_X, YZ_HALF_X, Y_HALF_XZ), XPOS_RB(Z_HALF_X, X, Y_HALF_X, YZ_HALF_X), XPOS_RT(YZ_HALF_X, Y_HALF_X, XY, Z_HALF_XY), XPOS_LT(Y_HALF_XZ, YZ_HALF_X, Z_HALF_XY, XYZ), + + ZNEG_LB(X, X_HALF, XY_HALF, Y_HALF_X), ZNEG_RB(X_HALF, ZERO, Y_HALF, XY_HALF), ZNEG_RT(XY_HALF, Y_HALF, Y, X_HALF_Y), ZNEG_LT(Y_HALF_X, XY_HALF, X_HALF_Y, XY), + ZPOS_LB(Z, X_HALF_Z, XY_HALF_Z, Y_HALF_Z), ZPOS_RB(X_HALF_Z, XZ, Y_HALF_XZ, XY_HALF_Z), ZPOS_RT(XY_HALF_Z, Y_HALF_XZ, XYZ, X_HALF_YZ), ZPOS_LT(Y_HALF_Z, XY_HALF_Z, X_HALF_YZ, YZ), + + YNEG_LB(ZERO, X_HALF, XZ_HALF, Z_HALF), YNEG_RB(X_HALF, X, Z_HALF_X, XZ_HALF), YNEG_RT(XZ_HALF, Z_HALF_X, XZ, X_HALF_Z), YNEG_LT(Z_HALF, XZ_HALF, X_HALF_Z, Z); private Vert xmin, xmax, ymin, ymax; @@ -118,6 +123,8 @@ public class RenderBlocksCTM extends RenderBlocks { TextureSubmap submapSmall; RenderBlocks rendererOld; + int[][] lightmap = new int[3][3]; + int bx, by, bz; @Override @@ -138,64 +145,51 @@ public class RenderBlocksCTM extends RenderBlocks { return res; } - void updateLighting() { - lightingCache[0] = brightnessBottomLeft; - lightingCache[1] = brightnessBottomRight; - lightingCache[2] = brightnessTopRight; - lightingCache[3] = brightnessTopLeft; - // // Updated to safely average light and color channels - // L[e] = averageBrightnessChannels(brightnessBottomLeft, brightnessTopLeft, brightnessTopRight, brightnessBottomRight); - // L[xa] = averageBrightnessChannels(L[a], L[b]); - // L[xb] = averageBrightnessChannels(L[b], L[c]); - // L[xc] = averageBrightnessChannels(L[c], L[d]); - // L[xd] = averageBrightnessChannels(L[d], L[a]); - // - // Rcache[a] = colorRedBottomLeft; - // Rcache[b] = colorRedBottomRight; - // Rcache[c] = colorRedTopRight; - // Rcache[d] = colorRedTopLeft; - // Rcache[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4; - // Rcache[xa] = (Rcache[a] + Rcache[b]) / 2; - // Rcache[xb] = (Rcache[b] + Rcache[c]) / 2; - // Rcache[xc] = (Rcache[c] + Rcache[d]) / 2; - // Rcache[xd] = (Rcache[d] + Rcache[a]) / 2; - // - // Gcache[a] = colorGreenBottomLeft; - // Gcache[b] = colorGreenBottomRight; - // Gcache[c] = colorGreenTopRight; - // Gcache[d] = colorGreenTopLeft; - // Gcache[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4; - // Gcache[xa] = (Gcache[a] + Gcache[b]) / 2; - // Gcache[xb] = (Gcache[b] + Gcache[c]) / 2; - // Gcache[xc] = (Gcache[c] + Gcache[d]) / 2; - // Gcache[xd] = (Gcache[d] + Gcache[a]) / 2; - // - // Bcache[a] = colorBlueBottomLeft; - // Bcache[b] = colorBlueBottomRight; - // Bcache[c] = colorBlueTopRight; - // Bcache[d] = colorBlueTopLeft; - // Bcache[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4; - // Bcache[xa] = (Bcache[a] + Bcache[b]) / 2; - // Bcache[xb] = (Bcache[b] + Bcache[c]) / 2; - // Bcache[xc] = (Bcache[c] + Bcache[d]) / 2; - // Bcache[xd] = (Bcache[d] + Bcache[a]) / 2; + /* This method fills a 3x3 grid of light values based on the four corners, by averaging them together. + * + * 2 TL x TR + * + * 1 x x x + * + * 0 BL x BR + * 0 1 2 + * + * Note: Variable names mean nothing... don't touch + * + * ._. + * + * shakes fist in anger + */ + void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) { + lightmap[0][0] = bottomRight; + lightmap[2][0] = topRight; + lightmap[2][2] = topLeft; + lightmap[0][2] = bottomLeft; + + lightmap[1][0] = avg(bottomRight, topRight); + lightmap[2][1] = avg(topRight, topLeft); + lightmap[1][2] = avg(topLeft, bottomLeft); + lightmap[0][1] = avg(bottomLeft, bottomRight); + + lightmap[1][1] = avg(bottomLeft, bottomRight, topRight, topLeft); + } + + void getLight(int x, int y) { + lightingCache[0] = lightmap[0+x][0+y]; + lightingCache[1] = lightmap[1+x][0+y]; + lightingCache[2] = lightmap[1+x][1+y]; + lightingCache[3] = lightmap[0+x][1+y]; + } + + void updateLighting() { + //nop } /** - * Takes in a variable number of packed light-integers, and computes the average value of each 4 bit channel - * - * For vanilla, these look like: (S = skylight and L = block light) 0000 0000 SSSS 0000 0000 0000 LLLL 0000 With the Colored Light Core installed, these look like: (B = Blue, G = Green, R = Red) - * 0000 0000 SSSS BBBB GGGG RRRR LLLL 0000 - * - * This method will average all of the values appropriately for the more complex case, by separating each color channel into a running total, then it will combine the final results together using - * integer division and a lot of bit-cramming. - * - * While slightly more complex, the runtime should not be drastically effected, and the averaging routine remains compatible with vanilla. - * - * Authored: CptSpaceToaster - 12/19/2014 + * This works around a bug in CLC atm */ - int averageBrightnessChannels(int... lightVals) { + int avg(int... lightVals) { blockLightBitChannel = 0; redBitChannel = 0; greenBitChannel = 0; @@ -247,10 +241,14 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4); - updateLighting(); + fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); + getLight(0, 0); side(XNEG_LB, tex[2], false); + getLight(1, 0); side(XNEG_RB, tex[3], false); + getLight(1, 1); side(XNEG_RT, tex[1], false); + getLight(0, 1); side(XNEG_LT, tex[0], false); } } @@ -267,11 +265,15 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5); - updateLighting(); - // side(11, 21, 3, 15, tex[3], false); - // side(16, 7, 21, 11, tex[2], false); - // side(25, 11, 15, 2, tex[1], false); - // side(6, 16, 11, 25, tex[0], false); + fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight); + getLight(0, 0); + side(XPOS_LB, tex[2], false); + getLight(1, 0); + side(XPOS_RB, tex[3], false); + getLight(1, 1); + side(XPOS_RT, tex[1], false); + getLight(0, 1); + side(XPOS_LT, tex[0], false); } } @@ -287,11 +289,15 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2); - updateLighting(); - // side(2, 15, 8, 22, tex[0], false); - // side(15, 3, 18, 8, tex[2], false); - // side(8, 18, 0, 14, tex[3], false); - // side(22, 8, 14, 1, tex[1], false); + fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); + getLight(0, 0); + side(ZNEG_LB, tex[2], false); + getLight(1, 0); + side(ZNEG_RB, tex[3], false); + getLight(1, 1); + side(ZNEG_RT, tex[1], false); + getLight(0, 1); + side(ZNEG_LT, tex[0], false); } } @@ -307,11 +313,15 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3); - updateLighting(); - // side(17, 4, 20, 10, tex[2], false); - // side(5, 17, 10, 24, tex[0], false); - // side(24, 10, 16, 6, tex[1], false); - // side(10, 20, 7, 16, tex[3], false); + fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight); + getLight(0, 0); + side(ZPOS_LB, tex[2], false); + getLight(1, 0); + side(ZPOS_RB, tex[3], false); + getLight(1, 1); + side(ZPOS_RT, tex[1], false); + getLight(0, 1); + side(ZPOS_LT, tex[0], false); } } @@ -327,11 +337,15 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); - updateLighting(); - // side(13, 21, 7, 20, tex[3], true); - // side(19, 13, 20, 4, tex[2], true); - // side(0, 18, 13, 19, tex[0], true); - // side(18, 3, 21, 13, tex[1], true); + fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); + getLight(0, 0); + side(YNEG_LB, tex[2], false); + getLight(1, 0); + side(YNEG_RB, tex[3], false); + getLight(1, 1); + side(YNEG_RT, tex[1], false); + getLight(0, 1); + side(YNEG_LT, tex[0], false); } } From 99dc2ffc6d7381a10bbc00c363844880201f3f24 Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Sat, 21 Feb 2015 01:20:53 -0500 Subject: [PATCH 03/16] all of the CTM faces at least render with proper lighting... bue some of the top faces don't notice that they should connect to neighboors --- .../chisel/client/render/CTM.java | 26 +++++++---- .../chisel/client/render/RenderBlocksCTM.java | 46 ++++++++++--------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java index fdf23d78..e5ec7bc6 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java @@ -30,11 +30,16 @@ public class CTM { int blockMetadata = world.getBlockMetadata(x, y, z); boolean b[] = new boolean[6]; - if (side <= 1) { + if (side == 0) { + b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); + b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); + b[2] = isConnected(world, x, y, z + 1, side, block, blockMetadata); + b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata); + } else if (side == 1) { b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[2] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata); + b[2] = isConnected(world, x, y, z - 1, side, block, blockMetadata); + b[3] = isConnected(world, x, y, z + 1, side, block, blockMetadata); } else if (side == 2) { b[0] = isConnected(world, x + 1, y, z, side, block, blockMetadata); b[1] = isConnected(world, x - 1, y, z, side, block, blockMetadata); @@ -88,11 +93,16 @@ public class CTM { texture = 34; boolean b2[] = new boolean[6]; - if (side <= 1) { - b2[0] = !isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); - b2[1] = !isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); - b2[2] = !isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); - b2[3] = !isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); + if (side == 0) { + b2[0] = !isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); + b2[1] = !isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); + b2[2] = !isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); + b2[3] = !isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); + } else if (side == 1) { + b2[0] = !isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); + b2[1] = !isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); + b2[2] = !isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); + b2[3] = !isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); } else if (side == 2) { b2[0] = !isConnected(world, x - 1, y - 1, z, side, block, blockMetadata); b2[1] = !isConnected(world, x + 1, y - 1, z, side, block, blockMetadata); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index aa68563c..fc1c03f9 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -81,8 +81,8 @@ public class RenderBlocksCTM extends RenderBlocks { ZNEG_LB(X, X_HALF, XY_HALF, Y_HALF_X), ZNEG_RB(X_HALF, ZERO, Y_HALF, XY_HALF), ZNEG_RT(XY_HALF, Y_HALF, Y, X_HALF_Y), ZNEG_LT(Y_HALF_X, XY_HALF, X_HALF_Y, XY), ZPOS_LB(Z, X_HALF_Z, XY_HALF_Z, Y_HALF_Z), ZPOS_RB(X_HALF_Z, XZ, Y_HALF_XZ, XY_HALF_Z), ZPOS_RT(XY_HALF_Z, Y_HALF_XZ, XYZ, X_HALF_YZ), ZPOS_LT(Y_HALF_Z, XY_HALF_Z, X_HALF_YZ, YZ), - YNEG_LB(ZERO, X_HALF, XZ_HALF, Z_HALF), YNEG_RB(X_HALF, X, Z_HALF_X, XZ_HALF), YNEG_RT(XZ_HALF, Z_HALF_X, XZ, X_HALF_Z), YNEG_LT(Z_HALF, XZ_HALF, X_HALF_Z, Z); - + YNEG_LB(ZERO, X_HALF, XZ_HALF, Z_HALF), YNEG_RB(X_HALF, X, Z_HALF_X, XZ_HALF), YNEG_RT(XZ_HALF, Z_HALF_X, XZ, X_HALF_Z), YNEG_LT(Z_HALF, XZ_HALF, X_HALF_Z, Z), + YPOS_LB(YZ, X_HALF_YZ, XZ_HALF_Y, Z_HALF_Y), YPOS_RB(X_HALF_YZ, XYZ, Z_HALF_XY, XZ_HALF_Y), YPOS_RT(XZ_HALF_Y, Z_HALF_XY, XY, X_HALF_Y), YPOS_LT(Z_HALF_Y, XZ_HALF_Y, X_HALF_Y, Y); private Vert xmin, xmax, ymin, ymax; SubSide(Vert xmin, Vert ymin, Vert ymax, Vert xmax) { @@ -162,15 +162,15 @@ public class RenderBlocksCTM extends RenderBlocks { * shakes fist in anger */ void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) { - lightmap[0][0] = bottomRight; - lightmap[2][0] = topRight; - lightmap[2][2] = topLeft; - lightmap[0][2] = bottomLeft; + lightmap[0][0] = bottomLeft; + lightmap[2][0] = bottomRight; + lightmap[2][2] = topRight; + lightmap[0][2] = topLeft; - lightmap[1][0] = avg(bottomRight, topRight); - lightmap[2][1] = avg(topRight, topLeft); - lightmap[1][2] = avg(topLeft, bottomLeft); - lightmap[0][1] = avg(bottomLeft, bottomRight); + lightmap[1][0] = avg(bottomLeft, bottomRight); + lightmap[2][1] = avg(bottomRight, topRight); + lightmap[1][2] = avg(topRight, topLeft); + lightmap[0][1] = avg(topLeft, bottomLeft); lightmap[1][1] = avg(bottomLeft, bottomRight, topRight, topLeft); } @@ -241,7 +241,7 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4); - fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); + fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); getLight(0, 0); side(XNEG_LB, tex[2], false); getLight(1, 0); @@ -265,7 +265,7 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5); - fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight); + fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight); getLight(0, 0); side(XPOS_LB, tex[2], false); getLight(1, 0); @@ -289,7 +289,7 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2); - fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); + fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); getLight(0, 0); side(ZNEG_LB, tex[2], false); getLight(1, 0); @@ -313,7 +313,7 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3); - fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight); + fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); getLight(0, 0); side(ZPOS_LB, tex[2], false); getLight(1, 0); @@ -335,7 +335,7 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV()); tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); + int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1); fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); getLight(0, 0); @@ -359,13 +359,17 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1); + int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); - updateLighting(); - // side(12, 24, 6, 25, tex[3], false); - // side(22, 12, 25, 2, tex[1], false); - // side(1, 23, 12, 22, tex[0], false); - // side(23, 5, 24, 12, tex[2], false); + fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight); + getLight(0, 0); + side(YPOS_LB, tex[2], false); + getLight(1, 0); + side(YPOS_RB, tex[3], false); + getLight(1, 1); + side(YPOS_RT, tex[1], false); + getLight(0, 1); + side(YPOS_LT, tex[0], false); } } From 6f74646869a6752470ba7b6e5bdfed2d324ae246 Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Sun, 1 Mar 2015 01:33:43 -0500 Subject: [PATCH 04/16] SUDOKU --- .../chisel/client/render/CTM.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java index e5ec7bc6..807a847b 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java @@ -5,6 +5,44 @@ import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; import com.cricketcraft.chisel.api.IFacade; +/** + * The CTM renderer will draw the block's FACE using by assembling 4 quadrants from the 5 available block + * textures. The normal Texture.png is the blocks "unconnected" texture, and is used when CTM is disabled or the block + * has nothing to connect to. This texture has all of the outside corner quadrants The texture-ctm.png contains the + * rest of the quadrants. + * + * ┌─────────────────┐ ┌────────────────────────────────┐ + * │ texture.png │ │ texture-ctm.png │ + * │ ╔══════╤══════╗ │ │ │ + * │ ║ │ ║ │ │ │ ║ │ ║ │ + * │ ║ 16 │ 17 ║ │ │ 0 │ 1 ║ 2 │ 3 ║ │ + * │ ╟──────┼──────╢ │ │ ──────┼───────╟──────┼──────╢ │ + * │ ║ │ ║ │ │ │ ║ │ ║ │ + * │ ║ 18 │ 19 ║ │ │ 4 │ 5 ║ 6 │ 7 ║ │ + * │ ╚══════╧══════╝ │ │ ══════╤═══════╝──────┼──────╚ │ + * └─────────────────┘ │ │ │ │ │ + * │ 8 │ 9 │ 10 │ 11 │ + * │ ──────┼───────┼──────┼────── │ + * │ │ │ │ │ + * │ 12 │ 13 │ 14 │ 15 │ + * │ ══════╧═══════╗ ╔ │ + * └────────────────────────────────┘ + * + * combining { 16, 9, 18, 13}, we can generate a connected texture! + * ╔══════╤═══════ + * ║ │ + * ║ 16 │ 9 + * ╟──────┼────── + * ║ │ + * ║ 18 │ 13 + * ╚══════╧═══════ + * + * HAVE FUN! + * -CptRageToaster- + * + * TODO: Everything + */ + public class CTM { From 5e2d9cef067cfa8f8e074a998e5099c93b10fad5 Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Sun, 1 Mar 2015 11:42:42 -0500 Subject: [PATCH 05/16] More sudoku... hopefully this is good enough documentation to move forward --- .../chisel/client/render/CTM.java | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java index 807a847b..d62feb9d 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java @@ -13,29 +13,43 @@ import com.cricketcraft.chisel.api.IFacade; * * ┌─────────────────┐ ┌────────────────────────────────┐ * │ texture.png │ │ texture-ctm.png │ - * │ ╔══════╤══════╗ │ │ │ - * │ ║ │ ║ │ │ │ ║ │ ║ │ - * │ ║ 16 │ 17 ║ │ │ 0 │ 1 ║ 2 │ 3 ║ │ - * │ ╟──────┼──────╢ │ │ ──────┼───────╟──────┼──────╢ │ - * │ ║ │ ║ │ │ │ ║ │ ║ │ - * │ ║ 18 │ 19 ║ │ │ 4 │ 5 ║ 6 │ 7 ║ │ - * │ ╚══════╧══════╝ │ │ ══════╤═══════╝──────┼──────╚ │ - * └─────────────────┘ │ │ │ │ │ - * │ 8 │ 9 │ 10 │ 11 │ - * │ ──────┼───────┼──────┼────── │ - * │ │ │ │ │ - * │ 12 │ 13 │ 14 │ 15 │ - * │ ══════╧═══════╗ ╔ │ + * │ ╔══════╤══════╗ │ │ ──────┼────── ║ ─────┼───── ║ │ + * │ ║ │ ║ │ │ │ │ │║ │ ║ │ + * │ ║ 16 │ 17 ║ │ │ │ 0 │ 1 │║ 2 │ 3 ║ │ + * │ ╟──────┼──────╢ │ │ ┼──────┼──────┼╟──────┼──────╢ │ + * │ ║ │ ║ │ │ │ │ │║ │ ║ │ + * │ ║ 18 │ 19 ║ │ │ │ 4 │ 5 │║ 6 │ 7 ║ │ + * │ ╚══════╧══════╝ │ │ ──────┼────── ║ ─────┼───── ║ │ + * └─────────────────┘ │ ═══════╤═══════╝ ─────┼───── ╚ │ + * │ │ │ ││ │ │ │ + * │ │ 8 │ 9 ││ 10 │ 11 │ │ + * │ ┼──────┼──────┼┼──────┼──────┼ │ + * │ │ │ ││ │ │ │ + * │ │ 12 │ 13 ││ 14 │ 15 │ │ + * │ ═══════╧═══════╗ ─────┼───── ╔ │ * └────────────────────────────────┘ * - * combining { 16, 9, 18, 13}, we can generate a connected texture! - * ╔══════╤═══════ - * ║ │ - * ║ 16 │ 9 - * ╟──────┼────── - * ║ │ - * ║ 18 │ 13 - * ╚══════╧═══════ + * combining { 16, 9, 18, 13}, we can generate a texture connected to the right! + * + * ╔══════╤═══════ + * ║ │ │ + * ║ 16 │ 9 │ + * ╟──────┼──────┼ + * ║ │ │ + * ║ 18 │ 13 │ + * ╚══════╧═══════ + * + * + * combining { 2, 11, 18, 13}, we can generate a texture, in the shape of an L (connected to the right, and up + * + * ║ ─────┼───── ╚ + * ║ │ │ + * ║ 2 │ 11 │ + * ╟──────┼──────┼ + * ║ │ │ + * ║ 18 │ 13 │ + * ╚══════╧═══════ + * * * HAVE FUN! * -CptRageToaster- From 8a329cd3f0807f412abe18f404833950b549c082 Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Sun, 1 Mar 2015 12:44:09 -0500 Subject: [PATCH 06/16] And there it goes --- .../chisel/client/render/CTM.java | 231 +++++++----------- 1 file changed, 89 insertions(+), 142 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java index d62feb9d..dfc3ac30 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java @@ -29,7 +29,7 @@ import com.cricketcraft.chisel.api.IFacade; * │ ═══════╧═══════╗ ─────┼───── ╔ │ * └────────────────────────────────┘ * - * combining { 16, 9, 18, 13}, we can generate a texture connected to the right! + * combining { 18, 13, 9, 16 }, we can generate a texture connected to the right! * * ╔══════╤═══════ * ║ │ │ @@ -40,7 +40,7 @@ import com.cricketcraft.chisel.api.IFacade; * ╚══════╧═══════ * * - * combining { 2, 11, 18, 13}, we can generate a texture, in the shape of an L (connected to the right, and up + * combining { 18, 13, 11, 2 }, we can generate a texture, in the shape of an L (connected to the right, and up * * ║ ─────┼───── ╚ * ║ │ │ @@ -60,12 +60,74 @@ import com.cricketcraft.chisel.api.IFacade; public class CTM { - static int submaps[][] = { { 16, 17, 18, 19 }, { 16, 9, 18, 13 }, { 8, 9, 12, 13 }, { 8, 17, 12, 19 }, { 16, 9, 6, 15 }, { 8, 17, 14, 7 }, { 2, 11, 6, 15 }, { 8, 9, 14, 15 }, { 10, 1, 14, 15 }, - { 10, 11, 14, 5 }, { 0, 11, 4, 15 }, { 0, 1, 14, 15 }, {}, {}, {}, {}, { 16, 17, 6, 7 }, { 16, 9, 6, 5 }, { 8, 9, 4, 5 }, { 8, 17, 4, 7 }, { 2, 11, 18, 13 }, { 10, 3, 12, 19 }, - { 10, 11, 12, 13 }, { 10, 3, 14, 7 }, { 0, 11, 14, 15 }, { 10, 11, 4, 15 }, { 10, 11, 4, 5 }, { 10, 1, 14, 5 }, {}, {}, {}, {}, { 2, 3, 6, 7 }, { 2, 1, 6, 5 }, { 0, 1, 4, 5 }, - { 0, 3, 4, 7 }, { 2, 11, 6, 5 }, { 8, 9, 4, 15 }, { 2, 1, 6, 15 }, { 8, 9, 14, 5 }, { 0, 1, 4, 15 }, { 0, 1, 14, 5 }, { 10, 1, 4, 15 }, { 0, 11, 14, 5 }, {}, {}, {}, {}, { 2, 3, 18, 19 }, - { 2, 1, 18, 13 }, { 0, 1, 12, 13 }, { 0, 3, 12, 19 }, { 10, 1, 12, 13 }, { 0, 3, 14, 7 }, { 0, 11, 12, 13 }, { 10, 3, 4, 7 }, { 0, 11, 4, 5 }, { 10, 1, 4, 5 }, { 10, 11, 14, 15 }, - { 0, 1, 4, 5 }, {}, {}, {}, {}, }; + /** + * The quads are ordered the same here, and in the renderer: + * 1. Lower left + * 2. Lower Right + * 3. Top Right + * 4. Top Left + */ + static int submaps[][] = { + { 18, 19, 17, 16 }, // 0 - No connection, with border + + { 18, 19, 3, 2 }, // 1 - Connected from above + { 18, 13, 9, 16 }, // 2 - Connected to the right + { 6, 7, 17, 16 }, // 3 - Connected from below + { 12, 19, 17, 8 }, // 4 - Connected to the left + + { 6, 7, 3, 2 }, // 5 - ║ + { 12, 13, 9, 8 }, // 6 - ═ + { 18, 13, 11, 2 }, // 7 - ╚ with inside corner + { 6, 15, 3, 16 }, // 8 - ╔ with inside corner + { 14, 7, 17, 8 }, // 9 - ╗ with inside corner + { 12, 19, 3, 10 }, // 10 - ╝ with inside corner + + { 18, 13, 1, 2 }, // 11 - ╚ no inside corner + { 6, 5, 3, 16 }, // 12 - ╔ no inside corner + { 4, 7, 17, 8 }, // 13 - ╗ no inside corner + { 12, 19, 3, 0 }, // 14 - ╝ no inside corner + + { 6, 15, 11, 2 }, // 15 - ╠ with inside corners + { 14, 15, 9, 8 }, // 16 - ╦ with inside corners + { 14, 7, 3, 10 }, // 17 - ╣ with inside corners + { 12, 13, 11, 10 }, // 18 - ╩ with inside corners + + { 6, 5, 11, 2 }, // 23 - ╠ with top right inside corner + { 4, 15, 9, 8 }, // 24 - ╦ with bottom right inside corner + { 14, 7, 3, 0 }, // 25 - ╣ with bottom left inside corner + { 12, 13, 1, 10 }, // 26 - ╩ with top left inside corner + + { 6, 15, 1, 2 }, // 19 - ╠ with bottom right inside corner + { 14, 5, 9, 8 }, // 20 - ╦ with bottom left inside corner + { 4, 7, 3, 10 }, // 21 - ╣ with top left inside corner + { 12, 13, 11, 0 }, // 22 - ╩ with top right inside corner + + { 6, 5, 1, 2 }, // 27 - ╠ no inside corners + { 4, 5, 9, 8 }, // 28 - ╦ no inside corners + { 4, 7, 3, 0 }, // 29 - ╣ no inside corners + { 12, 13, 1, 0 }, // 30 - ╩ no inside corners + + { 14, 15, 11, 10 }, // 31 - ╬, with all inside corners + + { 14, 5, 11, 10 }, // 32 - ╬, with all but bottom right inside corner + { 4, 15, 11, 10 }, // 33 - ╬, with all but bottom left inside corner + { 14, 15, 11, 0 }, // 34 - ╬, with all but top left inside corner + { 14, 15, 1, 10 }, // 35 - ╬, with all but top right inside corner + + { 4, 5, 11, 10 }, // 36 - ╬, with top inside corners + { 4, 15, 11, 0 }, // 37 - ╬, with right inside corners + { 14, 15, 1, 0 }, // 38 - ╬, with right inside corners + { 14, 5, 1, 10 }, // 39 - ╬, with left inside corners + { 4, 15, 1, 10 }, // 40 - ╬, with top left and bottom right inside corners + { 14, 5, 11, 0 }, // 41 - ╬, with top right and bottom left inside corners + + { 4, 5, 1, 10 }, // 42 - ╬, with top left inside corner + { 4, 5, 11, 0 }, // 43 - ╬, with top right inside corner + { 4, 15, 1, 0 }, // 44 - ╬, with bottom right inside corner + { 14, 5, 1, 0 }, // 45 - ╬, with bottom left inside corner + + { 4, 5, 1, 0 }, // 46 - ╬, no inside corners + }; public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { int index = getTexture(world, x, y, z, side); @@ -81,172 +143,58 @@ public class CTM { Block block = world.getBlock(x, y, z); int blockMetadata = world.getBlockMetadata(x, y, z); - boolean b[] = new boolean[6]; + boolean b[] = new boolean[8]; + /** + * b[0] b[1] b[2] + * + * + * + * b[3] FACE b[4] + * + * + * + * b[5] b[6] b[7] + */ if (side == 0) { + //TODO: b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); b[2] = isConnected(world, x, y, z + 1, side, block, blockMetadata); b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata); } else if (side == 1) { + //TODO: b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); b[2] = isConnected(world, x, y, z - 1, side, block, blockMetadata); b[3] = isConnected(world, x, y, z + 1, side, block, blockMetadata); } else if (side == 2) { + //TODO: b[0] = isConnected(world, x + 1, y, z, side, block, blockMetadata); b[1] = isConnected(world, x - 1, y, z, side, block, blockMetadata); b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); } else if (side == 3) { + //TODO: b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); } else if (side == 4) { + //TODO: b[0] = isConnected(world, x, y, z - 1, side, block, blockMetadata); b[1] = isConnected(world, x, y, z + 1, side, block, blockMetadata); b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); } else if (side == 5) { + //TODO: b[0] = isConnected(world, x, y, z + 1, side, block, blockMetadata); b[1] = isConnected(world, x, y, z - 1, side, block, blockMetadata); b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); } - if (b[0] & !b[1] & !b[2] & !b[3]) - texture = 3; - else if (!b[0] & b[1] & !b[2] & !b[3]) - texture = 1; - else if (!b[0] & !b[1] & b[2] & !b[3]) - texture = 16; - else if (!b[0] & !b[1] & !b[2] & b[3]) - texture = 48; - else if (b[0] & b[1] & !b[2] & !b[3]) - texture = 2; - else if (!b[0] & !b[1] & b[2] & b[3]) - texture = 32; - else if (b[0] & !b[1] & b[2] & !b[3]) - texture = 19; - else if (b[0] & !b[1] & !b[2] & b[3]) - texture = 51; - else if (!b[0] & b[1] & b[2] & !b[3]) - texture = 17; - else if (!b[0] & b[1] & !b[2] & b[3]) - texture = 49; - else if (!b[0] & b[1] & b[2] & b[3]) - texture = 33; - else if (b[0] & !b[1] & b[2] & b[3]) - texture = 35; - else if (b[0] & b[1] & !b[2] & b[3]) - texture = 50; - else if (b[0] & b[1] & b[2] & !b[3]) - texture = 18; - else if (b[0] & b[1] & b[2] & b[3]) - texture = 34; - boolean b2[] = new boolean[6]; - if (side == 0) { - b2[0] = !isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); - b2[1] = !isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); - b2[2] = !isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); - b2[3] = !isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); - } else if (side == 1) { - b2[0] = !isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); - b2[1] = !isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); - b2[2] = !isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); - b2[3] = !isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); - } else if (side == 2) { - b2[0] = !isConnected(world, x - 1, y - 1, z, side, block, blockMetadata); - b2[1] = !isConnected(world, x + 1, y - 1, z, side, block, blockMetadata); - b2[2] = !isConnected(world, x - 1, y + 1, z, side, block, blockMetadata); - b2[3] = !isConnected(world, x + 1, y + 1, z, side, block, blockMetadata); - } else if (side == 3) { - b2[0] = !isConnected(world, x + 1, y - 1, z, side, block, blockMetadata); - b2[1] = !isConnected(world, x - 1, y - 1, z, side, block, blockMetadata); - b2[2] = !isConnected(world, x + 1, y + 1, z, side, block, blockMetadata); - b2[3] = !isConnected(world, x - 1, y + 1, z, side, block, blockMetadata); - } else if (side == 4) { - b2[0] = !isConnected(world, x, y - 1, z + 1, side, block, blockMetadata); - b2[1] = !isConnected(world, x, y - 1, z - 1, side, block, blockMetadata); - b2[2] = !isConnected(world, x, y + 1, z + 1, side, block, blockMetadata); - b2[3] = !isConnected(world, x, y + 1, z - 1, side, block, blockMetadata); - } else if (side == 5) { - b2[0] = !isConnected(world, x, y - 1, z - 1, side, block, blockMetadata); - b2[1] = !isConnected(world, x, y - 1, z + 1, side, block, blockMetadata); - b2[2] = !isConnected(world, x, y + 1, z - 1, side, block, blockMetadata); - b2[3] = !isConnected(world, x, y + 1, z + 1, side, block, blockMetadata); - } + //TODO: return something other than zero - if (texture == 17 && b2[0]) - texture = 4; - if (texture == 19 && b2[1]) - texture = 5; - if (texture == 49 && b2[2]) - texture = 20; - if (texture == 51 && b2[3]) - texture = 21; - - if (texture == 18 && b2[0] && b2[1]) - texture = 7; - if (texture == 33 && b2[0] && b2[2]) - texture = 6; - if (texture == 35 && b2[3] && b2[1]) - texture = 23; - if (texture == 50 && b2[3] && b2[2]) - texture = 22; - - if (texture == 18 && !b2[0] && b2[1]) - texture = 39; - if (texture == 33 && b2[0] && !b2[2]) - texture = 38; - if (texture == 35 && !b2[3] && b2[1]) - texture = 53; - if (texture == 50 && b2[3] && !b2[2]) - texture = 52; - - if (texture == 18 && b2[0] && !b2[1]) - texture = 37; - if (texture == 33 && !b2[0] && b2[2]) - texture = 36; - if (texture == 35 && b2[3] && !b2[1]) - texture = 55; - if (texture == 50 && !b2[3] && b2[2]) - texture = 54; - - if (texture == 34 && b2[0] && b2[1] && b2[2] && b2[3]) - texture = 58; - - if (texture == 34 && !b2[0] && b2[1] && b2[2] && b2[3]) - texture = 9; - if (texture == 34 && b2[0] && !b2[1] && b2[2] && b2[3]) - texture = 25; - if (texture == 34 && b2[0] && b2[1] && !b2[2] && b2[3]) - texture = 8; - if (texture == 34 && b2[0] && b2[1] && b2[2] && !b2[3]) - texture = 24; - - if (texture == 34 && b2[0] && b2[1] && !b2[2] && !b2[3]) - texture = 11; - if (texture == 34 && !b2[0] && !b2[1] && b2[2] && b2[3]) - texture = 26; - if (texture == 34 && !b2[0] && b2[1] && !b2[2] && b2[3]) - texture = 27; - if (texture == 34 && b2[0] && !b2[1] && b2[2] && !b2[3]) - texture = 10; - - if (texture == 34 && b2[0] && !b2[1] && !b2[2] && b2[3]) - texture = 42; - if (texture == 34 && !b2[0] && b2[1] && b2[2] && !b2[3]) - texture = 43; - - if (texture == 34 && b2[0] && !b2[1] && !b2[2] && !b2[3]) - texture = 40; - if (texture == 34 && !b2[0] && b2[1] && !b2[2] && !b2[3]) - texture = 41; - if (texture == 34 && !b2[0] && !b2[1] && b2[2] && !b2[3]) - texture = 56; - if (texture == 34 && !b2[0] && !b2[1] && !b2[2] && b2[3]) - texture = 57; return texture; } @@ -294,5 +242,4 @@ public class CTM { } return blk; } - } From 4c6e799acd0f4a036ce50e3f5d670e60df0d040d Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Sun, 1 Mar 2015 12:52:10 -0500 Subject: [PATCH 07/16] prepared CTM-Renderer for upcoming changes' --- .../chisel/client/render/RenderBlocksCTM.java | 77 +++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index fc1c03f9..7c1d223e 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -13,14 +13,14 @@ public class RenderBlocksCTM extends RenderBlocks { /** * An enum for all possible 26 sub-side vertices. - *

+ * * The naming scheme is as follows: - *

+ * + * ZERO and ONE are special cases, they are the absolute min and absolute max of the block. + * X, Y, Z, or any combination means that the axes listed in the name are at 1. + * X, Y, Z, or any combination followed by HALF means that those axes are at 0.5. + * X, Y, Z, or any combination after a HALF means those axes are at 1. + * */ enum Vert { @@ -61,6 +61,7 @@ public class RenderBlocksCTM extends RenderBlocks { void render(RenderBlocksCTM inst, int cacheID) { if (inst.enableAO) { + // TODO: Get this back in // inst.tessellator.setColorOpaque_F(inst.redCache[cacheID], inst.greenCache[cacheID], inst.blueCache[cacheID]); inst.tessellator.setBrightness(inst.lightingCache[cacheID]); } @@ -182,10 +183,6 @@ public class RenderBlocksCTM extends RenderBlocks { lightingCache[3] = lightmap[0+x][1+y]; } - void updateLighting() { - //nop - } - /** * This works around a bug in CLC atm */ @@ -208,7 +205,7 @@ public class RenderBlocksCTM extends RenderBlocks { | ((blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000); } - void side(SubSide side, int iconIndex, boolean flip) { + void side(SubSide side, int iconIndex) { IIcon icon = iconIndex >= 16 ? submapSmall.icons[iconIndex - 16] : submap.icons[iconIndex]; double umax = icon.getMaxU(); @@ -216,14 +213,14 @@ public class RenderBlocksCTM extends RenderBlocks { double vmax = icon.getMaxV(); double vmin = icon.getMinV(); - uCache[0] = flip ? umax : umin; + uCache[0] = umin; uCache[1] = umax; - uCache[2] = flip ? umin : umax; + uCache[2] = umax; uCache[3] = umin; - vCache[0] = flip ? vmin : vmax; + vCache[0] = vmax; vCache[1] = vmax; - vCache[2] = flip ? vmax : vmin; + vCache[2] = vmin; vCache[3] = vmin; side.render(this); @@ -243,13 +240,13 @@ public class RenderBlocksCTM extends RenderBlocks { fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); getLight(0, 0); - side(XNEG_LB, tex[2], false); + side(XNEG_LB, tex[0]); getLight(1, 0); - side(XNEG_RB, tex[3], false); + side(XNEG_RB, tex[1]); getLight(1, 1); - side(XNEG_RT, tex[1], false); + side(XNEG_RT, tex[2]); getLight(0, 1); - side(XNEG_LT, tex[0], false); + side(XNEG_LT, tex[3]); } } @@ -267,13 +264,13 @@ public class RenderBlocksCTM extends RenderBlocks { fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight); getLight(0, 0); - side(XPOS_LB, tex[2], false); + side(XPOS_LB, tex[0]); getLight(1, 0); - side(XPOS_RB, tex[3], false); + side(XPOS_RB, tex[1]); getLight(1, 1); - side(XPOS_RT, tex[1], false); + side(XPOS_RT, tex[2]); getLight(0, 1); - side(XPOS_LT, tex[0], false); + side(XPOS_LT, tex[3]); } } @@ -291,13 +288,13 @@ public class RenderBlocksCTM extends RenderBlocks { fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); getLight(0, 0); - side(ZNEG_LB, tex[2], false); + side(ZNEG_LB, tex[0]); getLight(1, 0); - side(ZNEG_RB, tex[3], false); + side(ZNEG_RB, tex[1]); getLight(1, 1); - side(ZNEG_RT, tex[1], false); + side(ZNEG_RT, tex[2]); getLight(0, 1); - side(ZNEG_LT, tex[0], false); + side(ZNEG_LT, tex[3]); } } @@ -315,13 +312,13 @@ public class RenderBlocksCTM extends RenderBlocks { fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); getLight(0, 0); - side(ZPOS_LB, tex[2], false); + side(ZPOS_LB, tex[0]); getLight(1, 0); - side(ZPOS_RB, tex[3], false); + side(ZPOS_RB, tex[1]); getLight(1, 1); - side(ZPOS_RT, tex[1], false); + side(ZPOS_RT, tex[2]); getLight(0, 1); - side(ZPOS_LT, tex[0], false); + side(ZPOS_LT, tex[3]); } } @@ -339,13 +336,13 @@ public class RenderBlocksCTM extends RenderBlocks { fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); getLight(0, 0); - side(YNEG_LB, tex[2], false); + side(YNEG_LB, tex[0]); getLight(1, 0); - side(YNEG_RB, tex[3], false); + side(YNEG_RB, tex[1]); getLight(1, 1); - side(YNEG_RT, tex[1], false); + side(YNEG_RT, tex[2]); getLight(0, 1); - side(YNEG_LT, tex[0], false); + side(YNEG_LT, tex[3]); } } @@ -363,13 +360,13 @@ public class RenderBlocksCTM extends RenderBlocks { fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight); getLight(0, 0); - side(YPOS_LB, tex[2], false); + side(YPOS_LB, tex[0]); getLight(1, 0); - side(YPOS_RB, tex[3], false); + side(YPOS_RB, tex[1]); getLight(1, 1); - side(YPOS_RT, tex[1], false); + side(YPOS_RT, tex[2]); getLight(0, 1); - side(YPOS_LT, tex[0], false); + side(YPOS_LT, tex[3]); } } From 03b48c0e94a56d8eef824f2e81fce44dfa56de9e Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Wed, 4 Mar 2015 00:27:19 -0500 Subject: [PATCH 08/16] This should be all of the changes I made AFTER I ran the bogus merge, clearying out tterag's work --- .../chisel/client/render/CTM.java | 298 ++++++++---------- .../chisel/client/render/RenderBlocksCTM.java | 270 +++++++++------- .../chisel/config/Configurations.java | 50 +-- 3 files changed, 316 insertions(+), 302 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java index dfc3ac30..e0f3f763 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java @@ -1,201 +1,165 @@ package com.cricketcraft.chisel.client.render; +import com.cricketcraft.chisel.config.Configurations; import net.minecraft.block.Block; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; import com.cricketcraft.chisel.api.IFacade; + /** * The CTM renderer will draw the block's FACE using by assembling 4 quadrants from the 5 available block * textures. The normal Texture.png is the blocks "unconnected" texture, and is used when CTM is disabled or the block * has nothing to connect to. This texture has all of the outside corner quadrants The texture-ctm.png contains the * rest of the quadrants. * - * ┌─────────────────┐ ┌────────────────────────────────┐ - * │ texture.png │ │ texture-ctm.png │ - * │ ╔══════╤══════╗ │ │ ──────┼────── ║ ─────┼───── ║ │ - * │ ║ │ ║ │ │ │ │ │║ │ ║ │ - * │ ║ 16 │ 17 ║ │ │ │ 0 │ 1 │║ 2 │ 3 ║ │ - * │ ╟──────┼──────╢ │ │ ┼──────┼──────┼╟──────┼──────╢ │ - * │ ║ │ ║ │ │ │ │ │║ │ ║ │ - * │ ║ 18 │ 19 ║ │ │ │ 4 │ 5 │║ 6 │ 7 ║ │ - * │ ╚══════╧══════╝ │ │ ──────┼────── ║ ─────┼───── ║ │ - * └─────────────────┘ │ ═══════╤═══════╝ ─────┼───── ╚ │ - * │ │ │ ││ │ │ │ - * │ │ 8 │ 9 ││ 10 │ 11 │ │ - * │ ┼──────┼──────┼┼──────┼──────┼ │ - * │ │ │ ││ │ │ │ - * │ │ 12 │ 13 ││ 14 │ 15 │ │ - * │ ═══════╧═══════╗ ─────┼───── ╔ │ - * └────────────────────────────────┘ + * ┌─────────────────┐ ┌────────────────────────────────┐ + * │ texture.png │ │ texture-ctm.png │ + * │ ╔══════╤══════╗ │ │ ──────┼────── ║ ─────┼───── ║ │ + * │ ║ │ ║ │ │ │ │ │║ │ ║ │ + * │ ║ 16 │ 17 ║ │ │ │ 0 │ 1 │║ 2 │ 3 ║ │ + * │ ╟──────┼──────╢ │ │ ┼──────┼──────┼╟──────┼──────╢ │ + * │ ║ │ ║ │ │ │ │ │║ │ ║ │ + * │ ║ 18 │ 19 ║ │ │ │ 4 │ 5 │║ 6 │ 7 ║ │ + * │ ╚══════╧══════╝ │ │ ──────┼────── ║ ─────┼───── ║ │ + * └─────────────────┘ │ ═══════╤═══════╝ ─────┼───── ╚ │ + * │ │ │ ││ │ │ │ + * │ │ 8 │ 9 ││ 10 │ 11 │ │ + * │ ┼──────┼──────┼┼──────┼──────┼ │ + * │ │ │ ││ │ │ │ + * │ │ 12 │ 13 ││ 14 │ 15 │ │ + * │ ═══════╧═══════╗ ─────┼───── ╔ │ + * └────────────────────────────────┘ * * combining { 18, 13, 9, 16 }, we can generate a texture connected to the right! * - * ╔══════╤═══════ - * ║ │ │ - * ║ 16 │ 9 │ - * ╟──────┼──────┼ - * ║ │ │ - * ║ 18 │ 13 │ - * ╚══════╧═══════ + * ╔══════╤═══════ + * ║ │ │ + * ║ 16 │ 9 │ + * ╟──────┼──────┼ + * ║ │ │ + * ║ 18 │ 13 │ + * ╚══════╧═══════ * * * combining { 18, 13, 11, 2 }, we can generate a texture, in the shape of an L (connected to the right, and up * - * ║ ─────┼───── ╚ - * ║ │ │ - * ║ 2 │ 11 │ - * ╟──────┼──────┼ - * ║ │ │ - * ║ 18 │ 13 │ - * ╚══════╧═══════ + * ║ ─────┼───── ╚ + * ║ │ │ + * ║ 2 │ 11 │ + * ╟──────┼──────┼ + * ║ │ │ + * ║ 18 │ 13 │ + * ╚══════╧═══════ * * * HAVE FUN! * -CptRageToaster- - * - * TODO: Everything */ - public class CTM { - - /** - * The quads are ordered the same here, and in the renderer: - * 1. Lower left - * 2. Lower Right - * 3. Top Right - * 4. Top Left - */ - static int submaps[][] = { - { 18, 19, 17, 16 }, // 0 - No connection, with border - - { 18, 19, 3, 2 }, // 1 - Connected from above - { 18, 13, 9, 16 }, // 2 - Connected to the right - { 6, 7, 17, 16 }, // 3 - Connected from below - { 12, 19, 17, 8 }, // 4 - Connected to the left - - { 6, 7, 3, 2 }, // 5 - ║ - { 12, 13, 9, 8 }, // 6 - ═ - { 18, 13, 11, 2 }, // 7 - ╚ with inside corner - { 6, 15, 3, 16 }, // 8 - ╔ with inside corner - { 14, 7, 17, 8 }, // 9 - ╗ with inside corner - { 12, 19, 3, 10 }, // 10 - ╝ with inside corner - - { 18, 13, 1, 2 }, // 11 - ╚ no inside corner - { 6, 5, 3, 16 }, // 12 - ╔ no inside corner - { 4, 7, 17, 8 }, // 13 - ╗ no inside corner - { 12, 19, 3, 0 }, // 14 - ╝ no inside corner - - { 6, 15, 11, 2 }, // 15 - ╠ with inside corners - { 14, 15, 9, 8 }, // 16 - ╦ with inside corners - { 14, 7, 3, 10 }, // 17 - ╣ with inside corners - { 12, 13, 11, 10 }, // 18 - ╩ with inside corners - - { 6, 5, 11, 2 }, // 23 - ╠ with top right inside corner - { 4, 15, 9, 8 }, // 24 - ╦ with bottom right inside corner - { 14, 7, 3, 0 }, // 25 - ╣ with bottom left inside corner - { 12, 13, 1, 10 }, // 26 - ╩ with top left inside corner - - { 6, 15, 1, 2 }, // 19 - ╠ with bottom right inside corner - { 14, 5, 9, 8 }, // 20 - ╦ with bottom left inside corner - { 4, 7, 3, 10 }, // 21 - ╣ with top left inside corner - { 12, 13, 11, 0 }, // 22 - ╩ with top right inside corner - - { 6, 5, 1, 2 }, // 27 - ╠ no inside corners - { 4, 5, 9, 8 }, // 28 - ╦ no inside corners - { 4, 7, 3, 0 }, // 29 - ╣ no inside corners - { 12, 13, 1, 0 }, // 30 - ╩ no inside corners - - { 14, 15, 11, 10 }, // 31 - ╬, with all inside corners - - { 14, 5, 11, 10 }, // 32 - ╬, with all but bottom right inside corner - { 4, 15, 11, 10 }, // 33 - ╬, with all but bottom left inside corner - { 14, 15, 11, 0 }, // 34 - ╬, with all but top left inside corner - { 14, 15, 1, 10 }, // 35 - ╬, with all but top right inside corner - - { 4, 5, 11, 10 }, // 36 - ╬, with top inside corners - { 4, 15, 11, 0 }, // 37 - ╬, with right inside corners - { 14, 15, 1, 0 }, // 38 - ╬, with right inside corners - { 14, 5, 1, 10 }, // 39 - ╬, with left inside corners - { 4, 15, 1, 10 }, // 40 - ╬, with top left and bottom right inside corners - { 14, 5, 11, 0 }, // 41 - ╬, with top right and bottom left inside corners - - { 4, 5, 1, 10 }, // 42 - ╬, with top left inside corner - { 4, 5, 11, 0 }, // 43 - ╬, with top right inside corner - { 4, 15, 1, 0 }, // 44 - ╬, with bottom right inside corner - { 14, 5, 1, 0 }, // 45 - ╬, with bottom left inside corner - - { 4, 5, 1, 0 }, // 46 - ╬, no inside corners - }; - public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { - int index = getTexture(world, x, y, z, side); - - return submaps[index]; - } - - public static int getTexture(IBlockAccess world, int x, int y, int z, int side) { if (world == null) - return 0; + return new int[] { 18, 19, 17, 16 }; - int texture = 0; Block block = world.getBlock(x, y, z); int blockMetadata = world.getBlockMetadata(x, y, z); boolean b[] = new boolean[8]; - /** - * b[0] b[1] b[2] - * - * - * - * b[3] FACE b[4] - * - * - * - * b[5] b[6] b[7] - */ - if (side == 0) { - //TODO: - b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[2] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata); - } else if (side == 1) { - //TODO: - b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[2] = isConnected(world, x, y, z - 1, side, block, blockMetadata); - b[3] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - } else if (side == 2) { - //TODO: - b[0] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[1] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); - } else if (side == 3) { - //TODO: - b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); - } else if (side == 4) { - //TODO: - b[0] = isConnected(world, x, y, z - 1, side, block, blockMetadata); + /** + * b[0] b[1] b[2] + * + * + * + * b[3] FACE b[4] + * + * + * + * b[5] b[6] b[7] + */ + if (side == 0) { + b[0] = isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); b[1] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); - } else if (side == 5) { - //TODO: - b[0] = isConnected(world, x, y, z + 1, side, block, blockMetadata); + b[2] = isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); + b[3] = isConnected(world, x - 1, y, z, side, block, blockMetadata); + b[4] = isConnected(world, x + 1, y, z, side, block, blockMetadata); + b[5] = isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); + b[6] = isConnected(world, x, y, z - 1, side, block, blockMetadata); + b[7] = isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); + } else if (side == 1) { + b[0] = isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); b[1] = isConnected(world, x, y, z - 1, side, block, blockMetadata); - b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata); + b[2] = isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); + b[3] = isConnected(world, x - 1, y, z, side, block, blockMetadata); + b[4] = isConnected(world, x + 1, y, z, side, block, blockMetadata); + b[5] = isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); + b[6] = isConnected(world, x, y, z + 1, side, block, blockMetadata); + b[7] = isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); + } else if (side == 2) { + b[0] = isConnected(world, x + 1, y + 1, z, side, block, blockMetadata); + b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); + b[2] = isConnected(world, x - 1, y + 1, z, side, block, blockMetadata); + b[3] = isConnected(world, x + 1, y, z, side, block, blockMetadata); + b[4] = isConnected(world, x - 1, y, z, side, block, blockMetadata); + b[5] = isConnected(world, x + 1, y - 1, z, side, block, blockMetadata); + b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); + b[7] = isConnected(world, x - 1, y - 1, z, side, block, blockMetadata); + } else if (side == 3) { + b[0] = isConnected(world, x - 1, y + 1, z, side, block, blockMetadata); + b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); + b[2] = isConnected(world, x + 1, y + 1, z, side, block, blockMetadata); + b[3] = isConnected(world, x - 1, y, z, side, block, blockMetadata); + b[4] = isConnected(world, x + 1, y, z, side, block, blockMetadata); + b[5] = isConnected(world, x - 1, y - 1, z, side, block, blockMetadata); + b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); + b[7] = isConnected(world, x + 1, y - 1, z, side, block, blockMetadata); + } else if (side == 4) { + b[0] = isConnected(world, x, y + 1, z - 1, side, block, blockMetadata); + b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); + b[2] = isConnected(world, x, y + 1, z + 1, side, block, blockMetadata); + b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata); + b[4] = isConnected(world, x, y, z + 1, side, block, blockMetadata); + b[5] = isConnected(world, x, y - 1, z - 1, side, block, blockMetadata); + b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); + b[7] = isConnected(world, x, y - 1, z + 1, side, block, blockMetadata); + } else if (side == 5) { + b[0] = isConnected(world, x, y + 1, z + 1, side, block, blockMetadata); + b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); + b[2] = isConnected(world, x, y + 1, z - 1, side, block, blockMetadata); + b[3] = isConnected(world, x, y, z + 1, side, block, blockMetadata); + b[4] = isConnected(world, x, y, z - 1, side, block, blockMetadata); + b[5] = isConnected(world, x, y - 1, z + 1, side, block, blockMetadata); + b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); + b[7] = isConnected(world, x, y - 1, z - 1, side, block, blockMetadata); } - //TODO: return something other than zero + int[] ret = new int[] { 18, 19, 17, 16 }; - return texture; + // Bottom Left + if (b[3] || b[6]) { + ret[0] = 4 + (b[6] ? 2 : 0) + (b[3] ? 8 : 0); + if (b[3] && b[5] && b[6]) ret[0] = 4; + } + + // Bottom Right + if (b[6] || b[4]) { + ret[1] = 5 + (b[6] ? 2 : 0) + (b[4] ? 8 : 0); + if (b[4] && b[6] && b[7]) ret[1] = 5; + } + + // Top Right + if (b[4] || b[1]) { + ret[2] = 1 + (b[1] ? 2 : 0) + (b[4] ? 8 : 0); + if (b[1] && b[2] && b[4]) ret[2] = 1; + } + + // Top Left + if (b[1] || b[3]) { + ret[3] = (b[1] ? 2 : 0) + (b[3] ? 8 : 0); + if (b[0] && b[1] && b[3]) ret[3] = 0; + } + + return ret; } public static boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) { @@ -205,25 +169,25 @@ public class CTM { int x2 = x + dir.offsetX; int y2 = y + dir.offsetY; int z2 = z + dir.offsetZ; - + Block con = getBlockOrFacade(world, x, y, z, side); Block obscuring = getBlockOrFacade(world, x2, y2, z2, side); - + // no block or a bad API user if (con == null) { return false; } - + boolean ret = con.equals(block) && getBlockOrFacadeMetadata(world, x, y, z, side) == meta; - + // no block obscuring this face if (obscuring == null) { return true; } - + // check that we aren't already connected outwards from this side - ret &= !(obscuring.equals(block) && getBlockOrFacadeMetadata(world, x2, y2, z2, side) == meta); - + ret &= !(obscuring.equals(block) && getBlockOrFacadeMetadata(world, x2, y2, z2, side) == meta && Configurations.connectInsideCTM); + return ret; } @@ -242,4 +206,4 @@ public class CTM { } return blk; } -} +} \ No newline at end of file diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index 7c1d223e..28361403 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -20,7 +20,6 @@ public class RenderBlocksCTM extends RenderBlocks { * X, Y, Z, or any combination means that the axes listed in the name are at 1. * X, Y, Z, or any combination followed by HALF means that those axes are at 0.5. * X, Y, Z, or any combination after a HALF means those axes are at 1. - * */ enum Vert { @@ -61,8 +60,7 @@ public class RenderBlocksCTM extends RenderBlocks { void render(RenderBlocksCTM inst, int cacheID) { if (inst.enableAO) { - // TODO: Get this back in - // inst.tessellator.setColorOpaque_F(inst.redCache[cacheID], inst.greenCache[cacheID], inst.blueCache[cacheID]); + inst.tessellator.setColorOpaque_F(inst.redCache[cacheID], inst.grnCache[cacheID], inst.bluCache[cacheID]); inst.tessellator.setBrightness(inst.lightingCache[cacheID]); } @@ -72,18 +70,18 @@ public class RenderBlocksCTM extends RenderBlocks { /** * Each side is divided into 4 sub-sides. LB(left bottom), RB(right bottom), LT(right top), and RT(right top). - *

+ * * Each sub-side contains 4 {@link Vert} objects representing its position on the block. */ enum SubSide { - XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y), - XPOS_LB(XZ, Z_HALF_X, YZ_HALF_X, Y_HALF_XZ), XPOS_RB(Z_HALF_X, X, Y_HALF_X, YZ_HALF_X), XPOS_RT(YZ_HALF_X, Y_HALF_X, XY, Z_HALF_XY), XPOS_LT(Y_HALF_XZ, YZ_HALF_X, Z_HALF_XY, XYZ), + XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y), + XPOS_LB(XZ, Z_HALF_X, YZ_HALF_X, Y_HALF_XZ), XPOS_RB(Z_HALF_X, X, Y_HALF_X, YZ_HALF_X), XPOS_RT(YZ_HALF_X, Y_HALF_X, XY, Z_HALF_XY), XPOS_LT(Y_HALF_XZ, YZ_HALF_X, Z_HALF_XY, XYZ), - ZNEG_LB(X, X_HALF, XY_HALF, Y_HALF_X), ZNEG_RB(X_HALF, ZERO, Y_HALF, XY_HALF), ZNEG_RT(XY_HALF, Y_HALF, Y, X_HALF_Y), ZNEG_LT(Y_HALF_X, XY_HALF, X_HALF_Y, XY), - ZPOS_LB(Z, X_HALF_Z, XY_HALF_Z, Y_HALF_Z), ZPOS_RB(X_HALF_Z, XZ, Y_HALF_XZ, XY_HALF_Z), ZPOS_RT(XY_HALF_Z, Y_HALF_XZ, XYZ, X_HALF_YZ), ZPOS_LT(Y_HALF_Z, XY_HALF_Z, X_HALF_YZ, YZ), + ZNEG_LB(X, X_HALF, XY_HALF, Y_HALF_X), ZNEG_RB(X_HALF, ZERO, Y_HALF, XY_HALF), ZNEG_RT(XY_HALF, Y_HALF, Y, X_HALF_Y), ZNEG_LT(Y_HALF_X, XY_HALF, X_HALF_Y, XY), + ZPOS_LB(Z, X_HALF_Z, XY_HALF_Z, Y_HALF_Z), ZPOS_RB(X_HALF_Z, XZ, Y_HALF_XZ, XY_HALF_Z), ZPOS_RT(XY_HALF_Z, Y_HALF_XZ, XYZ, X_HALF_YZ), ZPOS_LT(Y_HALF_Z, XY_HALF_Z, X_HALF_YZ, YZ), - YNEG_LB(ZERO, X_HALF, XZ_HALF, Z_HALF), YNEG_RB(X_HALF, X, Z_HALF_X, XZ_HALF), YNEG_RT(XZ_HALF, Z_HALF_X, XZ, X_HALF_Z), YNEG_LT(Z_HALF, XZ_HALF, X_HALF_Z, Z), - YPOS_LB(YZ, X_HALF_YZ, XZ_HALF_Y, Z_HALF_Y), YPOS_RB(X_HALF_YZ, XYZ, Z_HALF_XY, XZ_HALF_Y), YPOS_RT(XZ_HALF_Y, Z_HALF_XY, XY, X_HALF_Y), YPOS_LT(Z_HALF_Y, XZ_HALF_Y, X_HALF_Y, Y); + YNEG_LB(ZERO, X_HALF, XZ_HALF, Z_HALF), YNEG_RB(X_HALF, X, Z_HALF_X, XZ_HALF), YNEG_RT(XZ_HALF, Z_HALF_X, XZ, X_HALF_Z), YNEG_LT(Z_HALF, XZ_HALF, X_HALF_Z, Z), + YPOS_LB(YZ, X_HALF_YZ, XZ_HALF_Y, Z_HALF_Y), YPOS_RB(X_HALF_YZ, XYZ, Z_HALF_XY, XZ_HALF_Y), YPOS_RT(XZ_HALF_Y, Z_HALF_XY, XY, X_HALF_Y), YPOS_LT(Z_HALF_Y, XZ_HALF_Y, X_HALF_Y, Y); private Vert xmin, xmax, ymin, ymax; SubSide(Vert xmin, Vert ymin, Vert ymax, Vert xmax) { @@ -118,18 +116,20 @@ public class RenderBlocksCTM extends RenderBlocks { double[] vCache = new double[4]; int[] lightingCache = new int[4]; float[] redCache = new float[4]; - float[] greenCache = new float[4]; - float[] blueCache = new float[4]; + float[] grnCache = new float[4]; + float[] bluCache = new float[4]; TextureSubmap submap; TextureSubmap submapSmall; RenderBlocks rendererOld; - int[][] lightmap = new int[3][3]; + int[][] lightmap = new int[3][3]; + float[][] redmap = new float[3][3]; + float[][] grnmap = new float[3][3]; + float[][] blumap = new float[3][3]; int bx, by, bz; - @Override - public boolean renderStandardBlock(Block block, int x, int y, int z) { + @Override public boolean renderStandardBlock(Block block, int x, int y, int z) { bx = x; by = y; bz = z; @@ -146,42 +146,70 @@ public class RenderBlocksCTM extends RenderBlocks { return res; } + /* This method fills a 3x3 grid of light values based on the four corners, by averaging them together. + * + * 2 TL x TR + * + * 1 x x x + * + * 0 BL x BR + * 0 1 2 + * + * Note: Variable names mean nothing... don't touch + * + * ._. + * + * shakes fist in anger + */ + void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) { + lightmap[0][0] = bottomLeft; + lightmap[2][0] = bottomRight; + lightmap[2][2] = topRight; + lightmap[0][2] = topLeft; - /* This method fills a 3x3 grid of light values based on the four corners, by averaging them together. - * - * 2 TL x TR - * - * 1 x x x - * - * 0 BL x BR - * 0 1 2 - * - * Note: Variable names mean nothing... don't touch - * - * ._. - * - * shakes fist in anger - */ - void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) { - lightmap[0][0] = bottomLeft; - lightmap[2][0] = bottomRight; - lightmap[2][2] = topRight; - lightmap[0][2] = topLeft; + lightmap[1][0] = avg(bottomLeft, bottomRight); + lightmap[2][1] = avg(bottomRight, topRight); + lightmap[1][2] = avg(topRight, topLeft); + lightmap[0][1] = avg(topLeft, bottomLeft); - lightmap[1][0] = avg(bottomLeft, bottomRight); - lightmap[2][1] = avg(bottomRight, topRight); - lightmap[1][2] = avg(topRight, topLeft); - lightmap[0][1] = avg(topLeft, bottomLeft); + lightmap[1][1] = avg(bottomLeft, bottomRight, topRight, topLeft); + } - lightmap[1][1] = avg(bottomLeft, bottomRight, topRight, topLeft); - } + void fillColormap(float bottomLeft, float bottomRight, float topRight, float topLeft, float[][] map) { + map[0][0] = bottomLeft; + map[2][0] = bottomRight; + map[2][2] = topRight; + map[0][2] = topLeft; - void getLight(int x, int y) { - lightingCache[0] = lightmap[0+x][0+y]; - lightingCache[1] = lightmap[1+x][0+y]; - lightingCache[2] = lightmap[1+x][1+y]; - lightingCache[3] = lightmap[0+x][1+y]; - } + map[1][0] = (bottomLeft + bottomRight) / 2.0F; + map[2][1] = (bottomRight + topRight) / 2.0F; + map[1][2] = (topRight + topLeft) / 2.0F; + map[0][1] = (topLeft + bottomLeft) / 2.0F; + + map[1][1] = (bottomLeft + bottomRight + topRight + topLeft) / 4.0F; + } + + void getLight(int x, int y) { + lightingCache[0] = lightmap[0 + x][0 + y]; + lightingCache[1] = lightmap[1 + x][0 + y]; + lightingCache[2] = lightmap[1 + x][1 + y]; + lightingCache[3] = lightmap[0 + x][1 + y]; + + redCache[0] = redmap[0 + x][0 + y]; + redCache[1] = redmap[1 + x][0 + y]; + redCache[2] = redmap[1 + x][1 + y]; + redCache[3] = redmap[0 + x][1 + y]; + + grnCache[0] = grnmap[0 + x][0 + y]; + grnCache[1] = grnmap[1 + x][0 + y]; + grnCache[2] = grnmap[1 + x][1 + y]; + grnCache[3] = grnmap[0 + x][1 + y]; + + bluCache[0] = blumap[0 + x][0 + y]; + bluCache[1] = blumap[1 + x][0 + y]; + bluCache[2] = blumap[1 + x][1 + y]; + bluCache[3] = blumap[0 + x][1 + y]; + } /** * This works around a bug in CLC atm @@ -201,8 +229,8 @@ public class RenderBlocksCTM extends RenderBlocks { sunlightBitChannel += (light & 0xF00000); } - return ((blockLightBitChannel / lightVals.length) & 0xFF) | ((redBitChannel / lightVals.length) & 0xF00) | ((greenBitChannel / lightVals.length) & 0xF000) - | ((blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000); + return ((blockLightBitChannel / lightVals.length) & 0xFF) | ((redBitChannel / lightVals.length) & 0xF00) | ((greenBitChannel / lightVals.length) & 0xF000) | ( + (blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000); } void side(SubSide side, int iconIndex) { @@ -226,8 +254,7 @@ public class RenderBlocksCTM extends RenderBlocks { side.render(this); } - @Override - public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { + @Override public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -238,20 +265,23 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4); - fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); - getLight(0, 0); + fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); + fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap); + fillColormap(colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, grnmap); + fillColormap(colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, blumap); + + getLight(0, 0); side(XNEG_LB, tex[0]); - getLight(1, 0); + getLight(1, 0); side(XNEG_RB, tex[1]); - getLight(1, 1); + getLight(1, 1); side(XNEG_RT, tex[2]); - getLight(0, 1); + getLight(0, 1); side(XNEG_LT, tex[3]); } } - @Override - public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) { + @Override public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -262,20 +292,22 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5); - fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight); - getLight(0, 0); - side(XPOS_LB, tex[0]); - getLight(1, 0); - side(XPOS_RB, tex[1]); - getLight(1, 1); - side(XPOS_RT, tex[2]); - getLight(0, 1); - side(XPOS_LT, tex[3]); + fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight); + fillColormap(colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, redmap); + fillColormap(colorGreenTopLeft, colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, grnmap); + fillColormap(colorBlueTopLeft, colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, blumap); + getLight(0, 0); + side(XPOS_LB, tex[0]); + getLight(1, 0); + side(XPOS_RB, tex[1]); + getLight(1, 1); + side(XPOS_RT, tex[2]); + getLight(0, 1); + side(XPOS_LT, tex[3]); } } - @Override - public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) { + @Override public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -286,20 +318,22 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2); - fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); - getLight(0, 0); - side(ZNEG_LB, tex[0]); - getLight(1, 0); - side(ZNEG_RB, tex[1]); - getLight(1, 1); - side(ZNEG_RT, tex[2]); - getLight(0, 1); - side(ZNEG_LT, tex[3]); + fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); + fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap); + fillColormap(colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, grnmap); + fillColormap(colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, blumap); + getLight(0, 0); + side(ZNEG_LB, tex[0]); + getLight(1, 0); + side(ZNEG_RB, tex[1]); + getLight(1, 1); + side(ZNEG_RT, tex[2]); + getLight(0, 1); + side(ZNEG_LT, tex[3]); } } - @Override - public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) { + @Override public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -310,20 +344,22 @@ public class RenderBlocksCTM extends RenderBlocks { } else { int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3); - fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); - getLight(0, 0); - side(ZPOS_LB, tex[0]); - getLight(1, 0); - side(ZPOS_RB, tex[1]); - getLight(1, 1); - side(ZPOS_RT, tex[2]); - getLight(0, 1); - side(ZPOS_LT, tex[3]); + fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); + fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap); + fillColormap(colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, grnmap); + fillColormap(colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, blumap); + getLight(0, 0); + side(ZPOS_LB, tex[0]); + getLight(1, 0); + side(ZPOS_RB, tex[1]); + getLight(1, 1); + side(ZPOS_RT, tex[2]); + getLight(0, 1); + side(ZPOS_LT, tex[3]); } } - @Override - public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) { + @Override public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -332,22 +368,24 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV()); tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1); + int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); - fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); - getLight(0, 0); - side(YNEG_LB, tex[0]); - getLight(1, 0); - side(YNEG_RB, tex[1]); - getLight(1, 1); - side(YNEG_RT, tex[2]); - getLight(0, 1); - side(YNEG_LT, tex[3]); + fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); + fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap); + fillColormap(colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, grnmap); + fillColormap(colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, blumap); + getLight(0, 0); + side(YNEG_LB, tex[0]); + getLight(1, 0); + side(YNEG_RB, tex[1]); + getLight(1, 1); + side(YNEG_RT, tex[2]); + getLight(0, 1); + side(YNEG_LT, tex[3]); } } - @Override - public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) { + @Override public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -356,18 +394,20 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); + int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1); - fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight); - getLight(0, 0); - side(YPOS_LB, tex[0]); - getLight(1, 0); - side(YPOS_RB, tex[1]); - getLight(1, 1); - side(YPOS_RT, tex[2]); - getLight(0, 1); - side(YPOS_LT, tex[3]); + fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight); + fillColormap(colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, redmap); + fillColormap(colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, colorGreenBottomRight, grnmap); + fillColormap(colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, colorBlueBottomRight, blumap); + getLight(0, 0); + side(YPOS_LB, tex[0]); + getLight(1, 0); + side(YPOS_RB, tex[1]); + getLight(1, 1); + side(YPOS_RT, tex[2]); + getLight(0, 1); + side(YPOS_LT, tex[3]); } } - -} +} \ No newline at end of file diff --git a/src/main/java/com/cricketcraft/chisel/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index 76c812c5..5e5e6c6a 100644 --- a/src/main/java/com/cricketcraft/chisel/config/Configurations.java +++ b/src/main/java/com/cricketcraft/chisel/config/Configurations.java @@ -33,23 +33,26 @@ public class Configurations { public static int particlesTickrate; public static boolean oldPillars; public static boolean disableCTM; + public static boolean connectInsideCTM; public static boolean fancy; public static boolean blockDescriptions; public static boolean allowChiselDamage; public static int ironChiselMaxDamage; public static int diamondChiselMaxDamage; + public static int obsidianChiselMaxDamage; public static boolean ironChiselCanLeftClick; public static boolean ironChiselHasModes; public static int ironChiselAttackDamage; public static int diamondChiselAttackDamage; + public static int obsidianChiselAttackDamage; public static boolean allowChiselCrossColors; public static boolean useRoadLineTool; public static String getRoadLineTool; public static int roadLineToolLevel; - public static int[] configColors = new int[ItemDye.field_150923_a.length]; + public static int[] configColors = new int[ItemDye.field_150923_a.length]; public static boolean refreshConfig() { @@ -82,6 +85,7 @@ public class Configurations { particlesTickrate = config.get(category, "particleTickrate", 1, "Particle tick rate. Greater value = less particles.").getInt(1); oldPillars = config.get(category, "pillarOldGraphics", false, "Use old pillar textures").getBoolean(false); disableCTM = !config.get(category, "connectedTextures", true, "Enable connected textures").getBoolean(true); + connectInsideCTM = !config.get(category, "connectInsideCTM", false, "Choose whether the inside corner is disconnected on a CTM block - http://imgur.com/eUywLZ4").getBoolean(false); fancy = config.get(category, "fancyLeaves", true, "Enable fancy textures").getBoolean(true); blockDescriptions = config.get(category, "tooltipsUseBlockDescriptions", true, "Make variations of blocks have the same name, and use the description in tooltip to distinguish them.") .getBoolean(true); @@ -89,14 +93,18 @@ public class Configurations { /* chisel */ category = "chisel"; allowChiselDamage = config.get(category, "allowChiselDamage", true, "Should the chisel be damageable and take damage when it chisels something.").getBoolean(); - ironChiselMaxDamage = config.get(category, "ironChiselMaxDamage", 500, "The max damage of the standard iron chisel. Default: 500.").getInt(); - diamondChiselMaxDamage = config.get(category, "diamondChiselMaxDamage", 5000, "The max damage of the diamond chisel. Default: 5000").getInt(); + ironChiselMaxDamage = config.getInt("ironChiselMaxDamage", category, 500, 1, Short.MAX_VALUE, "The max damage of the standard iron chisel."); + diamondChiselMaxDamage = config.getInt("diamondChiselMaxDamage", category, 5000, 1, Short.MAX_VALUE, "The max damage of the diamond chisel."); + obsidianChiselMaxDamage = config.getInt("obsidianChiselMaxDamage", category, 2500, 1, Short.MAX_VALUE, "The max damage of the obsidian chisel."); ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean(); ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean(); - ironChiselAttackDamage = config.get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.").getInt(); - diamondChiselAttackDamage = config.get(category, "diamondChiselAttackDamage", 2, - "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt(); allowChiselCrossColors = config.get(category, "allowChiselCrossColors", true, "Should someone be able to chisel something into a different color.").getBoolean(); + ironChiselAttackDamage = config.get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.") + .getInt(); + diamondChiselAttackDamage = config + .get(category, "diamondChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt(); + obsidianChiselAttackDamage = config + .get(category, "obsidianChiselAttackDamage", 4, "The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt(); /* block */ category = "block"; @@ -107,19 +115,19 @@ public class Configurations { .getInt(); /* hexColors */ - category = "hexColors"; + category = "hexColors"; - for(int i = 0; i < ItemDye.field_150923_a.length; i++) { - // tterrag... don't kill me over this formatting. - String temp = config.get(category, "hex" + ItemDye.field_150923_a[i], "#" + Integer.toHexString(ItemDye.field_150922_c[i]), Character.toUpperCase(ItemDye.field_150923_a[i].charAt(0)) + ItemDye.field_150923_a[i].substring(1) + " color for hex block overlay #RRGGBB").getString(); - // Or this - try { - configColors[i] = Integer.decode(temp); - } catch (NumberFormatException e) { - Chisel.logger.warn("Configuration error, " + temp + " was not recognized as a color. Using default: #" + Integer.toHexString(ItemDye.field_150922_c[i])); - configColors[i] = ItemDye.field_150922_c[i]; - } - } + for(int i = 0; i < ItemDye.field_150923_a.length; i++) { + // tterrag... don't kill me over this formatting. + String temp = config.get(category, "hex" + ItemDye.field_150923_a[i], "#" + Integer.toHexString(ItemDye.field_150922_c[i]), Character.toUpperCase(ItemDye.field_150923_a[i].charAt(0)) + ItemDye.field_150923_a[i].substring(1) + " color for hex block overlay #RRGGBB").getString(); + // Or this + try { + configColors[i] = Integer.decode(temp); + } catch (NumberFormatException e) { + Chisel.logger.warn("Configuration error, " + temp + " was not recognized as a color. Using default: #" + Integer.toHexString(ItemDye.field_150922_c[i])); + configColors[i] = ItemDye.field_150922_c[i]; + } + } if (config.hasChanged()) { config.save(); @@ -131,7 +139,9 @@ public class Configurations { return config.get("features", featureName(feature), true).getBoolean(true) && refreshConfig(); } - /** Makes the old camelCase names from the new CONSTANT_CASE names */ + /** + * Makes the old camelCase names from the new CONSTANT_CASE names + */ public static String featureName(Features feature) { String[] words = feature.name().toLowerCase(Locale.ENGLISH).split("_"); if (words.length == 1) { @@ -149,4 +159,4 @@ public class Configurations { public static boolean featureEnabled(String feature) { return false; } -} +} \ No newline at end of file From 2c8d88a6395622d0533433bdec7b4aab259e8fce Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 22 Apr 2015 17:52:03 -0400 Subject: [PATCH 09/16] Massively clean up CTM code, much more readable now --- eclipseFormat.xml | 554 +++++++++--------- .../chisel/carving/CarvableHelper.java | 314 ++-------- .../chisel/client/render/CTM.java | 244 ++++---- .../chisel/client/render/RenderBlocksCTM.java | 49 +- 4 files changed, 496 insertions(+), 665 deletions(-) diff --git a/eclipseFormat.xml b/eclipseFormat.xml index a7225f2a..0c657bc6 100644 --- a/eclipseFormat.xml +++ b/eclipseFormat.xml @@ -1,291 +1,295 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - + + + + + + + + + - - - - - - - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index bd36602f..d068a488 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -1,15 +1,9 @@ package com.cricketcraft.chisel.carving; -import com.cricketcraft.chisel.Chisel; -import com.cricketcraft.chisel.carving.CarvableVariation.CarvableVariationCTM; -import com.cricketcraft.chisel.client.render.CTM; -import com.cricketcraft.chisel.client.render.TextureSubmap; -import com.cricketcraft.chisel.compat.FMPIntegration; -import com.cricketcraft.chisel.config.Configurations; -import com.cricketcraft.chisel.item.ItemCarvable; -import com.cricketcraft.chisel.utils.GeneralClient; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockPane; import net.minecraft.block.material.Material; @@ -20,7 +14,14 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraftforge.oredict.OreDictionary; -import java.util.*; +import com.cricketcraft.chisel.Chisel; +import com.cricketcraft.chisel.client.render.CTM; +import com.cricketcraft.chisel.client.render.TextureSubmap; +import com.cricketcraft.chisel.compat.FMPIntegration; +import com.cricketcraft.chisel.item.ItemCarvable; +import com.cricketcraft.chisel.utils.GeneralClient; + +import cpw.mods.fml.common.registry.GameRegistry; public class CarvableHelper { @@ -33,248 +34,19 @@ public class CarvableHelper { void registerIcons(String modName, Block block, IIconRegister register); } - public enum TextureType implements ISubmapManager { + public enum TextureType { - TOPSIDE("top", "side") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - TOPBOTSIDE("top", "bottom", "side") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - CTM3("ctm1", "ctm2", "ctm3") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - CTMV("ctmv", "top") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - CTMH("ctmh", "top") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - V9("v9") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - V4("v4") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - CTMX("", "ctm") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - R16("r16") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - R9("r9") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - R4("r4") { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }, - NORMAL { - - @Override - public IIcon getIcon(int side, int meta) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void registerIcons(String modName, Block block, IIconRegister register) { - // TODO Auto-generated method stub - - } - }; + TOPSIDE("top", "side"), + TOPBOTSIDE("top", "bottom", "side"), + CTMV("ctmv", "top"), + CTMH("ctmh", "top"), + V9("v9"), + V4("v4"), + CTMX("", "ctm"), + R16("r16"), + R9("r9"), + R4("r4"), + NORMAL; private String[] suffixes; @@ -282,7 +54,7 @@ public class CarvableHelper { this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes; } - public static ISubmapManager getManagerFor(String path) { + public static TextureType getTypeFor(String path) { for (TextureType t : values()) { boolean matches = true; for (String s : t.suffixes) { @@ -297,12 +69,6 @@ public class CarvableHelper { } return null; } - - @Override - public abstract IIcon getIcon(int side, int meta); - - @Override - public abstract IIcon getIcon(IBlockAccess world, int x, int y, int z, int side); } private static final Random rand = new Random(); @@ -345,7 +111,7 @@ public class CarvableHelper { if (texture != null) { variation.texture = texture; String path = "/assets/" + Chisel.MOD_ID + "/textures/blocks/" + variation.texture; - variation.type = (TextureType) TextureType.getManagerFor(path); + variation.type = (TextureType) TextureType.getTypeFor(path); } else { variation.block = block; variation.type = TextureType.TOPBOTSIDE; @@ -390,8 +156,6 @@ public class CarvableHelper { return variation.iconBot; else return variation.icon; - case CTM3: - return variation.ctm.seams[0].icons[0]; case CTMV: if (side < 2) return variation.iconTop; @@ -434,13 +198,13 @@ public class CarvableHelper { case TOPSIDE: case TOPBOTSIDE: return getIcon(side, metadata); - case CTM3: - int tex = CTM.getTexture(world, x, y, z, side); - - int row = tex / 16; - int col = tex % 16; - - return variation.ctm.seams[col / 4].icons[col % 4 + row * 4]; +// case CTM3: +// int tex = CTM.getTexture(world, x, y, z, side); +// +// int row = tex / 16; +// int col = tex % 16; +// +// return variation.ctm.seams[col / 4].icons[col % 4 + row * 4]; case CTMV: { if (side < 2) return variation.iconTop; @@ -614,13 +378,13 @@ public class CarvableHelper { variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top"); variation.iconBot = register.registerIcon(modName + ":" + variation.texture + "-bottom"); break; - case CTM3: - CarvableVariationCTM ctm = new CarvableVariationCTM(); - ctm.seams[0] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm1"), 4, 4); - ctm.seams[1] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm2"), 4, 4); - ctm.seams[2] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm3"), 4, 4); - variation.ctm = ctm; - break; +// case CTM3: +// CarvableVariationCTM ctm = new CarvableVariationCTM(); +// ctm.seams[0] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm1"), 4, 4); +// ctm.seams[1] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm2"), 4, 4); +// ctm.seams[2] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm3"), 4, 4); +// variation.ctm = ctm; +// break; case CTMV: variation.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctmv"), 2, 2); variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top"); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java index e0f3f763..3792811c 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java @@ -1,13 +1,23 @@ package com.cricketcraft.chisel.client.render; -import com.cricketcraft.chisel.config.Configurations; +import gnu.trove.map.TIntObjectMap; +import gnu.trove.map.hash.TIntObjectHashMap; + +import java.util.EnumMap; + import net.minecraft.block.Block; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; import com.cricketcraft.chisel.api.IFacade; +import com.cricketcraft.chisel.config.Configurations; +import com.google.common.collect.Maps; + +import static com.cricketcraft.chisel.client.render.CTM.Dir.*; +import static net.minecraftforge.common.util.ForgeDirection.*; /** + * @formatter:off * The CTM renderer will draw the block's FACE using by assembling 4 quadrants from the 5 available block * textures. The normal Texture.png is the blocks "unconnected" texture, and is used when CTM is disabled or the block * has nothing to connect to. This texture has all of the outside corner quadrants The texture-ctm.png contains the @@ -56,129 +66,167 @@ import com.cricketcraft.chisel.api.IFacade; * HAVE FUN! * -CptRageToaster- */ - public class CTM { - public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { - if (world == null) - return new int[] { 18, 19, 17, 16 }; - Block block = world.getBlock(x, y, z); - int blockMetadata = world.getBlockMetadata(x, y, z); + enum Dir { + + TOP(UP), + TOP_RIGHT(UP, EAST), + RIGHT(EAST), + BOTTOM_RIGHT(DOWN, EAST), + BOTTOM(DOWN), + BOTTOM_LEFT(DOWN, WEST), + LEFT(WEST), + TOP_LEFT(UP, WEST); + // @formatter:on - boolean b[] = new boolean[8]; - /** - * b[0] b[1] b[2] - * - * - * - * b[3] FACE b[4] - * - * - * - * b[5] b[6] b[7] - */ - if (side == 0) { - b[0] = isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); - b[1] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - b[2] = isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); - b[3] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[4] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[5] = isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); - b[6] = isConnected(world, x, y, z - 1, side, block, blockMetadata); - b[7] = isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); - } else if (side == 1) { - b[0] = isConnected(world, x - 1, y, z - 1, side, block, blockMetadata); - b[1] = isConnected(world, x, y, z - 1, side, block, blockMetadata); - b[2] = isConnected(world, x + 1, y, z - 1, side, block, blockMetadata); - b[3] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[4] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[5] = isConnected(world, x - 1, y, z + 1, side, block, blockMetadata); - b[6] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - b[7] = isConnected(world, x + 1, y, z + 1, side, block, blockMetadata); - } else if (side == 2) { - b[0] = isConnected(world, x + 1, y + 1, z, side, block, blockMetadata); - b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); - b[2] = isConnected(world, x - 1, y + 1, z, side, block, blockMetadata); - b[3] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[4] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[5] = isConnected(world, x + 1, y - 1, z, side, block, blockMetadata); - b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[7] = isConnected(world, x - 1, y - 1, z, side, block, blockMetadata); - } else if (side == 3) { - b[0] = isConnected(world, x - 1, y + 1, z, side, block, blockMetadata); - b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); - b[2] = isConnected(world, x + 1, y + 1, z, side, block, blockMetadata); - b[3] = isConnected(world, x - 1, y, z, side, block, blockMetadata); - b[4] = isConnected(world, x + 1, y, z, side, block, blockMetadata); - b[5] = isConnected(world, x - 1, y - 1, z, side, block, blockMetadata); - b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[7] = isConnected(world, x + 1, y - 1, z, side, block, blockMetadata); - } else if (side == 4) { - b[0] = isConnected(world, x, y + 1, z - 1, side, block, blockMetadata); - b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); - b[2] = isConnected(world, x, y + 1, z + 1, side, block, blockMetadata); - b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata); - b[4] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - b[5] = isConnected(world, x, y - 1, z - 1, side, block, blockMetadata); - b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[7] = isConnected(world, x, y - 1, z + 1, side, block, blockMetadata); - } else if (side == 5) { - b[0] = isConnected(world, x, y + 1, z + 1, side, block, blockMetadata); - b[1] = isConnected(world, x, y + 1, z, side, block, blockMetadata); - b[2] = isConnected(world, x, y + 1, z - 1, side, block, blockMetadata); - b[3] = isConnected(world, x, y, z + 1, side, block, blockMetadata); - b[4] = isConnected(world, x, y, z - 1, side, block, blockMetadata); - b[5] = isConnected(world, x, y - 1, z + 1, side, block, blockMetadata); - b[6] = isConnected(world, x, y - 1, z, side, block, blockMetadata); - b[7] = isConnected(world, x, y - 1, z - 1, side, block, blockMetadata); + private static final ForgeDirection NORMAL = SOUTH; + private static final Dir[] VALUES = values(); + + private ForgeDirection[] dirs; + + private Dir(ForgeDirection... dirs) { + this.dirs = dirs; } + private boolean isConnected(IBlockAccess world, int x, int y, int z, int sideIdx, Block block, int meta) { + ForgeDirection side = getOrientation(sideIdx); + ForgeDirection[] dirs = getNormalizedDirs(side); + for (ForgeDirection dir : dirs) { + x += dir.offsetX; + y += dir.offsetY; + z += dir.offsetZ; + } + return CTM.isConnected(world, x, y, z, side, block, meta); + } + + private ForgeDirection[] getNormalizedDirs(ForgeDirection normal) { + if (normal == NORMAL) { + return dirs; + } else if (normal == NORMAL.getOpposite()) { + // If this is the opposite direction of the default normal, we need to mirror the dirs + // A mirror version does not affect y+ and y- so we ignore those + ForgeDirection[] ret = new ForgeDirection[dirs.length]; + for (int i = 0; i < ret.length; i++) { + ret[i] = dirs[i].offsetY != 0 ? dirs[i] : dirs[i].getOpposite(); + } + return ret; + } else { + ForgeDirection axis = null; + // Next, we need different a different rotation axis depending + // on if this is up/down or not + if (normal.offsetY == 0) { + // If it is not up/down, pick either the left or right-hand rotation + axis = normal == NORMAL.getRotation(UP) ? UP : DOWN; + } else { + // If it is up/down, pick either the up or down rotation. + axis = normal == UP ? NORMAL.getRotation(DOWN) : NORMAL.getRotation(UP); + } + ForgeDirection[] ret = new ForgeDirection[dirs.length]; + // Finally apply all the rotations + for (int i = 0; i < ret.length; i++) { + ret[i] = dirs[i].getRotation(axis); + } + return ret; + } + } + } + + /** Some hardcoded offset values for the different corner indeces */ + private static int[] submapOffsets = { 4, 5, 1, 0 }; + private static TIntObjectMap submapMap = new TIntObjectHashMap(); + private static EnumMap connectionMap = Maps.newEnumMap(Dir.class); + static { + for (Dir dir : Dir.VALUES) { + connectionMap.put(dir, false); + } + // Mapping the different corner indeces to their respective dirs + submapMap.put(0, new Dir[] { BOTTOM, LEFT, BOTTOM_LEFT }); + submapMap.put(1, new Dir[] { BOTTOM, RIGHT, BOTTOM_RIGHT }); + submapMap.put(2, new Dir[] { TOP, RIGHT, TOP_RIGHT }); + submapMap.put(3, new Dir[] { TOP, LEFT, TOP_LEFT }); + } + + public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { int[] ret = new int[] { 18, 19, 17, 16 }; - // Bottom Left - if (b[3] || b[6]) { - ret[0] = 4 + (b[6] ? 2 : 0) + (b[3] ? 8 : 0); - if (b[3] && b[5] && b[6]) ret[0] = 4; + if (world == null) { + return ret; } + + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); - // Bottom Right - if (b[6] || b[4]) { - ret[1] = 5 + (b[6] ? 2 : 0) + (b[4] ? 8 : 0); - if (b[4] && b[6] && b[7]) ret[1] = 5; + // Build connections + for (Dir dir : Dir.VALUES) { + connectionMap.put(dir, dir.isConnected(world, x, y, z, side, block, meta)); } - - // Top Right - if (b[4] || b[1]) { - ret[2] = 1 + (b[1] ? 2 : 0) + (b[4] ? 8 : 0); - if (b[1] && b[2] && b[4]) ret[2] = 1; + + // Map connections to submap indeces + for (int i = 0; i < 4; i++) { + fillSubmaps(ret, i); } - - // Top Left - if (b[1] || b[3]) { - ret[3] = (b[1] ? 2 : 0) + (b[3] ? 8 : 0); - if (b[0] && b[1] && b[3]) ret[3] = 0; - } - + return ret; } + private static void fillSubmaps(int[] ret, int idx) { + Dir[] dirs = submapMap.get(idx); + if (connectedOr(dirs[0], dirs[1])) { + if (connectedAnd(dirs)) { + // If all dirs are connected, we use the fully connected face, + // the base offset value. + ret[idx] = submapOffsets[idx]; + } else { + // This is a bit magic-y, but basically the array is ordered so + // the first dir requires an offset of 2, and the second dir + // requires an offset of 8, plus the initial offset for the + // corner. + ret[idx] = submapOffsets[idx] + (connected(dirs[0]) ? 2 : 0) + (connected(dirs[1]) ? 8 : 0); + } + } + } + + private static boolean connected(Dir dir) { + return connectionMap.get(dir); + } + private static boolean connectedAnd(Dir... dirs) { + for (Dir dir : dirs) { + if (!connected(dir)) { + return false; + } + } + return true; + } + + private static boolean connectedOr(Dir... dirs) { + for (Dir dir : dirs) { + if (connected(dir)) { + return true; + } + } + return false; + } + public static boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) { - ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[side]; + return isConnected(world, x, y, z, dir, block, meta); + } + public static boolean isConnected(IBlockAccess world, int x, int y, int z, ForgeDirection dir, Block block, int meta) { int x2 = x + dir.offsetX; int y2 = y + dir.offsetY; int z2 = z + dir.offsetZ; - Block con = getBlockOrFacade(world, x, y, z, side); - Block obscuring = getBlockOrFacade(world, x2, y2, z2, side); + Block con = getBlockOrFacade(world, x, y, z, dir.ordinal()); + Block obscuring = getBlockOrFacade(world, x2, y2, z2, dir.ordinal()); // no block or a bad API user if (con == null) { return false; } - boolean ret = con.equals(block) && getBlockOrFacadeMetadata(world, x, y, z, side) == meta; + boolean ret = con.equals(block) && getBlockOrFacadeMetadata(world, x, y, z, dir.ordinal()) == meta; // no block obscuring this face if (obscuring == null) { @@ -186,7 +234,7 @@ public class CTM { } // check that we aren't already connected outwards from this side - ret &= !(obscuring.equals(block) && getBlockOrFacadeMetadata(world, x2, y2, z2, side) == meta && Configurations.connectInsideCTM); + ret &= !(obscuring.equals(block) && getBlockOrFacadeMetadata(world, x2, y2, z2, dir.ordinal()) == meta && Configurations.connectInsideCTM); return ret; } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index 28361403..bda78b55 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -16,13 +16,14 @@ public class RenderBlocksCTM extends RenderBlocks { * * The naming scheme is as follows: * - * ZERO and ONE are special cases, they are the absolute min and absolute max of the block. - * X, Y, Z, or any combination means that the axes listed in the name are at 1. - * X, Y, Z, or any combination followed by HALF means that those axes are at 0.5. - * X, Y, Z, or any combination after a HALF means those axes are at 1. + * ZERO and ONE are special cases, they are the absolute min and absolute + * max of the block. X, Y, Z, or any combination means that the axes listed + * in the name are at 1. X, Y, Z, or any combination followed by HALF means + * that those axes are at 0.5. X, Y, Z, or any combination after a HALF + * means those axes are at 1. */ enum Vert { - + // @formatter:off ZERO(0, 0, 0), XYZ(1, 1, 1), X(1, 0, 0), @@ -49,6 +50,7 @@ public class RenderBlocksCTM extends RenderBlocks { XY_HALF_Z(0.5, 0.5, 1), YZ_HALF_X(1, 0.5, 0.5), XZ_HALF_Y(0.5, 1, 0.5); + // @formatter:on private double x, y, z; @@ -69,11 +71,14 @@ public class RenderBlocksCTM extends RenderBlocks { } /** - * Each side is divided into 4 sub-sides. LB(left bottom), RB(right bottom), LT(right top), and RT(right top). + * Each side is divided into 4 sub-sides. LB(left bottom), RB(right bottom), + * LT(right top), and RT(right top). * - * Each sub-side contains 4 {@link Vert} objects representing its position on the block. + * Each sub-side contains 4 {@link Vert} objects representing its position + * on the block. */ enum SubSide { + // @formatter:off XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y), XPOS_LB(XZ, Z_HALF_X, YZ_HALF_X, Y_HALF_XZ), XPOS_RB(Z_HALF_X, X, Y_HALF_X, YZ_HALF_X), XPOS_RT(YZ_HALF_X, Y_HALF_X, XY, Z_HALF_XY), XPOS_LT(Y_HALF_XZ, YZ_HALF_X, Z_HALF_XY, XYZ), @@ -82,6 +87,7 @@ public class RenderBlocksCTM extends RenderBlocks { YNEG_LB(ZERO, X_HALF, XZ_HALF, Z_HALF), YNEG_RB(X_HALF, X, Z_HALF_X, XZ_HALF), YNEG_RT(XZ_HALF, Z_HALF_X, XZ, X_HALF_Z), YNEG_LT(Z_HALF, XZ_HALF, X_HALF_Z, Z), YPOS_LB(YZ, X_HALF_YZ, XZ_HALF_Y, Z_HALF_Y), YPOS_RB(X_HALF_YZ, XYZ, Z_HALF_XY, XZ_HALF_Y), YPOS_RT(XZ_HALF_Y, Z_HALF_XY, XY, X_HALF_Y), YPOS_LT(Z_HALF_Y, XZ_HALF_Y, X_HALF_Y, Y); + // @formatter:on private Vert xmin, xmax, ymin, ymax; SubSide(Vert xmin, Vert ymin, Vert ymax, Vert xmax) { @@ -129,7 +135,8 @@ public class RenderBlocksCTM extends RenderBlocks { int bx, by, bz; - @Override public boolean renderStandardBlock(Block block, int x, int y, int z) { + @Override + public boolean renderStandardBlock(Block block, int x, int y, int z) { bx = x; by = y; bz = z; @@ -146,7 +153,8 @@ public class RenderBlocksCTM extends RenderBlocks { return res; } - /* This method fills a 3x3 grid of light values based on the four corners, by averaging them together. + /* @formatter:off + * This method fills a 3x3 grid of light values based on the four corners, by averaging them together. * * 2 TL x TR * @@ -161,6 +169,7 @@ public class RenderBlocksCTM extends RenderBlocks { * * shakes fist in anger */ + // @formatter:on void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) { lightmap[0][0] = bottomLeft; lightmap[2][0] = bottomRight; @@ -229,8 +238,8 @@ public class RenderBlocksCTM extends RenderBlocks { sunlightBitChannel += (light & 0xF00000); } - return ((blockLightBitChannel / lightVals.length) & 0xFF) | ((redBitChannel / lightVals.length) & 0xF00) | ((greenBitChannel / lightVals.length) & 0xF000) | ( - (blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000); + return ((blockLightBitChannel / lightVals.length) & 0xFF) | ((redBitChannel / lightVals.length) & 0xF00) | ((greenBitChannel / lightVals.length) & 0xF000) + | ((blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000); } void side(SubSide side, int iconIndex) { @@ -254,7 +263,8 @@ public class RenderBlocksCTM extends RenderBlocks { side.render(this); } - @Override public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { + @Override + public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -281,7 +291,8 @@ public class RenderBlocksCTM extends RenderBlocks { } } - @Override public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) { + @Override + public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -307,7 +318,8 @@ public class RenderBlocksCTM extends RenderBlocks { } } - @Override public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) { + @Override + public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -333,7 +345,8 @@ public class RenderBlocksCTM extends RenderBlocks { } } - @Override public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) { + @Override + public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -359,7 +372,8 @@ public class RenderBlocksCTM extends RenderBlocks { } } - @Override public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) { + @Override + public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; @@ -385,7 +399,8 @@ public class RenderBlocksCTM extends RenderBlocks { } } - @Override public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) { + @Override + public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) { if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) { IIcon i = rendererOld.overrideBlockTexture; From c647044006d15da17309beddf860b8bd9ce5d795 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 22 Apr 2015 18:00:56 -0400 Subject: [PATCH 10/16] Implement ISubmapManager for custom IIcon handling --- .../chisel/carving/CarvableHelper.java | 30 +++++++++++++++---- .../chisel/carving/CarvableVariation.java | 3 ++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index d068a488..10f0143b 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -2,7 +2,6 @@ package com.cricketcraft.chisel.carving; import java.util.ArrayList; import java.util.List; -import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockPane; @@ -14,6 +13,8 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraftforge.oredict.OreDictionary; +import org.apache.commons.lang3.ArrayUtils; + import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.client.render.CTM; import com.cricketcraft.chisel.client.render.TextureSubmap; @@ -46,16 +47,21 @@ public class CarvableHelper { R16("r16"), R9("r9"), R4("r4"), - NORMAL; + NORMAL, + CUSTOM; + private static final TextureType[] VALUES; private String[] suffixes; + static { + VALUES = ArrayUtils.subarray(values(), 0, values().length - 1); + } private TextureType(String... suffixes) { this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes; } public static TextureType getTypeFor(String path) { - for (TextureType t : values()) { + for (TextureType t : VALUES) { boolean matches = true; for (String s : t.suffixes) { String res = "".equals(s) ? path + ".png" : path + "-" + s + ".png"; @@ -67,12 +73,10 @@ public class CarvableHelper { return t; } } - return null; + return CUSTOM; } } - private static final Random rand = new Random(); - public ArrayList variations = new ArrayList(); CarvableVariation[] map = new CarvableVariation[16]; public boolean forbidChiseling = false; @@ -95,6 +99,10 @@ public class CarvableHelper { } public void addVariation(String description, int metadata, String texture, Block block, int blockMeta) { + addVariation(description, metadata, texture, block, blockMeta); + } + + public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, ISubmapManager customManager) { if (variations.size() >= 16) return; @@ -112,6 +120,10 @@ public class CarvableHelper { variation.texture = texture; String path = "/assets/" + Chisel.MOD_ID + "/textures/blocks/" + variation.texture; variation.type = (TextureType) TextureType.getTypeFor(path); + if (variation.type == TextureType.CUSTOM && customManager == null) { + throw new IllegalArgumentException(String.format("Could not find texture for block %s, and no custom texture manager was provided.", block)); + } + variation.manager = customManager; } else { variation.block = block; variation.type = TextureType.TOPBOTSIDE; @@ -178,6 +190,8 @@ public class CarvableHelper { return variation.variations9.icons[4]; case R4: return variation.variations9.icons[0]; + case CUSTOM: + return variation.manager.getIcon(side, metadata); } return GeneralClient.getMissingIcon(); @@ -297,6 +311,8 @@ public class CarvableHelper { // rand.setSeed(indexRan); // Broken return variation.variations9.icons[ /* rand */indexRan % ((variation.type == TextureType.R9) ? 9 : 4)]; + case CUSTOM: + return variation.manager.getIcon(world, x, y, z, side); } return GeneralClient.getMissingIcon(); @@ -413,6 +429,8 @@ public class CarvableHelper { case R4: variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r4"), 2, 2); break; + case CUSTOM: + variation.manager.registerIcons(modName, block, register); } } } diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java index 9d3254f4..30e3d866 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; import net.minecraft.util.IIcon; +import com.cricketcraft.chisel.carving.CarvableHelper.ISubmapManager; import com.cricketcraft.chisel.carving.CarvableHelper.TextureType; import com.cricketcraft.chisel.client.render.TextureSubmap; @@ -29,6 +30,8 @@ public class CarvableVariation { public TextureSubmap submap; public TextureSubmap submapSmall; + + public ISubmapManager manager; public String getDescription() { return I18n.format(descriptionUnloc); From 3b62791a0f1a4ebe660f353a9c4f94ab29542da2 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 22 Apr 2015 21:04:40 -0400 Subject: [PATCH 11/16] Implement Fake AE Controller with the new ISubmapManager system --- .../com/cricketcraft/chisel/Features.java | 4 +- .../chisel/carving/CarvableHelper.java | 18 +++-- .../chisel/client/render/CTM.java | 76 +++++++++++------- .../chisel/client/render/RenderBlocksCTM.java | 14 ++-- .../client/render/RenderBlocksCTMNoLight.java | 14 ++-- .../client/render/RenderBlocksColumn.java | 5 +- .../render/SubmapManagerFakeController.java | 45 +++++++++++ .../blocks/futura/WIP/controllerWIP-ctm.png | Bin 0 -> 7444 bytes .../blocks/futura/WIP/controllerWIP-ctm1.png | Bin 6824 -> 0 bytes .../futura/WIP/controllerWIP-ctm1.png.mcmeta | 5 -- .../blocks/futura/WIP/controllerWIP-ctm2.png | Bin 7106 -> 0 bytes .../futura/WIP/controllerWIP-ctm2.png.mcmeta | 5 -- .../blocks/futura/WIP/controllerWIP-ctm3.png | Bin 7354 -> 0 bytes .../futura/WIP/controllerWIP-ctm3.png.mcmeta | 5 -- .../blocks/futura/WIP/controllerWIP.png | Bin 6037 -> 0 bytes .../futura/WIP/controllerWIP.png.mcmeta | 18 ----- 16 files changed, 124 insertions(+), 85 deletions(-) create mode 100644 src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java create mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm1.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm1.png.mcmeta delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm2.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm2.png.mcmeta delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm3.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm3.png.mcmeta delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP.png.mcmeta diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index a0504edc..0eddf39b 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -6,6 +6,7 @@ import com.cricketcraft.chisel.carving.CarvableHelper; import com.cricketcraft.chisel.carving.CarvableVariation; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.carving.CarvingGroup; +import com.cricketcraft.chisel.client.render.SubmapManagerFakeController; import com.cricketcraft.chisel.config.Configurations; import com.cricketcraft.chisel.entity.EntityBallOMoss; import com.cricketcraft.chisel.entity.EntityCloudInABottle; @@ -17,6 +18,7 @@ import com.cricketcraft.chisel.item.*; import com.cricketcraft.chisel.item.chisel.ItemChisel; import com.cricketcraft.chisel.item.chisel.ItemChisel.ChiselType; import com.google.common.collect.Lists; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @@ -724,7 +726,7 @@ public enum Features { */).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10F); futura.carverHelper.addVariation("tile.futura.0.desc", 0, "futura/WIP/screenMetallicWIP"); futura.carverHelper.addVariation("tile.futura.1.desc", 1, "futura/WIP/screenCyanWIP"); - futura.carverHelper.addVariation("tile.futura.2.desc", 2, "futura/WIP/controllerWIP"); + futura.carverHelper.addVariation("tile.futura.2.desc", 2, "futura/WIP/controllerWIP", futura, 2, new SubmapManagerFakeController()); futura.carverHelper.addVariation("tile.futura.3.desc", 3, "futura/WIP/wavyWIP"); futura.carverHelper.registerAll(futura, "futura"); Carving.chisel.registerOre("futura", "futura"); diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index 10f0143b..87419c0f 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -76,6 +76,8 @@ public class CarvableHelper { return CUSTOM; } } + + private static CTM ctm = CTM.getInstance(); public ArrayList variations = new ArrayList(); CarvableVariation[] map = new CarvableVariation[16]; @@ -99,7 +101,7 @@ public class CarvableHelper { } public void addVariation(String description, int metadata, String texture, Block block, int blockMeta) { - addVariation(description, metadata, texture, block, blockMeta); + addVariation(description, metadata, texture, block, blockMeta, null); } public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, ISubmapManager customManager) { @@ -224,8 +226,8 @@ public class CarvableHelper { return variation.iconTop; Block block = world.getBlock(x, y, z); - boolean topConnected = CTM.isConnected(world, x, y + 1, z, side, block, metadata); - boolean botConnected = CTM.isConnected(world, x, y - 1, z, side, block, metadata); + boolean topConnected = ctm.isConnected(world, x, y + 1, z, side, block, metadata); + boolean botConnected = ctm.isConnected(world, x, y - 1, z, side, block, metadata); if (topConnected && botConnected) return variation.seamsCtmVert.icons[2]; @@ -239,18 +241,18 @@ public class CarvableHelper { if (side < 2) return variation.iconTop; - Block block = CTM.getBlockOrFacade(world, x, y, z, side); + Block block = ctm.getBlockOrFacade(world, x, y, z, side); boolean p; boolean n; boolean reverse = side == 2 || side == 4; if (side < 4) { - p = CTM.isConnected(world, x - 1, y, z, side, block, metadata); - n = CTM.isConnected(world, x + 1, y, z, side, block, metadata); + p = ctm.isConnected(world, x - 1, y, z, side, block, metadata); + n = ctm.isConnected(world, x + 1, y, z, side, block, metadata); } else { - p = CTM.isConnected(world, x, y, z - 1, side, block, metadata); - n = CTM.isConnected(world, x, y, z + 1, side, block, metadata); + p = ctm.isConnected(world, x, y, z - 1, side, block, metadata); + n = ctm.isConnected(world, x, y, z + 1, side, block, metadata); } if (p && n) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java index 3792811c..fba44f1b 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/CTM.java @@ -68,7 +68,7 @@ import static net.minecraftforge.common.util.ForgeDirection.*; */ public class CTM { - enum Dir { + public enum Dir { TOP(UP), TOP_RIGHT(UP, EAST), @@ -89,7 +89,7 @@ public class CTM { this.dirs = dirs; } - private boolean isConnected(IBlockAccess world, int x, int y, int z, int sideIdx, Block block, int meta) { + private boolean isConnected(CTM inst, IBlockAccess world, int x, int y, int z, int sideIdx, Block block, int meta) { ForgeDirection side = getOrientation(sideIdx); ForgeDirection[] dirs = getNormalizedDirs(side); for (ForgeDirection dir : dirs) { @@ -97,14 +97,15 @@ public class CTM { y += dir.offsetY; z += dir.offsetZ; } - return CTM.isConnected(world, x, y, z, side, block, meta); + return inst.isConnected(world, x, y, z, side, block, meta); } private ForgeDirection[] getNormalizedDirs(ForgeDirection normal) { if (normal == NORMAL) { return dirs; } else if (normal == NORMAL.getOpposite()) { - // If this is the opposite direction of the default normal, we need to mirror the dirs + // If this is the opposite direction of the default normal, we + // need to mirror the dirs // A mirror version does not affect y+ and y- so we ignore those ForgeDirection[] ret = new ForgeDirection[dirs.length]; for (int i = 0; i < ret.length; i++) { @@ -113,11 +114,12 @@ public class CTM { return ret; } else { ForgeDirection axis = null; - // Next, we need different a different rotation axis depending + // Next, we need different a different rotation axis depending // on if this is up/down or not if (normal.offsetY == 0) { - // If it is not up/down, pick either the left or right-hand rotation - axis = normal == NORMAL.getRotation(UP) ? UP : DOWN; + // If it is not up/down, pick either the left or right-hand + // rotation + axis = normal == NORMAL.getRotation(UP) ? UP : DOWN; } else { // If it is up/down, pick either the up or down rotation. axis = normal == UP ? NORMAL.getRotation(DOWN) : NORMAL.getRotation(UP); @@ -133,10 +135,13 @@ public class CTM { } /** Some hardcoded offset values for the different corner indeces */ - private static int[] submapOffsets = { 4, 5, 1, 0 }; - private static TIntObjectMap submapMap = new TIntObjectHashMap(); + private int[] submapOffsets = { 4, 5, 1, 0 }; + private TIntObjectMap submapMap = new TIntObjectHashMap(); private static EnumMap connectionMap = Maps.newEnumMap(Dir.class); - static { + + public boolean disableObscuredFaceCheck = false; + + private CTM() { for (Dir dir : Dir.VALUES) { connectionMap.put(dir, false); } @@ -146,31 +151,43 @@ public class CTM { submapMap.put(2, new Dir[] { TOP, RIGHT, TOP_RIGHT }); submapMap.put(3, new Dir[] { TOP, LEFT, TOP_LEFT }); } + + public static CTM getInstance() { + return new CTM(); + } - public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { + public int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { int[] ret = new int[] { 18, 19, 17, 16 }; if (world == null) { return ret; } - + Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); - // Build connections - for (Dir dir : Dir.VALUES) { - connectionMap.put(dir, dir.isConnected(world, x, y, z, side, block, meta)); - } - + buildConnectionMap(world, x, y, z, side, block, meta); + // Map connections to submap indeces for (int i = 0; i < 4; i++) { fillSubmaps(ret, i); } - + return ret; } - private static void fillSubmaps(int[] ret, int idx) { + /** + * Builds the connection map and stores it in this class. The + * {@link #connected(Dir)}, {@link #connectedAnd(Dir...)}, and + * {@link #connectedOr(Dir...)} methods can be used to access it. + */ + public void buildConnectionMap(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) { + for (Dir dir : Dir.VALUES) { + connectionMap.put(dir, dir.isConnected(this, world, x, y, z, side, block, meta)); + } + } + + private void fillSubmaps(int[] ret, int idx) { Dir[] dirs = submapMap.get(idx); if (connectedOr(dirs[0], dirs[1])) { if (connectedAnd(dirs)) { @@ -187,10 +204,11 @@ public class CTM { } } - private static boolean connected(Dir dir) { + public boolean connected(Dir dir) { return connectionMap.get(dir); } - private static boolean connectedAnd(Dir... dirs) { + + public boolean connectedAnd(Dir... dirs) { for (Dir dir : dirs) { if (!connected(dir)) { return false; @@ -198,8 +216,8 @@ public class CTM { } return true; } - - private static boolean connectedOr(Dir... dirs) { + + private boolean connectedOr(Dir... dirs) { for (Dir dir : dirs) { if (connected(dir)) { return true; @@ -208,18 +226,18 @@ public class CTM { return false; } - public static boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) { + public boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) { ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[side]; return isConnected(world, x, y, z, dir, block, meta); } - public static boolean isConnected(IBlockAccess world, int x, int y, int z, ForgeDirection dir, Block block, int meta) { + public boolean isConnected(IBlockAccess world, int x, int y, int z, ForgeDirection dir, Block block, int meta) { int x2 = x + dir.offsetX; int y2 = y + dir.offsetY; int z2 = z + dir.offsetZ; Block con = getBlockOrFacade(world, x, y, z, dir.ordinal()); - Block obscuring = getBlockOrFacade(world, x2, y2, z2, dir.ordinal()); + Block obscuring = disableObscuredFaceCheck ? null : getBlockOrFacade(world, x2, y2, z2, dir.ordinal()); // no block or a bad API user if (con == null) { @@ -230,7 +248,7 @@ public class CTM { // no block obscuring this face if (obscuring == null) { - return true; + return ret; } // check that we aren't already connected outwards from this side @@ -239,7 +257,7 @@ public class CTM { return ret; } - public static int getBlockOrFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) { + public int getBlockOrFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) { Block blk = world.getBlock(x, y, z); if (blk instanceof IFacade) { return ((IFacade) blk).getFacadeMetadata(world, x, y, z, side); @@ -247,7 +265,7 @@ public class CTM { return world.getBlockMetadata(x, y, z); } - public static Block getBlockOrFacade(IBlockAccess world, int x, int y, int z, int side) { + public Block getBlockOrFacade(IBlockAccess world, int x, int y, int z, int side) { Block blk = world.getBlock(x, y, z); if (blk instanceof IFacade) { blk = ((IFacade) blk).getFacade(world, x, y, z, side); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index bda78b55..cedab2c0 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -104,6 +104,8 @@ public class RenderBlocksCTM extends RenderBlocks { xmax.render(inst, 3); } } + + private static CTM ctm = CTM.getInstance(); // globals added to save the JVM some trouble. No need to constantly create // and destroy ints if we don't have to @@ -273,7 +275,7 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 4); fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap); @@ -301,7 +303,7 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMinU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMinU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 5); fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight); fillColormap(colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, redmap); @@ -328,7 +330,7 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV()); tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 2); fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft); fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap); @@ -355,7 +357,7 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 3); fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap); @@ -382,7 +384,7 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV()); tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 0); fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft); fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap); @@ -409,7 +411,7 @@ public class RenderBlocksCTM extends RenderBlocks { tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 1); fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight); fillColormap(colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, redmap); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java index 8f8a9040..541fe27c 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java @@ -7,6 +7,8 @@ import net.minecraft.util.IIcon; public class RenderBlocksCTMNoLight extends RenderBlocks { + private static CTM ctm = CTM.getInstance(); + RenderBlocksCTMNoLight() { super(); resetVertices(); @@ -82,7 +84,7 @@ public class RenderBlocksCTMNoLight extends RenderBlocks { tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 4); side(1, 14, 9, 23, tex[0], false); side(23, 9, 17, 5, tex[1], false); @@ -101,7 +103,7 @@ public class RenderBlocksCTMNoLight extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMinU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMinU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 5); side(11, 21, 3, 15, tex[3], false); side(16, 7, 21, 11, tex[2], false); @@ -120,7 +122,7 @@ public class RenderBlocksCTMNoLight extends RenderBlocks { tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV()); tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 2); side(2, 15, 8, 22, tex[0], false); side(15, 3, 18, 8, tex[2], false); @@ -139,7 +141,7 @@ public class RenderBlocksCTMNoLight extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 3); side(17, 4, 20, 10, tex[2], false); side(5, 17, 10, 24, tex[0], false); @@ -158,7 +160,7 @@ public class RenderBlocksCTMNoLight extends RenderBlocks { tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV()); tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 0); side(13, 21, 7, 20, tex[3], true); side(19, 13, 20, 4, tex[2], true); @@ -177,7 +179,7 @@ public class RenderBlocksCTMNoLight extends RenderBlocks { tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV()); tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV()); } else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1); + int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 1); side(12, 24, 6, 25, tex[3], false); side(22, 12, 25, 2, tex[1], false); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java index 629175cf..4e2874f8 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java @@ -10,14 +10,15 @@ public class RenderBlocksColumn extends RenderBlocks { TextureSubmap submap; IIcon iconTop; IIcon sides[] = new IIcon[6]; + CTM ctm = CTM.getInstance(); RenderBlocksColumn() { super(); } boolean connected(IBlockAccess world, int x, int y, int z, Block block, int meta) { - Block inWorld = CTM.getBlockOrFacade(world, x, y, z, -1); - return inWorld != null && inWorld.equals(block) && CTM.getBlockOrFacadeMetadata(world, x, y, z, -1) == meta; + Block inWorld = ctm.getBlockOrFacade(world, x, y, z, -1); + return inWorld != null && inWorld.equals(block) && ctm.getBlockOrFacadeMetadata(world, x, y, z, -1) == meta; } @Override diff --git a/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java new file mode 100644 index 00000000..8dbf9f7e --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java @@ -0,0 +1,45 @@ +package com.cricketcraft.chisel.client.render; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import com.cricketcraft.chisel.carving.CarvableHelper.ISubmapManager; +import com.cricketcraft.chisel.init.ChiselBlocks; + +import static com.cricketcraft.chisel.client.render.CTM.Dir.*; + +public class SubmapManagerFakeController implements ISubmapManager { + + private TextureSubmap map; + private CTM ctm = CTM.getInstance(); + + public SubmapManagerFakeController() { + ctm.disableObscuredFaceCheck = true; + } + + @Override + public IIcon getIcon(int side, int meta) { + return map.icons[0]; + } + + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, 2); + if (ctm.connectedAnd(TOP, BOTTOM, LEFT, RIGHT)) { + return map.icons[3]; + } else if (ctm.connectedAnd(TOP, BOTTOM)) { + return map.icons[2]; + } else if (ctm.connectedAnd(LEFT, RIGHT)) { + return map.icons[1]; + } else { + return map.icons[0]; + } + } + + @Override + public void registerIcons(String modName, Block block, IIconRegister register) { + map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controllerWIP-ctm"), 2, 2); + } +} diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm.png b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm.png new file mode 100644 index 0000000000000000000000000000000000000000..82059bb8336e92d62767585fc7041fa675656b7e GIT binary patch literal 7444 zcmc&$cU)6f8$S1Dk&v(wA|NBk1_40{OB4tz0)mJjxWEt~jDR74;*l8p@nS_M$p9b)3-zpxD>OC`z-};_=?|skZR0H7EP3+C$_uS-_05pCHfYH_Wob`GDbc+FK zI77N0K73x%mC9TnSJ%SALKm4-;sQ5RH9jj)Df zq#huA`&<)%Tl)s^CbAWj4=z$26MvPF)wTw7K}w;F<1hYgr#9}EFYVJeSwu>O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WIh%~auQ(_$;H(1=QQfgp*i%a z8Xy-X3lJvf)$yk^nwo$#YE}m`96{wd&jl4WJ~sLu5udG%tVm8p64H z4sztC5JnN^(NHyjlBgJ(BO#24LmEvv$iY0)pa^;BSD*KO6rVhG3g%S<3DqMMAP!~gp4SM<}f0TtVbB; z5GH%bz7HBeVpLS!1m{qrDUUc5Q7!Ufs2&UqG%Sf~3J=@n^zE`|| zUZ7T8k2u7m2>l=J067T->T}4Eho(IF4#}9TMfigTpcp2Q2}SaP>bNfrxeggaKiM<7 VQ~BoMzKho&FAg3VR3Df$@4v^8n}q-X literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm1.png b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm1.png deleted file mode 100644 index c7625808b0479fd948171effde59f61a92b9851d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6824 zcmbW5c{tQ-|Hr>G24i0`RQ9pNke$jl!x$u4hp}c!MvG7iVT^t2gd$rsl6{SkEnA`? zqHG~sLJEYvz96ulM`?nRp8`BM#Q1tN;LT zoHjPFqOT|b00U4a`jblKrEL1b;%jVw9RS#Pe|>|7rwLR5U^TypMq5~T`S|->_ww-- zJB>z*`Cjw!ym;jT00h3zvBqPqSNL^yK77|d6Gu!v<6{MbidpF=68Tc35#lV|CUN3< z6EMpT9t;K|*h`9IxO0bi8)hlbp1?ZJ{89YToyh#S1oGZoaQ@}dmYq+p59-Erm&&(t zY6qFyq3rjKRV~$t>?QglJhPEKFJ8`lR6vEZO8Nra&{_}i>-!QQV3(k+EeCIBehz>F z-?Bl0_OsdTNqr%%wQ1Um?{nfkx~G$Ll@!<052_|e9$%l1K246e4b}soC3y=14^fH zp2k3R1JFLe%~k_I*#RZXxM*1b5)8QZN=O6(QJDar;U-S|n_MOL5`unGnKjytlBY1? zj?m+N%s8Bah|Iug0XaSmH?Uh4N})3-^N32g8rSSrKLC(YVDw+RwI4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SyOKKQNAR{Wh@a2pwXvrq{>u1rKQy^I&~Pzrq`OxwMeA zVII0$pLCPy zrPV|QtQ6?EI7APq$E$t&m=TObXL&VNo}f0%io?yT(? bjR_EO>Tq>E)3ZhYD*!l+F*B&tca8WTMWvJp diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm1.png.mcmeta b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm1.png.mcmeta deleted file mode 100644 index 68df5399..00000000 --- a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm1.png.mcmeta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "animation": { - "frametime": 5 - } -} \ No newline at end of file diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm2.png b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm2.png deleted file mode 100644 index 5128d610bbb3e88bded587d73add8216b4f83e55..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7106 zcmeI0S6mb8y2d942{j;sihzXPdr?~GO^{wil%fez1QDfUK&m1LC{>z>bWj38s-Xx- z2~BD!A|0ei@0=)So$cCdpWoVRpM7yI_QlLMzi-}~nfICJ{XY|?r=w0ucAg9X07^{_ z6$8Sm001Wd5@N!YXrX-)VIg(VFuw-??2UV8IP_I*O}8JG_QPlL*OJj4 z5G)BrtcIAr1d1X@>B6ZmkD3}9$0r39{K?o|0BRESO_qBHY#?CUPga(X6$_~WKps8h zBmnkG5>}Wo4ePbPs?^-cIla0T$0$=s;;v0POUwP!+&V2FUL)d8`VU2?MkUtp+JzKmZWdG(~6t zZ_5BIj+(p}AfW(+^+SVr03vU|s+o<=0|-n2Xw_CtWxw+kQqS-b-c&-dY&pA>s=oz^ zz+H%`so(`}oaR|RT1o2@)`<#&b)E_IqW?7fKhgj#yi}PmgNuB(>MSWLNod< z09;pL7c^=?%Quk#fJ&M_?^{KN_1bg%SYpQ7lf$*-`&N>HO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98n{0yi(B#Q*>R diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm2.png.mcmeta b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm2.png.mcmeta deleted file mode 100644 index 68df5399..00000000 --- a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm2.png.mcmeta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "animation": { - "frametime": 5 - } -} \ No newline at end of file diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm3.png b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP-ctm3.png deleted file mode 100644 index b9c0954d3a19c617a25279cf6b19e8148a129b30..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7354 zcmeHLXIN8Pn>`_r(1QZf1OliaNN>_Zk)j|V9R%rB1OcUELI)K@q<58Gr38_Hp$I4) z1f)oZ2uKY`hlxIO@7#O8Z|0jj&-|Dl^CR!h-tT+z(Q$P1a`SX_bBAjv zE5qGA-0Yq1+5v#iScaa1zTVO~x!uWar5lmR7dPB)(UZb&DLqEg#a-g%Afve+$&oWk zuiJFy+BIU9j_gQqObqe~z3vstX!0-6d5)JcA+I8%KON5azj7JI>@Ien)QrgEO7Iy~ zy-+MEWum&Mt~ipiP>Jo#bVz$^+swQG0!4no9iSntvgPnR<^lnGL9()ZoLFch0P-26 zAO)~mX;`825vQv6tcx0?b};(1Wt$0648(qzd3D1C;a{MqdMrg#bGH8?92n7k)rU!^mD8 zsHg?7Jv0=R04XIPq#GG_86frtEIYWke1OmtfKGMGNOqI2j0VR`*r}9C*}4l-*HC7p z{P&?oMgnX+JsJ#rbP`rXR;dVqX5SPh5tJBg8s7x~*>UuQyTu>-^iY@e^hm^@sqgSF zzlWT1T3gSZEc6z;6CT`*S5W`S6~QWIqznYjd*XmxocZ9 z_k8bjvQX=Z#aOkYT8h&n)Oayg@vo?rfOap2T;cIwI@ zSbjDmSxQ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_H*UKT4u4xocCicUFPIdn64*xgqK-fJ0FUd9+HmL3LU8y|1aO^v?P$#|F zTK!u|oD|8!57Hr=;91=FxK{j*47%g$(K8wbQUg~hrQ7D9U z-ayz(jj!WOvfe~dof+yyV3iBTAbP|QYZIa_xnYGgg$jCul0a2w&__%@uh-}R*s^tQj|VS@s1wi7x;Tlh`P6b zP6pISd79GxJw{Y>rkW_CDup$Ngf5eS=OlzVHj|Wkd(u|86bXo-T!)|y;BBBYS{l}y zP5jas?FaMC-wLwhaCw*}jgTs1HL*m8T&RHQ;;W$A86AFU=QrQ~i*!!|Pc!g?|7Q1p f$*yolM>rjbcZDtUN5a&J_a2~o)kw1ng^v6WS;g%- diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP.png.mcmeta b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP.png.mcmeta deleted file mode 100644 index b695b035..00000000 --- a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerWIP.png.mcmeta +++ /dev/null @@ -1,18 +0,0 @@ -{ - "animation": { - "width": 64, - "height": 48, - "frametime": 1, - "frames": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - ] - } -} \ No newline at end of file From be707a89fe253b2e026f68f4fe8d1992bb4a6370 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 22 Apr 2015 21:47:44 -0400 Subject: [PATCH 12/16] Clean up CTM documentation and move to API --- eclipseFormat.xml | 2 +- .../{client/render => api/client}/CTM.java | 185 ++++++++++-------- .../chisel/carving/CarvableHelper.java | 2 +- .../chisel/client/render/RenderBlocksCTM.java | 3 +- .../client/render/RenderBlocksCTMNoLight.java | 2 + .../client/render/RenderBlocksColumn.java | 2 + .../render/SubmapManagerFakeController.java | 3 +- .../chisel/config/Configurations.java | 6 +- 8 files changed, 114 insertions(+), 91 deletions(-) rename src/main/java/com/cricketcraft/chisel/{client/render => api/client}/CTM.java (63%) diff --git a/eclipseFormat.xml b/eclipseFormat.xml index 0c657bc6..9c789066 100644 --- a/eclipseFormat.xml +++ b/eclipseFormat.xml @@ -64,7 +64,7 @@ - + diff --git a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java b/src/main/java/com/cricketcraft/chisel/api/client/CTM.java similarity index 63% rename from src/main/java/com/cricketcraft/chisel/client/render/CTM.java rename to src/main/java/com/cricketcraft/chisel/api/client/CTM.java index fba44f1b..32567289 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/api/client/CTM.java @@ -1,4 +1,4 @@ -package com.cricketcraft.chisel.client.render; +package com.cricketcraft.chisel.api.client; import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.TIntObjectHashMap; @@ -10,19 +10,17 @@ import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; import com.cricketcraft.chisel.api.IFacade; -import com.cricketcraft.chisel.config.Configurations; import com.google.common.collect.Maps; -import static com.cricketcraft.chisel.client.render.CTM.Dir.*; -import static net.minecraftforge.common.util.ForgeDirection.*; +import static com.cricketcraft.chisel.api.client.Dir.*; +// @formatter:off /** - * @formatter:off * The CTM renderer will draw the block's FACE using by assembling 4 quadrants from the 5 available block * textures. The normal Texture.png is the blocks "unconnected" texture, and is used when CTM is disabled or the block * has nothing to connect to. This texture has all of the outside corner quadrants The texture-ctm.png contains the * rest of the quadrants. - * + *

* ┌─────────────────┐ ┌────────────────────────────────┐ * │ texture.png │ │ texture-ctm.png │ * │ ╔══════╤══════╗ │ │ ──────┼────── ║ ─────┼───── ║ │ @@ -40,9 +38,9 @@ import static net.minecraftforge.common.util.ForgeDirection.*; * │ │ 12 │ 13 ││ 14 │ 15 │ │ * │ ═══════╧═══════╗ ─────┼───── ╔ │ * └────────────────────────────────┘ - * + *
* combining { 18, 13, 9, 16 }, we can generate a texture connected to the right! - * + *
* ╔══════╤═══════ * ║ │ │ * ║ 16 │ 9 │ @@ -50,10 +48,10 @@ import static net.minecraftforge.common.util.ForgeDirection.*; * ║ │ │ * ║ 18 │ 13 │ * ╚══════╧═══════ - * + *
* * combining { 18, 13, 11, 2 }, we can generate a texture, in the shape of an L (connected to the right, and up - * + *
* ║ ─────┼───── ╚ * ║ │ │ * ║ 2 │ 11 │ @@ -61,86 +59,23 @@ import static net.minecraftforge.common.util.ForgeDirection.*; * ║ │ │ * ║ 18 │ 13 │ * ╚══════╧═══════ - * + *
* * HAVE FUN! * -CptRageToaster- */ +// @formatter:on public class CTM { - public enum Dir { - - TOP(UP), - TOP_RIGHT(UP, EAST), - RIGHT(EAST), - BOTTOM_RIGHT(DOWN, EAST), - BOTTOM(DOWN), - BOTTOM_LEFT(DOWN, WEST), - LEFT(WEST), - TOP_LEFT(UP, WEST); - // @formatter:on - - private static final ForgeDirection NORMAL = SOUTH; - private static final Dir[] VALUES = values(); - - private ForgeDirection[] dirs; - - private Dir(ForgeDirection... dirs) { - this.dirs = dirs; - } - - private boolean isConnected(CTM inst, IBlockAccess world, int x, int y, int z, int sideIdx, Block block, int meta) { - ForgeDirection side = getOrientation(sideIdx); - ForgeDirection[] dirs = getNormalizedDirs(side); - for (ForgeDirection dir : dirs) { - x += dir.offsetX; - y += dir.offsetY; - z += dir.offsetZ; - } - return inst.isConnected(world, x, y, z, side, block, meta); - } - - private ForgeDirection[] getNormalizedDirs(ForgeDirection normal) { - if (normal == NORMAL) { - return dirs; - } else if (normal == NORMAL.getOpposite()) { - // If this is the opposite direction of the default normal, we - // need to mirror the dirs - // A mirror version does not affect y+ and y- so we ignore those - ForgeDirection[] ret = new ForgeDirection[dirs.length]; - for (int i = 0; i < ret.length; i++) { - ret[i] = dirs[i].offsetY != 0 ? dirs[i] : dirs[i].getOpposite(); - } - return ret; - } else { - ForgeDirection axis = null; - // Next, we need different a different rotation axis depending - // on if this is up/down or not - if (normal.offsetY == 0) { - // If it is not up/down, pick either the left or right-hand - // rotation - axis = normal == NORMAL.getRotation(UP) ? UP : DOWN; - } else { - // If it is up/down, pick either the up or down rotation. - axis = normal == UP ? NORMAL.getRotation(DOWN) : NORMAL.getRotation(UP); - } - ForgeDirection[] ret = new ForgeDirection[dirs.length]; - // Finally apply all the rotations - for (int i = 0; i < ret.length; i++) { - ret[i] = dirs[i].getRotation(axis); - } - return ret; - } - } - } - /** Some hardcoded offset values for the different corner indeces */ private int[] submapOffsets = { 4, 5, 1, 0 }; private TIntObjectMap submapMap = new TIntObjectHashMap(); private static EnumMap connectionMap = Maps.newEnumMap(Dir.class); - - public boolean disableObscuredFaceCheck = false; - + /** For use via the Chisel 2 config only, altering this could cause unintended behavior */ + public static boolean disableObscuredFaceCheckConfig = false; + + public Boolean disableObscuredFaceCheck = null; + private CTM() { for (Dir dir : Dir.VALUES) { connectionMap.put(dir, false); @@ -151,11 +86,16 @@ public class CTM { submapMap.put(2, new Dir[] { TOP, RIGHT, TOP_RIGHT }); submapMap.put(3, new Dir[] { TOP, LEFT, TOP_LEFT }); } - + public static CTM getInstance() { return new CTM(); } + /** + * @return The indeces of the typical 4x4 submap to use for the given face at the given location. + * + * Indeces are in counter-clockwise order starting at bottom right. + */ public int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { int[] ret = new int[] { 18, 19, 17, 16 }; @@ -177,9 +117,7 @@ public class CTM { } /** - * Builds the connection map and stores it in this class. The - * {@link #connected(Dir)}, {@link #connectedAnd(Dir...)}, and - * {@link #connectedOr(Dir...)} methods can be used to access it. + * Builds the connection map and stores it in this CTM instance. The {@link #connected(Dir)}, {@link #connectedAnd(Dir...)}, and {@link #connectedOr(Dir...)} methods can be used to access it. */ public void buildConnectionMap(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) { for (Dir dir : Dir.VALUES) { @@ -204,10 +142,20 @@ public class CTM { } } + /** + * @param dir + * The direction to check connection in. + * @return True if the cached connectionMap holds a connection in this {@link Dir direction}. + */ public boolean connected(Dir dir) { return connectionMap.get(dir); } + /** + * @param dirs + * The directions to check connection in. + * @return True if the cached connectionMap holds a connection in all the given {@link Dir directions}. + */ public boolean connectedAnd(Dir... dirs) { for (Dir dir : dirs) { if (!connected(dir)) { @@ -217,6 +165,11 @@ public class CTM { return true; } + /** + * @param dirs + * The directions to check connection in. + * @return True if the cached connectionMap holds a connection in one of the given {@link Dir directions}. + */ private boolean connectedOr(Dir... dirs) { for (Dir dir : dirs) { if (connected(dir)) { @@ -226,18 +179,56 @@ public class CTM { return false; } + /** + * A simple check for if the given block can connect to the given direction on the given side. + * + * @param world + * @param x + * The x coordinate of the block to check against. This is not the position of your block. + * @param y + * The y coordinate of the block to check against. This is not the position of your block. + * @param z + * The z coordinate of the block to check against. This is not the position of your block. + * @param side + * The side of the block to check for connection status. This is not the direction to check in. + * @param block + * The block to check against for connection. + * @param meta + * The metadata to check against for connection. + * @return True if the given block can connect to the given location on the given side. + */ public boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) { ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[side]; return isConnected(world, x, y, z, dir, block, meta); } + /** + * A simple check for if the given block can connect to the given direction on the given side. + * + * @param world + * @param x + * The x coordinate of the block to check against. This is not the position of your block. + * @param y + * The y coordinate of the block to check against. This is not the position of your block. + * @param z + * The z coordinate of the block to check against. This is not the position of your block. + * @param dir + * The {@link ForgeDirection side} of the block to check for connection status. This is not the direction to check in. + * @param block + * The block to check against for connection. + * @param meta + * The metadata to check against for connection. + * @return True if the given block can connect to the given location on the given side. + */ public boolean isConnected(IBlockAccess world, int x, int y, int z, ForgeDirection dir, Block block, int meta) { int x2 = x + dir.offsetX; int y2 = y + dir.offsetY; int z2 = z + dir.offsetZ; + boolean disableObscured = disableObscuredFaceCheck == null ? disableObscuredFaceCheckConfig : disableObscuredFaceCheck; + Block con = getBlockOrFacade(world, x, y, z, dir.ordinal()); - Block obscuring = disableObscuredFaceCheck ? null : getBlockOrFacade(world, x2, y2, z2, dir.ordinal()); + Block obscuring = disableObscured ? null : getBlockOrFacade(world, x2, y2, z2, dir.ordinal()); // no block or a bad API user if (con == null) { @@ -252,11 +243,22 @@ public class CTM { } // check that we aren't already connected outwards from this side - ret &= !(obscuring.equals(block) && getBlockOrFacadeMetadata(world, x2, y2, z2, dir.ordinal()) == meta && Configurations.connectInsideCTM); + ret &= !(obscuring.equals(block) && getBlockOrFacadeMetadata(world, x2, y2, z2, dir.ordinal()) == meta); return ret; } + /** + * A utility method to access metadata from both the world and {@link IFacade} blocks in the world. + * + * @param world + * @param x + * @param y + * @param z + * @param side + * The side to check for. -1 for unknown. + * @return The metadata at this position in the world, or inside an {@link IFacade} block. + */ public int getBlockOrFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) { Block blk = world.getBlock(x, y, z); if (blk instanceof IFacade) { @@ -265,6 +267,17 @@ public class CTM { return world.getBlockMetadata(x, y, z); } + /** + * A utility method to access a block from both the world and {@link IFacade} blocks in the world. + * + * @param world + * @param x + * @param y + * @param z + * @param side + * The side to check for. -1 for unknown. + * @return The block at this position in the world, or inside an {@link IFacade} block. + */ public Block getBlockOrFacade(IBlockAccess world, int x, int y, int z, int side) { Block blk = world.getBlock(x, y, z); if (blk instanceof IFacade) { diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index 87419c0f..581aa14d 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -16,7 +16,7 @@ import net.minecraftforge.oredict.OreDictionary; import org.apache.commons.lang3.ArrayUtils; import com.cricketcraft.chisel.Chisel; -import com.cricketcraft.chisel.client.render.CTM; +import com.cricketcraft.chisel.api.client.CTM; import com.cricketcraft.chisel.client.render.TextureSubmap; import com.cricketcraft.chisel.compat.FMPIntegration; import com.cricketcraft.chisel.item.ItemCarvable; diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java index cedab2c0..b5b6ad3b 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTM.java @@ -1,10 +1,11 @@ package com.cricketcraft.chisel.client.render; +import com.cricketcraft.chisel.api.client.CTM; + import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; - import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.Vert.*; import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.SubSide.*; import static com.cricketcraft.chisel.client.render.RenderBlocksCTM.Vert.Y_HALF_X; diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java index 541fe27c..03970684 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksCTMNoLight.java @@ -1,5 +1,7 @@ package com.cricketcraft.chisel.client.render; +import com.cricketcraft.chisel.api.client.CTM; + import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java index 4e2874f8..ca04bfb0 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java @@ -1,5 +1,7 @@ package com.cricketcraft.chisel.client.render; +import com.cricketcraft.chisel.api.client.CTM; + import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.util.IIcon; diff --git a/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java index 8dbf9f7e..d0c485e4 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java @@ -5,10 +5,11 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; +import com.cricketcraft.chisel.api.client.CTM; import com.cricketcraft.chisel.carving.CarvableHelper.ISubmapManager; import com.cricketcraft.chisel.init.ChiselBlocks; -import static com.cricketcraft.chisel.client.render.CTM.Dir.*; +import static com.cricketcraft.chisel.api.client.Dir.*; public class SubmapManagerFakeController implements ISubmapManager { diff --git a/src/main/java/com/cricketcraft/chisel/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index 5e5e6c6a..ea05b6d1 100644 --- a/src/main/java/com/cricketcraft/chisel/config/Configurations.java +++ b/src/main/java/com/cricketcraft/chisel/config/Configurations.java @@ -2,8 +2,11 @@ package com.cricketcraft.chisel.config; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.Features; +import com.cricketcraft.chisel.api.client.CTM; + import net.minecraft.item.ItemDye; import net.minecraftforge.common.config.Configuration; + import org.apache.commons.lang3.StringUtils; import java.util.Locale; @@ -85,7 +88,8 @@ public class Configurations { particlesTickrate = config.get(category, "particleTickrate", 1, "Particle tick rate. Greater value = less particles.").getInt(1); oldPillars = config.get(category, "pillarOldGraphics", false, "Use old pillar textures").getBoolean(false); disableCTM = !config.get(category, "connectedTextures", true, "Enable connected textures").getBoolean(true); - connectInsideCTM = !config.get(category, "connectInsideCTM", false, "Choose whether the inside corner is disconnected on a CTM block - http://imgur.com/eUywLZ4").getBoolean(false); + CTM.disableObscuredFaceCheckConfig = connectInsideCTM = !config.get(category, "connectInsideCTM", false, + "Choose whether the inside corner is disconnected on a CTM block - http://imgur.com/eUywLZ4").getBoolean(false); fancy = config.get(category, "fancyLeaves", true, "Enable fancy textures").getBoolean(true); blockDescriptions = config.get(category, "tooltipsUseBlockDescriptions", true, "Make variations of blocks have the same name, and use the description in tooltip to distinguish them.") .getBoolean(true); From 87ce7b34c3dd563798732b6eb7109aabc8e4a675 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 22 Apr 2015 21:57:39 -0400 Subject: [PATCH 13/16] Add missing Dir file --- .../cricketcraft/chisel/api/client/Dir.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/java/com/cricketcraft/chisel/api/client/Dir.java diff --git a/src/main/java/com/cricketcraft/chisel/api/client/Dir.java b/src/main/java/com/cricketcraft/chisel/api/client/Dir.java new file mode 100644 index 00000000..29ebe6de --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/api/client/Dir.java @@ -0,0 +1,73 @@ +package com.cricketcraft.chisel.api.client; + +import net.minecraft.block.Block; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; + +import static net.minecraftforge.common.util.ForgeDirection.*; + +public enum Dir { + + TOP(UP), + TOP_RIGHT(UP, EAST), + RIGHT(EAST), + BOTTOM_RIGHT(DOWN, EAST), + BOTTOM(DOWN), + BOTTOM_LEFT(DOWN, WEST), + LEFT(WEST), + TOP_LEFT(UP, WEST); + // @formatter:on + + private static final ForgeDirection NORMAL = SOUTH; + public static final Dir[] VALUES = values(); + + private ForgeDirection[] dirs; + + private Dir(ForgeDirection... dirs) { + this.dirs = dirs; + } + + public boolean isConnected(CTM inst, IBlockAccess world, int x, int y, int z, int sideIdx, Block block, int meta) { + ForgeDirection side = getOrientation(sideIdx); + ForgeDirection[] dirs = getNormalizedDirs(side); + for (ForgeDirection dir : dirs) { + x += dir.offsetX; + y += dir.offsetY; + z += dir.offsetZ; + } + return inst.isConnected(world, x, y, z, side, block, meta); + } + + private ForgeDirection[] getNormalizedDirs(ForgeDirection normal) { + if (normal == NORMAL) { + return dirs; + } else if (normal == NORMAL.getOpposite()) { + // If this is the opposite direction of the default normal, we + // need to mirror the dirs + // A mirror version does not affect y+ and y- so we ignore those + ForgeDirection[] ret = new ForgeDirection[dirs.length]; + for (int i = 0; i < ret.length; i++) { + ret[i] = dirs[i].offsetY != 0 ? dirs[i] : dirs[i].getOpposite(); + } + return ret; + } else { + ForgeDirection axis = null; + // Next, we need different a different rotation axis depending + // on if this is up/down or not + if (normal.offsetY == 0) { + // If it is not up/down, pick either the left or right-hand + // rotation + axis = normal == NORMAL.getRotation(UP) ? UP : DOWN; + } else { + // If it is up/down, pick either the up or down rotation. + axis = normal == UP ? NORMAL.getRotation(DOWN) : NORMAL.getRotation(UP); + } + ForgeDirection[] ret = new ForgeDirection[dirs.length]; + // Finally apply all the rotations + for (int i = 0; i < ret.length; i++) { + ret[i] = dirs[i].getRotation(axis); + } + return ret; + } + } +} \ No newline at end of file From 31ea512b486a7d764019623b324c4e1cf78810dd Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 22 Apr 2015 22:04:27 -0400 Subject: [PATCH 14/16] Javadoc typo --- src/main/java/com/cricketcraft/chisel/api/client/CTM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/client/CTM.java b/src/main/java/com/cricketcraft/chisel/api/client/CTM.java index 32567289..a4f4e07a 100644 --- a/src/main/java/com/cricketcraft/chisel/api/client/CTM.java +++ b/src/main/java/com/cricketcraft/chisel/api/client/CTM.java @@ -94,7 +94,7 @@ public class CTM { /** * @return The indeces of the typical 4x4 submap to use for the given face at the given location. * - * Indeces are in counter-clockwise order starting at bottom right. + * Indeces are in counter-clockwise order starting at bottom left. */ public int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) { int[] ret = new int[] { 18, 19, 17, 16 }; From c0f342f09429bfb1874700d4f11fcdd41417f85c Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 23 Apr 2015 00:27:42 -0400 Subject: [PATCH 15/16] Fix accidental reversion of CarvableHelper code during merge --- .../cricketcraft/chisel/carving/CarvableHelper.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index 0f50eb8f..7365ee63 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -63,12 +63,11 @@ public class CarvableHelper { this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes; } - public static TextureType getTypeFor(String path) { + public static TextureType getTypeFor(CarvableHelper inst, String modid, String path) { for (TextureType t : VALUES) { boolean matches = true; for (String s : t.suffixes) { - String res = "".equals(s) ? path + ".png" : path + "-" + s + ".png"; - if (Chisel.class.getResource(res) == null) { + if (!inst.exists(modid, path, s.isEmpty() ? s : "-" + s)) { matches = false; } } @@ -144,10 +143,9 @@ public class CarvableHelper { if (texture != null && FMLCommonHandler.instance().getSide().isClient()) { variation.texture = texture; - String path = "/assets/" + Chisel.MOD_ID + "/textures/blocks/" + variation.texture; - variation.type = (TextureType) TextureType.getTypeFor(path); + variation.type = (TextureType) TextureType.getTypeFor(this, modid, variation.texture); if (variation.type == TextureType.CUSTOM && customManager == null) { - throw new IllegalArgumentException(String.format("Could not find texture for block %s, and no custom texture manager was provided.", block)); + throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture)); } variation.manager = customManager; } else { From dffb73c5b40192c2b09e0bbf1a45e8be2675b0c8 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 23 Apr 2015 00:34:37 -0400 Subject: [PATCH 16/16] CTM refactor is complete, officially dubbing next version 2.4 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 359f6427..acb0a746 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ -mod_version=2.3.10 +mod_version=2.4.0 minecraft_version=1.7.10 forge_version=10.13.2.1291 -waila_version=1.5.8a +waila_version=1.5.10 ccl_version=1.1.1.110 ccc_version=1.0.4.29 nei_version=1.0.3.74