MFF

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

    Créer un gui et un container sur un bloc (type coffre)

    Planifier Épinglé Verrouillé Déplacé Les interfaces (GUI) et les container
    1.6.x
    136 Messages 24 Publieurs 55.9k Vues 5 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.
    • DiabolicaTrixD Hors-ligne
      DiabolicaTrix Correcteurs Moddeurs confirmés
      dernière édition par

      Je ne comprend pas où je draw le double coffre, mon draw est identique à celui du tutoriel.

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

        Ici :

        @Override
        protected void drawGuiContainerBackgroundLayer(float partialRenderType, int x, int y)
        {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // On remet les couleurs à 0
        this.mc.getTextureManager().bindTexture(textures); // On indique qu'on utilise la texture
        int k = (this.width - this.xSize) / 2; // On centre le GUI
        int l = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); // Et on le dessine
        }
        

        Site web contenant mes scripts : http://SCAREXgaming.github.io

        Pas de demandes de support par MP ni par skype SVP.
        Je n'accepte sur skype que l…

        1 réponse Dernière réponse Répondre Citer 0
        • DiabolicaTrixD Hors-ligne
          DiabolicaTrix Correcteurs Moddeurs confirmés
          dernière édition par

          C’est ça le problème, il est identique au tutoriel(vidéo) et dans la vidéo, il est simple…

          P.S: Ça fonctionne si je coupe la texture mais pas si la texture est double coffre, pourtant minecraft est supposé le couper lui même, non?

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

            Il faut savoir que les tailles que tu mets sont en fonction de la taille de ta texture sur la base 256, donc si ta texture fait 512*512, il faudra diviser par 2.

            Site web contenant mes scripts : http://SCAREXgaming.github.io

            Pas de demandes de support par MP ni par skype SVP.
            Je n'accepte sur skype que l…

            1 réponse Dernière réponse Répondre Citer 0
            • DiabolicaTrixD Hors-ligne
              DiabolicaTrix Correcteurs Moddeurs confirmés
              dernière édition par

              Ça ne marche pas plus en 256 :S

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

                Minecraft ne fait rien du tout, la fonction drawTexture est une fonction basique qui utilise le tesselator. Minecraft dessine le GUI du coffre en plusieurs parties.

                Site web contenant mes scripts : http://SCAREXgaming.github.io

                Pas de demandes de support par MP ni par skype SVP.
                Je n'accepte sur skype que l…

                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

                  Dans la classe du coffre de base Minecraft il y a deux draw et en effet le code coupe la texture.
                  Par contre le code que j’ai donné dans le tutoriel en vidéo n’a qu’un draw et ne fait pas cette coupure. Il faut donc une texture qui ne fait que la taille d’un coffre.

                  1 réponse Dernière réponse Répondre Citer 0
                  • DiabolicaTrixD Hors-ligne
                    DiabolicaTrix Correcteurs Moddeurs confirmés
                    dernière édition par

                    Ah, d’accord merci beaucoup!

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

                      Salut ! J’ai une erreur sur le .getBlockTileEntity que je n’arrive pas à résoudre :

                      http://www.noelshack.com/2017-28-2-1499806075-capture.png

                      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

                        essaies avec getTileEntity ?

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

                          Dans mon guihandler, il y des erreurs partout :

                          http://www.noelshack.com/2017-28-3-1499887482-9.png

                          Auriez-vous une solution ?

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

                            Oui je t’invite à regarder la partie du GuiHandler du tuto car là ton GuiHandler est pas bon du tout.

                            EDIT : en fait pas précisé dans le tuto car eclipse le fait tout seul si tu fais bien dans l’ordre mais il faut que la classe implémente IGuiHandler.

                            Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                            AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                            Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                            Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                              Ok j’ai modifié ça mais il y a ça comme erreurs :

                              http://www.noelshack.com/2017-28-3-1499888845-10.png

                              http://www.noelshack.com/2017-28-3-1499888851-11.png

                              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

                                La version 1.7.10 du tutoriel est ici : https://www.minecraftforgefrance.fr/showthread.php?tid=2082

                                1 réponse Dernière réponse Répondre Citer 1
                                • HeavenH Hors-ligne
                                  Heaven
                                  dernière édition par Heaven

                                  Bonjour , de 1 SUPER tuto !

                                  mais le coffre ne s ouvre pas et il n affiche pas la texture pourrais tu m aider @robin4002 ?

                                  mes 4 class:

                                  public class tileNugarCoffre extends TileEntity implements IInventory {
                                      private ItemStack[] inventory = new ItemStack[72];
                                  
                                      private String customName;
                                  
                                      public TileEntity tileEntity(World world) {
                                          return null;
                                      }
                                  
                                      public void readFromNBT(NBTTagCompound nbttag)
                                      {
                                          super.readFromNBT(nbttag);
                                          NBTTagList nbttaglist = nbttag.getTagList("Items", 0);
                                          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 = nbttaglist.getCompoundTagAt(i);
                                              int j = nbttagcompound1.getByte("Slot");
                                  
                                              if (j >= 0 && j < this.inventory.length)
                                              {
                                                  this.inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
                                              }
                                          }
                                      }
                                  
                                      public void writeToNBT(NBTTagCompound nbttag)
                                      {
                                          super.writeToNBT(nbttag);
                                          NBTTagList nbttaglist = new NBTTagList();
                                  
                                          for (int i = 0; i < this.inventory.length; i++)
                                          {
                                              if (this.inventory[i] != null)
                                              {
                                                  NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                                                  nbttagcompound1.setByte("Slot", (byte)i);
                                                  this.inventory[i].writeToNBT(nbttagcompound1);
                                                  nbttaglist.appendTag(nbttagcompound1);
                                              }
                                          }
                                  
                                          nbttag.setTag("Items", nbttaglist);
                                  
                                          if (this.isInvNameLocalized())
                                          {
                                              nbttag.setString("CustomName", this.customName);
                                          }
                                      }
                                  
                                  
                                      @Override
                                      public int getSizeInventory() {
                                          return inventory.length;
                                      }
                                  
                                  
                                      @Override
                                      public ItemStack getStackInSlot(int slotIndex) { //Renvoie L'itemStack se trouvant dans le slot passé en argument
                                          return this.inventory[slotIndex];
                                      }
                                  
                                      public ItemStack decrStackSize(int slotIndex, int amount) {
                                          if (this.inventory[slotIndex] != null)
                                          {
                                              ItemStack itemstack;
                                  
                                              if (this.inventory[slotIndex].stackSize <= amount)
                                              {
                                                  itemstack = this.inventory[slotIndex];
                                                  this.inventory[slotIndex] = null;
                                                  this.markDirty();
                                                  return itemstack;
                                              }
                                              else
                                              {
                                                  itemstack = this.inventory[slotIndex].splitStack(amount);
                                  
                                                  if (this.inventory[slotIndex].stackSize == 0)
                                                  {
                                                      this.inventory[slotIndex] = null;
                                                  }
                                  
                                                  this.markDirty();
                                                  return itemstack;
                                              }
                                          }
                                          else
                                          {
                                              return null;
                                          }
                                      }
                                  
                                      @Override
                                      public ItemStack getStackInSlotOnClosing(int slotIndex) {
                                          if (this.inventory[slotIndex] != null)
                                          {
                                              ItemStack itemstack = this.inventory[slotIndex];
                                              this.inventory[slotIndex] = null;
                                              return itemstack;
                                          }
                                          else
                                          {
                                              return null;
                                          }
                                      }
                                  
                                      @Override
                                      public void setInventorySlotContents(int slotIndex, ItemStack stack) {
                                          this.inventory[slotIndex] = stack;
                                  
                                          if (stack != null && stack.stackSize > this.getInventoryStackLimit())
                                          {
                                              stack.stackSize = this.getInventoryStackLimit();
                                          }
                                  
                                          this.markDirty();
                                      }
                                  
                                  
                                         @Override
                                      public String getInventoryName() { //J'ai décider qu'on ne pouvait pas mettre de nom custom
                                             return this.isInvNameLocalized() ? this.customName : "tile.nugarCoffre";
                                  
                                         }
                                  
                                      @Override
                                      public boolean hasCustomInventoryName() {
                                          return false;
                                      }
                                  
                                  
                                      public boolean isInvNameLocalized(){
                                          return this.customName != null && this.customName.length() > 0;
                                      }
                                  
                                      @Override
                                      public int getInventoryStackLimit()
                                      {
                                          return 64;
                                      }
                                      @Override
                                      public boolean isUseableByPlayer(EntityPlayer player) {
                                          return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
                                      }
                                  
                                  
                                  
                                      public void setCustomGuiName(String name)
                                      {
                                          this.customName = name;
                                      }
                                  
                                      @Override
                                      public void openInventory() {
                                  
                                      }
                                  
                                      @Override
                                      public void closeInventory() {
                                  
                                      }
                                  
                                      @Override
                                      public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
                                          return true;
                                      }
                                  
                                  
                                  }
                                  
                                  public class NugarCoffre extends BlockContainer {
                                  
                                  
                                  
                                      public NugarCoffre(Material material) {
                                          super(material);
                                          this.setResistance(8.0F);
                                          this.setHarvestLevel("axe", 0); //Outil pour casser le bloc, pour le chiffre : 0=bois, 1=pierre, 2=fer, 3=diamant
                                  
                                      }
                                      public static ResourceLocation texture = new ResourceLocation(References.MOD_ID, "textures/chest/NugarChest/NugarChest.png");
                                  
                                  
                                  
                                      @Override
                                      public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
                                          return null;
                                      }
                                  
                                      public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
                                      {
                                          FMLNetworkHandler.openGui(player, NugarMod.instance, 1, world, x, y, z);
                                          return true;
                                      }
                                  
                                      public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
                                      {
                                          TileEntity te = world.getTileEntity(x, y, z);
                                          if(te != null && stack.getItemDamage() == 3 && te instanceof tileNugarCoffre && stack.hasDisplayName())
                                          {
                                              ((tileNugarCoffre)te).setCustomGuiName(stack.getDisplayName());
                                          }
                                      }
                                  
                                      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, Block.getBlockById(side), metadata);
                                      }
                                      protected void dropContainerItem(World world, int x, int y, int z)
                                      {
                                          tileNugarCoffre nugarcoffre = (tileNugarCoffre)world.getTileEntity(x, y, z);
                                  
                                          if (nugarcoffre != null)
                                          {
                                              for (int slotId = 0; slotId < nugarcoffre.getSizeInventory(); slotId++)
                                              {
                                                  ItemStack stack = nugarcoffre.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.getItem(), 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 class GuiNugarCoffre extends GuiContainer{
                                  
                                      public static ResourceLocation texture = new ResourceLocation( "textures/gui/container/Chest.png");
                                      private tileNugarCoffre nugarCoffre;
                                      private IInventory playerInv;
                                  
                                      public GuiNugarCoffre(InventoryPlayer inventory, tileNugarCoffre tileEntity)
                                      {
                                          super(new ContainerNugarCOffre(inventory, tileEntity));
                                          this.nugarCoffre = tileEntity;
                                          this.playerInv = inventory;
                                          this.ySize = 230;
                                      }
                                  
                                      protected void drawGuiContainerForegroundLayer(int par1, int par2)
                                      {
                                          this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName()), 10, this.ySize - 98, 4210752);
                                          this.fontRendererObj.drawString(this.nugarCoffre.isInvNameLocalized() ? this.nugarCoffre.getInventoryName() : I18n.format(this.nugarCoffre.getInventoryName()), 8, 7, 0);
                                      }
                                  
                                      @Override
                                      protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
                                      {
                                          GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                          this.mc.getTextureManager().bindTexture(texture);
                                          int x = (this.width - this.xSize) / 2;
                                          int y = (this.height - this.ySize) / 2;
                                          this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
                                      }
                                  }
                                  
                                  public class ContainerNugarCOffre extends Container {
                                  
                                          private tileNugarCoffre tileEntity;
                                  
                                          public ContainerNugarCOffre(InventoryPlayer playerInventory, tileNugarCoffre teChest)
                                          {
                                              this.tileEntity = teChest;
                                  
                                              for(int i = 0; i < 6; i++)
                                              {
                                                  for(int j = 0; j < 9; j++)
                                                  {
                                                      this.addSlotToContainer(new Slot(teChest, 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));
                                              }
                                          }
                                  
                                          @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;
                                          }
                                      }
                                  
                                  
                                  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

                                    Avec la fonction createNewTileEntity qui retourne null dans la classe de ton bloc, ce n’est pas étonnant que cela ne fonctionne pas.

                                    Reprends la tête posée les différentes étapes et les pré-requis car tu as visiblement loupé des étapes.

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

                                      merci de ta réponse mais j avais régler se problème sauf que ca n a visiblement pas mis l édit bon pas grave

                                      la mon potentielle problème est la texture car aucune texture ne s affiche sur mon coffre sais tu comment régler ce problème ?

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

                                        j’ai un probleme avec un coffre que j’ai fais quand je lance le jeu et que met du contenue dans le coffre puis je le casse les items ne drop pas aidé moi et aussi je sais pas créer de nouveau sujet

                                        ma classe du block

                                        package com.mod.valerium.blocks;
                                        
                                        import com.mod.valerium.ModVale;
                                        import com.mod.valerium.tileentity.TileEntityValeriumChest;
                                        
                                        import cpw.mods.fml.relauncher.Side;
                                        import cpw.mods.fml.relauncher.SideOnly;
                                        import net.minecraft.block.Block;
                                        import net.minecraft.block.BlockContainer;
                                        import net.minecraft.block.material.Material;
                                        import net.minecraft.client.renderer.texture.IIconRegister;
                                        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.inventory.IInventory;
                                        import net.minecraft.item.ItemStack;
                                        import net.minecraft.nbt.NBTTagCompound;
                                        import net.minecraft.tileentity.TileEntity;
                                        import net.minecraft.util.MathHelper;
                                        import net.minecraft.world.World;
                                        
                                        public class BlockValeriumChest
                                          extends BlockContainer
                                        {
                                          private Entity entityitem;
                                        
                                        
                                        
                                        public BlockValeriumChest() {
                                            super(Material.iron);
                                            setResistance(8.0F);
                                            setHarvestLevel("pickaxe", 2);
                                            setCreativeTab(ModVale.valerium);
                                            setBlockName("valerium_chest");
                                            setHardness(12.0F);
                                            setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
                                          }
                                        
                                        
                                          
                                          public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityValeriumChest(); }
                                        
                                        
                                        
                                          
                                          public boolean hasTileEntity() { return true; }
                                        
                                        
                                          
                                          public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
                                            byte b0 = 0;
                                            int l = MathHelper.floor_double((entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 0x3;
                                            
                                            if (l == 0)
                                            {
                                              b0 = 2;
                                            }
                                            
                                            if (l == 1)
                                            {
                                              b0 = 5;
                                            }
                                            
                                            if (l == 2)
                                            {
                                              b0 = 3;
                                            }
                                            
                                            if (l == 3)
                                            {
                                              b0 = 4;
                                            }
                                            
                                            world.setBlockMetadataWithNotify(x, y, z, b0, 2);
                                          }
                                        
                                          
                                          public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
                                            if (!world.getBlock(x, y + 1, z).isNormalCube()) {
                                              if (!world.isRemote) {
                                                player.openGui(ModVale.modInstance, 4, world, x, y, z);
                                              }
                                              return true;
                                            } 
                                            return true;
                                          }
                                          
                                          public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
                                            TileEntity tileentity = world.getTileEntity(x, y, z);
                                            
                                            if (tileentity instanceof IInventory) {
                                              IInventory inv = (IInventory)tileentity;
                                              for (int i1 = 0; i1 < inv.getSizeInventory(); i1++) {
                                                ItemStack itemstack = inv.getStackInSlot(i1);
                                                
                                                if (itemstack != null) {
                                                  float f = world.rand.nextFloat() * 0.8F + 0.1F;
                                                  float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
                                        
                                                  
                                                  for (float f2 = world.rand.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world
                                                    .spawnEntityInWorld(entityitem)) {
                                                    int j1 = world.rand.nextInt(21) + 10;
                                                    
                                                    if (j1 > itemstack.stackSize) {
                                                      j1 = itemstack.stackSize;
                                                    }
                                                    
                                                    itemstack.stackSize -= j1;
                                        
                                                    
                                                    EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
                                                    float f3 = 0.05F;
                                                    entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
                                                    entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
                                                    entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
                                                    
                                                    if (itemstack.hasTagCompound()) {
                                                      entityitem.getEntityItem()
                                                        .setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
                                                    }
                                                  } 
                                                } 
                                              } 
                                              
                                              world.func_147453_f(x, y, z, block);
                                            } 
                                            
                                            super.breakBlock(world, x, y, z, block, metadata);
                                          }
                                        
                                          
                                          public boolean renderAsNormalBlock() { return false; }
                                        
                                        
                                          
                                          public int getRenderType() { return 22; }
                                        
                                        
                                          
                                          public boolean isOpaqueCube() { return false; }
                                        
                                        
                                          
                                          @SideOnly(Side.CLIENT)
                                          public void registerBlockIcons(IIconRegister icon) { this.blockIcon = icon.registerIcon("valerium:valerium_block"); }
                                        
                                          }
                                        
                                        
                                        1 réponse Dernière réponse Répondre Citer 0
                                        • blixow14B Hors-ligne
                                          blixow14
                                          dernière édition par

                                          Passe à une version supérieur ! Sinon pour quand même répondre à ta question, le problème vient de ta méthode breakBlock

                                          J'aime les pâtes

                                          M 1 réponse Dernière réponse Répondre Citer 0
                                          • M Hors-ligne
                                            MidacoYT @blixow14
                                            dernière édition par

                                            @blixow14 nn c’est bon j’ai refait toute la classe et sa fonctionne mais merci pour l’aide quand même

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB