MFF

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

    Faire un nouveau four

    Planifier Épinglé Verrouillé Déplacé Les blocs
    1.6.x
    70 Messages 15 Publieurs 26.3k Vues 1 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      Texture sur le gui ou texture du bloc ?
      Je peux avoir tes codes ?

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

        AHHHMMMMMMMMMMMM

        Non, je ne peux pas encore deviner d’où vien le problème, pourrais-tu me donner, pour commencer, version du jeu, classe principale et classe du four?


        Mettez à jours vers la dernière version stable (1.8.9 voir même…

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

          TOUTE les texture, 1.6.2
          class main
          :::

          package four;
          
          import net.minecraft.block.Block;
          import net.minecraft.creativetab.CreativeTabs;
          import tutoriel.proxy.TutoCommonProxy;
          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.network.NetworkMod;
          import cpw.mods.fml.common.network.NetworkRegistry;
          import cpw.mods.fml.common.registry.GameRegistry;
          
          @Mod(modid = "ModTutoriel", name = "Mod Tutoriel", version = "1.0.0", acceptedMinecraftVersions = "[1.6.2,)")
          @NetworkMod(clientSideRequired = true, serverSideRequired = false)
          
          public class main
          {
          @SidedProxy(clientSide = "tutoriel.proxy.TutoClientProxy", serverSide = "tutoriel.proxy.TutoCommonProxy")
          public static TutoCommonProxy proxy;
          
          @Instance("ModTutoriel")
          public static main instance;
          
          public static Block fourOn, fourOff, BlockFour;
          
          @EventHandler
          public void PreInit(FMLPreInitializationEvent event)
          {
          //Configuration
          
          //Blocks
          //BlockFour = new BlockFour(2000).setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep)
          //.setUnlocalizedName("BlockTutorial").func_111022_d("modtutoriel:BlockTutorial");
          
          fourOn = new BlockFour(800, true).func_111022_d("ModTutoriel:fouron").setUnlocalizedName("On");
          fourOff = new BlockFour(810, false).func_111022_d("ModTutoriel:fouroff").setUnlocalizedName("Off").setCreativeTab(CreativeTabs.tabBlock);
          
          GameRegistry.registerBlock(fourOn, "fourOn");
          GameRegistry.registerBlock(fourOff, "fourOff");
          
          GameRegistry.registerTileEntity(TileEntityFour.class, "TileEntityFour");
          //Items
          
          //Achievements
          }
          protected static final GuiHandler guihandler = new GuiHandler();
          @EventHandler
          public void Init(FMLInitializationEvent event)
          {
          //Registry
          NetworkRegistry.instance().registerGuiHandler(this, guihandler);
          //Mobs
          
          //Render
          proxy.registerRender();
          //NetWork
          
          //Recipe
          
          }
          
          @EventHandler
          public void PostInit(FMLPostInitializationEvent event)
          {
          //Intégration avec les autres mods
          
          }
          }
          

          le block

          package four;
          
          import java.util.Random;
          
          import net.minecraft.block.BlockContainer;
          import net.minecraft.block.material.Material;
          import net.minecraft.client.renderer.texture.IconRegister;
          import net.minecraft.entity.EntityLivingBase;
          import net.minecraft.entity.item.EntityItem;
          import net.minecraft.entity.player.EntityPlayer;
          import net.minecraft.item.ItemStack;
          import net.minecraft.nbt.NBTTagCompound;
          import net.minecraft.tileentity.TileEntity;
          import net.minecraft.util.Icon;
          import net.minecraft.util.MathHelper;
          import net.minecraft.world.World;
          import cpw.mods.fml.relauncher.Side;
          import cpw.mods.fml.relauncher.SideOnly;
          
          public class BlockFour extends BlockContainer
          {
          private final boolean isActive; // On défini une boolean isActive qui servira pour le rendu du block ( Allumé ou non )
          
          public BlockFour(int par1, boolean par2)
          {
          super(par1, Material.rock);
          this.isActive = par2;
          }
          
          public int idDropped(int par1, Random par2Random, int par3)
          {
          return main.BlockFour.blockID;
          }
          @SideOnly(Side.CLIENT)
          private Icon furnaceIconTop;
          @SideOnly(Side.CLIENT)
          private Icon furnaceIconFront;
          
          @SideOnly(Side.CLIENT)
          public Icon getIcon(int side, int metadata)
          {
          return side == 1 ? this.furnaceIconTop : (side == 0 ? this.furnaceIconTop : (side == metadata ? this.furnaceIconFront : (side == 3 && metadata == 0 ? this.furnaceIconFront : this.blockIcon)));
          }
          
          @SideOnly(Side.CLIENT)
          public void registerIcons(IconRegister par1IconRegister)
          {
          this.blockIcon = par1IconRegister.registerIcon("myfurnace_side");
          this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "myfurnace_front_on" : "myfurnace_front_off");
          this.furnaceIconTop = par1IconRegister.registerIcon("myfurnace_top");
          }
          
          public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
          {
          if (par1World.isRemote)
          {
          return true;
          }
          else
          {
          TileEntityFour tileentityfour = (TileEntityFour)par1World.getBlockTileEntity(par2, par3, par4);
          
          if (tileentityfour != null)
          {
          par5EntityPlayer.openGui(main.instance, 1, par1World, par2, par3, par4);
          }
          
          return true;
          }
          }
          
          public static void updateFurnaceBlockState(boolean par0, World par1World, int par2, int par3, int par4)
          {
          int l = par1World.getBlockMetadata(par2, par3, par4);
          TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
          keepFurnaceInventory = true;
          
          if (par0)
          {
          par1World.setBlock(par2, par3, par4, main.fourOn.blockID);
          }
          else
          {
          par1World.setBlock(par2, par3, par4, main.fourOff.blockID);
          }
          
          keepFurnaceInventory = false;
          par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);
          
          if (tileentity != null)
          {
          tileentity.validate();
          par1World.setBlockTileEntity(par2, par3, par4, tileentity);
          }
          }
          
          private static boolean keepFurnaceInventory = false;
          
          @SideOnly(Side.CLIENT)
          
          /**
          * Tick au hasard qui fait spawn des flammes et de la fumée
          */
          public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
          {
          if (this.isActive)
          {
          int l = par1World.getBlockMetadata(par2, par3, par4);
          float f = (float)par2 + 0.5F;
          float f1 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
          float f2 = (float)par4 + 0.5F;
          float f3 = 0.52F;
          float f4 = par5Random.nextFloat() * 0.6F - 0.3F;
          
          if (l == 4)
          {
          par1World.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
          par1World.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
          }
          else if (l == 5)
          {
          par1World.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
          par1World.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
          }
          else if (l == 2)
          {
          par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
          par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
          }
          else if (l == 3)
          {
          par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
          par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
          }
          }
          }
          
          /**
          * Crée une entité Four quand le block est placé
          */
          public TileEntity createNewTileEntity(World par1World)
          {
          return new TileEntityFour();
          }
          
          /**
          * Appelé quand le block est placé
          */
          public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
          {
          int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
          world.setBlockMetadataWithNotify(x, y, z, direction, 2);
          }
          public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
          {
          if (!keepFurnaceInventory)
          {
          TileEntityFour tileentityfurnace = (TileEntityFour)par1World.getBlockTileEntity(par2, par3, par4);
          
          if (tileentityfurnace != null)
          {
          for (int j1 = 0; j1 < tileentityfurnace.getSizeInventory(); ++j1)
          {
          ItemStack itemstack = tileentityfurnace.getStackInSlot(j1);
          
          if (itemstack != null)
          {
          float f = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
          float f1 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
          float f2 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
          
          while (itemstack.stackSize > 0)
          {
          int k1 = this.furnaceRand.nextInt(21) + 10;
          
          if (k1 > itemstack.stackSize)
          {
          k1 = itemstack.stackSize;
          }
          
          itemstack.stackSize -= k1;
          EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
          
          if (itemstack.hasTagCompound())
          {
          entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
          }
          
          float f3 = 0.05F;
          entityitem.motionX = (double)((float)this.furnaceRand.nextGaussian() * f3);
          entityitem.motionY = (double)((float)this.furnaceRand.nextGaussian() * f3 + 0.2F);
          entityitem.motionZ = (double)((float)this.furnaceRand.nextGaussian() * f3);
          par1World.spawnEntityInWorld(entityitem);
          }
          }
          }
          
          par1World.func_96440_m(par2, par3, par4, par5);
          }
          }
          
          super.breakBlock(par1World, par2, par3, par4, par5, par6);
          }
          public void breakBlock1(World par1World, int par2, int par3, int par4, int par5, int par6)
          {
          if (!keepFurnaceInventory)
          {
          TileEntityFour tileentityfurnace = (TileEntityFour)par1World.getBlockTileEntity(par2, par3, par4);
          
          if (tileentityfurnace != null)
          {
          for (int j1 = 0; j1 < tileentityfurnace.getSizeInventory(); ++j1)
          {
          ItemStack itemstack = tileentityfurnace.getStackInSlot(j1);
          
          if (itemstack != null)
          {
          float f = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
          float f1 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
          float f2 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
          
          while (itemstack.stackSize > 0)
          {
          int k1 = this.furnaceRand.nextInt(21) + 10;
          
          if (k1 > itemstack.stackSize)
          {
          k1 = itemstack.stackSize;
          }
          
          itemstack.stackSize -= k1;
          EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
          
          if (itemstack.hasTagCompound())
          {
          entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
          }
          
          float f3 = 0.05F;
          entityitem.motionX = (double)((float)this.furnaceRand.nextGaussian() * f3);
          entityitem.motionY = (double)((float)this.furnaceRand.nextGaussian() * f3 + 0.2F);
          entityitem.motionZ = (double)((float)this.furnaceRand.nextGaussian() * f3);
          par1World.spawnEntityInWorld(entityitem);
          }
          }
          }
          
          par1World.func_96440_m(par2, par3, par4, par5);
          }
          }
          
          super.breakBlock(par1World, par2, par3, par4, par5, par6);
          }
          
          private final Random furnaceRand = new Random();
          
          public boolean hasComparatorInputOverride()
          {
          return true;
          }
          
          }
          
          

          le Gui

          package four;
          
          import net.minecraft.client.gui.inventory.GuiContainer;
          import net.minecraft.client.resources.I18n;
          import net.minecraft.entity.player.InventoryPlayer;
          import net.minecraft.inventory.ContainerFurnace;
          import net.minecraft.util.ResourceLocation;
          
          import org.lwjgl.opengl.GL11;
          
          import cpw.mods.fml.relauncher.Side;
          import cpw.mods.fml.relauncher.SideOnly;
          
          @SideOnly(Side.CLIENT)
          public class GuiFour extends GuiContainer
          {
          private static final ResourceLocation field_110410_t = new ResourceLocation("ModTutoriel:textures/gui/container/guiFour.png");
          private TileEntityFour furnaceInventory;
          
          public GuiFour(InventoryPlayer par1InventoryPlayer, TileEntityFour par2TileEntityFour)
          {
          super(new ContainerFour(par1InventoryPlayer, par2TileEntityFour));
          this.furnaceInventory = par2TileEntityFour;
          } protected void drawGuiContainerForegroundLayer(int par1, int par2)
          {
          String s = this.furnaceInventory.isInvNameLocalized() ? this.furnaceInventory.getInvName() : I18n.func_135053_a(this.furnaceInventory.getInvName());
          this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
          this.fontRenderer.drawString(I18n.func_135053_a("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
          }
          
          protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
          {
          GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
          this.mc.func_110434_K().func_110577_a(field_110410_t);
          int k = (this.width - this.xSize) / 2;
          int l = (this.height - this.ySize) / 2;
          this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
          int i1;
          
          if (this.furnaceInventory.isBurning())
          {
          i1 = this.furnaceInventory.getBurnTimeRemainingScaled(12);
          this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
          }
          
          i1 = this.furnaceInventory.getCookProgressScaled(24);
          this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
          }
          }
          
          

          :::

          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

            Heu … le .func_111022_d(“ModTutoriel:fouron”) dans la déclaration de l’item de sert à rien comme tu as mit cette fonction dans le bloc :

            public void registerIcons(IconRegister par1IconRegister)
            {
            this.blockIcon = par1IconRegister.registerIcon("myfurnace_side");
            this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "myfurnace_front_on" : "myfurnace_front_off");
            this.furnaceIconTop = par1IconRegister.registerIcon("myfurnace_top");
            }
            

            Et ici il manque les modid:

            Et pour ici :

            private static final ResourceLocation field_110410_t = new ResourceLocation("ModTutoriel:textures/gui/container/guiFour.png");
            

            MAJUSCULE !!! -> new ResourceLocation(“modtutoriel”, “textures/gui/container/guiFour.png”); à utiliser de préférence.

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

              Merci!!! 🙂


              je voudrais savoir, c’est-tu possible de faire que ma texture du haut et du bas soit différente?

              Edit: c’est bon j’ai trouvé 🙂

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

                Bon là je comprend pas! Jusqu’à maintenant je faisait le four dans mon mod “Test”, j’ai copy/paste le code dans mon mod principal, le bloc est en jeu mais quand je fait click-Droit le GUI ne s’ouvre plus!!Pourtant je n’ai aucune erreur!!
                :::

                Mon main

                package havre;
                
                import havre.proxy.HavreCommonProxy;
                import net.minecraft.block.Block;
                import net.minecraft.creativetab.CreativeTabs;
                import net.minecraft.item.EnumToolMaterial;
                import net.minecraft.item.Item;
                import net.minecraft.item.ItemStack;
                import net.minecraft.util.WeightedRandomChestContent;
                import net.minecraftforge.common.ChestGenHooks;
                import net.minecraftforge.common.EnumHelper;
                import net.minecraftforge.common.MinecraftForge;
                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.network.NetworkMod;
                import cpw.mods.fml.common.network.NetworkRegistry;
                import cpw.mods.fml.common.registry.GameRegistry;
                
                @Mod(modid = "HS", name = "Haven-Craft", version = "V.01")
                @NetworkMod(clientSideRequired = true, serverSideRequired = false)
                
                public class havremain {
                
                @SidedProxy(clientSide = "havre.proxy.HavreClientProxy", serverSide = "havre.proxy.HavreCommonProxy")
                public static HavreCommonProxy proxy;
                
                @Instance("havremain")
                public static havremain instance;
                
                //Blocks peut en caller plusieur comme ca: public static Block BlockHaven, DeuximeBlock, TroixiemeBlock;
                public static Block havenblock, havenexit, havencore, havenclayblock, riceblock;
                public static Block fourOn, fourOff, BlockFour;
                
                //Material
                static EnumToolMaterial HavenMaterial = EnumHelper.addToolMaterial("HAVEN", 4, 1600, 8.0F, 4.0F, 10);
                
                //Item
                public static Item havenclay, HavenSword, HavenPickaxe, HavenAxe,
                HavenShovel, HavenHoe, omnitool, ironraffine, goldraffine ;
                //food
                public static Item rice, ricebowl;
                
                //Creative tabs
                public static CreativeTabs haventabs = new HavenTabs("HavenTabs");
                
                //Ore generation
                public static HavenOreWorldGeneration GenWorld = new HavenOreWorldGeneration();
                
                @EventHandler
                public void load(FMLInitializationEvent event)
                {
                HavenCrafting.loadrecipes();
                ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(new ItemStack(rice), 1, 3, 5));
                }
                
                @EventHandler
                //placer les configurations, compléter et enregistrer nos blocs et items, et placer les achievements.
                public void PreInit(FMLPreInitializationEvent event)
                {
                
                //Configuration
                
                //Blocks les Id sont de 601 à 4095
                //Haven-Block
                havenblock = new HavenBlock(700).setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundClothFootstep)
                .setUnlocalizedName("HavenBlock").func_111022_d("hs:havenblock");
                GameRegistry.registerBlock(havenblock, "HavenBlock");
                //Haven-Exit
                havenexit = new HavenExit(701).setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundClothFootstep)
                .setUnlocalizedName("HavenExit").func_111022_d("hs:havenexit");
                GameRegistry.registerBlock(havenexit, "Havenexit");
                //Haven-Core
                havencore = new HavenCore(702).setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundClothFootstep)
                .setUnlocalizedName("HavenCore").func_111022_d("hs:havencore");
                GameRegistry.registerBlock(havencore, "HavenCore");
                //Haven-Clay Block
                havenclayblock = new HavenClayBlock(703).setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundGravelFootstep)
                .setUnlocalizedName("HavenClay").func_111022_d("hs:havenclayblock");
                GameRegistry.registerBlock(havenclayblock, "HavenClay");
                //rice
                riceblock = new RiceBlock(704).setUnlocalizedName("Rice");//.func_111022_d("hs:rice");
                //Rafinery
                fourOn = new BlockFour(710, true).setUnlocalizedName("On");
                fourOff = new BlockFour(711, false).func_111022_d("hs:fouroff").setUnlocalizedName("Off").setCreativeTab(CreativeTabs.tabBlock);
                
                GameRegistry.registerBlock(fourOn, "fourOn");
                GameRegistry.registerBlock(fourOff, "fourOff");
                
                GameRegistry.registerTileEntity(TileEntityFour.class, "TileEntityFour");
                //Items les id sont de 4096 à 31 999\. sachez aussi que l'id que vous allez mettre ici n'est pas la même qu'en jeu, en effet 256 est additionné à cette id
                //Haven-Clay
                havenclay = new HavenClay(4100).setUnlocalizedName("HavenClay").func_111206_d("hs:havenclay");
                //Pelle de Ruel
                omnitool = new ruel(4106, havremain.HavenMaterial).setUnlocalizedName("OmniTool").func_111206_d("hs:ruelshovel");
                //Food
                rice = new Rice(4107, 1, 0.3F, riceblock.blockID, Block.tilledField.blockID).setUnlocalizedName("Rice").func_111206_d("hs:rice");
                ricebowl = new RiceBowl(4108, 10, 0.8F, false).setUnlocalizedName("RiceBowl").func_111206_d("hs:RB");
                //les truc pour faire la pelle
                ironraffine = new Raffine(4109).setUnlocalizedName("IronR").func_111206_d("hs:ironraffiner");
                goldraffine = new Raffine(4110).setUnlocalizedName("GoldRR").func_111206_d("hs:goldraffiner");
                //Achievements
                
                }
                protected static final GuiHandler guihandler = new GuiHandler();
                @EventHandler
                //enregistrer les tileEntity, les Entity, les rendu, etc …
                public void Init(FMLInitializationEvent event)
                {
                //Registry
                GameRegistry.registerWorldGenerator(GenWorld);
                NetworkRegistry.instance().registerGuiHandler(this, guihandler);
                /*GameRegistry.registerItem(rice, "Rice");
                LanguageRegistry.addName(rice, "Rice");
                
                GameRegistry.registerBlock(riceblock, "riceblock");
                LanguageRegistry.addName(riceblock, "Rice Crop");*/
                //Mobs
                
                //Render
                proxy.registerRender();
                //NetWork
                
                //Recipe
                
                //tools
                
                MinecraftForge.setToolClass(omnitool, "pickaxe", 4);
                MinecraftForge.setBlockHarvestLevel(havenblock, "pickaxe", 4);
                MinecraftForge.setBlockHarvestLevel(havencore, "pickaxe", 4);
                MinecraftForge.setBlockHarvestLevel(havenexit, "pickaxe", 4);
                MinecraftForge.setBlockHarvestLevel(havenclayblock, "pickaxe", 4);
                
                }
                
                @EventHandler
                //dernières finissions, comme par exemple les enregistrements de langages ou de recettes.
                public void PostInit(FMLPostInitializationEvent event)
                {
                //Intégration avec les autres mods
                }
                
                }
                
                

                le BlockFour ```java
                package havre;

                import java.util.Random;

                import net.minecraft.block.BlockContainer;
                import net.minecraft.block.material.Material;
                import net.minecraft.client.renderer.texture.IconRegister;
                import net.minecraft.entity.EntityLivingBase;
                import net.minecraft.entity.item.EntityItem;
                import net.minecraft.entity.player.EntityPlayer;
                import net.minecraft.item.ItemStack;
                import net.minecraft.nbt.NBTTagCompound;
                import net.minecraft.tileentity.TileEntity;
                import net.minecraft.util.Icon;
                import net.minecraft.util.MathHelper;
                import net.minecraft.world.World;
                import cpw.mods.fml.relauncher.Side;
                import cpw.mods.fml.relauncher.SideOnly;

                public class BlockFour extends BlockContainer
                {
                private final boolean isActive; // On défini une boolean isActive qui servira pour le rendu du block ( Allumé ou non )

                public BlockFour(int par1, boolean par2)
                {
                super(par1, Material.rock);
                this.isActive = par2;
                }

                public int idDropped(int par1, Random par2Random, int par3)
                {
                return havremain.fourOff.blockID;
                }
                @SideOnly(Side.CLIENT)
                private Icon furnaceIconBottom;
                @SideOnly(Side.CLIENT)
                private Icon furnaceIconTop;
                @SideOnly(Side.CLIENT)
                private Icon furnaceIconFront;

                @SideOnly(Side.CLIENT)
                public Icon getIcon(int side, int metadata) {
                if(side == 0) {
                return furnaceIconBottom;
                } else if(side == 1) {
                return furnaceIconTop;
                } else {
                return furnaceIconFront;
                }
                }

                @SideOnly(Side.CLIENT)
                public void registerIcons(IconRegister par1IconRegister)
                {
                this.blockIcon = par1IconRegister.registerIcon(“hs:raffineur_side”);
                this.furnaceIconFront = par1IconRegister.registerIcon(“hs:raffineur_front_off”);
                this.furnaceIconBottom = par1IconRegister.registerIcon(“hs:raffineur_bottom”);
                this.furnaceIconTop = par1IconRegister.registerIcon(this.isActive ? “hs:raffineur_top_on” :“hs:raffineur_top_off” );
                }

                public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
                {
                if (par1World.isRemote)
                {
                return true;
                }
                else
                {
                TileEntityFour tileentityfour = (TileEntityFour)par1World.getBlockTileEntity(par2, par3, par4);

                if (tileentityfour != null)
                {
                par5EntityPlayer.openGui(havremain.instance, 1, par1World, par2, par3, par4);
                }

                return true;
                }
                }

                public static void updateFurnaceBlockState(boolean par0, World par1World, int par2, int par3, int par4)
                {
                int l = par1World.getBlockMetadata(par2, par3, par4);
                TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
                keepFurnaceInventory = true;

                if (par0)
                {
                par1World.setBlock(par2, par3, par4, havremain.fourOn.blockID);
                }
                else
                {
                par1World.setBlock(par2, par3, par4, havremain.fourOff.blockID);
                }

                keepFurnaceInventory = false;
                par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);

                if (tileentity != null)
                {
                tileentity.validate();
                par1World.setBlockTileEntity(par2, par3, par4, tileentity);
                }
                }

                private static boolean keepFurnaceInventory = false;

                @SideOnly(Side.CLIENT)

                /**

                • Tick au hasard qui fait spawn des flammes et de la fumée
                  */
                  /*public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
                  {
                  if (this.isActive)
                  {
                  int l = par1World.getBlockMetadata(par2, par3, par4);
                  float f = (float)par2 + 0.5F;
                  float f1 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
                  float f2 = (float)par4 + 0.5F;
                  float f3 = 0.52F;
                  float f4 = par5Random.nextFloat() * 0.6F - 0.3F;

                if (l == 4)
                {
                par1World.spawnParticle(“smoke”, (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                par1World.spawnParticle(“flame”, (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                }
                else if (l == 5)
                {
                par1World.spawnParticle(“smoke”, (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                par1World.spawnParticle(“flame”, (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                }
                else if (l == 2)
                {
                par1World.spawnParticle(“smoke”, (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
                par1World.spawnParticle(“flame”, (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
                }
                else if (l == 3)
                {
                par1World.spawnParticle(“smoke”, (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
                par1World.spawnParticle(“flame”, (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
                }
                }
                }
                /
                /
                *

                • Crée une entité Four quand le block est placé
                  */
                  public TileEntity createNewTileEntity(World par1World)
                  {
                  return new TileEntityFour();
                  }

                /**

                • Appelé quand le block est placé
                  */
                  public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
                  {
                  int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
                  world.setBlockMetadataWithNotify(x, y, z, direction, 2);
                  }
                  public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
                  {
                  if (!keepFurnaceInventory)
                  {
                  TileEntityFour tileentityfurnace = (TileEntityFour)par1World.getBlockTileEntity(par2, par3, par4);

                if (tileentityfurnace != null)
                {
                for (int j1 = 0; j1 < tileentityfurnace.getSizeInventory(); ++j1)
                {
                ItemStack itemstack = tileentityfurnace.getStackInSlot(j1);

                if (itemstack != null)
                {
                float f = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
                float f1 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
                float f2 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;

                while (itemstack.stackSize > 0)
                {
                int k1 = this.furnaceRand.nextInt(21) + 10;

                if (k1 > itemstack.stackSize)
                {
                k1 = itemstack.stackSize;
                }

                itemstack.stackSize -= k1;
                EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));

                if (itemstack.hasTagCompound())
                {
                entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
                }

                float f3 = 0.05F;
                entityitem.motionX = (double)((float)this.furnaceRand.nextGaussian() * f3);
                entityitem.motionY = (double)((float)this.furnaceRand.nextGaussian() * f3 + 0.2F);
                entityitem.motionZ = (double)((float)this.furnaceRand.nextGaussian() * f3);
                par1World.spawnEntityInWorld(entityitem);
                }
                }
                }

                par1World.func_96440_m(par2, par3, par4, par5);
                }
                }

                super.breakBlock(par1World, par2, par3, par4, par5, par6);
                }
                public void breakBlock1(World par1World, int par2, int par3, int par4, int par5, int par6)
                {
                if (!keepFurnaceInventory)
                {
                TileEntityFour tileentityfurnace = (TileEntityFour)par1World.getBlockTileEntity(par2, par3, par4);

                if (tileentityfurnace != null)
                {
                for (int j1 = 0; j1 < tileentityfurnace.getSizeInventory(); ++j1)
                {
                ItemStack itemstack = tileentityfurnace.getStackInSlot(j1);

                if (itemstack != null)
                {
                float f = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
                float f1 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
                float f2 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;

                while (itemstack.stackSize > 0)
                {
                int k1 = this.furnaceRand.nextInt(21) + 10;

                if (k1 > itemstack.stackSize)
                {
                k1 = itemstack.stackSize;
                }

                itemstack.stackSize -= k1;
                EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));

                if (itemstack.hasTagCompound())
                {
                entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
                }

                float f3 = 0.05F;
                entityitem.motionX = (double)((float)this.furnaceRand.nextGaussian() * f3);
                entityitem.motionY = (double)((float)this.furnaceRand.nextGaussian() * f3 + 0.2F);
                entityitem.motionZ = (double)((float)this.furnaceRand.nextGaussian() * f3);
                par1World.spawnEntityInWorld(entityitem);
                }
                }
                }

                par1World.func_96440_m(par2, par3, par4, par5);
                }
                }

                super.breakBlock(par1World, par2, par3, par4, par5, par6);
                }

                private final Random furnaceRand = new Random();

                public boolean hasComparatorInputOverride()
                {
                return true;
                }

                }

                GUI Handler ```java
                package havre;
                
                import net.minecraft.entity.player.EntityPlayer;
                import net.minecraft.tileentity.TileEntity;
                import net.minecraft.world.World;
                import cpw.mods.fml.common.network.IGuiHandler;
                
                public class GuiHandler implements IGuiHandler{
                
                @Override
                public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                
                if(tile_entity instanceof TileEntityFour){
                return new ContainerFour(player.inventory, (TileEntityFour) tile_entity);
                }
                return null;
                }
                
                @Override
                public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                if(tile_entity instanceof TileEntityFour){
                return new GuiFour(player.inventory, (TileEntityFour) tile_entity);
                }
                return null;
                }
                
                }
                

                GUIFour```java
                package havre;

                import net.minecraft.client.gui.inventory.GuiContainer;
                import net.minecraft.client.resources.I18n;
                import net.minecraft.entity.player.InventoryPlayer;
                import net.minecraft.inventory.ContainerFurnace;
                import net.minecraft.util.ResourceLocation;

                import org.lwjgl.opengl.GL11;

                import cpw.mods.fml.relauncher.Side;
                import cpw.mods.fml.relauncher.SideOnly;

                @SideOnly(Side.CLIENT)
                public class GuiFour extends GuiContainer
                {
                private static final ResourceLocation field_110410_t = new ResourceLocation(“hs”, “textures/gui/container/guiFour.png”);
                private TileEntityFour furnaceInventory;

                public GuiFour(InventoryPlayer par1InventoryPlayer, TileEntityFour par2TileEntityFour)
                {
                super(new ContainerFour(par1InventoryPlayer, par2TileEntityFour));
                this.furnaceInventory = par2TileEntityFour;
                } protected void drawGuiContainerForegroundLayer(int par1, int par2)
                {
                String s = this.furnaceInventory.isInvNameLocalized() ? this.furnaceInventory.getInvName() : I18n.func_135053_a(this.furnaceInventory.getInvName());
                this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
                this.fontRenderer.drawString(I18n.func_135053_a(“container.inventory”), 8, this.ySize - 96 + 2, 4210752);
                }

                protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
                {
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                this.mc.func_110434_K().func_110577_a(field_110410_t);
                int k = (this.width - this.xSize) / 2;
                int l = (this.height - this.ySize) / 2;
                this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
                int i1;

                if (this.furnaceInventory.isBurning())
                {
                i1 = this.furnaceInventory.getBurnTimeRemainingScaled(12);
                this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
                }

                i1 = this.furnaceInventory.getCookProgressScaled(24);
                this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
                }
                }

                :::
                1 réponse Dernière réponse Répondre Citer 0
                • Superloup10S Hors-ligne
                  Superloup10 Modérateurs
                  dernière édition par

                  Vérifie qu’il ne te manque pas l’un de ses 3 codes dans ta classe principale```java
                  protected static final GuiHandler guihandler = new GuiHandler();
                  NetworkRegistry.instance().registerGuiHandler(this, guihandler);
                  GameRegistry.registerTileEntity(TileEntityFour.class, “TileEntityFour”);

                  
                  Et qu'ils ont bien mis au bon endroit.

                  Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                    Ils sont au bon endroits

                    1 réponse Dernière réponse Répondre Citer 0
                    • Superloup10S Hors-ligne
                      Superloup10 Modérateurs
                      dernière édition par

                      Si je ne me trompe ceci java protected static final GuiHandler guihandler = new GuiHandler(); doit être avant le PreInit, ceci ```java
                      NetworkRegistry.instance().registerGuiHandler(this, guihandler);
                      GameRegistry.registerTileEntity(TileEntityFour.class, “TileEntityFour”);

                      Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                        Nope ça ne fonctionne pas 😕

                        1 réponse Dernière réponse Répondre Citer 0
                        • Superloup10S Hors-ligne
                          Superloup10 Modérateurs
                          dernière édition par

                          Alors je vois vraiment pas pourquoi ça ne fonctionne pas.

                          Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                          Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

                          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

                            @Mod(modid = “HS”, name = “Haven-Craft”, version = “V.01”)

                            @Instance(“havremain”)
                            public static havremain instance;

                            Les deux String que j’ai mis en rouge doivent être identique.

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

                              Robin, si j’étais ne femme je pense que je te sauterait dessus!! Blague Merci! J’ai encore beaucoup de chose à apprendre ^^

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

                                Ah, j’avais pas pensé a une erreur aussi simple 😆

                                "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                                ― Jordan B. Peterson

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

                                  y a-t-il un moyen de faire que les particule de feu soit sur le “Top”?

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

                                    Augmente la position Y

                                    "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                                    ― Jordan B. Peterson

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

                                      Euh, dans quel partie du code?? Ça?

                                      /**
                                      * Tick au hasard qui fait spawn des flammes et de la fumée
                                      */
                                      public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
                                      {
                                      if (this.isActive)
                                      {
                                      int l = par1World.getBlockMetadata(par2, par3, par4);
                                      float f = (float)par2 + 0.5F;
                                      float f1 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
                                      float f2 = (float)par4 + 0.5F;
                                      float f3 = 0.52F;
                                      float f4 = par5Random.nextFloat() * 0.6F - 0.3F;
                                      
                                      if (l == 4)
                                      {
                                      par1World.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                                      par1World.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                                      }
                                      else if (l == 5)
                                      {
                                      par1World.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                                      par1World.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
                                      }
                                      else if (l == 2)
                                      {
                                      par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
                                      par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
                                      }
                                      else if (l == 3)
                                      {
                                      par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
                                      par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
                                      }
                                      }
                                      }
                                      
                                      1 réponse Dernière réponse Répondre Citer 0
                                      • GuguG Hors-ligne
                                        Gugu
                                        dernière édition par

                                        f1 = Position Y

                                        "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                                        ― Jordan B. Peterson

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

                                          ok merci

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

                                            Bon, je voudrais qu’on ne puisse utiliser que le bucket de lave dans le four. Mais lorsque je retire les autre objet de fuel, je ne peut pu rien faire cuir! Le bucket ne fonctionne pas!!

                                            package havre;
                                            
                                            import net.minecraft.block.Block;
                                            import net.minecraft.block.material.Material;
                                            import net.minecraft.entity.player.EntityPlayer;
                                            import net.minecraft.inventory.ISidedInventory;
                                            import net.minecraft.item.Item;
                                            import net.minecraft.item.ItemBlock;
                                            import net.minecraft.item.ItemHoe;
                                            import net.minecraft.item.ItemStack;
                                            import net.minecraft.item.ItemSword;
                                            import net.minecraft.item.ItemTool;
                                            import net.minecraft.nbt.NBTTagCompound;
                                            import net.minecraft.nbt.NBTTagList;
                                            import net.minecraft.tileentity.TileEntity;
                                            import cpw.mods.fml.common.registry.GameRegistry;
                                            import cpw.mods.fml.relauncher.Side;
                                            import cpw.mods.fml.relauncher.SideOnly;
                                            
                                            public class TileEntityFour extends TileEntity implements ISidedInventory
                                            {
                                            private ItemStack[] furnaceItemStacks = new ItemStack[3];
                                            
                                            public int getSizeInventory()
                                            {
                                            return this.furnaceItemStacks.length;
                                            }
                                            
                                            public ItemStack getStackInSlot(int par1)
                                            {
                                            return this.furnaceItemStacks[par1];
                                            }
                                            public ItemStack decrStackSize(int par1, int par2)
                                            {
                                            if (this.furnaceItemStacks[par1] != null)
                                            {
                                            ItemStack itemstack;
                                            
                                            if (this.furnaceItemStacks[par1].stackSize <= par2)
                                            {
                                            itemstack = this.furnaceItemStacks[par1];
                                            this.furnaceItemStacks[par1] = null;
                                            return itemstack;
                                            }
                                            else
                                            {
                                            itemstack = this.furnaceItemStacks[par1].splitStack(par2);
                                            
                                            if (this.furnaceItemStacks[par1].stackSize == 0)
                                            {
                                            this.furnaceItemStacks[par1] = null;
                                            }
                                            
                                            return itemstack;
                                            }
                                            }
                                            else
                                            {
                                            return null;
                                            }
                                            }
                                            public ItemStack getStackInSlotOnClosing(int par1)
                                            {
                                            if (this.furnaceItemStacks[par1] != null)
                                            {
                                            ItemStack itemstack = this.furnaceItemStacks[par1];
                                            this.furnaceItemStacks[par1] = null;
                                            return itemstack;
                                            }
                                            else
                                            {
                                            return null;
                                            }
                                            }
                                            public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
                                            {
                                            this.furnaceItemStacks[par1] = par2ItemStack;
                                            
                                            if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
                                            {
                                            par2ItemStack.stackSize = this.getInventoryStackLimit();
                                            }
                                            }
                                            private String field_94130_e; //Variable a mettre au debut de votre classe
                                            
                                            public String getInvName()
                                            {
                                            return this.isInvNameLocalized() ? this.field_94130_e : "container.four"; //Ici, c'est en rapport avec le fichier lang :o
                                            }
                                            
                                            public boolean isInvNameLocalized()
                                            {
                                            return this.field_94130_e != null && this.field_94130_e.length() > 0;
                                            }
                                            
                                            public void setGuiDisplayName(String par1Str)
                                            {
                                            this.field_94130_e = par1Str;
                                            }
                                            public void readFromNBT(NBTTagCompound par1NBTTagCompound)
                                            {
                                            super.readFromNBT(par1NBTTagCompound);
                                            NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items");
                                            this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];
                                            
                                            for (int i = 0; i < nbttaglist.tagCount(); ++i)
                                            {
                                            NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
                                            byte b0 = nbttagcompound1.getByte("Slot");
                                            
                                            if (b0 >= 0 && b0 < this.furnaceItemStacks.length)
                                            {
                                            this.furnaceItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
                                            }
                                            }
                                            
                                            this.furnaceBurnTime = par1NBTTagCompound.getShort("BurnTime");
                                            this.furnaceCookTime = par1NBTTagCompound.getShort("CookTime");
                                            this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
                                            
                                            if (par1NBTTagCompound.hasKey("CustomName"))
                                            {
                                            this.field_94130_e = par1NBTTagCompound.getString("CustomName");
                                            }
                                            }
                                            
                                            public void writeToNBT(NBTTagCompound par1NBTTagCompound)
                                            {
                                            super.writeToNBT(par1NBTTagCompound);
                                            par1NBTTagCompound.setShort("BurnTime", (short)this.furnaceBurnTime);
                                            par1NBTTagCompound.setShort("CookTime", (short)this.furnaceCookTime);
                                            NBTTagList nbttaglist = new NBTTagList();
                                            
                                            for (int i = 0; i < this.furnaceItemStacks.length; ++i)
                                            {
                                            if (this.furnaceItemStacks* != null)
                                            {
                                            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                                            nbttagcompound1.setByte("Slot", (byte)i);
                                            this.furnaceItemStacks*.writeToNBT(nbttagcompound1);
                                            nbttaglist.appendTag(nbttagcompound1);
                                            }
                                            }
                                            
                                            par1NBTTagCompound.setTag("Items", nbttaglist);
                                            
                                            if (this.isInvNameLocalized())
                                            {
                                            par1NBTTagCompound.setString("CustomName", this.field_94130_e);
                                            }
                                            }
                                            private static final int[] slots_top = new int[] {0};
                                            private static final int[] slots_bottom = new int[] {2, 1};
                                            private static final int[] slots_sides = new int[] {1};
                                            
                                            public int furnaceBurnTime;
                                            public int furnaceCookTime;
                                            
                                            public int currentItemBurnTime;
                                            
                                            public int getInventoryStackLimit()
                                            {
                                            return 64;
                                            }
                                            @SideOnly(Side.CLIENT)
                                            public int getCookProgressScaled(int par1)
                                            {
                                            return this.furnaceCookTime * par1 / 200;
                                            }
                                            
                                            @SideOnly(Side.CLIENT)
                                            public int getBurnTimeRemainingScaled(int par1)
                                            {
                                            if (this.currentItemBurnTime == 0)
                                            {
                                            this.currentItemBurnTime = 200;
                                            }
                                            
                                            return this.furnaceBurnTime * par1 / this.currentItemBurnTime;
                                            }
                                            public boolean isBurning()
                                            {
                                            return this.furnaceBurnTime > 0;
                                            }
                                            public void updateEntity()
                                            {
                                            boolean flag = this.furnaceBurnTime > 0;
                                            boolean flag1 = false;
                                            
                                            if (this.furnaceBurnTime > 0)
                                            {
                                            –this.furnaceBurnTime;
                                            }
                                            
                                            if (!this.worldObj.isRemote)
                                            {
                                            if (this.furnaceBurnTime == 0 && this.canSmelt())
                                            {
                                            this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
                                            
                                            if (this.furnaceBurnTime > 0)
                                            {
                                            flag1 = true;
                                            
                                            if (this.furnaceItemStacks[1] != null)
                                            {
                                            –this.furnaceItemStacks[1].stackSize;
                                            
                                            if (this.furnaceItemStacks[1].stackSize == 0)
                                            {
                                            this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem().getContainerItemStack(furnaceItemStacks[1]);
                                            }
                                            }
                                            }
                                            }
                                            
                                            if (this.isBurning() && this.canSmelt())
                                            {
                                            ++this.furnaceCookTime;
                                            
                                            if (this.furnaceCookTime == 200)
                                            {
                                            this.furnaceCookTime = 0;
                                            this.smeltItem();
                                            flag1 = true;
                                            }
                                            }
                                            else
                                            {
                                            this.furnaceCookTime = 0;
                                            }
                                            
                                            if (flag != this.furnaceBurnTime > 0)
                                            {
                                            flag1 = true;
                                            BlockFour.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
                                            }
                                            }
                                            
                                            if (flag1)
                                            {
                                            this.onInventoryChanged();
                                            }
                                            }
                                            private boolean canSmelt()
                                            {
                                            if (this.furnaceItemStacks[0] == null)
                                            {
                                            return false;
                                            }
                                            else
                                            {
                                            ItemStack itemstack = RecipesFour.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
                                            if (itemstack == null) return false;
                                            if (this.furnaceItemStacks[2] == null) return true;
                                            if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false;
                                            int result = furnaceItemStacks[2].stackSize + itemstack.stackSize;
                                            return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
                                            }
                                            }
                                            public void smeltItem()
                                            {
                                            if (this.canSmelt())
                                            {
                                            ItemStack itemstack = RecipesFour.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
                                            
                                            if (this.furnaceItemStacks[2] == null)
                                            {
                                            this.furnaceItemStacks[2] = itemstack.copy();
                                            }
                                            else if (this.furnaceItemStacks[2].isItemEqual(itemstack))
                                            {
                                            furnaceItemStacks[2].stackSize += itemstack.stackSize;
                                            }
                                            
                                            –this.furnaceItemStacks[0].stackSize;
                                            
                                            if (this.furnaceItemStacks[0].stackSize <= 0)
                                            {
                                            this.furnaceItemStacks[0] = null;
                                            }
                                            }
                                            }
                                            public static int getItemBurnTime(ItemStack par0ItemStack)
                                            {
                                            if (par0ItemStack == null)
                                            {
                                            return 0;
                                            }
                                            else
                                            {
                                            int i = par0ItemStack.getItem().itemID;
                                            Item item = par0ItemStack.getItem();
                                            
                                            if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList* != null)
                                            {
                                            Block block = Block.blocksList*;
                                            
                                            if (block == Block.woodSingleSlab)
                                            {
                                            return 150;
                                            }
                                            
                                            if (block.blockMaterial == Material.wood)
                                            {
                                            return 300;
                                            }
                                            
                                            if (block == Block.field_111034_cE)
                                            {
                                            return 16000;
                                            }
                                            }
                                            
                                            if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
                                            if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
                                            if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 200;
                                            if (i == Item.stick.itemID) return 100;
                                            if (i == Item.coal.itemID) return 1600;
                                            if (i == Item.bucketLava.itemID) return 20000;
                                            if (i == Block.sapling.blockID) return 100;
                                            if (i == Item.blazeRod.itemID) return 2400;
                                            return GameRegistry.getFuelValue(par0ItemStack);
                                            }
                                            }
                                            public static boolean isItemFuel(ItemStack par0ItemStack)
                                            {
                                            return getItemBurnTime(par0ItemStack) > 0;
                                            }
                                            public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
                                            {
                                            return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
                                            }
                                            public void openChest() {}
                                            
                                            public void closeChest() {}
                                            
                                            public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack)
                                            {
                                            return par1 == 2 ? false : (par1 == 1 ? isItemFuel(par2ItemStack) : true);
                                            }
                                            
                                            public int[] getAccessibleSlotsFromSide(int par1)
                                            {
                                            return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_sides);
                                            }
                                            
                                            public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3)
                                            {
                                            return this.isItemValidForSlot(par1, par2ItemStack);
                                            }
                                            
                                            public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3)
                                            {
                                            return par3 != 0 || par1 != 1 || par2ItemStack.itemID == Item.bucketEmpty.itemID;
                                            }
                                            
                                            }
                                            
                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 1 / 4
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB