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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      @‘FairyOne’:

      ps: demander moi les class que vous voulez voir

      Toutes les classes en rapport avec ton coffre.

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

        ok

        GuiContainer :
        :::

        import net.minecraft.client.gui.inventory.GuiContainer;

        import net.minecraft.client.resources.I18n;
        import net.minecraft.entity.player.InventoryPlayer;
        import net.minecraft.inventory.IInventory;
        import net.minecraft.util.ResourceLocation;

        import org.lwjgl.opengl.GL11;

        import FairyOne.common.ContainerBarrel;
        import FairyOne.common.ModAnaxia;

        public class GuiBarrel extends GuiContainer
        {
            private static final ResourceLocation textures = new ResourceLocation(ModAnaxia.MODID, “textures/gui/container/BarrelGui.png”);
            private TileEntityBlockBarrel3D TileBarrel;
            private IInventory PlayerInv;

        public GuiBarrel(TileEntityBlockBarrel3D tile, InventoryPlayer inventory)
            {
                super(new ContainerBarrel(tile, inventory));
                this.TileBarrel = tile;
                this.PlayerInv = inventory;
                this.allowUserInput = false;
                this.ySize = 170;
            }

        protected void drawGuiContainerForegroundLayer(int x, int y)
            {
                this.fontRendererObj.drawString(this.TileBarrel.hasCustomInventoryName() ? this.TileBarrel.getInventoryName() : I18n.format(this.TileBarrel.getInventoryName()), 8, 6, 4210752);
                this.fontRendererObj.drawString(this.PlayerInv.hasCustomInventoryName() ? this.PlayerInv.getInventoryName() : I18n.format(this.PlayerInv.getInventoryName()), 8, this.ySize - 96 + 2, 4210752);
            }

        @Override
            protected void drawGuiContainerBackgroundLayer(float partialRenderTick, int x, int y)
            {
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                this.mc.getTextureManager().bindTexture(textures);
                int k = (this.width - this.xSize) / 2;
                int l = (this.height - this.ySize) / 2;
                this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
            }

        }

        :::

        Container :
        :::
        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;
        import FairyOne.client.TileEntityBlockBarrel3D;

        public class ContainerBarrel extends Container
        {
            private final TileEntityBlockBarrel3D  tileBarrel;

        public ContainerBarrel(TileEntityBlockBarrel3D tile, InventoryPlayer inventory)
            {
                this.tileBarrel = tile;
                for (int j = 0; j < 3; ++j)
                {
                    for (int k = 0; k < 9; ++k)
                    {
                        this.addSlotToContainer(new Slot(tile, k + j * 9, 8 + k * 18, 18 + j * 18));
                    }
                }
                this.bindPlayerInventory(inventory);
            }

        private void bindPlayerInventory(InventoryPlayer inventory)
            {
                int j;
                for (j = 0; j < 3; ++j)
                {
                    for (int k = 0; k < 9; ++k)
                    {
                        this.addSlotToContainer(new Slot(inventory, k + j * 9 + 9, 8 + k * 18, 85 + j * 18));
                    }
                }

        for (j = 0; j < 9; ++j)
                {
                    this.addSlotToContainer(new Slot(inventory, j, 8 + j * 18, 143));
                }
            }
            public ItemStack transferStackInSlot(EntityPlayer player, int slotindex)
            {
                ItemStack itemstack = null;
                Slot slot = (Slot)this.inventorySlots.get(slotindex);

        if (slot != null && slot.getHasStack())
                {
                    ItemStack itemstack1 = slot.getStack();
                    itemstack = itemstack1.copy();

        if (slotindex < this.tileBarrel.getSizeInventory())
                    {
                        if (!this.mergeItemStack(itemstack1, this.tileBarrel.getSizeInventory(), this.inventorySlots.size(), true))
                        {
                            return null;
                        }
                    }
                    else if (!this.mergeItemStack(itemstack1, 0, this.tileBarrel.getSizeInventory(), false))
                    {
                        return null;
                    }

        if (itemstack1.stackSize == 0)
                    {
                        slot.putStack((ItemStack)null);
                    }
                    else
                    {
                        slot.onSlotChanged();
                    }
                }

        return itemstack;
            }

        @Override
            public boolean canInteractWith(EntityPlayer player)
            {
                return this.tileBarrel.isUseableByPlayer(player);
            }

        }
        :::

        GuiHandler :

        :::
        import net.minecraft.entity.player.EntityPlayer;
        import net.minecraft.tileentity.TileEntity;
        import net.minecraft.world.World;
        import FairyOne.client.GuiBarrel;
        import FairyOne.client.TileEntityBlockBarrel3D;
        import cpw.mods.fml.common.network.IGuiHandler;

        public class GuiHandlerBarrel implements IGuiHandler
        {

        @Override
            public Object getServerGuiElement(int ID, EntityPlayer player, World world,
                    int x, int y, int z)
            {
                TileEntity tile = world.getTileEntity(x, y, z);
                if(tile instanceof TileEntityBlockBarrel3D)
                {
                return new ContainerBarrel((TileEntityBlockBarrel3D)tile, player.inventory);
            }
                return null;
            }

        @Override
            public Object getClientGuiElement(int ID, EntityPlayer player, World world,
                    int x, int y, int z)
            {
                TileEntity tile = world.getTileEntity(x, y, z);
                if(tile instanceof TileEntityBlockBarrel3D)
                {
                return new GuiBarrel((TileEntityBlockBarrel3D)tile, player.inventory);
            }
                return null;
            }
        }
        :::

        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

          Tile entity ?

          1 réponse Dernière réponse Répondre Citer 0
          • 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