Jump to content

Recommended Posts

Posted

Ok, I'm currently making glass that has connected textures. The bottom and the top works alright, but when i add the south side (which i think is called 2 in the code), the top and the bottom textures change. It doesn't affect the bottom/top textures if they are already connected.

 

Pictures:

 

Top already connecting:

bZ2xvYp.png

Top not connecting:

mgf6udX.png

 

 

 

BlockConnectedGlass.java (very long file!):

 

package larsg310.mod.bd.block;

import larsg310.mod.bd.lib.Reference;
import larsg310.mod.bd.lib.Strings;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockConnectedGlass extends Block
{
private boolean localFlag = false;

public Icon[] textures = new Icon[47];

public BlockConnectedGlass(int id)
{
	super(id, Material.glass);
	this.setCreativeTab(CreativeTabs.tabBlock);
	this.setUnlocalizedName(Strings.CONNECTED_GLASS_NAME);
	this.setHardness(0);
	this.setResistance(0);
	this.setStepSound(soundGlassFootstep);
}
public void registerIcons(IconRegister iconRegister)
{
	for(int i = 0; i < 47; i++)
	{
		textures[i] = iconRegister.registerIcon(Reference.MOD_ID + ":" + this.getUnlocalizedName() + "_" + i);
	}
	this.blockIcon = iconRegister.registerIcon(Reference.MOD_ID + ":" + this.getUnlocalizedName() + "_0");
}
public boolean isOpaqueCube()
    {
        return false;
    }
public boolean renderAsNormalBlock()
    {
        return false;
    }
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
    {
        int id = par1IBlockAccess.getBlockId(par2, par3, par4);
        return !this.localFlag && id == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
    }
public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
    {
        switch(side)
        {
        	case 0:
        		//8 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[36];
        		}
        		//7 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[43];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[45];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[46];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[44];
        		}
        		//6 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[39];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[37];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[40];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[38];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[41];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[42];
        		}
        		//5 CKECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[23];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[21];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[22];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[20];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[32];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[34];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[35];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[33];
        		}
        		//4 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[15];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[24];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[26];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[27];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[25];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[30];
        		}
        		if(world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[31];
        		}
        		if(world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[28];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[29];
        		}
        		//3 CHECKS
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[18];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[16];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[17];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[19];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[13];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[11];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID)
        		{
        			return textures[12];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[14];
        		}
        		//2 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[5];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[6];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[7];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[8];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[10];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[9];
        		}
        		//1 CHECK
        		if(world.getBlockId(x-1, y, z) == this.blockID)
        		{
        			return textures[1];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[3];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[2];
        		}
        		if(world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[4];
        		}
        	case 1:
        		//8 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[36];
        		}
        		//7 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[43];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[45];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[46];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[44];
        		}
        		//6 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[39];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[37];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[40];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[38];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[41];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[42];
        		}
        		//5 CKECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[23];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[21];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[22];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[20];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[32];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[34];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[35];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[33];
        		}
        		//4 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[15];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[24];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[26];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[27];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[25];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID)
        		{
        			return textures[30];
        		}
        		if(world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID)
        		{
        			return textures[31];
        		}
        		if(world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID)
        		{
        			return textures[28];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID)
        		{
        			return textures[29];
        		}
        		//3 CHECKS
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z+1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[18];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z-1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[16];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y, z-1) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[17];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y, z+1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[19];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[13];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[11];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID)
        		{
        			return textures[12];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[14];
        		}
        		//2 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[5];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[6];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[7];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[8];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[10];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[9];
        		}
        		//1 CHECK
        		if(world.getBlockId(x-1, y, z) == this.blockID)
        		{
        			return textures[1];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[3];
        		}
        		if(world.getBlockId(x, y, z-1) == this.blockID)
        		{
        			return textures[2];
        		}
        		if(world.getBlockId(x, y, z+1) == this.blockID)
        		{
        			return textures[4];
        		}
        	case 2:
        		
        		//8 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID)
        		{
        			return textures[36];
        		}
        		
        		//7 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID)
        		{
        			return textures[43];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID)
        		{
        			return textures[45];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID)
        		{
        			return textures[46];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID)
        		{
        			return textures[44];
        		}
        		///////////////////////////////////////////
        		//6 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID)
        		{
        			return textures[39];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID)
        		{
        			return textures[37];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID)
        		{
        			return textures[40];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID)
        		{
        			return textures[38];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID)
        		{
        			return textures[41];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID)
        		{
        			return textures[42];
        		}
        		
        		//5 CKECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID)
        		{
        			return textures[23];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID)
        		{
        			return textures[21];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID)
        		{
        			return textures[22];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID)
        		{
        			return textures[20];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID)
        		{
        			return textures[32];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID)
        		{
        			return textures[34];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID)
        		{
        			return textures[35];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID)
        		{
        			return textures[33];
        		}
        		//4 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[15];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID)
        		{
        			return textures[24];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID)
        		{
        			return textures[26];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID)
        		{
        			return textures[27];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID)
        		{
        			return textures[25];
        		}
        		if(world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID)
        		{
        			return textures[30];
        		}
        		if(world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID)
        		{
        			return textures[31];
        		}
        		if(world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID)
        		{
        			return textures[28];
        		}
        		if(world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID)
        		{
        			return textures[29];
        		}
        		//3 CHECKS
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y+1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[18];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y-1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID)
        		{
        			return textures[16];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x+1, y-1, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID)
        		{
        			return textures[17];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x-1, y+1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[19];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID)
        		{
        			return textures[13];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[11];
        		}
        		if(world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x-1, y, z) == this.blockID)
        		{
        			return textures[12];
        		}
        		if(world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[14];
        		}
        		//2 CHECKS
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[5];
        		}
        		if(world.getBlockId(x, y-1, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[6];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID)
        		{
        			return textures[9];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y-1, z) == this.blockID)
        		{
        			return textures[10];
        		}
        		if(world.getBlockId(x-1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[8];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID && world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[7];
        		}
        		//1 CHECK
        		if(world.getBlockId(x-1, y, z) == this.blockID)
        		{
        			return textures[3];
        		}
        		if(world.getBlockId(x+1, y, z) == this.blockID)
        		{
        			return textures[1];
        		}
        		if(world.getBlockId(x, y-1, z) == this.blockID)
        		{
        			return textures[4];
        		}
        		if(world.getBlockId(x, y+1, z) == this.blockID)
        		{
        			return textures[2];
        		}
        	default:
        		return this.blockIcon;
        }
    }
}

 

 

Hope this made any sense, and hope you can't figure something out.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Seriously??? Nobody??? Sorry for the bumping but I really want this to work the way I want it to to work.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Can't you chain if statement instead of checking...8 conditions inside each one ?

It will be a lot easier to read and find the issue.

I don't know what you mean...

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

if(world.getBlockId(x-1, y, z) == this.blockID)
if(world.getBlockId(x+1, y, z) == this.blockID) 
   if(world.getBlockId(x, y, z-1) == this.blockID)
     if(world.getBlockId(x, y, z+1) == this.blockID)
       if(world.getBlockId(x+1, y, z+1) == this.blockID)
           if(world.getBlockId(x-1, y, z-1) == this.blockID)
             if(world.getBlockId(x-1, y, z+1) == this.blockID)
             {
                 if(world.getBlockId(x+1, y, z-1) == this.blockID)
        	  {
        		 return textures[36];
        	 }
        	 else
        	 {
        		 return textures[43];
        	  }
///other code
}}}}}}}

Better, just check the surrounding first:

List list = new ArrayList();
for(int i=x-1; i<x+2; i++)
    for(int j=y-1; j<y+2; j++)
         for(int k=z-1; k<z+2; k++)
              if((i!=x || j!=y || k!=z) && world.getBlockId(i,j,k) == this.blockID)//Find which neighbour block has same id
                   list.add(new int[]{i,j,k});
Iterator itr = list.iterator();
while(itr.hasNext())
{
int[] pos = (int[]) itr.next();
if(pos[1]>y)
   hasUpperNeighbour = true;
else if(pos[1<y)
   hasLowerNeighbour = true;
if(pos[0]>x)
  hasNorthNeighbour = true;
else if(pos[0]<x)
  hasSouthNeighbour = true;
if(pos[2]>z)
  hasEastNeighbour = true;
else if(pos[2]<z)
  hasWestNeighbour = true;
}
if(hasUpperNeighbour)
{
    if(hasLowerNeighbour)
//...
}
else if(hasLowerNeighbour)
{
//...
}
else
{
//...
}

Posted

I personally find my way of doing it a lot better, but now let's focus again on the problem i had: textures.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

I don't know what i'm doing wrong!!! That's why i'm asking on the forums!!! My last option is to code it again!!!And i don't want that!!!

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

What you are doing wrong? You are doing THE CODE wrong. You have 36 thousands symbols in 6 hundred lines just two check three sides! And you want as much again to check other three? Dude, this code makes no “sense”, it's extremely bulky and unoptimized, and if you found it “a lot better”, i can only suppose you to be a masochist. Or you want one's PC to lag to a death.

 

I understand you don't want to code it again, but coding the thing, even the way GotoLink has suggested, will take less effort, than doing it in your way. Also, why do you have 48 textures instead of 16?

 

P.S.

Modding = coding, and if you want to mod, you have to code and debug (and draw textures too, of course), that's modding in a nutshell.

 

If you are asking on the forums, be ready that people will criticize your code and suggest better ways, that's normal. Don't be so nervous, be a bit more patient, and you'll get your help then.

 

 

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.