MFF

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

    Porte

    Planifier Épinglé Verrouillé Déplacé Sans suite
    1.7.10
    9 Messages 7 Publieurs 1.9k 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.
    • I Hors-ligne
      impuuu
      dernière édition par

      Bonjour je voudrait cree plusieur porte pour mon serveur roleplay est j ai deja mit du code je veut que les porte soit parrielle que les porte en fer mais avec mes texture , le nom que je veut

      block porte:

      extends Block
      {
          @SideOnly(Side.CLIENT)
          private IIcon[] field_150017_a;
          @SideOnly(Side.CLIENT)
          private IIcon[] field_150016_b;
          private static final String __OBFID = "CL_00000230";
      
          protected BlockDoor(Material p_i45402_1_)
          {
              super(p_i45402_1_);
              float f = 0.5F;
              float f1 = 1.0F;
              this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
          }
      
          /**
           * Gets the block's texture. Args: side, meta
           */
          @SideOnly(Side.CLIENT)
          public IIcon getIcon(int p_149691_1_, int p_149691_2_)
          {
              return this.field_150016_b[0];
          }
      
          @SideOnly(Side.CLIENT)
          public IIcon getIcon(IBlockAccess p_149673_1_, int p_149673_2_, int p_149673_3_, int p_149673_4_, int p_149673_5_)
          {
              if (p_149673_5_ != 1 && p_149673_5_ != 0)
              {
                  int i1 = this.func_150012_g(p_149673_1_, p_149673_2_, p_149673_3_, p_149673_4_);
                  int j1 = i1 & 3;
                  boolean flag = (i1 & 4) != 0;
                  boolean flag1 = false;
                  boolean flag2 = (i1 & 8) != 0;
      
                  if (flag)
                  {
                      if (j1 == 0 && p_149673_5_ == 2)
                      {
                          flag1 = !flag1;
                      }
                      else if (j1 == 1 && p_149673_5_ == 5)
                      {
                          flag1 = !flag1;
                      }
                      else if (j1 == 2 && p_149673_5_ == 3)
                      {
                          flag1 = !flag1;
                      }
                      else if (j1 == 3 && p_149673_5_ == 4)
                      {
                          flag1 = !flag1;
                      }
                  }
                  else
                  {
                      if (j1 == 0 && p_149673_5_ == 5)
                      {
                          flag1 = !flag1;
                      }
                      else if (j1 == 1 && p_149673_5_ == 3)
                      {
                          flag1 = !flag1;
                      }
                      else if (j1 == 2 && p_149673_5_ == 4)
                      {
                          flag1 = !flag1;
                      }
                      else if (j1 == 3 && p_149673_5_ == 2)
                      {
                          flag1 = !flag1;
                      }
      
                      if ((i1 & 16) != 0)
                      {
                          flag1 = !flag1;
                      }
                  }
      
                  return flag2 ? this.field_150017_a[flag1?1:0] : this.field_150016_b[flag1?1:0];
              }
              else
              {
                  return this.field_150016_b[0];
              }
          }
      
          @SideOnly(Side.CLIENT)
          public void registerBlockIcons(IIconRegister p_149651_1_)
          {
              this.field_150017_a = new IIcon[2];
              this.field_150016_b = new IIcon[2];
              this.field_150017_a[0] = p_149651_1_.registerIcon(this.getTextureName() + "_upper");
              this.field_150016_b[0] = p_149651_1_.registerIcon(this.getTextureName() + "_lower");
              this.field_150017_a[1] = new IconFlipped(this.field_150017_a[0], true, false);
              this.field_150016_b[1] = new IconFlipped(this.field_150016_b[0], true, false);
          }
      
          /**
           * 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;
          }
      
          public boolean getBlocksMovement(IBlockAccess p_149655_1_, int p_149655_2_, int p_149655_3_, int p_149655_4_)
          {
              int l = this.func_150012_g(p_149655_1_, p_149655_2_, p_149655_3_, p_149655_4_);
              return (l & 4) != 0;
          }
      
          /**
           * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
           */
          public boolean renderAsNormalBlock()
          {
              return false;
          }
      
          /**
           * The type of render function that is called for this block
           */
          public int getRenderType()
          {
              return 7;
          }
      
          /**
           * Returns the bounding box of the wired rectangular prism to render.
           */
          @SideOnly(Side.CLIENT)
          public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
          {
              this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
              return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
          }
      
          /**
           * 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_)
          {
              this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
              return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
          }
      
          /**
           * Updates the blocks bounds based on its current state. Args: world, x, y, z
           */
          public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
          {
              this.func_150011_b(this.func_150012_g(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_));
          }
      
          public int func_150013_e(IBlockAccess p_150013_1_, int p_150013_2_, int p_150013_3_, int p_150013_4_)
          {
              return this.func_150012_g(p_150013_1_, p_150013_2_, p_150013_3_, p_150013_4_) & 3;
          }
      
          public boolean func_150015_f(IBlockAccess p_150015_1_, int p_150015_2_, int p_150015_3_, int p_150015_4_)
          {
              return (this.func_150012_g(p_150015_1_, p_150015_2_, p_150015_3_, p_150015_4_) & 4) != 0;
          }
      
          private void func_150011_b(int p_150011_1_)
          {
              float f = 0.1875F;
              this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
              int j = p_150011_1_ & 3;
              boolean flag = (p_150011_1_ & 4) != 0;
              boolean flag1 = (p_150011_1_ & 16) != 0;
      
              if (j == 0)
              {
                  if (flag)
                  {
                      if (!flag1)
                      {
                          this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
                      }
                      else
                      {
                          this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
                      }
                  }
                  else
                  {
                      this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
                  }
              }
              else if (j == 1)
              {
                  if (flag)
                  {
                      if (!flag1)
                      {
                          this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                      }
                      else
                      {
                          this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
                      }
                  }
                  else
                  {
                      this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
                  }
              }
              else if (j == 2)
              {
                  if (flag)
                  {
                      if (!flag1)
                      {
                          this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
                      }
                      else
                      {
                          this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
                      }
                  }
                  else
                  {
                      this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                  }
              }
              else if (j == 3)
              {
                  if (flag)
                  {
                      if (!flag1)
                      {
                          this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
                      }
                      else
                      {
                          this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                      }
                  }
                  else
                  {
                      this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
                  }
              }
          }
      
          /**
           * Called when a player hits the block. Args: world, x, y, z, player
           */
          public void onBlockClicked(World p_149699_1_, int p_149699_2_, int p_149699_3_, int p_149699_4_, EntityPlayer p_149699_5_) {}
      
          /**
           * Called upon block activation (right click on the block.)
           */
          public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
          {
              if (this.blockMaterial == Material.iron)
              {
                  return false; //Allow items to interact with the door
              }
              else
              {
                  int i1 = this.func_150012_g(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);
                  int j1 = i1 & 7;
                  j1 ^= 4;
      
                  if ((i1 & 8) == 0)
                  {
                      p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_, p_149727_4_, j1, 2);
                      p_149727_1_.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_);
                  }
                  else
                  {
                      p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_ - 1, p_149727_4_, j1, 2);
                      p_149727_1_.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_ - 1, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_);
                  }
      
                  p_149727_1_.playAuxSFXAtEntity(p_149727_5_, 1003, p_149727_2_, p_149727_3_, p_149727_4_, 0);
                  return true;
              }
          }
      
          public void func_150014_a(World p_150014_1_, int p_150014_2_, int p_150014_3_, int p_150014_4_, boolean p_150014_5_)
          {
              int l = this.func_150012_g(p_150014_1_, p_150014_2_, p_150014_3_, p_150014_4_);
              boolean flag1 = (l & 4) != 0;
      
              if (flag1 != p_150014_5_)
              {
                  int i1 = l & 7;
                  i1 ^= 4;
      
                  if ((l & 8) == 0)
                  {
                      p_150014_1_.setBlockMetadataWithNotify(p_150014_2_, p_150014_3_, p_150014_4_, i1, 2);
                      p_150014_1_.markBlockRangeForRenderUpdate(p_150014_2_, p_150014_3_, p_150014_4_, p_150014_2_, p_150014_3_, p_150014_4_);
                  }
                  else
                  {
                      p_150014_1_.setBlockMetadataWithNotify(p_150014_2_, p_150014_3_ - 1, p_150014_4_, i1, 2);
                      p_150014_1_.markBlockRangeForRenderUpdate(p_150014_2_, p_150014_3_ - 1, p_150014_4_, p_150014_2_, p_150014_3_, p_150014_4_);
                  }
      
                  p_150014_1_.playAuxSFXAtEntity((EntityPlayer)null, 1003, p_150014_2_, p_150014_3_, p_150014_4_, 0);
              }
          }
      
          /**
           * 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_)
          {
              int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_);
      
              if ((l & 8) == 0)
              {
                  boolean flag = false;
      
                  if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ + 1, p_149695_4_) != this)
                  {
                      p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
                      flag = true;
                  }
      
                  if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_))
                  {
                      p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
                      flag = true;
      
                      if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ + 1, p_149695_4_) == this)
                      {
                          p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_ + 1, p_149695_4_);
                      }
                  }
      
                  if (flag)
                  {
                      if (!p_149695_1_.isRemote)
                      {
                          this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0);
                      }
                  }
                  else
                  {
                      boolean flag1 = p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_) || p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_ + 1, p_149695_4_);
      
                      if ((flag1 || p_149695_5_.canProvidePower()) && p_149695_5_ != this)
                      {
                          this.func_150014_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, flag1);
                      }
                  }
              }
              else
              {
                  if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ - 1, p_149695_4_) != this)
                  {
                      p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
                  }
      
                  if (p_149695_5_ != this)
                  {
                      this.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_, p_149695_5_);
                  }
              }
          }
      
          public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
          {
              return (p_149650_1_ & 8) != 0 ? null : (this.blockMaterial == Material.iron ? Items.iron_door : Items.wooden_door);
          }
      
          /**
           * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
           * x, y, z, startVec, endVec
           */
          public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, Vec3 p_149731_5_, Vec3 p_149731_6_)
          {
              this.setBlockBoundsBasedOnState(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_);
              return super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_);
          }
      
          /**
           * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
           */
          public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
          {
              return p_149742_3_ >= p_149742_1_.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_);
          }
      
          /**
           * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility
           * and stop pistons
           */
          public int getMobilityFlag()
          {
              return 1;
          }
      
          public int func_150012_g(IBlockAccess p_150012_1_, int p_150012_2_, int p_150012_3_, int p_150012_4_)
          {
              int l = p_150012_1_.getBlockMetadata(p_150012_2_, p_150012_3_, p_150012_4_);
              boolean flag = (l & 8) != 0;
              int i1;
              int j1;
      
              if (flag)
              {
                  i1 = p_150012_1_.getBlockMetadata(p_150012_2_, p_150012_3_ - 1, p_150012_4_);
                  j1 = l;
              }
              else
              {
                  i1 = l;
                  j1 = p_150012_1_.getBlockMetadata(p_150012_2_, p_150012_3_ + 1, p_150012_4_);
              }
      
              boolean flag1 = (j1 & 1) != 0;
              return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0);
          }
      
          /**
           * 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 this.blockMaterial == Material.iron ? Items.iron_door : Items.wooden_door;
          }
      
          /**
           * Called when the block is attempted to be harvested
           */
          public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_)
          {
              if (p_149681_6_.capabilities.isCreativeMode && (p_149681_5_ & 8) != 0 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this)
              {
                  p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_);
              }
          }
      }
      

      item porte:

      package fr.impuuu.havenrp.common;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.material.Material;
      import net.minecraft.creativetab.CreativeTabs;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.init.Blocks;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemStack;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.World;
      
      public class ItemPorte extends Item
      {
          private Material doorMaterial;
          private static final String __OBFID = "CL_00000020";
      
          public ItemPorte(Material p_i45334_1_)
          {
              this.doorMaterial = p_i45334_1_;
              this.maxStackSize = 1;
              this.setCreativeTab(CreativeTabs.tabRedstone);
          }
      
          /**
           * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
           * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
           */
          public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
          {
              if (p_77648_7_ != 1)
              {
                  return false;
              }
              else
              {
                  ++p_77648_5_;
                  Block block;
      
                  if (this.doorMaterial == Material.wood)
                  {
                      block = Blocks.wooden_door;
                  }
                  else
                  {
                      block = Blocks.iron_door;
                  }
      
                  if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_))
                  {
                      if (!block.canPlaceBlockAt(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_))
                      {
                          return false;
                      }
                      else
                      {
                          int i1 = MathHelper.floor_double((double)((p_77648_2_.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
                          placeDoorBlock(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1, block);
                          –p_77648_1_.stackSize;
                          return true;
                      }
                  }
                  else
                  {
                      return false;
                  }
              }
          }
      
          public static void placeDoorBlock(World p_150924_0_, int p_150924_1_, int p_150924_2_, int p_150924_3_, int p_150924_4_, Block p_150924_5_)
          {
              byte b0 = 0;
              byte b1 = 0;
      
              if (p_150924_4_ == 0)
              {
                  b1 = 1;
              }
      
              if (p_150924_4_ == 1)
              {
                  b0 = -1;
              }
      
              if (p_150924_4_ == 2)
              {
                  b1 = -1;
              }
      
              if (p_150924_4_ == 3)
              {
                  b0 = 1;
              }
      
              int i1 = (p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_, p_150924_3_ - b1).isNormalCube() ? 1 : 0) + (p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_ + 1, p_150924_3_ - b1).isNormalCube() ? 1 : 0);
              int j1 = (p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_, p_150924_3_ + b1).isNormalCube() ? 1 : 0) + (p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_ + 1, p_150924_3_ + b1).isNormalCube() ? 1 : 0);
              boolean flag = p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_, p_150924_3_ - b1) == p_150924_5_ || p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_ + 1, p_150924_3_ - b1) == p_150924_5_;
              boolean flag1 = p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_, p_150924_3_ + b1) == p_150924_5_ || p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_ + 1, p_150924_3_ + b1) == p_150924_5_;
              boolean flag2 = false;
      
              if (flag && !flag1)
              {
                  flag2 = true;
              }
              else if (j1 > i1)
              {
                  flag2 = true;
              }
      
              p_150924_0_.setBlock(p_150924_1_, p_150924_2_, p_150924_3_, p_150924_5_, p_150924_4_, 2);
              p_150924_0_.setBlock(p_150924_1_, p_150924_2_ + 1, p_150924_3_, p_150924_5_, 8 | (flag2 ? 1 : 0), 2);
              p_150924_0_.notifyBlocksOfNeighborChange(p_150924_1_, p_150924_2_, p_150924_3_, p_150924_5_);
              p_150924_0_.notifyBlocksOfNeighborChange(p_150924_1_, p_150924_2_ + 1, p_150924_3_, p_150924_5_);
          }
      }
      

      class principal:

      package fr.impuuu.havenrp.common;
      
      import java.io.InputStream;
      import java.nio.ByteBuffer;
      
      import org.lwjgl.opengl.Display;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.material.Material;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.gui.GuiMainMenu;
      import net.minecraft.creativetab.CreativeTabs;
      import net.minecraft.init.Blocks;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemStack;
      import net.minecraft.util.EnumChatFormatting;
      import net.minecraft.util.ResourceLocation;
      import cpw.mods.fml.client.FMLClientHandler;
      import cpw.mods.fml.common.FMLCommonHandler;
      import cpw.mods.fml.common.Mod;
      import cpw.mods.fml.common.Mod.EventHandler;
      import cpw.mods.fml.common.Mod.Instance;
      import cpw.mods.fml.common.SidedProxy;
      import cpw.mods.fml.common.event.FMLInitializationEvent;
      import cpw.mods.fml.common.event.FMLPostInitializationEvent;
      import cpw.mods.fml.common.event.FMLPreInitializationEvent;
      import cpw.mods.fml.common.eventhandler.SubscribeEvent;
      import cpw.mods.fml.common.gameevent.TickEvent;
      import cpw.mods.fml.common.registry.GameRegistry;
      import cpw.mods.fml.relauncher.Side;
      import cpw.mods.fml.relauncher.SideOnly;
      import fr.impuuu.havenrp.proxy.CommonProxy;
      
      @Mod(modid = "havenrp", name = "HavenRP", version ="2.0")
      public class HavenRP
      {
          private static final ResourceLocation icon = new ResourceLocation("havenrp", "textures/icon/icon.png");
          public static final String MODID = "havenrp";
          @Instance(MODID)
          public static HavenRP instance;
      
          @SidedProxy(clientSide = "fr.impuuu.havenrp.proxy.ClientProxy", serverSide = "fr.impuuu.havenrp.proxy.CommonProxy")
          public static CommonProxy proxy;
      
          public static Item item5;
          public static Item item10;
          public static Item item20;
          public static Item item50;
          public static Item item100;
          public static Item item200;
          public static Item item500, drink;
          public static Block porte;
          public static Item porteItem;
      
         /*Block*/
          public static Block BlockPomme, white_clay_stairs, orange_clay_stairs, magenta_clay_stairs, light_blue_clay_stairs, yellow_clay_stairs, lime_clay_stairs
          , pink_clay_stairs, gray_clay_stairs, light_gray_clay_stairs
          , cyan_clay_stairs, purple_clay_stairs, blue_clay_stairs,
          brown_clay_stairs, green_clay_stairs, red_clay_stairs,
          black_clay_stairs, porte_test;
      
          @EventHandler
          public void preInit(FMLPreInitializationEvent event)
          {   
              item5 = new Item5().setUnlocalizedName("5").setTextureName(MODID+":billet_5").setCreativeTab(tabHavenRP);
              item10 = new Item10().setUnlocalizedName("10").setTextureName(MODID+":billet_10").setCreativeTab(tabHavenRP);
              item20 = new Item20().setUnlocalizedName("20").setTextureName(MODID+":billet_20").setCreativeTab(tabHavenRP);
              item50 = new Item50().setUnlocalizedName("50").setTextureName(MODID+":billet_50").setCreativeTab(tabHavenRP);
              item100 = new Item100().setUnlocalizedName("100").setTextureName(MODID+":billet_100").setCreativeTab(tabHavenRP);
              item200 = new Item200().setUnlocalizedName("200").setTextureName(MODID+":billet_200").setCreativeTab(tabHavenRP);
              item500 = new Item500().setUnlocalizedName("500").setTextureName(MODID+":billet_500").setCreativeTab(tabHavenRP);
              porteItem = new ItemPorte(Material.iron).setUnlocalizedName("lol").setTextureName(MODID+":item_porte").setCreativeTab(tabHavenRP);
      
              /*Block*/
              BlockPomme = new BlockPomme(Material.leaves).setBlockName("Blockdepomme").setBlockTextureName(MODID+":PommeBlock").setCreativeTab(CreativeTabs.tabBlock);
              white_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 0).setBlockName("white_clay_stairs").setCreativeTab(tabHavenRP);
              orange_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 1).setBlockName("orange_clay_stairs").setCreativeTab(tabHavenRP);
              magenta_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 2).setBlockName("magenta_clay_stairs").setCreativeTab(tabHavenRP);
              light_blue_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 3).setBlockName("light_blue_clay_stairs").setCreativeTab(tabHavenRP);
              yellow_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 4).setBlockName("yellow_clay_stairs").setCreativeTab(tabHavenRP);
              lime_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 5).setBlockName("lime_clay_stairs").setCreativeTab(tabHavenRP);
              pink_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 6).setBlockName("pink_clay_stairs").setCreativeTab(tabHavenRP);
              gray_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 7).setBlockName("gray_clay_stairs").setCreativeTab(tabHavenRP);
              light_gray_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 8).setBlockName("light_gray_clay_stairs").setCreativeTab(tabHavenRP);
              cyan_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 9).setBlockName("cyan_clay_stairs").setCreativeTab(tabHavenRP);
              purple_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 10).setBlockName("purple_clay_stairs").setCreativeTab(tabHavenRP);
              blue_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 11).setBlockName("blue_clay_stairs").setCreativeTab(tabHavenRP);
              brown_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 12).setBlockName("brown_clay_stairs").setCreativeTab(tabHavenRP);
              green_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 13).setBlockName("green_clay_stairs").setCreativeTab(tabHavenRP);
              red_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 14).setBlockName("red_clay_stairs").setCreativeTab(tabHavenRP);
              black_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 15).setBlockName("black_clay_stairs").setCreativeTab(tabHavenRP);
              porte_test = new porte(Material.anvil).setBlockName("porte_test").setCreativeTab(tabHavenRP);
      
              GameRegistry.registerItem(item5, "5€");
              GameRegistry.registerItem(item10, "10€");
              GameRegistry.registerItem(item20, "20€");
              GameRegistry.registerItem(item50, "50€");
              GameRegistry.registerItem(item100, "100€");
              GameRegistry.registerItem(item200, "200€");
              GameRegistry.registerItem(item500, "500€");
      
              GameRegistry.registerBlock(porte_test, "porte");
              GameRegistry.registerItem(porteItem, "item_porte");
      
              /*Block*/
              GameRegistry.registerBlock(BlockPomme, "Block de Pomme");
              GameRegistry.registerBlock(orange_clay_stairs, "test");
              GameRegistry.registerBlock(magenta_clay_stairs, "test1");
              GameRegistry.registerBlock(light_blue_clay_stairs, "test2");
              GameRegistry.registerBlock(yellow_clay_stairs, "test3");
              GameRegistry.registerBlock(lime_clay_stairs, "test4");
              GameRegistry.registerBlock(cyan_clay_stairs, "test5");
              GameRegistry.registerBlock(blue_clay_stairs, "test6");
      
              Display.setTitle("HavenRP");
          }
      
          @EventHandler
          public void init(FMLInitializationEvent event)
          {  
              FMLCommonHandler.instance().bus().register(this);
              proxy.registerRender();
          }
          @EventHandler
          public void postInit(FMLPostInitializationEvent event)
          { 
          }
          public static CreativeTabs tabHavenRP = new CreativeTabs("HavenRP"){
              @Override
              public Item getTabIconItem(){
                  return new ItemStack(item500).getItem();
              }
          };
          @SubscribeEvent
          @SideOnly(Side.CLIENT)
          public void onTick(TickEvent.ClientTickEvent event)
          {
              Minecraft mc = FMLClientHandler.instance().getClient();
              if(mc.currentScreen != null && mc.currentScreen.getClass().equals(GuiMainMenu.class))
              {
                  mc.displayGuiScreen(new GuiCustomMainMenu());
              }
          }
      }
      
      
      1 réponse Dernière réponse Répondre Citer 0
      • RedRelayR Hors-ligne
        RedRelay Moddeurs confirmés
        dernière édition par

        Pour créer une porte, c’est super simple, tu va à l’établis et tu met 6 planches de bois de sorte a faire un rectangle de 2*3 avec les coté à 2 en haut et en bas et les coté à 3 à droite et à gauche.
        Et voila, tu as une porte ! J’ai mis longtemps a trouver, mais avec la pratique aujourd’hui, j’arrive a faire des stacks de 64 portes.

        De rien

        –------------------------------------------------------------------------------------
        Si tu trouves mon intervention pertinente, n'hésite pas a m…

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

          tu aurait pas du code puisque je comprend pas

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

            Salut,
            Les textures de portes sont découpées en deux parties : la partie haute et la partie basse.
            Il faut donc ajouter deux textures pour chacune de tes portes.
            Dans ta classe principale tu as déclaré :

            porteItem = new ItemPorte(Material.iron).setUnlocalizedName("lol").setTextureName(MODID+":item_porte").setCreativeTab(tabHavenRP);
            

            Et dans la classe du block tu as :

            this.field_150017_a[0] = p_149651_1_.registerIcon(this.getTextureName() + "_upper");
            this.field_150016_b[0] = p_149651_1_.registerIcon(this.getTextureName() + "_lower");
            

            Tu devras donc avoir dans tes dossiers textures une texture item_porte_upper et item_porte_lower.

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

              oui mais le item porte place une porte en fer

              clien proxy:

              package fr.impuuu.havenrp.proxy;
              
              import java.awt.Desktop;
              import java.io.IOException;
              import java.net.URI;
              
              import cpw.mods.fml.client.FMLClientHandler;
              import cpw.mods.fml.common.ObfuscationReflectionHelper;
              import cpw.mods.fml.common.eventhandler.SubscribeEvent;
              import cpw.mods.fml.relauncher.SideOnly;
              import net.minecraft.client.gui.FontRenderer;
              import net.minecraft.client.gui.GuiButton;
              import net.minecraft.client.gui.GuiIngameMenu;
              import net.minecraft.client.gui.GuiMainMenu;
              import net.minecraft.client.multiplayer.GuiConnecting;
              import net.minecraft.client.resources.I18n;
              import net.minecraft.util.EnumChatFormatting;
              import net.minecraft.util.ResourceLocation;
              import net.minecraftforge.client.event.RenderGameOverlayEvent;
              import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
              import net.minecraftforge.common.MinecraftForge;
              
              public class ClientProxy extends CommonProxy
              {
                  public ClientProxy(){
                      MinecraftForge.EVENT_BUS.register(this);
                  }
                  @SubscribeEvent
                  public void onInitGuiEvent(InitGuiEvent.Post event) {
                      if (event.gui instanceof GuiMainMenu) { // On regarde si le gui est bien le menu principal
                          for (Object b : event.buttonList) { // On parcourt la liste des boutons
                              if (((GuiButton) b).id == 14) { // Si c'est le bouton "Minecraft Realms" (qui a l'ID 14)
                                  ((GuiButton) b).visible = false; // On ne l'affiche plus
                              }
                              if(((GuiButton) b).id == 6){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 1){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 0){
                                  ((GuiButton) b).visible = false ;
                              }
                              if(((GuiButton) b).id == 2){
                                  ((GuiButton) b).visible = false ;
                              }
                              if(((GuiButton) b).id == 5){
                                  ((GuiButton) b).visible = false ;
                              }
                              if(((GuiButton) b).id == 4){
                                  ((GuiButton) b).visible = false ;
                              }
                          }
                          int i = event.gui.height / 4 + 48; // On définit une variable pour simplifier le code (elle est utilisée par Minecraft)
                          event.buttonList.add(new GuiButton(30, event.gui.width / 2 - 100, i + 24 * 2, 200, 20, EnumChatFormatting.GRAY+"Teamspeak") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique
                                  if (Desktop.isDesktopSupported()) { // Si on peut utiliser des URIs
                                      try {
                                          Desktop.getDesktop().browse(new URI("ts3server://212.83.151.173?port=10614")); // On essaye de lancer TeamSpeak
                                      } catch (Exception e) {
                                          e.printStackTrace();
                                          }
                                      }
              
                              }
                          });
                          event.buttonList.add(new GuiButton(31, event.gui.width / 2 - 100, i + 72, 200, 20, EnumChatFormatting.BLUE+"Site") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique
                                  if (Desktop.isDesktopSupported()) { // Si on peut utiliser des URIs
                                      try {
                                          Desktop.getDesktop().browse(new URI("http://havenrp-v2.livehost.fr/")); // On essaye de lancer TeamSpeak
                                      } catch (Exception e) {
                                          e.printStackTrace();
                                          }
                                      }
              
                              }
                          });
              
                          event.buttonList.add(new GuiButton(0, event.gui.width / 2 - 100, i + 0 * 2, 200, 20, EnumChatFormatting.DARK_AQUA+"Options") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique                    
                              }
                          });
                          event.buttonList.add(new GuiButton(31, event.gui.width / 2 - 100, i + 12 * 2, 200, 20, EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11"+EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"HavenRP"+EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique
                                  FMLClientHandler.instance().connectToServerAtStartup("MineLifeRP.crystal-serv.com", 25790);
              
                              }
                          });
                          ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu) event.gui, EnumChatFormatting.GOLD+"HavenRP :)", "splashText", "field_73975_c");
                  }
              
                  }
                  @SubscribeEvent
                  public void InitGuiEvent(InitGuiEvent.Post e) {
                      if(e.gui instanceof GuiIngameMenu){
                          for(Object b : e.buttonList){
                              if(((GuiButton) b).id == 1){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 12){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 7){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 5){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 6){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 4){
                                  ((GuiButton) b).visible = false;
                              }
                              if(((GuiButton) b).id == 0){
                                  ((GuiButton) b).visible = false;
                              }
                              }
                          byte b0 = -16;
                          e.buttonList.add(new GuiButton(4, e.gui.width / 2 - 100, e.gui.height / 4 + 24 + b0, 200, 20, EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11"+EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"Retour au jeu"+EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11") {
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique                    
                              }
                          });
                          e.buttonList.add(new GuiButton(0, e.gui.width / 2 - 100, e.gui.height / 4 + 48 + b0, 200, 20, EnumChatFormatting.DARK_AQUA+"Options") {
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique                    
                              }
                          });
                          e.buttonList.add(new GuiButton(40, e.gui.width / 2 - 100, e.gui.height / 4 + 72 + b0, 200, 20, EnumChatFormatting.GRAY+"Teamspeak 3"){
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique
                                  if (Desktop.isDesktopSupported()) {
              
                                      try {
                                          Desktop.getDesktop().browse(new URI("ts3server://212.83.151.173?port=10614")); // On essaye de lancer TeamSpeak
                                      } catch (Exception e) {
                                          e.printStackTrace();
              
                                  }
              
                                  }
              
                                  }
              
                          });
                          e.buttonList.add(new GuiButton(41, e.gui.width / 2 - 100, e.gui.height / 4 + 96 + b0, 200, 20, EnumChatFormatting.BLUE+"Site"){
                              @Override
                              public void mouseReleased(int x, int y) { // Lorsque l'on clique
                                  if (Desktop.isDesktopSupported()) {
              
                                      try {
                                          Desktop.getDesktop().browse(new URI("http://havenrp-v2.livehost.fr/")); // On essaye de lancer TeamSpeak
                                      } catch (Exception e) {
                                          e.printStackTrace();
              
                                  }
              
                                  }
              
                                  }
                          });
              
                          }
                  }
              
              }
              
              
              1 réponse Dernière réponse Répondre Citer 0
              • AymericRedA Hors-ligne
                AymericRed
                dernière édition par

                Non ce n’est même pas deux textures, c’est deux blocs.

                Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk

                Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                  j ai prit mon block de pomme pour test qui dans ma classe principal

                  regarde le code il sa bloque ici

                              if (this.doorMaterial == Material.iron)
                              {
                                 block = HavenRP.BlockPomme;
                              }
                  
                  1 réponse Dernière réponse Répondre Citer 0
                  • FolganskyF Hors-ligne
                    Folgansky Correcteurs
                    dernière édition par

                    Au lieu de faire ```java

                    1. if(((GuiButton) b).id == 1){
                    2. ((GuiButton) b).visible = false;
                    3. }
                    4. if(((GuiButton) b).id == 12){
                    5. ((GuiButton) b).visible = false;
                    6. }
                    7. if(((GuiButton) b).id == 7){
                    8. ((GuiButton) b).visible = false;
                    9. }
                    10. if(((GuiButton) b).id == 5){
                    11. ((GuiButton) b).visible = false;
                    12. }
                    13. if(((GuiButton) b).id == 6){
                    14. ((GuiButton) b).visible = false;
                    15. }
                    16. if(((GuiButton) b).id == 4){
                    17. ((GuiButton) b).visible = false;
                    18. }
                    19. if(((GuiButton) b).id == 0){
                    20. ((GuiButton) b).visible = false;
                    21. }
                    
                    Tu peux utiliser le || qui est traduit par "ou"
                    
                    Donc ta condition donnerait:
                    ```java
                    if(((GuiButton) b).id == 1 || ((GuiButton) b).id == 12 || ((GuiButton) b).id == 7 || /*ETC tu continues*/)
                    {
                               ((GuiButton) b).visible = false;
                    }
                    

                    C’est pas vraiment le sujet mais ça devrait quand même t’aider

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

                      Et puis pour gagner encore plus de place tu peux créer directement au-dessus de ta condition, une variable GuiButton button = (GuiButton)b; pour éviter de toujours faire le cast dans la condition. Ou tu peux même faire l’équivalent avec une variable integer : int idButton = ((GuiButton)b).id;
                      Pour finir, lorsque tu as juste une seule ligne en-dessous d’une condition, tu peux virer les accolades …

                      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