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

    Résolu Orientation

    1.9.x et 1.10.x
    1.9.4
    2
    3
    1000
    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.
    • Tituya
      Tituya dernière édition par

      Je suis en train de me casser la tête depuis 1heure….
      J’ai crée mon bloc transformateur (clique droit etc) et je l’ai rendu activable seulement quand il a un courant de redstone, ça c’est simple !
      le seul problème c’est que mon bloc à une animation de fonctionnement, j’ai donc dit au code que quand le bloc n’est pas alimenté, il se transforme en bloc non alimenter (ayant une autre texture) Et c’est la le problème !
      Mes bloc orientable ce remet dans leur position initial vers le nord à chaque changement d’état de bloc: je m’explique, je pose mon bloc direction sud, je l’active il se redirige directement vers le nord !
      Il faudrait dire que quand mon bloc est remplacé, il se redirige directement vers le joueur !
      Et ce n’est pas le seul problème ! Quand mon bloc éteint est vers le nord, si je place un bloc activateur (redstone) devant lui, il se retourne sur lui même, passe en bloc activé ! Je pense que je ne me fait pas bien comprendre mais bon je tente.
      Voila mes classes :

      Block actif

      package com.tuto.mod.blocks;
      
      import java.util.Random;
      
      import javax.annotation.Nullable;
      
      import com.tuto.mod.init.BlocksMod;
      import com.tuto.mod.init.ItemsMod;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.BlockHorizontal;
      import net.minecraft.block.material.Material;
      import net.minecraft.block.properties.IProperty;
      import net.minecraft.block.properties.PropertyDirection;
      import net.minecraft.block.state.BlockStateContainer;
      import net.minecraft.block.state.IBlockState;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.item.EntityItem;
      import net.minecraft.entity.item.EntityTNTPrimed;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.init.Blocks;
      import net.minecraft.init.Items;
      import net.minecraft.init.MobEffects;
      import net.minecraft.init.SoundEvents;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemStack;
      import net.minecraft.potion.Potion;
      import net.minecraft.potion.PotionEffect;
      import net.minecraft.util.EnumFacing;
      import net.minecraft.util.EnumHand;
      import net.minecraft.util.EnumParticleTypes;
      import net.minecraft.util.Mirror;
      import net.minecraft.util.Rotation;
      import net.minecraft.util.SoundCategory;
      import net.minecraft.util.math.BlockPos;
      import net.minecraft.util.text.TextComponentString;
      import net.minecraft.util.text.TextComponentTranslation;
      import net.minecraft.util.text.TextFormatting;
      import net.minecraft.world.World;
      
      public class MachineMod extends Block
      {
          public static final PropertyDirection FACING = BlockHorizontal.FACING;
      
          public MachineMod(Material materialIn)
          {
              super(materialIn);
              setResistance(3F);
              setHardness(5F);
              setHarvestLevel("pickaxe", 1);
              this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
          }
      
          @Override
          public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player,
                  EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
          {
                  if(player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == ItemsMod.supT && worldIn.isBlockPowered(pos))
                  {
                      player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemsMod.dust));
                      player.addChatMessage(new TextComponentString("§4Pouf !"));
                      worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_ANVIL_USE, SoundCategory.BLOCKS, 2.0F, 1.0F, false);
                      player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 600, 0));
                      player.addExperienceLevel(-3);
      
                  }
                  if(player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == ItemsMod.test)
               {
                   player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemsMod.supT));
                   player.addChatMessage(new TextComponentString("§3Pouf !"));
                   worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_ANVIL_USE, SoundCategory.BLOCKS, 2.0F, 1.0F, false);
                   player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 600, 0));
                   player.addExperienceLevel(-3);
      
               }
               //ICI LES CRAFTS
              return super.onBlockActivated(worldIn, pos, state, player, hand, heldItem, side, hitX, hitY, hitZ);
          }
      
          private void setDefaultFacing1(World worldIn, BlockPos pos, IBlockState state)
          {
              if (!worldIn.isRemote)
              {
                  IBlockState iblockstate = worldIn.getBlockState(pos.north());
                  IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
                  IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
                  IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
                  EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
      
                  if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
                  {
                      enumfacing = EnumFacing.SOUTH;
                  }
                  else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
                  {
                      enumfacing = EnumFacing.NORTH;
                  }
                  else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
                  {
                      enumfacing = EnumFacing.EAST;
                  }
                  else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
                  {
                      enumfacing = EnumFacing.WEST;
                  }
      
                  worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
              }
          }
      
          public IBlockState withRotation1(IBlockState state, Rotation rot)
          {
              return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
          }
      
          /**
           * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
           * blockstate.
           */
          public IBlockState withMirror1(IBlockState state, Mirror mirrorIn)
          {
              return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
          }
      
          /**
           * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
           * IBlockstate
           */
          public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
          {
              return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
          }
      
          /**
           * Convert the given metadata into a BlockState for this Block
           */
          public IBlockState getStateFromMeta1(int meta)
          {
              return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
          }
      
          /**
           * Convert the BlockState into the correct metadata value
           */
          public int getMetaFromState1(IBlockState state)
          {
              return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
          }
      
          protected BlockStateContainer createBlockState1()
          {
              return new BlockStateContainer(this, new IProperty[] {FACING});
          }
      
          /**
           * Called after the block is set in the Chunk data, but before the Tile Entity is set
           */
          public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
          {
              this.setDefaultFacing1(worldIn, pos, state);
          }
      
          private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
          {
              if (!worldIn.isRemote)
              {
                  IBlockState iblockstate = worldIn.getBlockState(pos.north());
                  IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
                  IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
                  IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
                  EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
      
                  if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
                  {
                      enumfacing = EnumFacing.SOUTH;
                  }
                  else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
                  {
                      enumfacing = EnumFacing.NORTH;
                  }
                  else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
                  {
                      enumfacing = EnumFacing.EAST;
                  }
                  else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
                  {
                      enumfacing = EnumFacing.WEST;
                  }
      
                  worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
              }
          }
      
          public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
          {
              return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
          }
      
          /**
           * Convert the given metadata into a BlockState for this Block
           */
          public IBlockState getStateFromMeta(int meta)
          {
              EnumFacing enumfacing = EnumFacing.getFront(meta);
      
              if (enumfacing.getAxis() == EnumFacing.Axis.Y)
              {
                  enumfacing = EnumFacing.NORTH;
              }
      
              return this.getDefaultState().withProperty(FACING, enumfacing);
          }
      
          /**
           * Convert the BlockState into the correct metadata value
           */
          public int getMetaFromState(IBlockState state)
          {
              return ((EnumFacing)state.getValue(FACING)).getIndex();
          }
      
          /**
           * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
           * blockstate.
           */
          public IBlockState withRotation(IBlockState state, Rotation rot)
          {
              return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
          }
      
          /**
           * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
           * blockstate.
           */
          public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
          {
              return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
          }
      
          protected BlockStateContainer createBlockState()
          {
              return new BlockStateContainer(this, new IProperty[] {FACING});
          }
      
          public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
          {
              worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
          }
      
          public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
          {
              if (!worldIn.isRemote)
              {
                  if (worldIn.isBlockPowered(pos))
                  {
                      worldIn.setBlockState(pos, BlocksMod.machine.getDefaultState(), 2);
                  }
                  else
                  {
                      worldIn.setBlockState(pos, BlocksMod.machineo.getDefaultState(), 2);
                  }
              }
          }
      
          @Nullable
          public Item getItemDropped(IBlockState state, Random rand, int fortune)
          {
              return Item.getItemFromBlock(BlocksMod.machineo);
          }
      
      }
      

      Bloc éteint

      package com.tuto.mod.blocks;
      
      import com.tuto.mod.init.BlocksMod;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.BlockHorizontal;
      import net.minecraft.block.material.Material;
      import net.minecraft.block.properties.IProperty;
      import net.minecraft.block.properties.PropertyDirection;
      import net.minecraft.block.state.BlockStateContainer;
      import net.minecraft.block.state.IBlockState;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.item.ItemStack;
      import net.minecraft.util.EnumFacing;
      import net.minecraft.util.Mirror;
      import net.minecraft.util.Rotation;
      import net.minecraft.util.math.BlockPos;
      import net.minecraft.world.World;
      
      public class MachineoMod extends Block
      {
      
          public static final PropertyDirection FACING = BlockHorizontal.FACING;
      
          public MachineoMod(Material materialIn)
          {
              super(materialIn);
              setResistance(3F);
              setHardness(5F);
              setHarvestLevel("pickaxe", 1);
              this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
          }
      
           public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
              {
                  if (!worldIn.isRemote)
                  {
                      if (worldIn.isBlockPowered(pos))
                      {
                          worldIn.setBlockState(pos, BlocksMod.machine.getDefaultState(), 2);
                      }
                      else
                      {
                          worldIn.setBlockState(pos, BlocksMod.machineo.getDefaultState(), 2);
                      }
                  }
              }
      
              private void setDefaultFacing1(World worldIn, BlockPos pos, IBlockState state)
              {
                  if (!worldIn.isRemote)
                  {
                      IBlockState iblockstate = worldIn.getBlockState(pos.north());
                      IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
                      IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
                      IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
                      EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
      
                      if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
                      {
                          enumfacing = EnumFacing.SOUTH;
                      }
                      else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
                      {
                          enumfacing = EnumFacing.NORTH;
                      }
                      else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
                      {
                          enumfacing = EnumFacing.EAST;
                      }
                      else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
                      {
                          enumfacing = EnumFacing.WEST;
                      }
      
                      worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
                  }
              }
      
              public IBlockState withRotation1(IBlockState state, Rotation rot)
              {
                  return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
              }
      
              /**
               * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
               * blockstate.
               */
              public IBlockState withMirror1(IBlockState state, Mirror mirrorIn)
              {
                  return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
              }
      
              /**
               * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
               * IBlockstate
               */
              public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
              {
                  return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
              }
      
              /**
               * Convert the given metadata into a BlockState for this Block
               */
              public IBlockState getStateFromMeta1(int meta)
              {
                  return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
              }
      
              /**
               * Convert the BlockState into the correct metadata value
               */
              public int getMetaFromState1(IBlockState state)
              {
                  return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
              }
      
              protected BlockStateContainer createBlockState1()
              {
                  return new BlockStateContainer(this, new IProperty[] {FACING});
              }
      
              /**
               * Called after the block is set in the Chunk data, but before the Tile Entity is set
               */
              public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
              {
                  this.setDefaultFacing1(worldIn, pos, state);
              }
      
              private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
              {
                  if (!worldIn.isRemote)
                  {
                      IBlockState iblockstate = worldIn.getBlockState(pos.north());
                      IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
                      IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
                      IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
                      EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
      
                      if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
                      {
                          enumfacing = EnumFacing.SOUTH;
                      }
                      else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
                      {
                          enumfacing = EnumFacing.NORTH;
                      }
                      else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
                      {
                          enumfacing = EnumFacing.EAST;
                      }
                      else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
                      {
                          enumfacing = EnumFacing.WEST;
                      }
      
                      worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
                  }
              }
      
              public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
              {
                  return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
              }
      
              /**
               * Convert the given metadata into a BlockState for this Block
               */
              public IBlockState getStateFromMeta(int meta)
              {
                  EnumFacing enumfacing = EnumFacing.getFront(meta);
      
                  if (enumfacing.getAxis() == EnumFacing.Axis.Y)
                  {
                      enumfacing = EnumFacing.NORTH;
                  }
      
                  return this.getDefaultState().withProperty(FACING, enumfacing);
              }
      
              /**
               * Convert the BlockState into the correct metadata value
               */
              public int getMetaFromState(IBlockState state)
              {
                  return ((EnumFacing)state.getValue(FACING)).getIndex();
              }
      
              /**
               * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
               * blockstate.
               */
              public IBlockState withRotation(IBlockState state, Rotation rot)
              {
                  return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
              }
      
              /**
               * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
               * blockstate.
               */
              public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
              {
                  return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
              }
      
              protected BlockStateContainer createBlockState()
              {
                  return new BlockStateContainer(this, new IProperty[] {FACING});
              }
      
              public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
              {
                  worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
              }
      
      }
      

      Et pendant que l’on y est, comment on peu régler la taille du bloc droppé ? il est énorme pour moi

      Pour peu etre que ça soit plus simple pour vous de voir le problème : mon dossier src ICI

      Il y a deux choses qui m'énerve dans la vie : les babouches et les personnes jouant en 1.7.10 !

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

        Salut,
        le problème vient du fait que tu fais un getDefaultState dans ta méthode neighborChanged, du coup ton nouveau block placé prend la direction du Nord, et non celle enregistré dans la propriété facing.
        Voilà la classe corrigé :

        
        package com.tuto.mod.blocks;
        
        import com.tuto.mod.init.BlocksMod;
        
        import net.minecraft.block.Block;
        import net.minecraft.block.BlockHorizontal;
        import net.minecraft.block.material.Material;
        import net.minecraft.block.properties.IProperty;
        import net.minecraft.block.properties.PropertyDirection;
        import net.minecraft.block.state.BlockStateContainer;
        import net.minecraft.block.state.IBlockState;
        import net.minecraft.entity.EntityLivingBase;
        import net.minecraft.item.ItemStack;
        import net.minecraft.util.EnumFacing;
        import net.minecraft.util.Mirror;
        import net.minecraft.util.Rotation;
        import net.minecraft.util.math.BlockPos;
        import net.minecraft.world.World;
        
        public class MachineoMod extends Block
        {
        
        public static final PropertyDirection FACING = BlockHorizontal.FACING;
        
        public MachineoMod(Material materialIn)
        {
        super(materialIn);
        setResistance(3F);
        setHardness(5F);
        setHarvestLevel("pickaxe", 1);
        this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
        }
        
        public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
           {
               if (!worldIn.isRemote)
               {
                   if (worldIn.isBlockPowered(pos))
                   {
                    worldIn.setBlockState(pos, BlocksMod.machine.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
                       worldIn.setBlockState(pos, BlocksMod.machine.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
                   }
                   else
                   {
                    worldIn.setBlockState(pos, BlocksMod.machineo.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
                       worldIn.setBlockState(pos, BlocksMod.machineo.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
                   }
               }
           }
        
           private void setDefaultFacing1(World worldIn, BlockPos pos, IBlockState state)
           {
               if (!worldIn.isRemote)
               {
                   IBlockState iblockstate = worldIn.getBlockState(pos.north());
                   IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
                   IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
                   IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
                   EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        
                   if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
                   {
                       enumfacing = EnumFacing.SOUTH;
                   }
                   else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
                   {
                       enumfacing = EnumFacing.NORTH;
                   }
                   else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
                   {
                       enumfacing = EnumFacing.EAST;
                   }
                   else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
                   {
                       enumfacing = EnumFacing.WEST;
                   }
        
                   worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
               }
           }
        
           public IBlockState withRotation1(IBlockState state, Rotation rot)
           {
               return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
           }
        
           /**
            * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
            * blockstate.
            */
           public IBlockState withMirror1(IBlockState state, Mirror mirrorIn)
           {
               return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
           }
        
           /**
            * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
            * IBlockstate
            */
           public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
           {
               return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
           }
        
           /**
            * Convert the given metadata into a BlockState for this Block
            */
           public IBlockState getStateFromMeta1(int meta)
           {
               return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
           }
        
           /**
            * Convert the BlockState into the correct metadata value
            */
           public int getMetaFromState1(IBlockState state)
           {
               return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
           }
        
           protected BlockStateContainer createBlockState1()
           {
               return new BlockStateContainer(this, new IProperty[] {FACING});
           }
        
           /**
            * Called after the block is set in the Chunk data, but before the Tile Entity is set
            */
           public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
           {
               this.setDefaultFacing1(worldIn, pos, state);
           }
        
           private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
           {
               if (!worldIn.isRemote)
               {
                   IBlockState iblockstate = worldIn.getBlockState(pos.north());
                   IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
                   IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
                   IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
                   EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        
                   if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
                   {
                       enumfacing = EnumFacing.SOUTH;
                   }
                   else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
                   {
                       enumfacing = EnumFacing.NORTH;
                   }
                   else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
                   {
                       enumfacing = EnumFacing.EAST;
                   }
                   else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
                   {
                       enumfacing = EnumFacing.WEST;
                   }
        
                   worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
               }
           }
        
           public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
           {
               return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
           }
        
           /**
            * Convert the given metadata into a BlockState for this Block
            */
           public IBlockState getStateFromMeta(int meta)
           {
               EnumFacing enumfacing = EnumFacing.getFront(meta);
        
               if (enumfacing.getAxis() == EnumFacing.Axis.Y)
               {
                   enumfacing = EnumFacing.NORTH;
               }
        
               return this.getDefaultState().withProperty(FACING, enumfacing);
           }
        
           /**
            * Convert the BlockState into the correct metadata value
            */
           public int getMetaFromState(IBlockState state)
           {
               return ((EnumFacing)state.getValue(FACING)).getIndex();
           }
        
           /**
            * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
            * blockstate.
            */
           public IBlockState withRotation(IBlockState state, Rotation rot)
           {
               return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
           }
        
           /**
            * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
            * blockstate.
            */
           public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
           {
               return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
           }
        
           protected BlockStateContainer createBlockState()
           {
               return new BlockStateContainer(this, new IProperty[] {FACING});
           }
        
           public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
           {
               worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
           }
        
        }
        
        

        Ensuite il te suffit de faire la même manip pour le MachineMod block, remodifier la méthode neighborChanged par la mienne !

        J’ai juste pu comprendre ton problème de direction, le reste de ton message était incompréhensible ^^’

        1 réponse Dernière réponse Répondre Citer 0
        • Tituya
          Tituya dernière édition par

          Un ENORME merci ! Le reste des problemes ont été corrigé par ce que tu ma dit, le suite de mon message était bizarre c’est vrai x)

          Il y a deux choses qui m'énerve dans la vie : les babouches et les personnes jouant en 1.7.10 !

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

          MINECRAFT FORGE FRANCE © 2018

          Powered by NodeBB