MFF

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

    Probléme machine, Slot

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    46 Messages 5 Publieurs 6.8k 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.
    • ? Hors-ligne
      Un Ancien Utilisateur
      dernière édition par

      ba en faites j’ai pas réussi xD

      1 réponse Dernière réponse Répondre Citer 0
      • ? Hors-ligne
        Un Ancien Utilisateur
        dernière édition par

        Up toujours pas réussi

        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

          Renvoies ton code actuelle.

          1 réponse Dernière réponse Répondre Citer 0
          • ? Hors-ligne
            Un Ancien Utilisateur
            dernière édition par

            D’accord Merci de ton aide car il semble que personnes ne veux plus m’aider

            CLASS PRINCIPALE:

            package com.adamitemod.mod;
            
            import java.awt.Color;
            import java.io.File;
            import java.util.Properties;
            
            import com.google.common.base.Throwables;
            
            import org.apache.logging.log4j.Logger;
            
            import net.minecraft.block.Block;
            import net.minecraft.block.material.Material;
            import net.minecraft.client.Minecraft;
            import net.minecraft.client.gui.GuiMainMenu;
            import net.minecraft.creativetab.CreativeTabs;
            import net.minecraft.init.Blocks;
            import net.minecraft.init.Items;
            import net.minecraft.item.Item;
            import net.minecraft.item.ItemStack;
            import net.minecraft.potion.Potion;
            import net.minecraft.stats.Achievement;
            import net.minecraft.stats.StatBasic;
            import net.minecraft.util.ChatComponentTranslation;
            import net.minecraft.util.WeightedRandomChestContent;
            import net.minecraftforge.common.AchievementPage;
            import net.minecraftforge.common.ChestGenHooks;
            import net.minecraftforge.common.MinecraftForge;
            import net.minecraftforge.common.config.Configuration;
            
            import net.minecraftforge.fluids.Fluid;
            import net.minecraftforge.fluids.FluidContainerRegistry;
            import net.minecraftforge.fluids.FluidRegistry;
            
            import com.adamitemod.mod.Dynamite.EntityDynamite;
            import com.adamitemod.mod.blocks.BlockElevator;
            import com.adamitemod.mod.blocks.ElevatorEvent;
            import com.adamitemod.mod.init.BlocksMod;
            import com.adamitemod.mod.init.CraftsMod;
            import com.adamitemod.mod.init.ItemsMod;
            import com.adamitemod.mod.items.ItemDynamite;
            import com.adamitemod.mod.proxy.CommonProxy;
            import com.adamitemod.mod.world.WorldRegister;
            
            import cpw.mods.fml.client.FMLClientHandler;
            import cpw.mods.fml.common.FMLCommonHandler;
            import cpw.mods.fml.common.Loader;
            import cpw.mods.fml.common.Mod;
            import cpw.mods.fml.common.Mod.EventHandler;
            import cpw.mods.fml.common.Mod.Instance;
            import cpw.mods.fml.common.SidedProxy;
            import cpw.mods.fml.common.event.FMLInitializationEvent;
            import cpw.mods.fml.common.event.FMLPostInitializationEvent;
            import cpw.mods.fml.common.event.FMLPreInitializationEvent;
            import cpw.mods.fml.common.eventhandler.SubscribeEvent;
            import cpw.mods.fml.common.gameevent.TickEvent;
            import cpw.mods.fml.common.network.NetworkRegistry;
            import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
            import cpw.mods.fml.common.registry.EntityRegistry;
            import cpw.mods.fml.common.registry.GameRegistry;
            import cpw.mods.fml.relauncher.Side;
            import cpw.mods.fml.relauncher.SideOnly;
            
            @Mod(modid = References.MOD_ID, name = References.MOD_NAME, version = References.VERSION)
            
            public class AdamiteMod
            {
            @Instance(References.MOD_ID)
            public static AdamiteMod instance;
            
            public static SimpleNetworkWrapper networkWrapper;
            
                public static Item Dynamite, bucketFake;
                public static Block Machine, BlockFluidFake, MachinePulveriser;
            
                public static Fluid fluidFake;
            
                @SidedProxy(clientSide = References.CLIENT_PROXY, serverSide = References.SERVER_PROXY)
                public static CommonProxy proxy;
            
            public static Block Elevator;
            
                public static CreativeTabs Ada = new CreativeTabs("Ada")
                {
                    @SideOnly(Side.CLIENT)
                    public Item getTabIconItem()
                    {
                        return ItemsMod.adamiteChestplate;
                    }
                };
            
                @EventHandler
                public void preInit(FMLPreInitializationEvent event)
                { 
            
                if (Loader.isModLoaded("cheatingessentials")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("hud")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("XaeroMinimap")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("XaeroBetterPvP")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("EllianMaterialDetector")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("CJB|Cheats")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("DirectionHUD")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("alluwant")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("VoxelMap")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
                if (Loader.isModLoaded("thebombzenapi")) {
                  Throwables.propagate(new Exception("java.io.FileNotFoundException.4"));
                }
            
                    fluidFake = new Fluid("fake").setDensity(4000).setViscosity(500).setTemperature(459).setLuminosity(10).setUnlocalizedName("fake");
                    FluidRegistry.registerFluid(fluidFake);
                    fluidFake = FluidRegistry.getFluid("fake");
            
                    if(fluidFake.getBlock() == null)
                    {
                        BlockFluidFake = new BlockFluidFake(fluidFake, Material.water).setBlockName("fluidFake");
                        GameRegistry.registerBlock(BlockFluidFake, "fluidFake");
                        fluidFake.setBlock(BlockFluidFake);
                    }
                    else
                    {
                        BlockFluidFake = fluidFake.getBlock();
                    }
            
                    bucketFake = new ItemBucketFake(BlockFluidFake).setUnlocalizedName("bucketFake").setTextureName("AdamiteMod:Fake");
            
             GameRegistry.registerItem(bucketFake, "bucketFake", "AdamiteMod");
            
             FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fake", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFake), FluidContainerRegistry.EMPTY_BUCKET);
            
                    BlocksMod.init();
            
            Elevator = new BlockElevator().setBlockTextureName(References.MOD_ID + ":elevator").setHardness(3.5F).setBlockName("Elevator").setCreativeTab(AdamiteMod.Ada);
            
            GameRegistry.registerBlock(Elevator, "Elevator");
            
                    BlocksMod.register();
                    ItemsMod.init();
                    Machine = new Machine().setBlockName("machine");
                    MachinePulveriser = new MachinePulveriser().setBlockName("machinepulveriser");
                    ItemsMod.register();
                    Dynamite = new ItemDynamite(Dynamite).setUnlocalizedName("Dynamite").setCreativeTab(AdamiteMod.Ada).setTextureName(References.MOD_ID + ":dynamite");
                    GameRegistry.registerItem(Dynamite, "Dynamite");
                    GameRegistry.registerBlock(Machine, "Machine");
                    GameRegistry.registerBlock(MachinePulveriser, "MachinePulveriser");
                    CraftsMod.init();
                    WorldRegister.mainRegsitry();
                    proxy.registerRenders();
               EntityRegistry.registerModEntity(EntityDynamite.class, "Dynamite", 7, this, 64, 20, true);
            
                }
            
                @EventHandler
                public void init(FMLInitializationEvent event)
                {
            
                proxy.registerRenders();
            
                    ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.adamite), 1, 2, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.adamite), 1, 2, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.adamite), 1, 3, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.adamite), 1, 3, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.adamite), 1, 3, 1));
            
                    ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.fission), 1, 1, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.fission), 1, 1, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.fission), 1, 2, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.fission), 1, 2, 1));
                    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(new WeightedRandomChestContent(new ItemStack(ItemsMod.fission), 1, 2, 1));
            
            MinecraftForge.EVENT_BUS.register(new ElevatorEvent());
            FMLCommonHandler.instance().bus().register(new ElevatorEvent());
            
                    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
            
               EntityRegistry.registerModEntity(EntityDynamite.class, "Dynamite", 7, this, 64, 20, true);
            
               GameRegistry.registerTileEntity(TileEntityMachine.class, References.MOD_ID + ":MachineTileEntity");
               GameRegistry.registerTileEntity(TileEntityMachinePulveriser.class, References.MOD_ID + ":MachineTileEntityPulveriser");
            
               }
            
                @EventHandler
                public void postInit(FMLPostInitializationEvent event) {
            
                }
            
            @SideOnly(Side.CLIENT)
                public void onTick(TickEvent.ClientTickEvent event)
                {
                    Minecraft mc = FMLClientHandler.instance().getClient();
                    {
            }
                }
            }
            
            

            CONTENERE

            package com.adamitemod.mod;
            
            import net.minecraft.entity.player.EntityPlayer;
            import net.minecraft.entity.player.InventoryPlayer;
            import net.minecraft.inventory.Container;
            import net.minecraft.inventory.Slot;
            import net.minecraft.item.ItemStack;
            
            public class ContainerMachinePulveriser extends Container
            {
            
                public ContainerMachinePulveriser(TileEntityMachinePulveriser tile, InventoryPlayer inventory)
                {
                    this.tileMachinePulveriser = tile;
                    this.addSlotToContainer(new Slot(tile, 0, 48, 76)); 
                    this.addSlotToContainer(new SlotResult(tile, 1, 89, 135)); 
                   this.bindPlayerInventory(inventory);
                }
            
                public boolean canInteractWith(EntityPlayer player)
                {
                    return tileMachinePulveriser.isUseableByPlayer(player);
                }
            
                private void bindPlayerInventory(InventoryPlayer inventory)
                {
                    for(int i = 0; i < 3; i++)
                    {
                        for(int j = 0; j < 9; j++)
                        addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 17 + j * 18, 171 + i * 18));
            
                    }
            
                    for(int i = 0; i < 9; i++)
                    addSlotToContainer(new Slot(inventory, i, 17 + i * 18, 229));
            
                }
            
                public ItemStack transferStackInSlot(EntityPlayer player, int quantity)
                {
                    ItemStack itemstack = null;
                    Slot slot = (Slot)inventorySlots.get(quantity);
                    if(slot != null && slot.getHasStack())
                    {
                        ItemStack itemstack1 = slot.getStack();
                        itemstack = itemstack1.copy();
                        if(quantity < tileMachinePulveriser.getSizeInventory())
                        {
                            if(!mergeItemStack(itemstack1, tileMachinePulveriser.getSizeInventory(), inventorySlots.size(), true))
                                return null;
                        } else
                        if(!mergeItemStack(itemstack1, 0, tileMachinePulveriser.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);
                    tileMachinePulveriser.closeInventory();
                }
            
                private TileEntityMachinePulveriser tileMachinePulveriser;
            }
            
            

            GUI

            package com.adamitemod.mod;
            
            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;
            
            public class GuiMachinePulveriser extends GuiContainer {
            
              private static final ResourceLocation GuiAdamite = new ResourceLocation("adamitemod","textures/gui/GuiPulveriser.png");
               @SuppressWarnings("unused")
            private TileEntityMachinePulveriser tileCompressor;
            
            public GuiMachinePulveriser(TileEntityMachinePulveriser tile, InventoryPlayer inventory) 
            {
            super(new ContainerMachinePulveriser(tile, inventory));
                   this.tileCompressor = tile;
            
                   this.allowUserInput = false;
                   this.ySize = 256;
                   this.xSize = 256;
            }
            
            @Override
            protected void drawGuiContainerBackgroundLayer(float partialRenderTick, int x, int y) 
            {
            
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                   this.mc.getTextureManager().bindTexture(GuiAdamite);
                   int k = (this.width - this.xSize) / 2;
                   int l = (this.height - this.ySize) / 2;
                   this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
                   this.drawTexturedModalRect(0, 0, 176, 14, 100 + 1, 16);
            
            }
            
            }
            

            CLASS DU BLOCK

            package com.adamitemod.mod;
            
            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.creativetab.CreativeTabs;
            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.IIcon;
            import net.minecraft.world.World;
            
            public class MachinePulveriser extends BlockContainer
            {
                public MachinePulveriser()
                {
                    super(Material.rock);
                    setResistance(8F);
                    setHarvestLevel("pickaxe", 2);
                    setCreativeTab(AdamiteMod.Ada);
                    setHardness(8F);
                }
                public TileEntity createNewTileEntity(World world, int metadata)
                {
                    return new TileEntityMachinePulveriser();
                }
                public boolean hasTileEntity(int metadata)
                {
                    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)
                                continue;
                            float f = world.rand.nextFloat() * 0.8F + 0.1F;
                            float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
                            float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
                            while(itemstack.stackSize > 0) 
                            {
                                int j1 = world.rand.nextInt(21) + 10;
                                if(j1 > itemstack.stackSize)
                                    j1 = itemstack.stackSize;
                                itemstack.stackSize -= j1;
                                EntityItem entityitem = new EntityItem(world, (float)x + f, (float)y + f1, (float)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.spawnEntityInWorld(entityitem);
                            }
                        }
            
                        world.func_147453_f(x, y, z, block);
                    }
                    super.breakBlock(world, x, y, z, block, metadata);
                }
            
                public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
                {
                    if(world.isRemote)
                    {
                        return true;
                    } else
                    {
                        player.openGui(AdamiteMod.instance, 0, world, x, y, z);
                        return true;
                    }
                }
            
                public void registerBlockIcons(IIconRegister iiconRegister)
                {
                blockIcon = iiconRegister.registerIcon(References.MOD_ID + ":2");
                    top = iiconRegister.registerIcon(References.MOD_ID + ":1");
                    bottom = iiconRegister.registerIcon(References.MOD_ID + ":3");
                }
            
                public IIcon getIcon(int side, int metadata)
                {
                if(side == 0)
                {
                return this.bottom;
                }
                else if(side == 1)
                {
                return this.top;
                }
                    return this.blockIcon;
                }
            
                IIcon icontop;
                private IIcon iconbottom;
                private IIcon top;
                private IIcon bottom;
            }
            
            

            RECIPES

            package com.adamitemod.mod;
            
            import java.util.HashMap;
            import java.util.Iterator;
            import java.util.Map;
            import java.util.Map.Entry;
            
            import com.adamitemod.mod.init.BlocksMod;
            import com.adamitemod.mod.init.ItemsMod;
            
            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;
            
            @SuppressWarnings("rawtypes")
            public class MachineRecipesPulveriser {
            
            private static final MachineRecipesPulveriser smeltingBase = new MachineRecipesPulveriser();
            
            private Map smeltingList = new HashMap(); 
            
            public MachineRecipesPulveriser()
            {
            
            this.addRecipe(ItemsMod.StrengthStone, new ItemStack(ItemsMod.StickDeForce));
            
            }
            
            @SuppressWarnings("unchecked")
            public void addRecipe(ItemStack stack1, ItemStack stack2) 
            {
            ItemStack[] stackList = new ItemStack[]{stack1, stack2};
            this.smeltingList.put(stackList, stack2);
            }
            
                    public void addRecipe(Item item1, ItemStack stack) 
            {
            this.addRecipe(new ItemStack(item1), stack);
            }
            
            public ItemStack getSmeltingResult(ItemStack[] stack)
            {
                Iterator iterator = this.smeltingList.entrySet().iterator();
                Entry entry;
            
                do
                {
                    if (!iterator.hasNext()) 
                    {
                        return null; 
                    }
                       entry = (Entry)iterator.next(); 
                   }
                   while (!this.isSameKey(stack, (ItemStack[])entry.getKey())); 
            
                   return (ItemStack)entry.getValue(); 
             }
            
            private boolean isSameKey(ItemStack[] stackList, ItemStack[] stackList2)
            {
            boolean isSame = false; 
            for(int i=0; i<=2; i++) 
            {
            System.out.println(stackList.length + "  " + stackList2.length);
            if(stackList*.getItem() == stackList2*.getItem()) 
            {
            isSame = true; 
            }
            else
            {
            return false; 
            }
            }
            return isSame;
            }
            
            public Map getSmeltingList()
            {
                   return this.smeltingList;
                }
            
            public static MachineRecipesPulveriser smelting()
            {
            return smeltingBase;
            }
            
            }
            

            SLOT RESULTE

            package com.adamitemod.mod;
            
            import net.minecraft.entity.player.EntityPlayer;
            import net.minecraft.inventory.IInventory;
            import net.minecraft.inventory.Slot;
            import net.minecraft.item.ItemStack;
            
            public class SlotResultPulveriser extends Slot
            {
            
                public SlotResultPulveriser(IInventory inventory, int id, int x, int y)
                {
                    super(inventory, id, x, y);
                }
            
                public boolean isItemValid(ItemStack stack)
                {
                    return false;
                }
            
                public ItemStack decrStackSize(int amount)
                {
                    return super.decrStackSize(amount);
                }
            
                public void onPickupFromSlot(EntityPlayer player, ItemStack stack)
                {
                    super.onCrafting(stack);
                    super.onPickupFromSlot(player, stack);
                }
            }
            
            

            TILE ENTIYMACHINE

            package com.adamitemod.mod;
            
            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;
            
            public class TileEntityMachinePulveriser extends TileEntity implements IInventory {
            
            private ItemStack[] contents = new ItemStack[2];
            private int workingTime = 0; 
            private int workingTimeNeeded = 200; 
            
            @Override 
                public void writeToNBT(NBTTagCompound compound)
                {
                    super.writeToNBT(compound);
                    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);
                    compound.setShort("workingTime",(short)this.workingTime); 
                    compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded);
                }
            
            @Override
                public void readFromNBT(NBTTagCompound compound)
                {
                    super.readFromNBT(compound);
            
                    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.workingTimeNeeded = compound.getShort("workingTimeNeeded");
                }
            
            @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 "tile.machineTuto";
            }
            
            @Override
            public boolean hasCustomInventoryName() {
            return false;
            }
            
            @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 slot, ItemStack stack) {
            return slot == 1 ? false : true;
            }
            
            public boolean isBurning()
                {
            return this.workingTime > 0;
            }
            
            private boolean canSmelt()
                {
                    if (this.contents[0] == null) //Si les trois premiers slots sont vides
                    {
                        return false; 
                    }
                    else
                    {
                        ItemStack itemstack = MachineRecipesPulveriser.smelting().getSmeltingResult(new ItemStack[]{this.contents[0]}); 
                        if (itemstack == null) return false; 
                        if (this.contents[1] == null) return true; 
                        if (!this.contents[1].isItemEqual(itemstack)) return false; 
                        int result = contents[1].stackSize + itemstack.stackSize;
                        return result <= getInventoryStackLimit() && result <= this.contents[0].getMaxStackSize();
                    }
                }
            
            public void updateEntity() 
                {
                if(this.isBurning() && this.canSmelt()) 
                {
                ++this.workingTime; 
                }
                if(this.canSmelt() && !this.isBurning())
                {
                this.workingTime = 1; 
                }
                if(this.canSmelt() && this.workingTime == this.workingTimeNeeded) 
                {
                this.smeltItem(); 
                this.workingTime = 0; 
                }
                    if(!this.canSmelt()) 
                    {
                           this.workingTime= 0; 
                    }
                }
            
            public void smeltItem()
                {
                    if (this.canSmelt())
                    {
                        ItemStack itemstack = MachineRecipes.smelting().getSmeltingResult(new ItemStack[]{this.contents[0]}); //On récupère l'output de la recette
                         if (this.contents[1] == null) 
                         {
                              this.contents[1] = itemstack.copy(); 
                         }
                         else if (this.contents[1].getItem() == itemstack.getItem()) 
                         {
                              this.contents[1].stackSize += itemstack.stackSize; 
                         }
            
                         –this.contents[0].stackSize; 
            
                         if (this.contents[0].stackSize <= 0) 
                         {
                             this.contents[0] = 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

              Envoies-moi plutôt un zip de ton dossier src, ça serait plus simple pour moi.
              Car il y a tellement de classe que c’est galère.

              1 réponse Dernière réponse Répondre Citer 0
              • ? Hors-ligne
                Un Ancien Utilisateur
                dernière édition par

                D’accord

                1 réponse Dernière réponse Répondre Citer 0
                • ? Hors-ligne
                  Un Ancien Utilisateur
                  dernière édition par

                  Tien! : http://www.mediafire.com/download/30h6i0lij2641am/src+Machine.rar

                  1 réponse Dernière réponse Répondre Citer 0
                  • ? Hors-ligne
                    Un Ancien Utilisateur
                    dernière édition par

                    Je up erci d’avance

                    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 ce que tu m’as envoyé je ne peux pas faire grand chose.
                      J’aimerai tous le dossier src pour faire des tests directement sur eclipse sur mon pc.
                      Si tu veux pas que n’importe qui est accès au source du mod envoies-moi les par mp.

                      1 réponse Dernière réponse Répondre Citer 0
                      • ? Hors-ligne
                        Un Ancien Utilisateur
                        dernière édition par

                        c’est bon

                        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

                          Tu pourrai réexpliquer ce que tu cherche à faire ?
                          Car la seule chose que je vois actuellement c’est un bloc en jeu sans texture pour le gui, ça n’aide pas à comprendre l’objectif du bloc ni ou se trouve les slots.

                          1 réponse Dernière réponse Répondre Citer 0
                          • ? Hors-ligne
                            Un Ancien Utilisateur
                            dernière édition par

                            Je veux faire une machine en 1input 1output ses bon, mais des que je lance le craft sa crash

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

                            MINECRAFT FORGE FRANCE © 2024

                            Powered by NodeBB