Code (cpp):
package mod.iKube.Blocks;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mod.iKube.client.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockiKube extends Block
{
private int nbMetadata = 1;
public static final String[] testType = new String[] {"0", "1", "2", "3", "4", "5"};
public BlockiKube(int par1, int par2, Material par3Material)
{
super(par1, par2, par3Material);
}
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
if (par2 == 0)
{
if (par1 == 0 || par1 == 1 || par1 == 4 || par1 == 5)return 4;
if (par1 == 2 && par1 == 3)return 0;
else return 0;
}
if (par2 == 1)
{
if (par1 == 0 || par1 == 1 || par1 == 2 || par1 == 3)return 4;
if (par1 == 5 && par1 == 4)return 0;
else return 0;
}
if (par2 == 2)
{
if (par1 == 0 || par1 == 1 || par1 == 4 || par1 == 5)return 4;
if (par1 == 3 && par1 == 2)
return 0;
else return 0;
}
if (par2 == 3)
{
if (par1 == 0 || par1 == 1 || par1 == 2 || par1 == 3)return 4;
if (par1 == 4 && par1 == 5)return 0;
else return 0;
}
if (par2 == 4)
{
if (par1 == 2 || par1 == 3 || par1 == 4 || par1 == 5)return 4;
if (par1 == 0 && par1 == 1)return 0;
else return 0;
}
if (par2 == 5)
{
if (par1 == 2 || par1 == 3 || par1 == 4 || par1 == 5)return 4;
if (par1 == 1 && par1 == 0)return 0;
else return 0;
}
else return this.blockIndexInTexture;
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int var7 = par1World.getBlockMetadata(par2, par3, par4) & 4;
if (var6 == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | var7);
}
if (var6 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | var7);
}
if (var6 == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | var7);
}
if (var6 == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | var7);
}
if (var6 == 4)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4 | var7);
}
if (var6 == 5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5| var7);
}
}
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
this.updateiKubeBounds(par1IBlockAccess.getBlockMetadata(par2, par3, par4));
}
/**
* Update the iKube block bounds based on the given metadata value.
*/
public void updateiKubeBounds(int par1)
{
if (par1 == 0)
{
this.setBlockBounds(0.0F, 0.0F, 0.999F, 1.0F, 1.0F, 1.0F);
}
if (par1 == 1)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.001F, 1.0F, 1.0F);
}
if (par1 == 2)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.001F);
}
if (par1 == 3)
{
this.setBlockBounds(0.999F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
if (par1 == 4)
{
this.setBlockBounds(0.0F, 0.0F, 0.999F, 1.0F, 1.0F, 1.0F);
}
if (par1 == 5)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.001F);
}
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 7;
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int var4 = 0; var4 < nbMetadata; ++var4)
{
par3List.add(new ItemStack(par1, 1, var4));
}
}
}
A cela ce joint un autre problème lié à un autre projet, je créerai une nouvelle discussion pour celui-ci.