mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 08:17:48 +00:00
Implement Fake AE Controller with the new ISubmapManager system
This commit is contained in:
1 parent
c647044006
commit
3b62791a0f
16 files changed
+124
-85
No files matched your search
@@ -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");
|
||||
|
||||
@@ -76,6 +76,8 @@ public class CarvableHelper {
|
||||
return CUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
private static CTM ctm = CTM.getInstance();
|
||||
|
||||
public ArrayList<CarvableVariation> variations = new ArrayList<CarvableVariation>();
|
||||
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)
|
||||
|
||||
@@ -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<Dir[]> submapMap = new TIntObjectHashMap<Dir[]>();
|
||||
private int[] submapOffsets = { 4, 5, 1, 0 };
|
||||
private TIntObjectMap<Dir[]> submapMap = new TIntObjectHashMap<Dir[]>();
|
||||
private static EnumMap<Dir, Boolean> 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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user