This commit is contained in:
Aidan C. Brady 2015-03-18 07:50:17 -04:00
parent 1b813b4142
commit cc5080d908
2 changed files with 55 additions and 90 deletions

View file

@ -8,78 +8,18 @@ import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
/**
* CTM Logic adapted from Chisel.
* Code licensed under GPLv2
* CTM Logic adapted from Chisel. Code licensed under GPLv2
*
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
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},
{},
{},
{},
{},
};
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}, {}, {}, {}, {},};
public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side, HashMap<Block, List<Integer>> blockMetas, boolean convexConnections)
{
@ -105,25 +45,29 @@ public class CTM
b[1] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections);
} else if(side == 2)
}
else if(side == 2)
{
b[0] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections);
b[1] = isConnected(world, x - 1, y, z, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections);
} else if(side == 3)
}
else if(side == 3)
{
b[0] = isConnected(world, x - 1, y, z, side, blockMetas, convexConnections);
b[1] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections);
} else if(side == 4)
}
else if(side == 4)
{
b[0] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections);
b[1] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections);
} else if(side == 5)
}
else if(side == 5)
{
b[0] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections);
b[1] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections);
@ -134,46 +78,60 @@ public class CTM
if(b[0] & !b[1] & !b[2] & !b[3])
{
texture = 3;
} else if(!b[0] & b[1] & !b[2] & !b[3])
}
else if(!b[0] & b[1] & !b[2] & !b[3])
{
texture = 1;
} else if(!b[0] & !b[1] & b[2] & !b[3])
}
else if(!b[0] & !b[1] & b[2] & !b[3])
{
texture = 16;
} else if(!b[0] & !b[1] & !b[2] & b[3])
}
else if(!b[0] & !b[1] & !b[2] & b[3])
{
texture = 48;
} else if(b[0] & b[1] & !b[2] & !b[3])
}
else if(b[0] & b[1] & !b[2] & !b[3])
{
texture = 2;
} else if(!b[0] & !b[1] & b[2] & b[3])
}
else if(!b[0] & !b[1] & b[2] & b[3])
{
texture = 32;
} else if(b[0] & !b[1] & b[2] & !b[3])
}
else if(b[0] & !b[1] & b[2] & !b[3])
{
texture = 19;
} else if(b[0] & !b[1] & !b[2] & b[3])
}
else if(b[0] & !b[1] & !b[2] & b[3])
{
texture = 51;
} else if(!b[0] & b[1] & b[2] & !b[3])
}
else if(!b[0] & b[1] & b[2] & !b[3])
{
texture = 17;
} else if(!b[0] & b[1] & !b[2] & b[3])
}
else if(!b[0] & b[1] & !b[2] & b[3])
{
texture = 49;
} else if(!b[0] & b[1] & b[2] & b[3])
}
else if(!b[0] & b[1] & b[2] & b[3])
{
texture = 33;
} else if(b[0] & !b[1] & b[2] & b[3])
}
else if(b[0] & !b[1] & b[2] & b[3])
{
texture = 35;
} else if(b[0] & b[1] & !b[2] & b[3])
}
else if(b[0] & b[1] & !b[2] & b[3])
{
texture = 50;
} else if(b[0] & b[1] & b[2] & !b[3])
}
else if(b[0] & b[1] & b[2] & !b[3])
{
texture = 18;
} else if(b[0] & b[1] & b[2] & b[3])
}
else if(b[0] & b[1] & b[2] & b[3])
{
texture = 34;
}
@ -186,25 +144,29 @@ public class CTM
b2[1] = !isConnected(world, x - 1, y, z + 1, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x + 1, y, z - 1, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x - 1, y, z - 1, side, blockMetas, convexConnections);
} else if(side == 2)
}
else if(side == 2)
{
b2[0] = !isConnected(world, x - 1, y - 1, z, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x + 1, y - 1, z, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x - 1, y + 1, z, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x + 1, y + 1, z, side, blockMetas, convexConnections);
} else if(side == 3)
}
else if(side == 3)
{
b2[0] = !isConnected(world, x + 1, y - 1, z, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x - 1, y - 1, z, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x + 1, y + 1, z, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x - 1, y + 1, z, side, blockMetas, convexConnections);
} else if(side == 4)
}
else if(side == 4)
{
b2[0] = !isConnected(world, x, y - 1, z + 1, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x, y - 1, z - 1, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x, y + 1, z + 1, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x, y + 1, z - 1, side, blockMetas, convexConnections);
} else if(side == 5)
}
else if(side == 5)
{
b2[0] = !isConnected(world, x, y - 1, z - 1, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x, y - 1, z + 1, side, blockMetas, convexConnections);

View file

@ -47,8 +47,10 @@ public class AdvancedMachineInput extends MachineInput<AdvancedMachineInput>
{
inventory[index] = StackUtils.subtract(inventory[index], itemStack);
}
return true;
}
return false;
}
@ -59,6 +61,7 @@ public class AdvancedMachineInput extends MachineInput<AdvancedMachineInput>
gasTank.draw(amountToUse, deplete);
return true;
}
return false;
}