MFF

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

    [1.7.10]Poser les seed sur une nouvelle farmland!

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    4 Messages 3 Publieurs 1.1k Vues 3 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.
    • HeavenH Hors-ligne
      Heaven
      dernière édition par

      Bonjour,j ai un problème depuis quelque temps.j aimerais créer ma farmlande qui:
      -N a pas besoin d eau
      -quand on saute dessus çà fait rien
      -çà accélère la plantation des seed

      j ai déjà tester et réussi 1/3 des problème celui de quand on saute dessus ça fait rien.
      la classe de mon block:

      package com.nugarium.nugarMod.block.farmblock;
      
      import com.nugarium.nugarMod.NugarMod;
      import com.nugarium.nugarMod.References;
      import com.nugarium.nugarMod.utils.farmlandplus;
      import cpw.mods.fml.common.registry.GameRegistry;
      import net.minecraft.block.Block;
      
      public class FarmBlockplus {
          public static Block FarmBlockplus;
      
      
          public static void init(){
              FarmBlockplus = new farmlandplus().setHardness(1.5F).setBlockName("FarmBlockplus").setBlockTextureName(References.MOD_ID + ":FarmBlockplus").setCreativeTab(NugarMod.NugarTab);
          }
      
          public static void register(){
      
              GameRegistry.registerBlock(FarmBlockplus, FarmBlockplus.getUnlocalizedName().substring(5));
      
      
          }
      }
      

      l autre classe:

      package com.nugarium.nugarMod.utils;
      
      import cpw.mods.fml.relauncher.Side;
      import cpw.mods.fml.relauncher.SideOnly;
      import net.minecraft.block.Block;
      import net.minecraft.block.material.Material;
      import net.minecraft.client.renderer.texture.IIconRegister;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.init.Blocks;
      import net.minecraft.item.Item;
      import net.minecraft.util.AxisAlignedBB;
      import net.minecraft.util.IIcon;
      import net.minecraft.world.World;
      import net.minecraftforge.common.IPlantable;
      import net.minecraftforge.common.util.ForgeDirection;
      
      import java.util.Random;
      
      import static com.nugarium.nugarMod.block.farmblock.FarmBlockplus.FarmBlockplus;
      
      public class farmlandplus extends Block
      {
          @SideOnly(Side.CLIENT)
          private IIcon field_149824_a;
          @SideOnly(Side.CLIENT)
          private IIcon field_149823_b;
          private static final String __OBFID = "CL_00000241";
      
          public farmlandplus()
          {
              super(Material.ground);
              this.setTickRandomly(true);
              this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
              this.setLightOpacity(255);
          }
      
          /**
           * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
           * cleared to be reused)
           */
          public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
          {
              return AxisAlignedBB.getBoundingBox((double)(p_149668_2_ + 0), (double)(p_149668_3_ + 0), (double)(p_149668_4_ + 0), (double)(p_149668_2_ + 1), (double)(p_149668_3_ + 1), (double)(p_149668_4_ + 1));
          }
      
          /**
           * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
           * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
           */
          public boolean isOpaqueCube()
          {
              return false;
          }
      
          /**
           * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
           */
          public boolean renderAsNormalBlock()
          {
              return false;
          }
      
          /**
           * Gets the block's texture. Args: side, meta
           */
          @SideOnly(Side.CLIENT)
          public IIcon getIcon(int p_149691_1_, int p_149691_2_)
          {
              return p_149691_1_ == 1 ? (p_149691_2_ > 0 ? this.field_149824_a : this.field_149823_b) : Blocks.dirt.getBlockTextureFromSide(p_149691_1_);
          }
      
          /**
           * Ticks the block if it's been scheduled
           */
          public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
          {
              if (!this.func_149821_m(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_) && !p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_ + 1, p_149674_4_))
              {
                  int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
      
                  if (l > 0)
                  {
                      p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l - 1, 2);
                  }
                  else if (!this.func_149822_e(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
                  {
                      p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
                  }
              }
              else
              {
                  p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 7, 2);
              }
          }
      
          /**
           * Block's chance to react to an entity falling on it.
           */
          public void onFallenUpon(World p_149746_1_, int p_149746_2_, int p_149746_3_, int p_149746_4_, Entity p_149746_5_, float p_149746_6_)
          {
              if (!p_149746_1_.isRemote && p_149746_1_.rand.nextFloat() < p_149746_6_ - 0.5F)
              {
                  if (!(p_149746_5_ instanceof EntityPlayer) && !p_149746_1_.getGameRules().getGameRuleBooleanValue("mobGriefing"))
                  {
                      return;
                  }
      
                  p_149746_1_.setBlock(p_149746_2_, p_149746_3_, p_149746_4_, FarmBlockplus);
              }
          }
      
          private boolean func_149822_e(World p_149822_1_, int p_149822_2_, int p_149822_3_, int p_149822_4_)
          {
              byte b0 = 0;
      
              for (int l = p_149822_2_ - b0; l <= p_149822_2_ + b0; ++l)
              {
                  for (int i1 = p_149822_4_ - b0; i1 <= p_149822_4_ + b0; ++i1)
                  {
                      Block block = p_149822_1_.getBlock(l, p_149822_3_ + 1, i1);
      
                      if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block))
                      {
                          return true;
                      }
                  }
              }
      
              return false;
          }
      
          private boolean func_149821_m(World p_149821_1_, int p_149821_2_, int p_149821_3_, int p_149821_4_)
          {
              for (int l = p_149821_2_ - 4; l <= p_149821_2_ + 4; ++l)
              {
                  for (int i1 = p_149821_3_; i1 <= p_149821_3_ + 1; ++i1)
                  {
                      for (int j1 = p_149821_4_ - 4; j1 <= p_149821_4_ + 4; ++j1)
                      {
                          if (p_149821_1_.getBlock(l, i1, j1).getMaterial() == Material.water)
                          {
                              return false;
                          }
                      }
                  }
              }
      
              return false;
          }
      
          /**
           * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
           * their own) Args: x, y, z, neighbor Block
           */
          public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
          {
              super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_);
              Material material = p_149695_1_.getBlock(p_149695_2_, p_149695_3_ + 1, p_149695_4_).getMaterial();
      
              if (material.isSolid())
              {
                  p_149695_1_.setBlock(p_149695_2_, p_149695_3_, p_149695_4_, Blocks.dirt);
              }
          }
      
          public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
          {
              return Blocks.dirt.getItemDropped(0, p_149650_2_, p_149650_3_);
          }
      
          /**
           * Gets an item for the block being called on. Args: world, x, y, z
           */
          @SideOnly(Side.CLIENT)
          public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
          {
              return Item.getItemFromBlock(FarmBlockplus);
          }
      
          @SideOnly(Side.CLIENT)
          public void registerBlockIcons(IIconRegister p_149651_1_)
          {
              this.field_149824_a = p_149651_1_.registerIcon(this.getTextureName() + "_wet");
              this.field_149823_b = p_149651_1_.registerIcon(this.getTextureName() + "_dry");
          }
      }
      
      1 réponse Dernière réponse Répondre Citer 0
      • HeavenH Hors-ligne
        Heaven
        dernière édition par

        c bon j ai trouver ! je vous passe mon code mais il n a pas besoin d eau quand on saute dessus ca fait rien et ca pousse plus vite:

        package com.nugarium.nugarMod.utils;
        
        import com.nugarium.nugarMod.References;
        import net.minecraft.block.Block;
        import net.minecraft.block.material.Material;
        import net.minecraft.client.renderer.texture.IIconRegister;
        import net.minecraft.init.Blocks;
        import net.minecraft.item.Item;
        import net.minecraft.item.ItemStack;
        import net.minecraft.util.AxisAlignedBB;
        import net.minecraft.util.EnumFacing;
        import net.minecraft.util.IIcon;
        import net.minecraft.util.MovingObjectPosition;
        import net.minecraft.world.IBlockAccess;
        import net.minecraft.world.World;
        import net.minecraftforge.common.EnumPlantType;
        import net.minecraftforge.common.IPlantable;
        import net.minecraftforge.common.util.ForgeDirection;
        
        
        import java.util.Random;
        
        public class BlockFertilizedDirt extends Block{
        
        
            boolean tilled;
            private IIcon top, bottom, back, front, right, left;
        
            public BlockFertilizedDirt(boolean tilled)
            {
        
                super (Material.ground);
        
                this.tilled = tilled;
                this.setTickRandomly(true);
                this.setHardness(0.6F);
                this.setStepSound(soundTypeGravel);
        
                if (tilled)
                {
                    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
                    this.setLightOpacity(255);
                    this.setCreativeTab(null);
                    this.useNeighborBrightness = true;
                }
            }
        
        
        
            @Override
            public String getUnlocalizedName()
            {
                return "tile.fertilizedDirt";
            }
        
        
        
            @Override
            public boolean isOpaqueCube()
            {
                return !tilled;
            }
        
        
        
            public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
                plantable.getPlant(world, x, y + 1, z);
                EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z);
                switch(plantType) {
                    case Desert:
                        return !this.tilled;
                    case Nether:
                        return false;
                    case Crop:
                        return this.tilled;
                    case Cave:
                        return !this.tilled;
                    case Plains:
                        return !this.tilled;
                    case Water:
                        return true;
                    case Beach:
                        return !this.tilled;
                    default:
                        return false;
                }
            }
        
            public void registerBlockIcons(IIconRegister iiconRegister) {
                this.blockIcon = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine");
                this.top = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_1");
                this.bottom = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_4");
                this.back = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_3");
                this.front = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_2");
                this.right = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_3");
                this.left = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_2");
            }
        
            public IIcon getIcon(int side, int metadata) {
                if (side == 0) {
                    return this.bottom;
                } else if (side == 1) {
                    return this.top;
                } else if (side == 2) {
                    return this.front;
                } else if (side == 3) {
                    return this.back;
                } else if (side == 4) {
                    return this.left;
                } else if (side == 5) {
                    return this.right;
                }
                return this.blockIcon;
            }
        
            @Override
            public void updateTick(World world, int x, int y, int z, Random rand)
            {
                if (!world.isRemote)
                {
                    Block toBoost = world.getBlock(x,y-1,z);
                    if (toBoost != null && toBoost != Blocks.air && toBoost instanceof IPlantable)
                    {
                        world.playAuxSFX(2005,x,y+1,z, 0);
                    }
                    for (int i = 0; i < 5; i++)
                    {
                        toBoost = world.getBlock(x,y+1,z);
                        if (toBoost != null && toBoost != Blocks.air && toBoost instanceof IPlantable)
                        {
                            toBoost.updateTick(world, x,y+1,z, rand);
                        }
                    }
                }
            }
        
        }
        
        1 réponse Dernière réponse Répondre Citer 0
        • K Hors-ligne
          Klayzz
          dernière édition par

          Ce message a été supprimé !
          1 réponse Dernière réponse Répondre Citer 0
          • HeavenH Hors-ligne
            Heaven
            dernière édition par

            c bon j ai trouver ! je vous passe mon code mais il n a pas besoin d eau quand on saute dessus ca fait rien et ca pousse plus vite:

            package com.nugarium.nugarMod.utils;
            
            import com.nugarium.nugarMod.References;
            import net.minecraft.block.Block;
            import net.minecraft.block.material.Material;
            import net.minecraft.client.renderer.texture.IIconRegister;
            import net.minecraft.init.Blocks;
            import net.minecraft.item.Item;
            import net.minecraft.item.ItemStack;
            import net.minecraft.util.AxisAlignedBB;
            import net.minecraft.util.EnumFacing;
            import net.minecraft.util.IIcon;
            import net.minecraft.util.MovingObjectPosition;
            import net.minecraft.world.IBlockAccess;
            import net.minecraft.world.World;
            import net.minecraftforge.common.EnumPlantType;
            import net.minecraftforge.common.IPlantable;
            import net.minecraftforge.common.util.ForgeDirection;
            
            
            import java.util.Random;
            
            public class BlockFertilizedDirt extends Block{
            
            
                boolean tilled;
                private IIcon top, bottom, back, front, right, left;
            
                public BlockFertilizedDirt(boolean tilled)
                {
            
                    super (Material.ground);
            
                    this.tilled = tilled;
                    this.setTickRandomly(true);
                    this.setHardness(0.6F);
                    this.setStepSound(soundTypeGravel);
            
                    if (tilled)
                    {
                        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
                        this.setLightOpacity(255);
                        this.setCreativeTab(null);
                        this.useNeighborBrightness = true;
                    }
                }
            
            
            
                @Override
                public String getUnlocalizedName()
                {
                    return "tile.fertilizedDirt";
                }
            
            
            
                @Override
                public boolean isOpaqueCube()
                {
                    return !tilled;
                }
            
            
            
                public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
                    plantable.getPlant(world, x, y + 1, z);
                    EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z);
                    switch(plantType) {
                        case Desert:
                            return !this.tilled;
                        case Nether:
                            return false;
                        case Crop:
                            return this.tilled;
                        case Cave:
                            return !this.tilled;
                        case Plains:
                            return !this.tilled;
                        case Water:
                            return true;
                        case Beach:
                            return !this.tilled;
                        default:
                            return false;
                    }
                }
            
                public void registerBlockIcons(IIconRegister iiconRegister) {
                    this.blockIcon = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine");
                    this.top = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_1");
                    this.bottom = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_4");
                    this.back = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_3");
                    this.front = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_2");
                    this.right = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_3");
                    this.left = iiconRegister.registerIcon(References.MOD_ID + ":fertilized_machine_2");
                }
            
                public IIcon getIcon(int side, int metadata) {
                    if (side == 0) {
                        return this.bottom;
                    } else if (side == 1) {
                        return this.top;
                    } else if (side == 2) {
                        return this.front;
                    } else if (side == 3) {
                        return this.back;
                    } else if (side == 4) {
                        return this.left;
                    } else if (side == 5) {
                        return this.right;
                    }
                    return this.blockIcon;
                }
            
                @Override
                public void updateTick(World world, int x, int y, int z, Random rand)
                {
                    if (!world.isRemote)
                    {
                        Block toBoost = world.getBlock(x,y-1,z);
                        if (toBoost != null && toBoost != Blocks.air && toBoost instanceof IPlantable)
                        {
                            world.playAuxSFX(2005,x,y+1,z, 0);
                        }
                        for (int i = 0; i < 5; i++)
                        {
                            toBoost = world.getBlock(x,y+1,z);
                            if (toBoost != null && toBoost != Blocks.air && toBoost instanceof IPlantable)
                            {
                                toBoost.updateTick(world, x,y+1,z, rand);
                            }
                        }
                    }
                }
            
            }
            
            1 réponse Dernière réponse Répondre Citer 0
            • I Hors-ligne
              iZcoKs
              dernière édition par

              Salut
              quand je pose 2 graine perso a coter sur ta fertilized dirt 1 se casse comment faire stp

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

              MINECRAFT FORGE FRANCE © 2024

              Powered by NodeBB