• Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes
  • S'inscrire
  • Se connecter
  • S'inscrire
  • Se connecter
  • Recherche
  • Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes

Résolu Machine Recipe Complex

1.7.x
1.7.10
4
43
5.8k
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.
  • SpyMan
    SpyMan dernière édition par 11 mars 2016, 23:29

    Bonjour
    Alors voici mon problème: 
    Je voudrais faire un recipe dans une machine avec différents results: un même item/block en input et plusieurs items en result avec un random pour l’obtention des items.
    Exemple: Un gravel en input –-> 0 à 5 seeds, 0 à 8 cobble, etc…

    Comment je pourrai faire cela ?

    1 réponse Dernière réponse Répondre Citer 0
    • robin4002
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par 12 mars 2016, 08:59

      Salut,
      Au lieu de mettre un itemstack en sortie il faut mettre une map d’int et d’itemstack ou l’int sera utilisé pour la proba.
      Ensuite dans la fonction qui gère le résultat tu fais un random entre 0 et la comme de tous les int présent dans la map, puis tu prends un des items de la map en fonction de ce nombre random.

      1 réponse Dernière réponse Répondre Citer 0
      • SpyMan
        SpyMan dernière édition par robin4002 9 sept. 2018, 15:11 12 mars 2016, 09:32

        Ok je comprend, mais aussi les slotresults, il m’en faut plusieurs, je suppose que l’on ne peut pas en ajouter plusieurs comme ça dans le Container.

        Mon gui:
        <pièce jointe non disponible>

        EDIT: Je crains de ne pas savoir utiliser les Maps 😕

        1 réponse Dernière réponse Répondre Citer 0
        • AymericRed
          AymericRed dernière édition par 12 mars 2016, 10:01

          Si tu peux, t’a juste à agrandir ton array de stacks dans ton tile entity et à les ajouter directement dans le container

          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
          • SpyMan
            SpyMan dernière édition par 12 mars 2016, 11:46

            J’ai essayé quelque chose mais quand je pose le block cela crash 😕

            Le block concerné est : OreExtractor

            1 réponse Dernière réponse Répondre Citer 0
            • AymericRed
              AymericRed dernière édition par 12 mars 2016, 12:20

              Le crash report ?

              Et aussi, pense à utiliser les @Override, quand tu changeras de version, ça te sera utile.

              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
              • SpyMan
                SpyMan dernière édition par 12 mars 2016, 16:20

                –-- Minecraft Crash Report ----
                // Don't do that.
                
                Time: 12/03/16 12:00
                Description: Exception ticking world
                
                java.lang.RuntimeException: class com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor.TileEntityOreExtractor is missing a mapping! This is a bug!
                at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:96)
                at com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor.TileEntityOreExtractor.writeToNBT(TileEntityOreExtractor.java:57)
                at com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor.TileEntityOreExtractor.getDescriptionPacket(TileEntityOreExtractor.java:92)
                at net.minecraft.server.management.PlayerManager$PlayerInstance.sendTileToAllPlayersWatchingChunk(PlayerManager.java:632)
                at net.minecraft.server.management.PlayerManager$PlayerInstance.sendChunkUpdate(PlayerManager.java:574)
                at net.minecraft.server.management.PlayerManager.updatePlayerInstances(PlayerManager.java:80)
                at net.minecraft.world.WorldServer.tick(WorldServer.java:193)
                at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:692)
                at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
                at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
                at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
                at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
                
                A detailed walkthrough of the error, its code path and all known details is as follows:
                ---------------------------------------------------------------------------------------
                
                -- Head --
                Stacktrace:
                at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:96)
                at com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor.TileEntityOreExtractor.writeToNBT(TileEntityOreExtractor.java:57)
                at com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor.TileEntityOreExtractor.getDescriptionPacket(TileEntityOreExtractor.java:92)
                at net.minecraft.server.management.PlayerManager$PlayerInstance.sendTileToAllPlayersWatchingChunk(PlayerManager.java:632)
                at net.minecraft.server.management.PlayerManager$PlayerInstance.sendChunkUpdate(PlayerManager.java:574)
                at net.minecraft.server.management.PlayerManager.updatePlayerInstances(PlayerManager.java:80)
                at net.minecraft.world.WorldServer.tick(WorldServer.java:193)
                
                -- Affected level --
                Details:
                Level name: New World
                All players: 1 total; [EntityPlayerMP['SpyMan'/201, l='New World', x=-544,68, y=4,00, z=-1244,70]]
                Chunk stats: ServerChunkCache: 430 Drop: 169
                Level seed: -5270529354148508640
                Level generator: ID 01 - flat, ver 0\. Features enabled: false
                Level generator options:
                Level spawn location: World: (-554,4,-1237), Chunk: (at 6,0,11 in -35,-78; contains blocks -560,0,-1248 to -545,255,-1233), Region: (-2,-3; contains chunks -64,-96 to -33,-65, blocks -1024,0,-1536 to -513,255,-1025)
                Level time: 295247 game time, 9536 day time
                Level dimension: 0
                Level storage version: 0x04ABD - Anvil
                Level weather: Rain time: 108263 (now: false), thunder time: 93731 (now: false)
                Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
                Stacktrace:
                at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:692)
                at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
                at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
                at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
                at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
                
                – System Details --
                Details:
                Minecraft Version: 1.7.10
                Operating System: Windows 7 (amd64) version 6.1
                Java Version: 1.8.0_66, Oracle Corporation
                Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                Memory: 836857272 bytes (798 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
                JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
                AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
                FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 4 mods loaded, 4 mods active
                States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
                UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
                UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
                UCHIJAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
                UCHIJAAAA mechanicalcraft{beta-0.1} [MechanicalCraft] (NewMechanicalCraft)
                GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
                Profiler Position: N/A (disabled)
                Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                Player Count: 1 / 8; [EntityPlayerMP['SpyMan'/201, l='New World', x=-544,68, y=4,00, z=-1244,70]]
                Type: Integrated Server (map_client.txt)
                Is Modded: Definitely; Client brand changed to 'fml,forge'
                
                1 réponse Dernière réponse Répondre Citer 0
                • AymericRed
                  AymericRed dernière édition par 12 mars 2016, 16:50

                  T’a pas register ton entitée (TileEntityRegistry.registerTileEntity).

                  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
                  • SpyMan
                    SpyMan dernière édition par 12 mars 2016, 18:53

                    Ok merci je comprend mieux.
                    Mais j’ai un problème de recipe dans mon block OreExtractor : Quand le craft se lance l’item est bien dans le result mais il n’est pas “réel”.
                    Voici mon code:

                    [font=Courier Newpublic class ]%(#345f99)[OreExtractorRecipes
                    ]{
                       private static final OreExtractorRecipes smeltingBase = new OreExtractorRecipes()%(#aaa9a7)[;
                    ]    private Map<ItemStack[], ItemStack> smeltingList = new HashMap<ItemStack[], ItemStack>()%(#aaa9a7)[;
                    ]    private Item[] resultList = new Item[]
                       {
                           MechanicalCraft.brokenTinOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenCopperOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenZincOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenIronOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenGoldOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenCoalOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenDiamondOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenEmeraldOre%(#aaa9a7)[,
                    ]        MechanicalCraft.brokenRedstoneOre%(#aaa9a7)[,
                    ]        MechanicalCraft.%(#666965)[brokenLapisOre
                    ]    }%(#aaa9a7)[;
                    ]
                       public OreExtractorRecipes()
                       {
                           Random item = new Random()%(#aaa9a7)[;
                    ]        Random quantityRandom = new Random()%(#aaa9a7)[;
                    ]        int %(#666965)_= item.nextInt(9)%(#aaa9a7)[;
                    ]        int quantity = quantityRandom.nextInt(3)%(#aaa9a7)[;
                    ]        this.addRecipe(Blocks.gravel, new ItemStack(resultList[%(#666965)*], quantity, 0))%(#aaa9a7)[;
                    ]    }
                       public void addRecipe(ItemStack *input1*, ItemStack *output1*)
                       {
                           ItemStack[] stackList = new ItemStack[] {*input1*}%(#aaa9a7)[;
                    ]        this.smeltingList.put(stackList, *output1*)%(#aaa9a7)[;
                    ]    }
                       public void addRecipe(Item *input1*, ItemStack *output1*)
                       {   this.addRecipe(new ItemStack(*input1*), *output1*);   }
                       public void addRecipe(Block *input1*, ItemStack *output1*)
                       {   this.addRecipe(new ItemStack(*input1*), *output1*);   }
                       public ItemStack getSmeltingResult(ItemStack[] *stack*)
                       {
                           Iterator<Map.Entry<ItemStack[], ItemStack>> iterator = this.smeltingList.entrySet().iterator()%(#aaa9a7)[;
                    ]        Map.Entry<ItemStack[], ItemStack> entry%(#aaa9a7)[;
                    ]
                           %(#0187df)[do
                    ]        {
                               if(!iterator.hasNext())
                               {
                                   return null%(#aaa9a7)[;
                    ]            }
                               entry = (Map.Entry<ItemStack[], ItemStack>)iterator.next()%(#aaa9a7)[;
                    ]        }
                           while(!this.isSameKey(*stack*, (ItemStack[])entry.getKey()))%(#aaa9a7)[;
                    ]
                           return (ItemStack)entry.getValue()%(#aaa9a7)[;
                    ]    }
                       private boolean isSameKey(ItemStack[] *stackList*, ItemStack[] *stackList2*)
                       {
                           boolean isSame = false%(#aaa9a7)[;
                    ]
                           if(*stackList*[0].getItem() == *stackList2*[0].getItem())
                           {
                               isSame = true%(#aaa9a7)[;
                    ]        }
                           %(#0187df)[else
                    ]        {
                               return false%(#aaa9a7)[;
                    ]        }
                           return isSame%(#aaa9a7)[;
                    ]    }
                       public Map<ItemStack[], ItemStack> getSmeltingList()
                       {
                           return this.smeltingList%(#aaa9a7)[;
                    ]    }
                       public static OreExtractorRecipes smelting()
                       {
                           return smeltingBase%(#aaa9a7)[;
                    ]    }
                    }
                    ```_
                    1 réponse Dernière réponse Répondre Citer 0
                    • AymericRed
                      AymericRed dernière édition par 12 mars 2016, 21:26

                      Vérifiés bien que l’item est créé sur le serveur et aussi quand tu me toninventaire[.] = leresult, fait bien = leresult. copy()

                      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
                      • SpyMan
                        SpyMan dernière édition par 12 mars 2016, 22:08

                        Oui pourtant

                        public class ContainerOreExtractor extends Container
                        {
                            private TileEntityOreExtractor tileCrusher;
                            private int workingTime;
                            private int workingTimeNeeded;
                            public ContainerOreExtractor(TileEntityOreExtractor tile, InventoryPlayer inventory)
                            {
                                this.tileCrusher = tile;
                                this.addSlotToContainer(new Slot((IInventory)tile, 0, 8, 17));//dust 1
                                this.addSlotToContainer(new Slot((IInventory)tile, 1, 8, 53));//coal
                                this.addSlotToContainer(new Slot((IInventory)tile, 2, 150, 17));//upgrade
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 3, 64, 17));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 4, 82, 17));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 5, 100, 17));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 6, 118, 17));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 7, 64, 35));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 8, 82, 35));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 9, 100, 35));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 10, 118, 35));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 11, 64, 53));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 12, 82, 53));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 13, 100, 53));//result
                                this.addSlotToContainer(new OreExtractorSlotResult(tile, 14, 118, 53));//result
                                this.bindPlayerInventory(inventory);
                            }
                            @Override
                            public boolean canInteractWith(EntityPlayer player)
                            {
                                return this.tileCrusher.isUseableByPlayer(player);
                            }
                            private void bindPlayerInventory(InventoryPlayer inventory)
                            {
                                int i;
                                for (i = 0; i < 3; ++i)
                                {
                                    for (int j = 0; j < 9; ++j)
                                    {
                                        this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
                                    }
                                }
                                for (i = 0; i < 9; ++i)
                                {
                                    this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
                                }
                            }
                            public ItemStack transferStackInSlot(EntityPlayer player, int quantity)
                            {
                                ItemStack itemstack = null;
                                Slot slot = (Slot)this.inventorySlots.get(quantity);
                                if (slot != null && slot.getHasStack())
                                {
                                    ItemStack itemstack1 = slot.getStack();
                                    itemstack = itemstack1.copy();
                                    if (quantity < this.tileCrusher.getSizeInventory())
                                    {
                                        if (!this.mergeItemStack(itemstack1, this.tileCrusher.getSizeInventory(), this.inventorySlots.size(), true))
                                        {
                                            return null;
                                        }
                                    }
                                    else if (!this.mergeItemStack(itemstack1, 0, this.tileCrusher.getSizeInventory(), false))
                                    {
                                        return null;
                                    }
                                    if (itemstack1.stackSize == 0)
                                    {
                                        slot.putStack((ItemStack)null);
                                    }
                                    else
                                    {
                                        slot.onSlotChanged();
                                    }
                                }
                                return itemstack;
                            }
                            public void onContainerClosed(EntityPlayer player)
                            {
                                super.onContainerClosed(player);
                                this.tileCrusher.closeInventory();
                            }
                            public void detectAndSendChanges()
                            {
                                super.detectAndSendChanges();
                                for(int i = 0; i < this.crafters.size(); ++i)
                                {
                                    ICrafting icrafting = (ICrafting)this.crafters.get(i);
                                    if(this.workingTime != this.tileCrusher.workingTime)
                                    {
                                        icrafting.sendProgressBarUpdate(this, 0, this.tileCrusher.workingTime);
                                    }
                                    if(this.workingTimeNeeded != this.tileCrusher.workingTimeNeeded)
                                    {
                                        icrafting.sendProgressBarUpdate(this, 1, this.tileCrusher.workingTimeNeeded);
                                    }
                                }
                                this.workingTime = this.tileCrusher.workingTime;
                                this.workingTimeNeeded = this.tileCrusher.workingTimeNeeded;
                            }
                            @SideOnly(Side.CLIENT)
                            public void updateProgressBar(int id, int value)
                            {
                                if(id == 0)
                                {
                                    this.tileCrusher.workingTime = value;
                                }
                                if(id == 1)
                                {
                                    this.tileCrusher.workingTimeNeeded = value;
                                }
                            }
                        }
                        1 réponse Dernière réponse Répondre Citer 0
                        • AymericRed
                          AymericRed dernière édition par 12 mars 2016, 22:13

                          Ton container est bien mais vérifies bien pour le .copy, parce que c’est probable que ce soit ça.

                          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
                          • SpyMan
                            SpyMan dernière édition par 12 mars 2016, 22:22

                            Pourtant oui ligne 62 du container

                            1 réponse Dernière réponse Répondre Citer 0
                            • AymericRed
                              AymericRed dernière édition par 12 mars 2016, 22:37

                              Il faut aussi que tu vérifiés dans ta fonction smelt de tile entity

                              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
                              • SpyMan
                                SpyMan dernière édition par 12 mars 2016, 22:53

                                oui pourtant il est present

                                package com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor;
                                import com.google.SpyMan.Mechanicalcraft.common.Items.SpeedUpgrade;
                                import com.google.SpyMan.Mechanicalcraft.common.Items.SpeedUpgradeThree;
                                import com.google.SpyMan.Mechanicalcraft.common.Items.SpeedUpgradeTwo;
                                import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft;
                                import cpw.mods.fml.relauncher.Side;
                                import cpw.mods.fml.relauncher.SideOnly;
                                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.NetworkManager;
                                import net.minecraft.network.Packet;
                                import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
                                import net.minecraft.tileentity.TileEntity;
                                import net.minecraft.tileentity.TileEntityFurnace;
                                public class TileEntityOreExtractor extends TileEntity implements IInventory
                                {
                                    private byte direction;
                                    private ItemStack[] contents = new ItemStack[15];
                                    protected int workingTime = 0;
                                    protected int workingTimeNeeded = 200;
                                    protected int workingTimeNeededDefault = 200;
                                    protected int burnTime = 0;
                                    protected int burnTimeTotal = 0;
                                    @Override
                                    public void readFromNBT(NBTTagCompound compound)
                                    {
                                        super.readFromNBT(compound);
                                        this.direction = compound.getByte("Direction");
                                        NBTTagList nbttaglist = compound.getTagList("Items", 10);
                                        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);
                                            }
                                        }
                                        this.workingTime = compound.getShort("workingTime");
                                        this.burnTime = compound.getShort("burnTime");
                                        this.burnTimeTotal = compound.getShort("burnTimeTotal");
                                        //this.workingTimeNeeded = compound.getShort("workingTimeNeeded");
                                    }
                                    @Override
                                    public void writeToNBT(NBTTagCompound compound)
                                    {
                                        super.writeToNBT(compound);
                                        NBTTagList nbttaglist = new NBTTagList();
                                        compound.setByte("Direction", this.direction);
                                        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);
                                        compound.setShort("workingTime", (short)this.workingTime);
                                        compound.setShort("burnTime", (short)this.burnTime);
                                        compound.setShort("burnTimeTotal", (short)this.burnTimeTotal);
                                        //compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded);
                                    }
                                    public byte getDirection()
                                    {
                                        return direction;
                                    }
                                    public void setDirection(byte direction)
                                    {
                                        this.direction = direction;
                                        this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
                                    }
                                    public Packet getDescriptionPacket()
                                    {
                                        NBTTagCompound nbttagcompound = new NBTTagCompound();
                                        this.writeToNBT(nbttagcompound);
                                        return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound);
                                    }
                                    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
                                    {
                                        this.readFromNBT(pkt.func_148857_g());
                                    }
                                    public int getSizeInventory()
                                    {
                                        return this.contents.length;
                                    }
                                    public void openInventory() {}
                                    public void closeInventory() {}
                                    public String getInventoryName()
                                    {
                                        return MechanicalCraft.oreExtractor.getLocalizedName();
                                    }
                                    public boolean hasCustomInventoryName()
                                    {
                                        return false;
                                    }
                                    public int getInventoryStackLimit()
                                    {
                                        return 64;
                                    }
                                    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 ItemStack getStackInSlot(int slotIndex)
                                    {
                                        return this.contents[slotIndex];
                                    }
                                    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;
                                        }
                                    }
                                    public ItemStack getStackInSlotOnClosing(int slotIndex)
                                    {
                                        if(this.contents[slotIndex] != null)
                                        {
                                            ItemStack itemstack = this.contents[slotIndex];
                                            this.contents[slotIndex] = null;
                                            return itemstack;
                                        }
                                        else
                                        {
                                            return null;
                                        }
                                    }
                                    public void setInventorySlotContents(int slotIndex, ItemStack stack)
                                    {
                                        this.contents[slotIndex] = stack;
                                        if(stack != null && stack.stackSize > this.getInventoryStackLimit())
                                        {
                                            stack.stackSize = this.getInventoryStackLimit();
                                        }
                                        this.markDirty();
                                    }
                                    public boolean isItemValidForSlot(int slot, ItemStack stack)
                                    {
                                        return slot == 2 ? false : true;
                                    }
                                    public boolean isBurning()
                                    {
                                        return this.workingTime > 0;
                                    }
                                    protected boolean canSmelt()
                                    {
                                        if(this.contents[0] == null)
                                        {
                                            return false;
                                        }
                                        else
                                        {
                                            ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0]});
                                            if(itemstack == null)
                                                return false;
                                            if(this.contents[3] == null)
                                                return true;
                                            if(!this.contents[3].isItemEqual(itemstack))
                                                return false;
                                            int result = contents[3].stackSize + itemstack.stackSize;
                                            return result <= getInventoryStackLimit() && result <= this.contents[3].getMaxStackSize();
                                        }
                                    }
                                    public void smeltItem()
                                    {
                                        if(this.canSmelt())
                                        {
                                            ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0]});
                                            if(this.contents[3] == null)
                                            {
                                                this.contents[3] = itemstack.copy();
                                            }
                                            else if(this.contents[3].getItem() == itemstack.getItem())
                                            {
                                                this.contents[3].stackSize += itemstack.stackSize;
                                            }
                                            this.decrStackSize(0, 1);
                                        }
                                    }
                                    public void updateEntity()
                                    {
                                        if(this.burnTime > 0)
                                        {
                                            burnTime–;
                                        }
                                        if(this.canSmelt())
                                        {
                                            if(this.burnTime <= 0)
                                            {
                                                int time = TileEntityFurnace.getItemBurnTime(contents[1]);
                                                if (time > 0)
                                                {
                                                    this.decrStackSize(1, 1);
                                                    this.burnTimeTotal = time;
                                                    this.burnTime = time;
                                                }
                                            }
                                            if(burnTime > 0)
                                            {
                                                workingTime++;
                                            }
                                        }
                                        if (this.workingTime >= this.workingTimeNeeded)
                                        {
                                            this.smeltItem();
                                            this.workingTime = 0;
                                        }
                                        if (!this.canSmelt() || burnTime <= 0)
                                        {
                                            this.workingTime = 0;
                                        }
                                        // Update WorkingTime –> Speed Upgrade
                                        if (contents[2] != null)
                                        {
                                            if (contents[2].getItem() == MechanicalCraft.speedUpgrade)
                                            {
                                                workingTimeNeeded = SpeedUpgrade.getSpeedUp();
                                            }
                                            else if (contents[2].getItem() == MechanicalCraft.speedUpgradeTwo)
                                            {
                                                workingTimeNeeded = SpeedUpgradeTwo.getSpeedUp();
                                            }
                                            else if (contents[2].getItem() == MechanicalCraft.speedUpgradeThree)
                                            {
                                                workingTimeNeeded = SpeedUpgradeThree.getSpeedUp();
                                            }
                                        }
                                        else
                                        {
                                            workingTimeNeeded = workingTimeNeededDefault;
                                        }
                                    }
                                    @SideOnly(Side.CLIENT)
                                    public int getCookProgress()
                                    {
                                        return this.workingTime * 24 / this.workingTimeNeeded;
                                    }
                                    @SideOnly(Side.CLIENT)
                                    public int getBurnTime()
                                    {
                                        return this.burnTime * 14 / this.burnTimeTotal;
                                    }
                                }

                                Recipes

                                package com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor;
                                import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft;
                                import net.minecraft.block.Block;
                                import net.minecraft.init.Blocks;
                                import net.minecraft.init.Items;
                                import net.minecraft.item.Item;
                                import net.minecraft.item.ItemStack;
                                import java.util.HashMap;
                                import java.util.Iterator;
                                import java.util.Map;
                                import java.util.Random;
                                public class OreExtractorRecipes
                                {
                                    private static final OreExtractorRecipes smeltingBase = new OreExtractorRecipes();
                                    private Map <itemstack[], itemstack="">smeltingList = new HashMap<itemstack[], itemstack="">();
                                    private Item[] resultList = new Item[]
                                    {
                                        MechanicalCraft.brokenTinOre,
                                        MechanicalCraft.brokenCopperOre,
                                        MechanicalCraft.brokenZincOre,
                                        MechanicalCraft.brokenIronOre,
                                        MechanicalCraft.brokenGoldOre,
                                        MechanicalCraft.brokenCoalOre,
                                        MechanicalCraft.brokenDiamondOre,
                                        MechanicalCraft.brokenEmeraldOre,
                                        MechanicalCraft.brokenRedstoneOre,
                                        MechanicalCraft.brokenLapisOre
                                    };
                                    public OreExtractorRecipes()
                                    {
                                        Random item = new Random();
                                        Random quantityRandom = new Random();
                                        int i = item.nextInt(9);
                                        int quantity = quantityRandom.nextInt(3);
                                        this.addRecipe(Blocks.gravel, new ItemStack(resultList*, quantity, 0));
                                    }
                                    public void addRecipe(ItemStack input1, ItemStack output1)
                                    {
                                        ItemStack[] stackList = new ItemStack[] {input1};
                                        this.smeltingList.put(stackList, output1);
                                    }
                                    public void addRecipe(Item input1, ItemStack output1)
                                    {   this.addRecipe(new ItemStack(input1), output1);   }
                                    public void addRecipe(Block input1, ItemStack output1)
                                    {   this.addRecipe(new ItemStack(input1), output1);   }
                                    public ItemStack getSmeltingResult(ItemStack[] stack)
                                    {
                                        Iterator<map.entry<itemstack[], itemstack="">> iterator = this.smeltingList.entrySet().iterator();
                                        Map.Entry <itemstack[], itemstack="">entry;
                                        do
                                        {
                                            if(!iterator.hasNext())
                                            {
                                                return null;
                                            }
                                            entry = (Map.Entry<itemstack[], itemstack="">)iterator.next();
                                        }
                                        while(!this.isSameKey(stack, (ItemStack[])entry.getKey()));
                                        return (ItemStack)entry.getValue();
                                    }
                                    private boolean isSameKey(ItemStack[] stackList, ItemStack[] stackList2)
                                    {
                                        boolean isSame = false;
                                        if(stackList[0].getItem() == stackList2[0].getItem())
                                        {
                                            isSame = true;
                                        }
                                        else
                                        {
                                            return false;
                                        }
                                        return isSame;
                                    }
                                    public Map <itemstack[], itemstack="">getSmeltingList()
                                    {
                                        return this.smeltingList;
                                    }
                                    public static OreExtractorRecipes smelting()
                                    {
                                        return smeltingBase;
                                    }
                                }
                                ```</itemstack[],></itemstack[],></itemstack[],></map.entry<itemstack[],></itemstack[],></itemstack[],>
                                1 réponse Dernière réponse Répondre Citer 0
                                • AymericRed
                                  AymericRed dernière édition par 13 mars 2016, 00:08

                                  Effectivement bizarre… Explique plus en détail ce que ça te fait

                                  Et aussi là je te précise que ton random n’est pas vraiment random vu que ce sera le mémé Item pour toute la session de jeu

                                  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
                                  • SpyMan
                                    SpyMan dernière édition par 13 mars 2016, 08:48

                                    alors quand le craft est terminer j’ai un item en resultat dans un de mes slots result, sauf que cet item n’est pas vraiment “réel” :
                                    Je ne peut pas le stacker –> il se remove quand je le stack
                                    Cela vien de mes recipes car j’ai verifié la chose

                                    Et aussi pour les ramdons comment je peut faire?

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • AymericRed
                                      AymericRed dernière édition par 13 mars 2016, 10:05

                                      Ah OK, pour le random, il faut que tu le fasses quand la recette à terminé (au getSmeltingResult), et peut-être que ça résoudra ton problème du même coup

                                      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
                                      • SpyMan
                                        SpyMan dernière édition par 13 mars 2016, 10:34

                                        Ok ça c’est pour la quantity mais le random de l’item comment je peut faire ?

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • AymericRed
                                          AymericRed dernière édition par 13 mars 2016, 10:45

                                          Soit dans ta liste de recette tu met le tableau d’item à la place du stack, soit tu fait un mémé random pour tt les items avec le tableau que tu as déjà crée

                                          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
                                          • 1
                                          • 2
                                          • 3
                                          • 1 / 3
                                          9 sur 43
                                          • Premier message
                                            9/43
                                            Dernier message
                                          Design by Woryk
                                          Contact / Mentions Légales

                                          MINECRAFT FORGE FRANCE © 2018

                                          Powered by NodeBB