MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Animer vos rendus TESR.

    Planifier Épinglé Verrouillé Déplacé Les blocs
    1.6.4
    35 Messages 5 Publieurs 11.1k Vues 1 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • arthur111213A Hors-ligne
      arthur111213
      dernière édition par

      Non, il est même plus petit. c’est une armoire à pharmacie.
      ___
      Voici mon code

      TileEntityArmoirePh

      
      package _fearZ.mod.tileentity;
      
      import java.util.Iterator;
      import java.util.List;
      
      import _fearZ.mod.ContainerArmoirePh;
      import _fearZ.mod.blocks.BlockPharmacie;
      import _fearZ.mod.blocks.model.ModelArmoirPh;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.inventory.IInventory;
      import net.minecraft.item.ItemStack;
      import net.minecraft.nbt.NBTTagCompound;
      import net.minecraft.nbt.NBTTagList;
      import net.minecraft.network.INetworkManager;
      import net.minecraft.network.packet.Packet;
      import net.minecraft.network.packet.Packet132TileEntityData;
      import net.minecraft.tileentity.TileEntity;
      import net.minecraft.util.AxisAlignedBB;
      
      public class TileEntityArmoirePh extends TileEntity implements IInventory
      {
      public float lidAngle;
      public float prevLidAngle;
      public int numUsingPlayers;
      private int ticksSinceSync;
      
      public byte direction;
      private ItemStack[] inventory = new ItemStack[72];
      private String customName;
      public void readFromNBT(NBTTagCompound nbtTag)
      {
      super.readFromNBT(nbtTag);
      direction = nbtTag.getByte("direction");
      
      super.readFromNBT(nbtTag);
      NBTTagList nbttaglist = nbtTag.getTagList("Items");
      this.inventory = new ItemStack[this.getSizeInventory()];
      
      if (nbtTag.hasKey("CustomName"))
      {
      this.customName = nbtTag.getString("CustomName");
      }
      
      for (int i = 0; i < nbttaglist.tagCount(); i++)
      {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
      int j = nbttagcompound1.getByte("Slot");
      
      if (j >= 0 && j < this.inventory.length)
      {
      this.inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
      }
      }
      
      public boolean isUseableByPlayer(EntityPlayer player)
      {
      return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
      }
      
      public void writeToNBT(NBTTagCompound nbtTag)
      {
      super.writeToNBT(nbtTag);
      nbtTag.setByte("direction", direction);
      
      NBTTagList nbttaglist = new NBTTagList();
      
      for (int i = 0; i < this.inventory.length; i++)
      {
      if (this.inventory* != null)
      {
      NBTTagCompound nbttagcompound1 = new NBTTagCompound();
      nbttagcompound1.setByte("Slot", (byte)i);
      this.inventory*.writeToNBT(nbttagcompound1);
      nbttaglist.appendTag(nbttagcompound1);
      }
      }
      
      nbtTag.setTag("Items", nbttaglist);
      
      if (this.isInvNameLocalized())
      {
      nbtTag.setString("CustomName", this.customName);
      }
      }
      
      public ItemStack decrStackSize(int slotId, int quantity)
      {
      if (this.inventory[slotId] != null)
      {
      ItemStack itemstack;
      
      if (this.inventory[slotId].stackSize <= quantity)
      {
      itemstack = this.inventory[slotId];
      this.inventory[slotId] = null;
      this.onInventoryChanged();
      return itemstack;
      }
      else
      {
      itemstack = this.inventory[slotId].splitStack(quantity);
      
      if (this.inventory[slotId].stackSize == 0)
      {
      this.inventory[slotId] = null;
      }
      
      this.onInventoryChanged();
      return itemstack;
      }
      }
      else
      {
      return null;
      }
      }
      
      public ItemStack getStackInSlotOnClosing(int slotId)
      {
      if (this.inventory[slotId] != null)
      {
      ItemStack itemstack = this.inventory[slotId];
      this.inventory[slotId] = null;
      return itemstack;
      }
      else
      {
      return null;
      }
      }
      
      public void setInventorySlotContents(int slotId, ItemStack stack)
      {
      this.inventory[slotId] = stack;
      
      if (stack != null && stack.stackSize > this.getInventoryStackLimit())
      {
      stack.stackSize = this.getInventoryStackLimit();
      }
      
      this.onInventoryChanged();
      }
      
      public String getInvName()
      {
      return this.isInvNameLocalized() ? this.customName : "container.armoireph";
      }
      
      public int getInventoryStackLimit()
      {
      return 64;
      }
      
      public boolean isInvNameLocalized()
      {
      return this.customName != null && this.customName.length() > 0;
      }
      
      public void setCustomGuiName(String name)
      {
      this.customName = name;
      }
      
      public ItemStack getStackInSlot(int slotId)
      {
      return inventory[slotId];
      }
      
      public int getSizeInventory()
      {
      return inventory.length;
      }
      
      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 boolean isItemValidForSlot(int slotId, ItemStack stack)
      {
      return true;
      }
      
      public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
      {
      this.readFromNBT(pkt.data);
      }
      
      @Override
      public void openChest()
      {
      if(this.numUsingPlayers < 0)
      {
      this.numUsingPlayers = 0;
      }
      
      ++this.numUsingPlayers;
      this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 1, this.numUsingPlayers);
      }
      
      @Override
      public void closeChest()
      {
      –this.numUsingPlayers;
      this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 1, this.numUsingPlayers);
      }
      
      public boolean receiveClientEvent(int eventId, int eventValue)
      {
      if(eventId == 1)
      {
      this.numUsingPlayers = eventValue;
      return true;
      }
      else
      {
      return super.receiveClientEvent(eventId, eventValue);
      }
      }
      
      public void updateEntity()
      {
      super.updateEntity();
      ++this.ticksSinceSync;
      
      if(!this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0)
      {
      this.numUsingPlayers = 0;
      List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB(this.xCoord - 5, this.yCoord - 5, this.zCoord - 5, this.xCoord + 6, this.yCoord + 6, this.zCoord + 6));
      Iterator iterator = list.iterator();
      
      while(iterator.hasNext())
      {
      EntityPlayer entityplayer = (EntityPlayer)iterator.next();
      
      if(entityplayer.openContainer instanceof ContainerArmoirePh)
      {
      ++this.numUsingPlayers;
      }
      }
      }
      
      this.prevLidAngle = this.lidAngle;
      
      if(this.numUsingPlayers > 0 && this.lidAngle == 0.0F)
      {
      this.worldObj.playSoundEffect(((double)this.xCoord + 0.5), (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
      }
      
      if(this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F)
      {
      float f1 = this.lidAngle;
      
      if(this.numUsingPlayers > 0)
      {
      this.lidAngle += 0.1F;
      }
      else
      {
      this.lidAngle -= 0.1F;
      }
      
      if(this.lidAngle > 1.0F)
      {
      this.lidAngle = 1.0F;
      }
      
      float f2 = 0.5F;
      
      if(this.lidAngle < f2 && f1 >= f2)
      {
      this.worldObj.playSoundEffect((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
      }
      
      if(this.lidAngle < 0.0F)
      {
      this.lidAngle = 0.0F;
      }
      }
      }
      
      }
      
      

      ContainerArmoirePh

      
      package _fearZ.mod;
      
      import _fearZ.mod.tileentity.TileEntityArmoirePh;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.entity.player.InventoryPlayer;
      import net.minecraft.inventory.Container;
      import net.minecraft.inventory.Slot;
      import net.minecraft.item.ItemStack;
      
      public class ContainerArmoirePh extends Container
      {
      private TileEntityArmoirePh tileEntity;
      
      public ContainerArmoirePh(InventoryPlayer playerInventory, TileEntityArmoirePh teArmoirePh)
      {
      this.tileEntity = teArmoirePh;
      
      teArmoirePh.openChest();
      
      for(int i = 0; i < 6; i++)
      {
      for(int j = 0; j < 9; j++)
      {
      this.addSlotToContainer(new Slot(teArmoirePh, j + i * 9, 8 + j * 18, 18 + i * 18));
      }
      }
      this.bindPlayerInventory(playerInventory);
      }
      
      private void bindPlayerInventory(InventoryPlayer playerInventory)
      {
      int i;
      for(i = 0; i < 3; i++)
      {
      for(int j = 0; j < 9; j++)
      {
      this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 103 + i * 18 + 37));
      }
      }
      
      for(i = 0; i < 9; i++)
      {
      this.addSlotToContainer(new Slot(playerInventory, i, 8 + i * 18, 161 + 37));
      }
      }
      
      public void onContainerClosed(EntityPlayer player)
      {
      super.onContainerClosed(player);
      tileEntity.closeChest();
      }
      
      @Override
      public boolean canInteractWith(EntityPlayer player)
      {
      return tileEntity.isUseableByPlayer(player);
      }
      
      public ItemStack transferStackInSlot(EntityPlayer player, int slotId)
      {
      ItemStack itemstack = null;
      Slot slot = (Slot)this.inventorySlots.get(slotId);
      
      if(slot != null && slot.getHasStack())
      {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();
      
      if(slotId < 9)
      {
      if(!this.mergeItemStack(itemstack1, 9, this.inventorySlots.size(), true))
      {
      return null;
      }
      }
      else if(!this.mergeItemStack(itemstack1, 0, 9, false))
      {
      return null;
      }
      
      if(itemstack1.stackSize == 0)
      {
      slot.putStack((ItemStack)null);
      }
      else
      {
      slot.onSlotChanged();
      }
      }
      return itemstack;
      }
      }
      
      

      BlockPharmacie

      
      package _fearZ.mod.blocks;
      
      import java.util.List;
      
      import _fearZ.mod.Mod_FearZ;
      import _fearZ.mod.blocks.model.ModelArmoirPh;
      import _fearZ.mod.client.ClientProxy;
      import _fearZ.mod.tileentity.TileEntityArmoirePh;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.BlockContainer;
      import net.minecraft.block.material.Material;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.renderer.texture.IconRegister;
      import net.minecraft.creativetab.CreativeTabs;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.item.EntityItem;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.item.ItemStack;
      import net.minecraft.nbt.NBTTagCompound;
      import net.minecraft.tileentity.TileEntity;
      import net.minecraft.util.Icon;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.IBlockAccess;
      import net.minecraft.world.World;
      import cpw.mods.fml.common.network.FMLNetworkHandler;
      import cpw.mods.fml.relauncher.Side;
      import cpw.mods.fml.relauncher.SideOnly;
      
      public class BlockPharmacie extends BlockContainer
      {
      private double angle = 0;
      public BlockPharmacie(int id)
      {
      super(id, Material.rock);
      this.setCreativeTab(Mod_FearZ.onglet);
      }
      
      @Override
      public TileEntity createNewTileEntity(World world)
      {
      return null;
      }
      
      @Override
      public TileEntity createTileEntity(World world, int metadata)
      {
      return new TileEntityArmoirePh();
      }
      
      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.renderInventoryTESRId;
      }
      
      public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
      {
      FMLNetworkHandler.openGui(player, Mod_FearZ.modInstance, 0, world, x, y, z);
      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.getBlockTileEntity(x, y, z);
      if(te != null && te instanceof TileEntityArmoirePh)
      {
      ((TileEntityArmoirePh)te).setDirection((byte)direction);
      world.markBlockForUpdate(x, y, z);
      }
      }
      
      public void breakBlock(World world, int x, int y, int z, int side, int metadata)
      {
      dropContainerItem(world, x, y, z);
      super.breakBlock(world, x, y, z, side, metadata);
      }
      
      protected void dropContainerItem(World world, int x, int y, int z)
      {
      TileEntityArmoirePh pharmacie = (TileEntityArmoirePh)world.getBlockTileEntity(x, y, z);
      
      if (pharmacie != null)
      {
      for (int slotId = 0; slotId < pharmacie.getSizeInventory(); slotId++)
      {
      ItemStack stack = pharmacie.getStackInSlot(slotId);
      
      if (stack != null)
      {
      float f = world.rand.nextFloat() * 0.8F + 0.1F;
      float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
      EntityItem entityitem;
      
      for (float f2 = world.rand.nextFloat() * 0.8F + 0.1F; stack.stackSize > 0; world.spawnEntityInWorld(entityitem))
      {
      int k1 = world.rand.nextInt(21) + 10;
      
      if (k1 > stack.stackSize)
      {
      k1 = stack.stackSize;
      }
      
      stack.stackSize -= k1;
      entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(stack.itemID, k1, stack.getItemDamage()));
      float f3 = 0.05F;
      entityitem.motionX = (double)((float)world.rand.nextGaussian() * f3);
      entityitem.motionY = (double)((float)world.rand.nextGaussian() * f3 + 0.2F);
      entityitem.motionZ = (double)((float)world.rand.nextGaussian() * f3);
      
      if (stack.hasTagCompound())
      {
      entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
      }
      }
      }
      }
      }
      }
      
      public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventValue)
      {
      TileEntity tileentity = world.getBlockTileEntity(x, y, z);
      return tileentity != null ? tileentity.receiveClientEvent(eventId, eventValue) : false;
      }
      
      @Override
      public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z)
      {
      TileEntity te = blockAccess.getBlockTileEntity(x, y, z);
      if (te != null && te instanceof TileEntityArmoirePh)
      {
      if (((TileEntityArmoirePh)te).getDirection() == 0)
      {
      this.setBlockBounds(0.0F, 0.19F, 0.0F, 1.0F, 0.81F, 0.368F);
      }
      
      else if (((TileEntityArmoirePh)te).getDirection() == 1)
      {
      this.setBlockBounds(0.625F, 0.19F, 0.0F, 1.0F, 0.81F, 1.0F);
      }
      else if (((TileEntityArmoirePh)te).getDirection() == 2)
      {
      this.setBlockBounds(0.0F, 0.19F, 0.625F, 1.0F, 0.81F, 1.0F);
      }
      else if (((TileEntityArmoirePh)te).getDirection() == 3)
      {
      this.setBlockBounds(0.0F, 0.19F, 0.0F, 0.368F, 0.81F, 1.0F);
      }
      else
      {
      this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
      }
      }
      }
      public Icon getIcon(int side, int metadata)
      {
      return Block.blockIron.getIcon(0, 0);
      }
      }
      
      

      TileEntityArmoirePhSpecialRender

      
      package _fearZ.mod.tileentity.renderer;
      
      import org.lwjgl.opengl.GL11;
      
      import _fearZ.mod.blocks.model.ModelArmoirPh;
      import _fearZ.mod.tileentity.TileEntityArmoirePh;
      import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
      import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
      import net.minecraft.tileentity.TileEntity;
      import net.minecraft.util.ResourceLocation;
      
      public class TileEntityArmoirePhSpecialRender extends TileEntitySpecialRenderer implements IInventoryRenderer
      {
      private final ModelArmoirPh mdl = new ModelArmoirPh();
      public static final ResourceLocation texture = new ResourceLocation("fearz", "textures/blocks/ArmoirePharmacie.png");
      public TileEntityArmoirePhSpecialRender()
      {
      this.setTileEntityRenderer(TileEntityRenderer.instance);
      }
      
      @Override
      public void renderInventory(double x, double y, double z)
      {
      this.renderTileEntityArmoirePhAt(null, x, y, z, 0.0F);
      }
      
      @Override
      public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f)
      {
      this.renderTileEntityArmoirePhAt((TileEntityArmoirePh)te, x, y, z, f);
      }
      
      public void renderTileEntityArmoirePhAt(TileEntityArmoirePh te, double x, double y, double z, float tick)
      {
      GL11.glPushMatrix();
      GL11.glTranslated(x + 0.5F, y + 1.5F, z + 0.5F);
      this.bindTexture(texture);
      
      GL11.glRotatef(180.0F, -2000000.0F, 0.0F, 1.0F);
      if(te != null)
      {
      GL11.glRotatef(90F * te.getDirection(), 0.0F, 1.0F, 0.0F);
      }
      this.mdl.render(0.0625F);
      GL11.glPopMatrix();
      
      if(te != null)
      {
      float angle = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * tick;
      angle = 1.0F - angle;
      angle = 1.0F - angle * angle * angle;
      this.mdl.porte1.rotateAngleY = (angle * (float)Math.PI / 2.0F);
      this.mdl.poignee1.rotateAngleY = (angle * (float)Math.PI / 2.0F);
      this.mdl.porte2.rotateAngleY = -(angle * (float)Math.PI / 2.0F);
      this.mdl.poignee2.rotateAngleY = -(angle * (float)Math.PI / 2.0F);
      }
      }
      }
      
      
      1 réponse Dernière réponse Répondre Citer 0
      • robin4002R Hors-ligne
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
        dernière édition par

        public void renderTileEntityArmoirePhAt(TileEntityArmoirePh te, double x, double y, double z, float tick)
        {
        GL11.glPushMatrix();
        GL11.glTranslated(x + 0.5F, y + 1.5F, z + 0.5F);
        this.bindTexture(texture);
        
        GL11.glRotatef(180.0F, -2000000.0F, 0.0F, 1.0F);
        if(te != null)
        {
        float angle = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * tick;
        angle = 1.0F - angle;
        angle = 1.0F - angle * angle * angle;
        this.mdl.porte1.rotateAngleY = (angle * (float)Math.PI / 2.0F);
        this.mdl.poignee1.rotateAngleY = (angle * (float)Math.PI / 2.0F);
        this.mdl.porte2.rotateAngleY = -(angle * (float)Math.PI / 2.0F);
        this.mdl.poignee2.rotateAngleY = -(angle * (float)Math.PI / 2.0F);
        GL11.glRotatef(90F * te.getDirection(), 0.0F, 1.0F, 0.0F);
        }
        this.mdl.render(0.0625F);
        GL11.glPopMatrix();
        }
        

        Comme ça. Le .render et le GL11.glPopMatrix(); doivent être en dernier.

        1 réponse Dernière réponse Répondre Citer 0
        • arthur111213A Hors-ligne
          arthur111213
          dernière édition par

          Ah désolé, je suis un peu fatigué en ce moment 😄
          tout marche bien maintenant. Merci 🙂

          1 réponse Dernière réponse Répondre Citer 0
          • robin4002R Hors-ligne
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
            dernière édition par

            C’est aussi de ma faute, j’ai pas précisez ou mettre le null check, j’ai ajouté une indication ;).

            1 réponse Dernière réponse Répondre Citer 0
            • P Hors-ligne
              Portuar
              dernière édition par

              tu as monter ici comment faire un mouvement de “portière” mais pourrais tu donner d’autre exemple comme un mouvement circulaire ou un blokc qui tourne sur lui même.

              1 réponse Dernière réponse Répondre Citer 0
              • robin4002R Hors-ligne
                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                dernière édition par

                C’est le même principe, il faut utilise pi. Regarde le code pour le deuxième bloc, l’axe centrale tourne en rond :
                https://github.com/FFMT/ModTutoriel/commit/38671521bc9b537e484cc299400cac8414fc4947
                Il me semblait avoir rédigé la deuxième partie, mais visiblement non x)

                1 réponse Dernière réponse Répondre Citer 0
                • pulganP Hors-ligne
                  pulgan
                  dernière édition par

                  J’ai du mal a comprendre d’accord il faut passer par l’autre tuto mais je n’ai rien compris le rapport avec celui ci est t’il possible de faire le tuto depuis le début car la je suis completement perdu. Dommage c’est un sujet que je voulait bien comprendre

                  1 réponse Dernière réponse Répondre Citer 0
                  • robin4002R Hors-ligne
                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                    dernière édition par

                    Heu non ça serait beaucoup trop long. Commence d’abord par avoir un bloc avec un rendu TESR fonctionnel.

                    1 réponse Dernière réponse Répondre Citer 0
                    • pulganP Hors-ligne
                      pulgan
                      dernière édition par

                      daccord mais pour avoir le rendu TESR il faut faire tout l’autre tuto?

                      1 réponse Dernière réponse Répondre Citer 0
                      • robin4002R Hors-ligne
                        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                        dernière édition par

                        Oui. Si tu veux animer quelque chose il faut déjà avoir ce quelque chose 😉

                        1 réponse Dernière réponse Répondre Citer 0
                        • pulganP Hors-ligne
                          pulgan
                          dernière édition par

                          Pour ouvrir le block il faut absolument avoir le gui?

                          1 réponse Dernière réponse Répondre Citer 0
                          • robin4002R Hors-ligne
                            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                            dernière édition par

                            Non, pas forcement, tu peux faire qu’il s’ouvre suite à une autre action (genre quand tu fais un clic droit ça passe une boolean et true, et du-coup ça l’ouvre).

                            1 réponse Dernière réponse Répondre Citer 0
                            • pulganP Hors-ligne
                              pulgan
                              dernière édition par

                              Il faut mieux commencer par faire le coffre ou le rendu TESR d’abord ? car je m’embrouille un peu

                              1 réponse Dernière réponse Répondre Citer 0
                              • robin4002R Hors-ligne
                                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                dernière édition par

                                Coffre, car sans bloc tu peux pas faire de tesr.

                                1 réponse Dernière réponse Répondre Citer 0
                                • P Hors-ligne
                                  Portuar
                                  dernière édition par

                                  J’ai une question, comment faire pour avoir un mouvement verticale ou horizontale pour seulement une seul partie du model?

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • robin4002R Hors-ligne
                                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                    dernière édition par

                                    Il faut gérer ça au niveau du model.render() en fait ce qu’il faudrait faire, c’est exclure la partie voulu de la fonction render() et créer une autre fonction pour la partie voulu. Et du-coup tu as juste a faire une translation avec openGL avant de rendre la partie voulu.

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • P Hors-ligne
                                      Portuar
                                      dernière édition par

                                      J’ai mis ceci

                                      GL11.glPushMatrix();

                                      GL11.glTranslated(x, y + 1f, z);
                                      this.model.renderDoor_1(0.0625F);
                                      GL11.glPopMatrix();

                                      Mais la “porte” reste à la même place!

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • robin4002R Hors-ligne
                                        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                        dernière édition par

                                        N’ouvre pas de nouvelle matrix.
                                        Rend tout le modèle sauf le morceau voulu, déplace, puis fait le rendu du morceau voulu :

                                        ​    private void renderTileEntityTutorielAt(TileEntityTutoriel tile, double x, double y, double z, float partialRenderTick)
                                        
                                            {
                                                GL11.glPushMatrix();
                                                GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D);
                                                GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
                                                GL11.glRotatef((90F * tile.getDirection()) + 180F, 0.0F, 1.0F, 0.0F);
                                                this.bindTexture(texture);
                                                model.renderAll();
                                        
                                                GL11.glTranslated(0.0D, -1D, 0.0D);
                                                model.renderDoor();
                                        
                                                GL11.glPopMatrix();
                                            }
                                        

                                        ça fonctionne sans problème chez moi, la partie porte se trouve un bloc plus haut que le reste avec ça.

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • P Hors-ligne
                                          Portuar
                                          dernière édition par

                                          Sa me met une erreur quand j’essaye de “bouger” le model en question j’ai ecris cec

                                                  GL11.glTranslated(0.0D, -te.getMouv_1(), 0.0D);
                                          
                                          

                                          Mais sa ne fonctionne pas et te.getMouv_1() varie de 0 à 1

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • robin4002R Hors-ligne
                                            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                            dernière édition par

                                            Tes valeurs sont bien synchro avec le client ?

                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB