@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side)
{
TileEntity te = blockaccess.getBlockTileEntity(x, y, z);
if(te != null && te instanceof TileEntityLedVerte)
{
//TileEntityLedVerte tetuto = (TileEntityLedVerte)tetuto;
//return TileEntityLedVerte.isEnable() ? this.iconGreen : this.iconDark;
}
return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z));
}
La ou il y a les // de commentaire, c’est la ou il y a les erreurs.___
Je te met tous mes codes :
BlockLedVerte
package Assabody.mod;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockLedVerte extends Block{
private Object iconDark;
private Object iconGreen;
public BlockLedVerte(int par1)
{
super(par1, Material.rock);
this.setCreativeTab(ModAssabody.AssabodyCreativeTabs);
}
public void registerIcons(IconRegister iconRegister)
{
iconGreen = iconRegister.registerIcon("modid:TextureVerte");
iconDark = iconRegister.registerIcon("modid:TextureNoire");
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileEntityLedVerte();
}
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side)
{
TileEntity te = blockaccess.getBlockTileEntity(x, y, z);
if(te != null && te instanceof TileEntityLedVerte)
{
//TileEntityLedVerte tetuto = (TileEntityLedVerte)tetuto;
//return TileEntityLedVerte.isEnable() ? this.iconGreen : this.iconDark;
}
return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z));
}
public boolean hasTileEntity(int metadata)
{
return true;
}
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborblockid, World par1World, int par2, int par3, int par4)
{
if(world.isBlockIndirectlyGettingPowered(x, y, z) && world.getBlockPowerInput(x, y, z) > 8)
{
//par1World.setBlock(par2, par3, par4, ModAssabody.BlockSoin.blockID, 0, 2);
}
}
public int idDropped(int par1, Random par2Random, int par3)
{
return this.blockID;
}
public boolean renderAsNormalBlock()
{
return true;
}
public boolean isOpaqueCube()
{
return false;
}
}
**TileEntityLedVerte **
package Assabody.mod;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
public class TileEntityLedVerte extends TileEntity
{
private boolean enable;
public void updateEntity()
{
enable = this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) && this.worldObj.getBlockPowerInput(this.xCoord, this.yCoord, this.zCoord) > 8;
}
public boolean isEnable()
{
return enable;
}
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.writeToNBT(nbttagcompound);
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 4, nbttagcompound);
}
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
//this.readFromNBT(pkt.data);
}
public void readFromNBT(NBTTagCompound nbtTag)
{
super.readFromNBT(nbtTag);
enable = nbtTag.getBoolean("enable");
}
public void writeToNBT(NBTTagCompound nbtTag)
{
super.writeToNBT(nbtTag);
nbtTag.setBoolean("enable", enable);
}
}