J’ai crée des Tile Entity pour mon mod en 1.7.2, (j’ai suivis les vieux tuto, mais le problème c’est que celles-ci marchent temps que la map reste chargée ). Une fois la map sauvegardé et relancé toutes les valeurs sont a 0.
Le code est très simple j’ai peut-être oublié quelque chose ou la 1.7 a peut-etre changé quelques chose.
Le Block :
| |
| public class Axe extends BlockContainer{ |
| |
| public Axe() { |
| super(Material.wood); |
| } |
| |
| public TileEntity createTileEntity(World world, int metadata) |
| { |
| return new TileEntityAxe(); |
| } |
| |
| public boolean hasTileEntity(int metadata) |
| { |
| return true; |
| } |
| |
| public boolean renderAsNormalBlock() |
| { |
| return false; |
| } |
| |
| public boolean isOpaqueCube() |
| { |
| return false; |
| } |
| |
| |
| |
| |
| public int getRenderType() |
| { |
| return ClientProxy.renderInventoryHandEnergieMakerId; |
| } |
| |
| @Override |
| public TileEntity createNewTileEntity(World var1, int var2) { |
| return new TileEntityAxe(); |
| } |
| |
| } |
| |
Le TileEntity :
| |
| public class TileEntityAxe extends TileEntityEnergieConduct{ |
| private float angle = 0; |
| private int direction = 0; |
| private boolean change = true; |
| public boolean[] connect = {false,false}; |
| |
| public void readFromNBT(NBTTagCompound nbtTag) |
| { |
| super.readFromNBT(nbtTag); |
| nbtTag.setInteger("Direction", this.direction); |
| nbtTag.setBoolean("connect1", this.connect[0]); |
| nbtTag.setBoolean("connect2", this.connect[1]); |
| |
| } |
| |
| public void writeToNBT(NBTTagCompound nbtTag) |
| { |
| super.writeToNBT(nbtTag); |
| connect[0] = nbtTag.getBoolean("connect1"); |
| connect[1] = nbtTag.getBoolean("connect2"); |
| direction = nbtTag.getInteger("Direction"); |
| } |
| } |
| } |
Merci pour votre aide.
Vebert