• Voila j'ai fait mon rendu de bloc techne et j'ai donc créer tous mes codes pour le mettre en jeu tout fonctionne niquel sauf le rendu en main , il n’apparaît pas et je ne sais pas pourquoi , y a t-il un changement à cause de la 1.7 , j'ai aussi une deuxième question y a t-il moyen de faire tourner le bloc dans la direction ou se trouve le personnage sans passer pas block metadata etc ? Aussi quel est le code pour modifier la hitbox ? Merciiii 🙂 🙂

    Dites moi si vous voulez les codes 🙂

  • Moddeurs confirmés Rédacteurs Administrateurs

    Non, pas de changement avec la 1.7, c'est toujours le même principe. Pour faire tourne sans passer le metadata, il faut passer par le tile entity, c'est expliqué dans le tutoriel.
    Pour la hitbox, c'est une fonction dans la classe du bloc, je me souviens plus du nom.

    Et oui il faut les codes.


  • Oui mais il est mis qu'il faut d'abbord suivre à la lettre la partie sur les metadatas et ensuite ajouter dans TileEntityBarriereSpecialRender de plus si je ne met que dans TileEntityBarriereSpecialRender le code il me souligne getDirection en rouge 😕 J'ajoute les codes tout de suite 🙂

  • Moddeurs confirmés Rédacteurs Administrateurs

    Je vois aucun code …


  • Désolé je me lavais 😛

    Voici tout les codes :

    BlockBarriere

    package mod.common;
    
    import javax.swing.Icon;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import mod.proxy.ClientProxy;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    
    public class BlockBarriere extends Block
    {
    
    public BlockBarriere(int id)
    {
    super(Material.rock);
    }
    
    public TileEntity createTileEntity(World world, int metadata)
    {
    return new TileEntityBarriere();
    }
    
    public boolean hasTileEntity(int metadata)
    {
    return true;
    }
    
    public boolean renderAsNormalBlock()
    {
    return false;
    }
    
    public boolean isOpaqueCube()
    {
    return false;
    }
    
    @SideOnly(Side.CLIENT)
    public int getRenderType()
    {
    return ClientProxy.renderInventoryBarriere;
    }
    
    protected BlockBarriere(Material material)
    {
    super(material);
    }
    
    public IIcon getIcon(int side, int metadata)
    {
    return ((Blocks.iron_block).getIcon(0, 0));
    }
    
    }
    

    TileEntityBarriere

    package mod.common;
    
    import javax.swing.Icon;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    
    public class TileEntityBarriere extends TileEntity
    {
    
    }
    
    

    TileEntityBarriereSpecialRender

    package mod.common;
    
    import mod.proxy.IInventoryRenderer;
    import mod.proxy.ModelBarriere;
    import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    
    import org.lwjgl.opengl.GL11;
    
    public class TileEntityBarriereSpecialRender extends TileEntitySpecialRenderer implements IInventoryRenderer {
    public static final ResourceLocation textureLocation = new ResourceLocation(ModMinecraft.MODID, "textures/blocks/blockBarriere.png");
    private final ModelBarriere model = new ModelBarriere();
    
    public TileEntityBarriereSpecialRender()
    {
    this.func_147497_a(TileEntityRendererDispatcher.instance);
    }
    
    @Override
    public void renderInventory(double x, double y, double z)
    {
    this.renderTileEntityBarriereAt(null, x, y, z, 0.0F);
    }
    
    @Override
    public void renderTileEntityAt(TileEntity te, double x, double y, double z, float tick)
    {
    this.renderTileEntityBarriereAt((TileEntityBarriere)te, x, y, z, tick);
    }
    public void renderTileEntityBarriereAt(TileEntityBarriere te, double x, double y, double z, float tick)
    {
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5F, y + 1.5F, z + 0.5F);
    this.bindTexture(textureLocation);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    if(te != null)
    {
    GL11.glRotatef(90F * te.getDirection(), 0.0F, 1.0F, 0.0F);
    }
    this.model.render(0.0625F);
    GL11.glPopMatrix();
    
    }
    
    }
    

    BarriereInventoryRenderer

    package mod.proxy;
    
    import java.util.HashMap;
    
    import net.minecraft.block.Block;
    import net.minecraft.client.renderer.RenderBlocks;
    import net.minecraft.world.IBlockAccess;
    import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
    
    public class BarriereInventoryRenderer implements ISimpleBlockRenderingHandler
    {
    public static class TESRIndex
    {
    Block block;
    int metadata;
    
    public TESRIndex(Block block, int metadata)
    {
    this.block = block;
    this.metadata = metadata;
    }
    
    @Override
    public int hashCode()
    {
    return block.hashCode() + metadata;
    }
    
    @Override
    public boolean equals(Object o)
    {
    if(!(o instanceof TESRIndex))
    return false;
    
    TESRIndex tesr = (TESRIndex)o;
    
    return tesr.block == block && tesr.metadata == metadata;
    }
    }
    
    public static HashMap <tesrindex, iinventoryrenderer="">blockByTESR = new HashMap<tesrindex, iinventoryrenderer="">();
    @Override
    public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer)
    {
    // TODO Auto-generated method stub
    
    }
    
    @Override
    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
    {
    return true;
    }
    
    public boolean shouldRender3DInInventory(int modelId)
    {
    // TODO Auto-generated method stub
    return true;
    }
    
    @Override
    public int getRenderId()
    {
    return ClientProxy.renderInventoryBarriere;
    }
    
    }
    
    

    ClientProxy

    package mod.proxy;
    
    import net.minecraft.client.model.ModelBiped;
    import mod.common.EntityBrachiosaurus;
    import mod.common.EntityFlechette;
    import mod.common.EntityFrog;
    import mod.common.ModMinecraft;
    import mod.common.ModelBrachiosaurus;
    import mod.common.ModelFrog;
    import mod.common.RenderBrachiosaurus;
    import mod.common.RenderFlechette;
    import mod.common.RenderFrog;
    import mod.common.TileEntityBarriere;
    import mod.common.TileEntityBarriereSpecialRender;
    import mod.proxy.BarriereInventoryRenderer.TESRIndex;
    import cpw.mods.fml.client.registry.ClientRegistry;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    
    public class ClientProxy extends CommonProxy
    {
    public static int renderInventoryBarriere;
    @Override
    public void registerRender()
    {
    System.out.println("render");
    
    RenderingRegistry.registerEntityRenderingHandler(EntityFlechette.class, new RenderFlechette(null, 0));
    
    RenderingRegistry.registerEntityRenderingHandler(EntityFrog.class, new RenderFrog(new ModelFrog(), 0.5F));
    
    RenderingRegistry.registerEntityRenderingHandler(EntityBrachiosaurus.class, new RenderBrachiosaurus(new ModelBrachiosaurus(), 3.5F));
    
    renderInventoryBarriere = RenderingRegistry.getNextAvailableRenderId();
    RenderingRegistry.registerBlockHandler(new BarriereInventoryRenderer());
    }
    
    @Override
    public void registerTileEntityRender()
    {
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBarriere.class, new TileEntityBarriereSpecialRender());
    BarriereInventoryRenderer.blockByTESR.put(new TESRIndex(ModMinecraft.BlockBarriere, 0), new TileEntityBarriereSpecialRender());
    }
    }
    
    

    IInventoryRenderer

    package mod.proxy;
    
    public interface IInventoryRenderer
    {
    public void renderInventory(double x, double y, double z);
    }
    
    

    ModelBarriere

    package mod.proxy;
    
    import net.minecraft.client.model.ModelBase;
    import net.minecraft.client.model.ModelRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.world.World;
    
    public class ModelBarriere extends ModelBase
    {
    //fields
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
    ModelRenderer Shape7;
    ModelRenderer Shape8;
    ModelRenderer Shape9;
    ModelRenderer Shape10;
    ModelRenderer Shape11;
    ModelRenderer Shape12;
    ModelRenderer Shape13;
    ModelRenderer Shape14;
    ModelRenderer Shape15;
    
    public ModelBarriere()
    {
    textureWidth = 128;
    textureHeight = 64;
    
    Shape1 = new ModelRenderer(this, 0, 0);
    Shape1.addBox(0F, 0F, 0F, 16, 2, 4);
    Shape1.setRotationPoint(-8F, 22F, -1F);
    Shape1.setTextureSize(128, 64);
    Shape1.mirror = true;
    setRotation(Shape1, 0F, 0F, 0F);
    Shape2 = new ModelRenderer(this, 40, 0);
    Shape2.addBox(-2F, 0F, 0F, 1, 43, 2);
    Shape2.setRotationPoint(-6F, -19.1F, 0F);
    Shape2.setTextureSize(128, 64);
    Shape2.mirror = true;
    setRotation(Shape2, 0F, 0F, 0F);
    Shape3 = new ModelRenderer(this, 46, 0);
    Shape3.addBox(0F, 0F, 0F, 1, 43, 2);
    Shape3.setRotationPoint(7F, -19.1F, 0F);
    Shape3.setTextureSize(128, 64);
    Shape3.mirror = true;
    setRotation(Shape3, 0F, 0F, 0F);
    Shape4 = new ModelRenderer(this, 52, 0);
    Shape4.addBox(0F, 0F, 2F, 1, 3, 2);
    Shape4.setRotationPoint(-8F, -20.1F, -2.9F);
    Shape4.setTextureSize(128, 64);
    Shape4.mirror = true;
    setRotation(Shape4, 0.4461433F, 0F, 0F);
    Shape5 = new ModelRenderer(this, 58, 0);
    Shape5.addBox(0F, 0F, 2F, 1, 3, 2);
    Shape5.setRotationPoint(7F, -20.1F, -2.9F);
    Shape5.setTextureSize(128, 64);
    Shape5.mirror = true;
    setRotation(Shape5, 0.4461433F, 0F, 0F);
    Shape6 = new ModelRenderer(this, 0, 6);
    Shape6.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape6.setRotationPoint(-7F, -5F, 0.5F);
    Shape6.setTextureSize(128, 64);
    Shape6.mirror = true;
    setRotation(Shape6, 0F, 0F, 0F);
    Shape7 = new ModelRenderer(this, 0, 8);
    Shape7.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape7.setRotationPoint(-7F, 5F, 0.5F);
    Shape7.setTextureSize(128, 64);
    Shape7.mirror = true;
    setRotation(Shape7, 0F, 0F, 0F);
    Shape8 = new ModelRenderer(this, 0, 10);
    Shape8.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape8.setRotationPoint(-7F, 10F, 0.5F);
    Shape8.setTextureSize(128, 64);
    Shape8.mirror = true;
    setRotation(Shape8, 0F, 0F, 0F);
    Shape9 = new ModelRenderer(this, 0, 12);
    Shape9.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape9.setRotationPoint(-7F, 20F, 0.5F);
    Shape9.setTextureSize(128, 64);
    Shape9.mirror = true;
    setRotation(Shape9, 0F, 0F, 0F);
    Shape10 = new ModelRenderer(this, 0, 14);
    Shape10.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape10.setRotationPoint(-7F, -20.5F, 0F);
    Shape10.setTextureSize(128, 64);
    Shape10.mirror = true;
    setRotation(Shape10, 0F, 0F, 0F);
    Shape11 = new ModelRenderer(this, 0, 18);
    Shape11.addBox(0F, 0F, 0F, 7, 5, 0);
    Shape11.setRotationPoint(-3.5F, -4.5F, 0.4F);
    Shape11.setTextureSize(128, 64);
    Shape11.mirror = true;
    setRotation(Shape11, 0F, 0F, 0F);
    Shape12 = new ModelRenderer(this, 0, 16);
    Shape12.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape12.setRotationPoint(-7F, 15F, 0.5F);
    Shape12.setTextureSize(128, 64);
    Shape12.mirror = true;
    setRotation(Shape12, 0F, 0F, 0F);
    Shape13 = new ModelRenderer(this, 52, 5);
    Shape13.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape13.setRotationPoint(-7F, 0F, 0.5F);
    Shape13.setTextureSize(128, 64);
    Shape13.mirror = true;
    setRotation(Shape13, 0F, 0F, 0F);
    Shape14 = new ModelRenderer(this, 52, 7);
    Shape14.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape14.setRotationPoint(-7F, -10F, 0.5F);
    Shape14.setTextureSize(128, 64);
    Shape14.mirror = true;
    setRotation(Shape14, 0F, 0F, 0F);
    Shape15 = new ModelRenderer(this, 52, 9);
    Shape15.addBox(0F, 0F, 0F, 14, 1, 1);
    Shape15.setRotationPoint(-7F, -15F, 0.5F);
    Shape15.setTextureSize(128, 64);
    Shape15.mirror = true;
    setRotation(Shape15, 0F, 0F, 0F);
    }
    
    public void render(float f)
    {
    Shape1.render(f);
    Shape2.render(f);
    Shape3.render(f);
    Shape4.render(f);
    Shape5.render(f);
    Shape6.render(f);
    Shape7.render(f);
    Shape8.render(f);
    Shape9.render(f);
    Shape10.render(f);
    Shape11.render(f);
    Shape12.render(f);
    Shape13.render(f);
    Shape14.render(f);
    Shape15.render(f);
    }
    
    private void setRotation(ModelRenderer model, float x, float y, float z)
    {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
    }
    }
    
    

    Voila voila :)</tesrindex,></tesrindex,>

  • Moddeurs confirmés Rédacteurs Administrateurs

    Ok bon tu peux retourné voir les tutoriels.
    La fonction renderInventoryBlock dans BarriereInventoryRenderer n'est pas censé être vide.
    Si tu avais bien suivis le tutoriel sur les blocs directionnels TileEntityBarriere ne serai pas vide.


  • Oké je vais relire tout attentivement alors et je te dis quoi après 😉 Mais si tu dis qu'il dois y avoir quelques chose tu dois avoir raison 🙂


    Pour le rendu en main ca marche , le problème est que la barrière dépasse du cadre et pour le TileEntityBarriere vide je dois suivre le tuto sur les Directions de blocs simple ou metadata ? 😕

  • Moddeurs confirmés Rédacteurs Administrateurs

    metadata, car il faut passer par le tile entity


  • D'accord comme je suis loin d'être un pro j'ai essayé et j'ai quelques problème 😞

    BlockBarriere

    package mod.common;
    
    import javax.swing.Icon;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import mod.proxy.ClientProxy;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    public class BlockBarriere extends Block
    {
    
    public BlockBarriere(int id)
    {
    super(Material.rock);
    }
    
    public boolean hasTileEntity(int metadata)
    {
    return true;
    }
    
    public boolean renderAsNormalBlock()
    {
    return false;
    }
    
    public boolean isOpaqueCube()
    {
    return false;
    }
    
    @SideOnly(Side.CLIENT)
    public int getRenderType()
    {
    return ClientProxy.renderInventoryBarriere;
    }
    
    protected BlockBarriere(Material material)
    {
    super(material);
    }
    
    public IIcon getIcon(int side, int metadata)
    {
    return ((Blocks.iron_block).getIcon(0, 0));
    }
    
    @Override
    public TileEntity createTileEntity(World world, int metadata)
    {
    if(metadata == 0)
    return new TileEntityBarriere();
    else if(metadata == 2)
    return new TileEntityBarriere2();
    else
    return null;
    }
    public boolean hasTileEntity1(int metadata)
    {
    if(metadata == 0 || metadata == 2)
    return true;
    else
    return false;
    }
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
    {
    int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
    TileEntity te = world.getTileEntity(x, y, z);
    if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2)
    {
    ((TileEntityBarriere2)te).setDirection((byte)direction);
    world.markBlockForUpdate(x, y, z);
    }
    }
    @SideOnly(Side.CLIENT)
    
    public IIcon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side)
    {
    if(blockaccess.getBlockMetadata(x, y, z) == 2)
    {
    TileEntity te = blockaccess.getTileEntity(x, y, z);
    byte direction = ((TileEntityBarriere2)te).getDirection();
    return side == 1 ? Icon3[0] : (side == 0 ? Icon3[1] : (direction == 2 && side == 2 ? Icon3[2] : (direction == 3 && side == 5 ? Icon3[2] : (direction == 0 && side == 3 ? Icon3[2] : (direction == 1 && side == 4 ? Icon3[2] : Icon3[3])))));
    } else
    {
    return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z));
    }
    }
    
    }
    

    TileEntityBarriere2

    package mod.common;
    
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.Packet;
    import net.minecraft.tileentity.TileEntity;
    
    public class TileEntityBarriere2 extends TileEntity
    {
    public byte direction;
    
    public void readFromNBT(NBTTagCompound nbtTag)
    {
    super.readFromNBT(nbtTag);
    direction = nbtTag.getByte("direction");
    }
    
    public void writeToNBT(NBTTagCompound nbtTag)
    {
    super.writeToNBT(nbtTag);
    nbtTag.setByte("direction", direction);
    }
    
    public void setDirection(byte direct)
    {
    direction = direct;
    }
    
    public byte getDirection()
    {
    return direction;
    }
    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);
    }
    }
    

    le Packet132TileEntityData est souligné en rouge 😕
    mais j'ai plein d'erreur 😞

  • Moddeurs confirmés Rédacteurs Administrateurs

    En effet les fonctions ne sont pas les mêmes en 1.7.

    public Packet getDescriptionPacket()
    {
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    this.writeToNBT(nbttagcompound);
    return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound);
    }
    
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
    {
    this.readFromNBT(pkt.func_148857_g());
    this.worldObj.markBlockRangeForRenderUpdate(this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord);
    }
    

  • Oké maintenant ce code :

    @SideOnly(Side.CLIENT)
    public Icon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side)
    {
    if(blockaccess.getBlockMetadata(x, y, z) == 2)
    {
    TileEntity te = blockaccess.getBlockTileEntity(x, y, z);
    byte direction = ((TileEntityBarriere2)te).getDirection();
    return side == 1 ? Icon3[0] : (side == 0 ? Icon3[1] : (direction == 2 && side == 2 ? Icon3[2] : (direction == 3 && side == 5 ? Icon3[2] : (direction == 0 && side == 3 ? Icon3[2] : (direction == 1 && side == 4 ? Icon3[2] : Icon3[3])))));
    } else
    {
    return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z));
    }
    }
    ``` je dois bien le placer dans la classe du block ? Car sinon j'ai plein d'erreur comme getBlockTileEntity également Icon3 et getIcon :/
  • Moddeurs confirmés Rédacteurs Administrateurs

    Inutile dans le cas du TESR, retire-le


  • Voila tout mes codes mais sa ne marche pas 😕 Aucune erreur.

    TileEntityBarriere2

    
    package mod.common;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.NetworkManager;
    import net.minecraft.network.Packet;
    import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.world.IBlockAccess;
    
    public class TileEntityBarriere2 extends TileEntity
    {
    public byte direction;
    
    public void readFromNBT(NBTTagCompound nbtTag)
    {
    super.readFromNBT(nbtTag);
    direction = nbtTag.getByte("direction");
    }
    
    public void writeToNBT(NBTTagCompound nbtTag)
    {
    super.writeToNBT(nbtTag);
    nbtTag.setByte("direction", direction);
    }
    
    public void setDirection(byte direct)
    {
    direction = direct;
    }
    
    public byte getDirection()
    {
    return direction;
    }
    public Packet getDescriptionPacket()
    {
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    this.writeToNBT(nbttagcompound);
    return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound);
    }
    
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
    {
    this.readFromNBT(pkt.func_148857_g());
    this.worldObj.markBlockRangeForRenderUpdate(this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord);
    }
    
    }
    
    

    BlockBarriere

    
    package mod.common;
    
    import javax.swing.Icon;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import mod.proxy.ClientProxy;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    public class BlockBarriere extends Block
    {
    
    public BlockBarriere(int id)
    {
    super(Material.rock);
    }
    
    public boolean hasTileEntity(int metadata)
    {
    return true;
    }
    
    public boolean renderAsNormalBlock()
    {
    return false;
    }
    
    public boolean isOpaqueCube()
    {
    return false;
    }
    
    @SideOnly(Side.CLIENT)
    public int getRenderType()
    {
    return ClientProxy.renderInventoryBarriere;
    }
    
    protected BlockBarriere(Material material)
    {
    super(material);
    }
    
    public IIcon getIcon(int side, int metadata)
    {
    return ((Blocks.iron_block).getIcon(0, 0));
    }
    
    @Override
    public TileEntity createTileEntity(World world, int metadata)
    {
    if(metadata == 0)
    return new TileEntityBarriere();
    else if(metadata == 2)
    return new TileEntityBarriere2();
    else
    return null;
    }
    public boolean hasTileEntity1(int metadata)
    {
    if(metadata == 0 || metadata == 2)
    return true;
    else
    return false;
    }
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
    {
    int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
    TileEntity te = world.getTileEntity(x, y, z);
    if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2)
    {
    ((TileEntityBarriere2)te).setDirection((byte)direction);
    world.markBlockForUpdate(x, y, z);
    }
    }
    
    }
    
  • Moddeurs confirmés Rédacteurs Administrateurs

    public boolean hasTileEntity1(int metadata)
    ça c'est faux. C'est :
    public boolean hasTileEntity(int metadata)
    Je vois pas d'autre problème.


  • Voici le crash report

    Dé que j'ouvre le monde ca crash.

    –-- Minecraft Crash Report ----
    // Everything's going to plan. No, really, that was supposed to happen.
    
    Time: 25/07/14 0:19
    Description: Rendering Block Entity
    
    java.lang.ClassCastException: mod.common.TileEntityBarriere cannot be cast to mod.common.TileEntityBarriere2
    at mod.common.TileEntityBarriereSpecialRender.renderTileEntityAt(TileEntityBarriereSpecialRender.java:36)
    at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
    at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:544)
    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1298)
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1095)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1024)
    at net.minecraft.client.Minecraft.run(Minecraft.java:912)
    at net.minecraft.client.main.Main.main(Main.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    at mod.common.TileEntityBarriereSpecialRender.renderTileEntityAt(TileEntityBarriereSpecialRender.java:36)
    
    -- Block Entity Details --
    Details:
    Name: Barriere // mod.common.TileEntityBarriere
    Block type: ID #166 (tile.blockBarriere // mod.common.BlockBarriere)
    Block data value: 0 / 0x0 / 0b0000
    Block location: World: (-1113,4,-1261), Chunk: (at 7,0,3 in -70,-79; contains blocks -1120,0,-1264 to -1105,255,-1249), Region: (-3,-3; contains chunks -96,-96 to -65,-65, blocks -1536,0,-1536 to -1025,255,-1025)
    Actual block type: ID #166 (tile.blockBarriere // mod.common.BlockBarriere)
    Actual block data value: 0 / 0x0 / 0b0000
    Stacktrace:
    at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
    at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:544)
    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1298)
    
    -- Affected level --
    Details:
    Level name: MpServer
    All players: 1 total; [EntityClientPlayerMP['Player484'/168, l='MpServer', x=-1112,35, y=5,62, z=-1261,52]]
    Chunk stats: MultiplayerChunkCache: 50, 50
    Level seed: 0
    Level generator: ID 01 - flat, ver 0\. Features enabled: false
    Level generator options:
    Level spawn location: World: (-1122,4,-1265), Chunk: (at 14,0,15 in -71,-80; contains blocks -1136,0,-1280 to -1121,255,-1265), Region: (-3,-3; contains chunks -96,-96 to -65,-65, blocks -1536,0,-1536 to -1025,255,-1025)
    Level time: 100988 game time, 6000 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 74 total; [EntityPig['Pig'/128, l='MpServer', x=-1092,07, y=4,00, z=-1299,93], EntitySheep['Sheep'/129, l='MpServer', x=-1101,84, y=4,00, z=-1309,88], EntitySheep['Sheep'/130, l='MpServer', x=-1101,81, y=4,00, z=-1302,88], EntityPig['Pig'/135, l='MpServer', x=-1074,78, y=4,00, z=-1307,97], EntityChicken['Chicken'/136, l='MpServer', x=-1074,47, y=4,00, z=-1305,47], EntitySheep['Sheep'/137, l='MpServer', x=-1079,94, y=4,00, z=-1306,97], EntitySheep['Sheep'/138, l='MpServer', x=-1078,91, y=4,00, z=-1215,09], EntitySheep['Sheep'/145, l='MpServer', x=-1061,91, y=4,00, z=-1286,04], EntityHorse['Horse'/146, l='MpServer', x=-1056,81, y=4,00, z=-1283,50], EntityPig['Pig'/147, l='MpServer', x=-1060,81, y=4,00, z=-1283,91], EntityPig['Pig'/148, l='MpServer', x=-1067,09, y=4,00, z=-1260,84], EntitySheep['Sheep'/149, l='MpServer', x=-1063,88, y=4,00, z=-1234,03], EntityClientPlayerMP['Player484'/168, l='MpServer', x=-1112,35, y=5,62, z=-1261,52], EntitySheep['Sheep'/150, l='MpServer', x=-1060,06, y=4,00, z=-1246,09], EntityChicken['Chicken'/151, l='MpServer', x=-1066,69, y=4,00, z=-1209,19], EntityHorse['Donkey'/47, l='MpServer', x=-1167,28, y=4,00, z=-1218,84], EntityHorse['Horse'/54, l='MpServer', x=-1142,28, y=4,00, z=-1283,66], EntityItemFrame['entity.ItemFrame.name'/55, l='MpServer', x=-1136,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/56, l='MpServer', x=-1140,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/57, l='MpServer', x=-1144,50, y=5,50, z=-1264,06], EntityFlechette['entity.RenderFlechetteun.name'/58, l='MpServer', x=-1144,97, y=3,05, z=-1253,78], EntityFlechette['entity.RenderFlechetteun.name'/59, l='MpServer', x=-1139,06, y=3,05, z=-1260,81], EntityItemFrame['entity.ItemFrame.name'/67, l='MpServer', x=-1120,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/68, l='MpServer', x=-1121,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/69, l='MpServer', x=-1121,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/70, l='MpServer', x=-1120,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/71, l='MpServer', x=-1120,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/72, l='MpServer', x=-1121,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/73, l='MpServer', x=-1123,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/74, l='MpServer', x=-1124,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/75, l='MpServer', x=-1125,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/76, l='MpServer', x=-1125,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/77, l='MpServer', x=-1124,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/78, l='MpServer', x=-1123,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/79, l='MpServer', x=-1123,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/80, l='MpServer', x=-1124,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/81, l='MpServer', x=-1125,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/82, l='MpServer', x=-1129,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/83, l='MpServer', x=-1128,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/84, l='MpServer', x=-1127,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/85, l='MpServer', x=-1127,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/86, l='MpServer', x=-1128,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/87, l='MpServer', x=-1129,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/88, l='MpServer', x=-1128,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/89, l='MpServer', x=-1127,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/90, l='MpServer', x=-1129,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/91, l='MpServer', x=-1132,50, y=5,50, z=-1264,06], EntityHorse['Horse'/92, l='MpServer', x=-1121,19, y=4,88, z=-1265,00], EntityHorse['Donkey'/93, l='MpServer', x=-1133,91, y=4,00, z=-1216,09], EntityPig['Pig'/94, l='MpServer', x=-1121,84, y=4,00, z=-1207,84], EntitySheep['Sheep'/99, l='MpServer', x=-1108,50, y=4,00, z=-1306,16], EntityItemFrame['entity.ItemFrame.name'/100, l='MpServer', x=-1115,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/101, l='MpServer', x=-1116,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/102, l='MpServer', x=-1117,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/103, l='MpServer', x=-1117,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/104, l='MpServer', x=-1116,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/105, l='MpServer', x=-1115,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/106, l='MpServer', x=-1116,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/107, l='MpServer', x=-1117,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/108, l='MpServer', x=-1115,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/109, l='MpServer', x=-1119,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/110, l='MpServer', x=-1119,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/111, l='MpServer', x=-1119,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/112, l='MpServer', x=-1113,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/113, l='MpServer', x=-1112,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/114, l='MpServer', x=-1111,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/115, l='MpServer', x=-1112,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/116, l='MpServer', x=-1113,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/117, l='MpServer', x=-1113,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/118, l='MpServer', x=-1112,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/119, l='MpServer', x=-1111,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/120, l='MpServer', x=-1111,50, y=6,50, z=-1264,06], EntitySheep['Sheep'/121, l='MpServer', x=-1116,16, y=4,00, z=-1246,81], EntitySheep['Sheep'/122, l='MpServer', x=-1112,95, y=4,00, z=-1233,54]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
    Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:412)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2523)
    at net.minecraft.client.Minecraft.run(Minecraft.java:934)
    at net.minecraft.client.main.Main.main(Main.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    
    – System Details --
    Details:
    Minecraft Version: 1.7.2
    Operating System: Windows 8.1 (amd64) version 6.3
    Java Version: 1.8.0_05, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 838425512 bytes (799 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    AABB Pool Size: 20006 (1120336 bytes; 1 MB) allocated, 811 (45416 bytes; 0 MB) used
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active
    mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    modminecraft{1.0} [Mod Minecraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    Launched Version: 1.6
    LWJGL: 2.9.0
    OpenGL: GeForce GTX 650/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: ~~ERROR~~ NullPointerException: null
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 443 (24808 bytes; 0 MB) allocated, 162 (9072 bytes; 0 MB) used
    Anisotropic Filtering: Off (1)
    

    Il ne faut rien avoir dans le TileEntityBarriere alors ?

  • Moddeurs confirmés Rédacteurs Administrateurs

    Tu as le mauvais tile entity dans le code du rendu.
    Mais en fait je capte pas pourquoi tu as deux tile entity ?


  • Parceque dans ce code j'ai ce TileEntityBarriere2 qui est souligné en rouge si je ne le créer pas 😕

    
    package mod.common;
    
    import javax.swing.Icon;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import mod.proxy.ClientProxy;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    public class BlockBarriere extends Block
    {
    
    public BlockBarriere(int id)
    {
    super(Material.rock);
    }
    
    public boolean renderAsNormalBlock()
    {
    return false;
    }
    
    public boolean isOpaqueCube()
    {
    return false;
    }
    
    @SideOnly(Side.CLIENT)
    public int getRenderType()
    {
    return ClientProxy.renderInventoryBarriere;
    }
    
    protected BlockBarriere(Material material)
    {
    super(material);
    }
    
    public IIcon getIcon(int side, int metadata)
    {
    return ((Blocks.iron_block).getIcon(0, 0));
    }
    
    @Override
    public TileEntity createTileEntity(World world, int metadata)
    {
    if(metadata == 0)
    return new TileEntityBarriere();
    else if(metadata == 2)
    return new TileEntityBarriere2();
    else
    return null;
    }
    public boolean hasTileEntity(int metadata)
    {
    if(metadata == 0 || metadata == 2)
    return true;
    else
    return false;
    }
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
    {
    int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
    TileEntity te = world.getTileEntity(x, y, z);
    if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2)
    {
    ((TileEntityBarriere2)te).setDirection((byte)direction);
    world.markBlockForUpdate(x, y, z);
    }
    }
    
    }
    
  • Moddeurs confirmés Rédacteurs Administrateurs

    WHAT ? Attends, explique moi ce que tu veux faire. Tu veux faire un ou deux blocs ? Car la ce que tu as fait actuellement c'est 2 blocs en metadata avec 2 tile entity.


  • Non donc j'ai mon block barriere qui est un modèle techne donc j'ai suivi le tutoriel pour le faire , après j'ai voulu faire en sorte que sa tourne selon la direction j'ai posté ce message car je n'y arrivais pas et tu ma dis qu'il fallait aussi suivre le tuto sur la direction des blocs pour que mon model techne se tourne selon ou je me trouve j'ai donc suivi le tuto et dans le tuto il y a deux classes apparement ce que je voudrais c'est que mon model se tourne quand je le place de la facon dont moi je suis 🙂 Désolé si je semble mal m'exprimé 😕

  • Moddeurs confirmés Rédacteurs Administrateurs

    Les tutoriels, ils faut les lires, pas les copier/coller …
    J'ai expliqué dans le tutoriel sur les directions que j'appliquais la direction à un bloc en metadata de metadata2, dans ton cas tu n'as pas de bloc avec metadata, il te faut donc un seul tile entity --'
    Donc ça :

    @Override
    public TileEntity createTileEntity(World world, int metadata)
    {
    if(metadata == 0)
    return new TileEntityBarriere();
    else if(metadata == 2)
    return new TileEntityBarriere2();
    else
    return null;
    }
    public boolean hasTileEntity(int metadata)
    {
    if(metadata == 0 || metadata == 2)
    return true;
    else
    return false;
    }
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
    {
    int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
    TileEntity te = world.getTileEntity(x, y, z);
    if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2)
    {
    ((TileEntityBarriere2)te).setDirection((byte)direction);
    world.markBlockForUpdate(x, y, z);
    }
    }
    

    Devient :

    @Override
    public TileEntity createTileEntity(World world, int metadata)
    {
    return new TileEntityBarriere();
    }
    public boolean hasTileEntity(int metadata)
    {
    return true;
    }
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
    {
    int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
    TileEntity te = world.getTileEntity(x, y, z);
    if(te instanceof TileEntityBarriere)
    {
    ((TileEntityBarriere)te).setDirection((byte)direction);
    world.markBlockForUpdate(x, y, z);
    }
    }
    

    Et tu mets tout le contenu de TileEntityBarriere2 dans TileEntityBarriere et puis tu supprime TileEntityBarriere2