MFF

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

    Bug chest

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.2
    15 Messages 2 Publieurs 3.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.
    • FairyOneF Hors-ligne
      FairyOne
      dernière édition par

      A oups désoler

      TileEntity :

      :::
      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.tileentity.TileEntity;
      import net.minecraftforge.common.util.Constants;

      public class TileEntityBlockBarrel3D extends TileEntity implements IInventory
      {
          private ItemStack[] contents = new ItemStack[27];
          private String customName;

      @Override
          public void readFromNBT(NBTTagCompound compound)
          {
              super.readFromNBT(compound);

      if (compound.hasKey(“CustomName”, Constants.NBT.TAG_STRING))
              {
                  this.customName = compound.getString(“CustomName”);
              }
              NBTTagList nbttaglist = compound.getTagList(“Items”, Constants.NBT.TAG_COMPOUND);
              this.contents = new ItemStack[this.getSizeInventory()];

      for (int i = 0; i < nbttaglist.tagCount(); ++i)
              {
                  NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
                  int j = nbttagcompound1.getByte(“Slot”) & 255;

      if (j >= 0 && j < this.contents.length)
                  {
                      this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
                  }
              }
          }
          @Override
          public void writeToNBT(NBTTagCompound compound)
          {
              super.writeToNBT(compound);

      if (this.hasCustomInventoryName())
              {
                  compound.setString(“CustomName”, this.customName);
              }
              NBTTagList nbttaglist = new NBTTagList();

      for (int i = 0; i < this.contents.length; ++i)
              {
                  if (this.contents* != null)
                  {
                      NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                      nbttagcompound1.setByte(“Slot”, (byte)i);
                      this.contents*.writeToNBT(nbttagcompound1);
                      nbttaglist.appendTag(nbttagcompound1);
                  }
              }

      compound.setTag(“Items”, nbttaglist);
          }
          @Override
          public int getSizeInventory()
          {
              return this.contents.length;
          }

      @Override
          public ItemStack getStackInSlot(int slotIndex)
          {
              return this.contents[slotIndex];
          }

      @Override
          public ItemStack decrStackSize(int slotIndex, int amount)
          {
              if (this.contents[slotIndex] != null)
              {
                  ItemStack itemstack;

      if (this.contents[slotIndex].stackSize <= amount)
                  {
                      itemstack = this.contents[slotIndex];
                      this.contents[slotIndex] = null;
                      this.markDirty();
                      return itemstack;
                  }
                  else
                  {
                      itemstack = this.contents[slotIndex].splitStack(amount);

      if (this.contents[slotIndex].stackSize == 0)
                      {
                          this.contents[slotIndex] = null;
                      }

      this.markDirty();
                      return itemstack;
                  }
              }
              else
              {
                  return null;
              }
          }

      @Override
          public ItemStack getStackInSlotOnClosing(int slotIndex)
          {
           if (this.contents[slotIndex] != null)
              {
                  ItemStack itemstack = this.contents[slotIndex];
                  this.contents[slotIndex] = null;
                  return itemstack;
              }
              else
              {
                  return null;
              }
          }

      @Override
          public void setInventorySlotContents(int slotIndex, ItemStack stack)
          {
              this.contents[slotIndex] = stack;

      if (stack != null && stack.stackSize > this.getInventoryStackLimit())
              {
                  stack.stackSize = this.getInventoryStackLimit();
              }

      this.markDirty();
          }

      @Override
          public String getInventoryName()
          {
              return this.hasCustomInventoryName() ? this.customName : “Tile.Barrel”;
          }

      @Override
          public boolean hasCustomInventoryName()
          {
              return this.customName != null && this.customName.isEmpty();
          }

      public void setCustomName(String customName) {
              this.customName = customName;
          }

      @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;
          }

      @Override
          public void openInventory()
          {

      }

      @Override
          public void closeInventory()
          {

      }

      @Override
          public boolean isItemValidForSlot(int slotIndex, ItemStack stack)
          {
              return true;
          }

      }

      :::

      TileEntitySpecialRenderer :

      :::
      import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;

      import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
      import net.minecraft.tileentity.TileEntity;
      import net.minecraft.util.ResourceLocation;

      import org.lwjgl.opengl.GL11;

      import FairyOne.common.ModAnaxia;

      public class TileEntityBlockBarrel3DSpecialRenderer extends
              TileEntitySpecialRenderer
              {

      public static ModelBarrel model = new  ModelBarrel();
          public static ResourceLocation texture = new ResourceLocation(ModAnaxia.MODID, “textures/models/Block/Model_Barrel.png”);

      public TileEntityBlockBarrel3DSpecialRenderer()
              {
                  this.func_147497_a(TileEntityRendererDispatcher.instance);
              }

      @Override
          public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick)
          {
              this.renderTileEntityBlockBarrel3DAt((TileEntityBlockBarrel3D)tile, x, y, z, partialRenderTick);
          }

      private void renderTileEntityBlockBarrel3DAt(TileEntityBlockBarrel3D 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);
              this.bindTexture(texture);
              model.renderAll();
              GL11.glPopMatrix();
          }

      }

      :::

      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

        Je ne vois aucune erreur dans ton code. À la limite envoie un zip de ton dossier src, je regarderai de mon côté.

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

          voila je viens de te l’envoyer en mp

          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

            Trouvé, ton tile entity n’est pas enregistré dans ta classe principale (GameRegistry.regiterTileEntity(TileEntityBlockBarrel3D.class, “nom”);)

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

              Ok je vais voir merci pour la réponse .
              si sa te dérange pas je sais pas comment mettre deux son dans le . json

              :::
              {

              “records.music1”: {
                      “category”: “record”,
                      “sounds”: [
                          {
                              “name”: “records/Music1”,
                              “stream”: true
                          }
                      ]
                  }
                  }

              {

              “records.music1”: {
                      “category”: “record”,
                      “sounds”: [
                          {
                              “name”: “records/Music1”,
                              “stream”: true
                          }
                      ]
                  }
                  }

              :::

              j’ai essayer sa mais sa marche pas
              http://jsonlint.com/

              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 y a une parenthèse en trop et une virgule qui manque.

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

                  Tu pourrais m’envoyer comment tu la mis toi___j’ai test sa mais “records.music1” sais le nom pour lécouter

                  {

                  “records.music1”: {
                          “category”: “record”,
                          “sounds”: [
                              {
                                  “name”: “records/Music1”,
                                  “stream”: true
                              },
                              {
                                  “name”: “records/Music2”,
                                  “stream”: true
                              }
                          ]
                      }
                  }

                  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

                    Ah, tu veux plusieurs sons pour la même musique ?
                    Normalement comme ça c’est bon.

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

                      nop je veut mettre une nouvelle music mais sa chaque fois sa me mais une erreur j’ai un peut tout tester mais j’ai toujours pas trouver donc si tu pourrais me montré comment faire 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 comme ça alors :

                        {
                           "records.music1": {
                               "category": "record",
                               "sounds": [
                                   {
                                       "name": "records/Music1",
                                       "stream": true
                                   }
                               ]
                           },
                           "records.music2": {
                               "category": "record",
                               "sounds": [
                                   {
                                       "name": "records/Music2",
                                       "stream": true
                                   }
                               ]
                           }
                        }
                        
                        1 réponse Dernière réponse Répondre Citer 0
                        • FairyOneF Hors-ligne
                          FairyOne
                          dernière édition par

                          merci beaucoup

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

                          MINECRAFT FORGE FRANCE © 2024

                          Powered by NodeBB