2015-04-17 01:15:33 +02:00
|
|
|
package techreborn.blocks;
|
|
|
|
|
2015-07-02 20:51:24 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
import erogenousbeef.coreTR.multiblock.BlockMultiblockBase;
|
2015-09-26 14:54:58 +02:00
|
|
|
import net.minecraft.block.Block;
|
2015-04-17 01:15:33 +02:00
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
2015-09-26 10:16:08 +02:00
|
|
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
|
|
import net.minecraft.client.renderer.texture.TextureMap;
|
2015-04-17 01:15:33 +02:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2015-04-17 18:42:57 +02:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2015-04-17 01:15:33 +02:00
|
|
|
import net.minecraft.util.IIcon;
|
2015-09-26 14:54:58 +02:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2015-04-17 18:42:57 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import techreborn.client.TechRebornCreativeTab;
|
2015-09-26 14:54:58 +02:00
|
|
|
import techreborn.client.texture.ConnectedTexture;
|
2015-09-26 10:16:08 +02:00
|
|
|
import techreborn.client.texture.ConnectedTextureGenerator;
|
2015-04-17 18:42:57 +02:00
|
|
|
import techreborn.tiles.TileMachineCasing;
|
2015-07-02 20:51:24 +02:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Random;
|
2015-04-17 18:42:57 +02:00
|
|
|
|
2015-04-17 21:40:33 +02:00
|
|
|
public class BlockMachineCasing extends BlockMultiblockBase {
|
2015-04-17 01:15:33 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
public static final String[] types = new String[]
|
|
|
|
{"standard", "reinforced", "advanced"};
|
2015-09-26 14:54:58 +02:00
|
|
|
public IIcon[][] icons;
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
public BlockMachineCasing(Material material) {
|
|
|
|
super(material);
|
|
|
|
setCreativeTab(TechRebornCreativeTab.instance);
|
|
|
|
setBlockName("techreborn.machineCasing");
|
|
|
|
setHardness(2F);
|
|
|
|
}
|
2015-04-17 01:15:33 +02:00
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
public static int getHeatFromMeta(int meta) {
|
|
|
|
switch (meta) {
|
|
|
|
case 0:
|
|
|
|
return 1020 / 25;
|
|
|
|
case 1:
|
|
|
|
return 1700 / 25;
|
|
|
|
case 2:
|
|
|
|
return 2380 / 25;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
public Item getItemDropped(int meta, Random random, int fortune) {
|
|
|
|
return Item.getItemFromBlock(this);
|
|
|
|
}
|
2015-04-17 01:15:33 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
|
|
|
for (int meta = 0; meta < types.length; meta++) {
|
|
|
|
list.add(new ItemStack(item, 1, meta));
|
|
|
|
}
|
|
|
|
}
|
2015-04-17 01:15:33 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
public int damageDropped(int metaData) {
|
|
|
|
return metaData;
|
|
|
|
}
|
2015-04-17 01:15:33 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
2015-09-26 14:54:58 +02:00
|
|
|
this.icons = new IIcon[types.length][16];
|
|
|
|
for (int i = 0; i < types.length; i++) {
|
|
|
|
// up down left right
|
|
|
|
icons[i][0] = genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i);
|
|
|
|
icons[i][1] = genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i);
|
|
|
|
icons[i][2] = genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i);
|
2015-09-26 16:47:54 +02:00
|
|
|
icons[i][3] = genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i);
|
2015-09-26 14:54:58 +02:00
|
|
|
icons[i][4] = genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i);
|
|
|
|
icons[i][5] = genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i);
|
|
|
|
icons[i][6] = genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i);
|
2015-09-26 16:47:54 +02:00
|
|
|
icons[i][7] = genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i);
|
|
|
|
icons[i][8] = genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i);
|
|
|
|
icons[i][9] = genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i);
|
|
|
|
icons[i][10] = genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i);
|
|
|
|
icons[i][11] = genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i);
|
|
|
|
icons[i][12] = genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i);
|
|
|
|
icons[i][13] = genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i);
|
|
|
|
icons[i][14] = genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i);
|
|
|
|
icons[i][15] = genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i);
|
2015-09-26 14:54:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
public IIcon genIcon(ConnectedTexture connectedTexture, IIconRegister iconRegister, int texNum, int meta) {
|
|
|
|
if (iconRegister instanceof TextureMap) {
|
2015-09-26 10:16:08 +02:00
|
|
|
TextureMap map = (TextureMap) iconRegister;
|
2015-09-26 14:54:58 +02:00
|
|
|
String name = ConnectedTextureGenerator.getDerivedName(types[meta] + "." + texNum);
|
2015-09-26 16:47:54 +02:00
|
|
|
System.out.println(name);
|
2015-09-26 14:54:58 +02:00
|
|
|
TextureAtlasSprite texture = map.getTextureExtry(name);
|
2015-09-26 16:47:54 +02:00
|
|
|
if (texture == null) {
|
2015-09-26 14:54:58 +02:00
|
|
|
texture = new ConnectedTextureGenerator(name, types[meta], connectedTexture);
|
|
|
|
map.setTextureEntry(name, texture);
|
2015-09-26 10:16:08 +02:00
|
|
|
}
|
2015-09-26 14:54:58 +02:00
|
|
|
return map.getTextureExtry(name);
|
|
|
|
} else {
|
|
|
|
return null;
|
2015-08-09 12:05:32 +02:00
|
|
|
}
|
|
|
|
}
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
2015-09-26 14:54:58 +02:00
|
|
|
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
|
|
|
int meta = blockAccess.getBlockMetadata(x, y, z);
|
2015-09-26 16:47:54 +02:00
|
|
|
return getConnectedBlockTexture(blockAccess, x, y, z, side, icons[meta]);
|
2015-08-09 12:05:32 +02:00
|
|
|
}
|
2015-04-17 01:15:33 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
2015-09-26 16:47:54 +02:00
|
|
|
public IIcon getIcon(int side, int meta) {
|
|
|
|
return icons[meta][0];
|
2015-08-09 12:05:32 +02:00
|
|
|
}
|
2015-04-26 17:22:26 +02:00
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
@Override
|
|
|
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
|
|
|
return new TileMachineCasing();
|
2015-04-26 17:22:26 +02:00
|
|
|
}
|
2015-09-26 14:54:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is taken from https://github.com/SlimeKnights/TinkersConstruct/blob/a7405a3d10318bb5c486ec75fb62897a8149d1a6/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java
|
|
|
|
*/
|
2015-09-26 16:47:54 +02:00
|
|
|
public IIcon getConnectedBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons)
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false;
|
2015-09-26 16:47:54 +02:00
|
|
|
|
|
|
|
switch (par5)
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
case 0:
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenDown = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenUp = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenLeft = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenRight = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[15];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[11];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[12];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[13];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[14];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[5];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[6];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[8];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[10];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[7];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[9];
|
|
|
|
}
|
|
|
|
else if (isOpenDown)
|
|
|
|
{
|
|
|
|
return icons[3];
|
|
|
|
}
|
|
|
|
else if (isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[4];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[2];
|
|
|
|
}
|
|
|
|
else if (isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[1];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenDown = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenUp = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenLeft = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenRight = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[15];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[11];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[12];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[13];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[14];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[5];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[6];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[8];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[10];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[7];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[9];
|
|
|
|
}
|
|
|
|
else if (isOpenDown)
|
|
|
|
{
|
|
|
|
return icons[3];
|
|
|
|
}
|
|
|
|
else if (isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[4];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[2];
|
|
|
|
}
|
|
|
|
else if (isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[1];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenDown = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenUp = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenLeft = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenRight = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[15];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[13];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[14];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[11];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[12];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[6];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[5];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[9];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[10];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[7];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[8];
|
|
|
|
}
|
|
|
|
else if (isOpenDown)
|
|
|
|
{
|
|
|
|
return icons[1];
|
|
|
|
}
|
|
|
|
else if (isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[2];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[4];
|
|
|
|
}
|
|
|
|
else if (isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[3];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenDown = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenUp = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenLeft = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenRight = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[15];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[14];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[13];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[11];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[12];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[6];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[5];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[10];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[9];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[8];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[7];
|
|
|
|
}
|
|
|
|
else if (isOpenDown)
|
|
|
|
{
|
|
|
|
return icons[1];
|
|
|
|
}
|
|
|
|
else if (isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[2];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[3];
|
|
|
|
}
|
|
|
|
else if (isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[4];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenDown = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenUp = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenLeft = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenRight = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[15];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[14];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[13];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[11];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[12];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[6];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[5];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[10];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[9];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[8];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[7];
|
|
|
|
}
|
|
|
|
else if (isOpenDown)
|
|
|
|
{
|
|
|
|
return icons[1];
|
|
|
|
}
|
|
|
|
else if (isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[2];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[3];
|
|
|
|
}
|
|
|
|
else if (isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[4];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenDown = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenUp = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenLeft = true;
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
|
|
|
isOpenRight = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[15];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[13];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[14];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[11];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[12];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[6];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[5];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[9];
|
|
|
|
}
|
|
|
|
else if (isOpenDown && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[10];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[7];
|
|
|
|
}
|
|
|
|
else if (isOpenUp && isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[8];
|
|
|
|
}
|
|
|
|
else if (isOpenDown)
|
|
|
|
{
|
|
|
|
return icons[1];
|
|
|
|
}
|
|
|
|
else if (isOpenUp)
|
|
|
|
{
|
|
|
|
return icons[2];
|
|
|
|
}
|
|
|
|
else if (isOpenLeft)
|
|
|
|
{
|
|
|
|
return icons[4];
|
|
|
|
}
|
|
|
|
else if (isOpenRight)
|
|
|
|
{
|
|
|
|
return icons[3];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return icons[0];
|
|
|
|
}
|
|
|
|
|
2015-09-26 16:47:54 +02:00
|
|
|
@Override
|
|
|
|
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
2015-09-26 14:54:58 +02:00
|
|
|
{
|
2015-09-26 16:47:54 +02:00
|
|
|
Block b = par1IBlockAccess.getBlock(par2, par3, par4);
|
|
|
|
return b == (Block) this ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
|
2015-09-26 14:54:58 +02:00
|
|
|
return block == (Block) this;
|
|
|
|
}
|
2015-04-17 01:15:33 +02:00
|
|
|
}
|