当前位置: 首页>>代码示例>>Java>>正文


Java BlockRailBase.EnumRailDirection方法代码示例

本文整理汇总了Java中net.minecraft.block.BlockRailBase.EnumRailDirection方法的典型用法代码示例。如果您正苦于以下问题:Java BlockRailBase.EnumRailDirection方法的具体用法?Java BlockRailBase.EnumRailDirection怎么用?Java BlockRailBase.EnumRailDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.BlockRailBase的用法示例。


在下文中一共展示了BlockRailBase.EnumRailDirection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
  IBlockState iblockstate = worldIn.getBlockState(pos);
  if (!BlockRailBase.isRailBlock(iblockstate)) {
    return EnumActionResult.FAIL;
  }
  else {
    ItemStack itemstack = player.getHeldItem(hand);
    if (!worldIn.isRemote) {
      BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? ((BlockRailBase) iblockstate.getBlock()).getRailDirection(worldIn, pos, iblockstate, null) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
      double d0 = 0.0D;
      if (blockrailbase$enumraildirection.isAscending()) {
        d0 = 0.5D;
      }
      EntityMinecart entityminecart = summonMinecart(worldIn);//new EntityMinecartTurret(worldIn, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.0625D + d0, (double) pos.getZ() + 0.5D);
      entityminecart.setPosition((double) pos.getX() + 0.5D, (double) pos.getY() + 0.0625D + d0, (double) pos.getZ() + 0.5D);
      if (itemstack.hasDisplayName()) {
        entityminecart.setCustomNameTag(itemstack.getDisplayName());
      }
      worldIn.spawnEntity(entityminecart);
    }
    itemstack.shrink(1);
    return EnumActionResult.SUCCESS;
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:26,代码来源:BaseItemMinecart.java

示例2: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (!BlockRailBase.isRailBlock(iblockstate))
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        if (!worldIn.isRemote)
        {
            BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            double d0 = 0.0D;

            if (blockrailbase$enumraildirection.isAscending())
            {
                d0 = 0.5D;
            }

            EntityMinecart entityminecart = EntityMinecart.create(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.0625D + d0, (double)pos.getZ() + 0.5D, this.minecartType);

            if (stack.hasDisplayName())
            {
                entityminecart.setCustomNameTag(stack.getDisplayName());
            }

            worldIn.spawnEntityInWorld(entityminecart);
        }

        --stack.stackSize;
        return EnumActionResult.SUCCESS;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:ItemMinecart.java

示例3: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (BlockRailBase.isRailBlock(iblockstate))
    {
        if (!worldIn.isRemote)
        {
            BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            double d0 = 0.0D;

            if (blockrailbase$enumraildirection.isAscending())
            {
                d0 = 0.5D;
            }

            EntityMinecart entityminecart = EntityMinecart.func_180458_a(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.0625D + d0, (double)pos.getZ() + 0.5D, this.minecartType);

            if (stack.hasDisplayName())
            {
                entityminecart.setCustomNameTag(stack.getDisplayName());
            }

            worldIn.spawnEntityInWorld(entityminecart);
        }

        --stack.stackSize;
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:ItemMinecart.java

示例4: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    IBlockState iblockstate = playerIn.getBlockState(worldIn);

    if (!BlockRailBase.isRailBlock(iblockstate))
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        ItemStack itemstack = stack.getHeldItem(pos);

        if (!playerIn.isRemote)
        {
            BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            double d0 = 0.0D;

            if (blockrailbase$enumraildirection.isAscending())
            {
                d0 = 0.5D;
            }

            EntityMinecart entityminecart = EntityMinecart.create(playerIn, (double)worldIn.getX() + 0.5D, (double)worldIn.getY() + 0.0625D + d0, (double)worldIn.getZ() + 0.5D, this.minecartType);

            if (itemstack.hasDisplayName())
            {
                entityminecart.setCustomNameTag(itemstack.getDisplayName());
            }

            playerIn.spawnEntityInWorld(entityminecart);
        }

        itemstack.func_190918_g(1);
        return EnumActionResult.SUCCESS;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:ItemMinecart.java

示例5: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
/**
    * Called when a Block is right-clicked with this Item
    */
   @Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
   {
   	ItemStack stack = playerIn.getHeldItem(hand);
       IBlockState iblockstate = worldIn.getBlockState(pos);

       if (!BlockRailBase.isRailBlock(iblockstate))
       {
           return EnumActionResult.FAIL;
       }
       else
       {
           if (!worldIn.isRemote)
           {
               BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
               double d0 = 0.0D;

               if (blockrailbase$enumraildirection.isAscending())
               {
                   d0 = 0.5D;
               }
               
               EntityWirelessChestMinecart entityminecart = new EntityWirelessChestMinecart(worldIn, pos.getX() + 0.5D, pos.getY() + 0.0625D + d0, pos.getZ() + 0.5D);
               entityminecart.setCode(ItemNBTHelper.getInteger(stack, WirelessChestHelper.NBT_CODE, 0));
               String owner = ItemNBTHelper.getString(stack, WirelessChestHelper.NBT_OWNER, "");
               if(UUIDUtils.isUUID(owner))entityminecart.setOwner(UUIDUtils.fromString(owner));
               
               if (stack.hasDisplayName())
               {
                   entityminecart.setCustomNameTag(stack.getDisplayName());
               }

               worldIn.spawnEntity(entityminecart);
           }

           ItemStackTools.incStackSize(stack, -1);
           return EnumActionResult.SUCCESS;
       }
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:43,代码来源:ItemWirelessChestMinecart.java

示例6: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
/**
    * Called when a Block is right-clicked with this Item
    */
   @Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
   {
   	ItemStack stack = playerIn.getHeldItem(hand);
       IBlockState iblockstate = worldIn.getBlockState(pos);

       if (!BlockRailBase.isRailBlock(iblockstate))
       {
           return EnumActionResult.FAIL;
       }
       else
       {
           if (!worldIn.isRemote)
           {
               BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
               double d0 = 0.0D;

               if (blockrailbase$enumraildirection.isAscending())
               {
                   d0 = 0.5D;
               }

               CrystalChestType type = CrystalChestType.values()[CrystalChestType.validateMeta(stack.getMetadata())];
               EntityMinecart entityminecart = EntityCrystalChestMinecartBase.makeMinecart(worldIn, pos.getX() + 0.5D, pos.getY() + 0.0625D + d0, pos.getZ() + 0.5D, type);

               if (stack.hasDisplayName())
               {
                   entityminecart.setCustomNameTag(stack.getDisplayName());
               }

               worldIn.spawnEntity(entityminecart);
           }

           ItemStackTools.incStackSize(stack, -1);
           return EnumActionResult.SUCCESS;
       }
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:41,代码来源:ItemCrystalChestMinecart.java

示例7: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
/**
    * Called when a Block is right-clicked with this Item
    */
   @Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
   {
   	ItemStack stack = playerIn.getHeldItem(hand);
   	IBlockState iblockstate = worldIn.getBlockState(pos);

       if (!BlockRailBase.isRailBlock(iblockstate))
       {
           return EnumActionResult.FAIL;
       }
       else
       {
           if (!worldIn.isRemote)
           {
               BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
               double d0 = 0.0D;

               if (blockrailbase$enumraildirection.isAscending())
               {
                   d0 = 0.5D;
               }
               
               EntityEnderChestMinecart entityminecart = new EntityEnderChestMinecart(worldIn, pos.getX() + 0.5D, pos.getY() + 0.0625D + d0, pos.getZ() + 0.5D);
               
               if (stack.hasDisplayName())
               {
                   entityminecart.setCustomNameTag(stack.getDisplayName());
               }

               worldIn.spawnEntity(entityminecart);
           }

           ItemStackTools.incStackSize(stack, -1);
           return EnumActionResult.SUCCESS;
       }
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:40,代码来源:ItemEnderChestMinecart.java

示例8: moveAlongTrack

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
@Override
protected void moveAlongTrack(BlockPos pos, IBlockState state) {
  BlockRailBase blockrailbase = (BlockRailBase) state.getBlock();
  if (blockrailbase != Blocks.ACTIVATOR_RAIL) {
    this.timeSinceDropped = 0;
  }
  //force DISPENSER to face sime direction as my movemene
  //      double slopeAdjustment = getSlopeAdjustment();
  BlockRailBase.EnumRailDirection raildirection = blockrailbase.getRailDirection(world, pos, state, this);
  EnumFacing fac = null;
  switch (raildirection) {
    case ASCENDING_EAST:
      fac = EnumFacing.EAST;
    break;
    case ASCENDING_WEST:
      fac = EnumFacing.WEST;
    break;
    case ASCENDING_NORTH:
      fac = EnumFacing.NORTH;
    break;
    case ASCENDING_SOUTH:
      fac = EnumFacing.SOUTH;
    case EAST_WEST:
      fac = (this.motionX > 0) ? EnumFacing.SOUTH : EnumFacing.NORTH;
    break;
    case NORTH_SOUTH:
      fac = (this.motionZ < 0) ? EnumFacing.WEST : EnumFacing.EAST;
    break;
    default:
    break;
  }
  super.moveAlongTrack(pos, state);
  if (fac != null) {
    this.setDisplayTile(getDefaultDisplayTile().withProperty(BlockObserver.FACING, fac));
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:37,代码来源:EntityMinecartTurret.java

示例9: moveAlongTrack

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
@Override
protected void moveAlongTrack(BlockPos pos, IBlockState state) {
  BlockRailBase blockrailbase = (BlockRailBase) state.getBlock();
  if (blockrailbase != Blocks.ACTIVATOR_RAIL) {
    this.timeSinceDropped = 0;
  }
  //force DISPENSER to face sime direction as my movemene
  //      double slopeAdjustment = getSlopeAdjustment();
  BlockRailBase.EnumRailDirection raildirection = blockrailbase.getRailDirection(world, pos, state, this);
  EnumFacing fac = null;
  switch (raildirection) {
    case ASCENDING_EAST:
      fac = EnumFacing.EAST;
    break;
    case ASCENDING_WEST:
      fac = EnumFacing.WEST;
    break;
    case ASCENDING_NORTH:
      fac = EnumFacing.NORTH;
    break;
    case ASCENDING_SOUTH:
      fac = EnumFacing.SOUTH;
    case EAST_WEST:
      fac = (this.motionX > 0) ? EnumFacing.SOUTH : EnumFacing.NORTH;
    //        fac = (this.motionX < 0) ? EnumFacing.WEST : EnumFacing.EAST;
    break;
    case NORTH_SOUTH:
      //        fac = (this.motionZ > 0) ? EnumFacing.SOUTH : EnumFacing.NORTH;
      fac = (this.motionZ < 0) ? EnumFacing.WEST : EnumFacing.EAST;
    break;
    default:
    break;
  }
  super.moveAlongTrack(pos, state);
  if (fac != null) {
    //      ModCyclic.logger.info(raildirection+" setDisplayTile  "+fac);
    this.setDisplayTile(getDefaultDisplayTile().withProperty(BlockDispenser.FACING, fac));
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:40,代码来源:EntityGoldMinecartDispenser.java

示例10: onItemUse

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (BlockRailBase.isRailBlock(iblockstate)) {
        if (!worldIn.isRemote)
        {
            BlockRailBase.EnumRailDirection enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            double d0 = 0.0D;

            if (enumraildirection.isAscending()) {
                d0 = 0.5D;
            }

            EntityMinecart entityminecart;
            if (type == EnumMinecartType.FURNACE) {
            	entityminecart = new EntityCoalPoweredMinecartVC(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.0625D + d0, (double)pos.getZ() + 0.5D);
            } else {
            	entityminecart = new EntityEmptyMinecartVC(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.0625D + d0, (double)pos.getZ() + 0.5D);
            }
            
            if (stack.hasDisplayName()) {
                entityminecart.setCustomNameTag(stack.getDisplayName());
            }

            worldIn.spawnEntityInWorld(entityminecart);
        }

        --stack.stackSize;
        return true;
    }
    else {
        return false;
    }
}
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:35,代码来源:ItemMinecartVC.java

示例11: func_70489_a

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
public Vec3 func_70489_a(double p_70489_1_, double p_70489_3_, double p_70489_5_)
{
    int i = MathHelper.floor_double(p_70489_1_);
    int j = MathHelper.floor_double(p_70489_3_);
    int k = MathHelper.floor_double(p_70489_5_);

    if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(i, j - 1, k)))
    {
        --j;
    }

    IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(i, j, k));

    if (BlockRailBase.isRailBlock(iblockstate))
    {
        BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty());
        int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()];
        double d0 = 0.0D;
        double d1 = (double)i + 0.5D + (double)aint[0][0] * 0.5D;
        double d2 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D;
        double d3 = (double)k + 0.5D + (double)aint[0][2] * 0.5D;
        double d4 = (double)i + 0.5D + (double)aint[1][0] * 0.5D;
        double d5 = (double)j + 0.0625D + (double)aint[1][1] * 0.5D;
        double d6 = (double)k + 0.5D + (double)aint[1][2] * 0.5D;
        double d7 = d4 - d1;
        double d8 = (d5 - d2) * 2.0D;
        double d9 = d6 - d3;

        if (d7 == 0.0D)
        {
            p_70489_1_ = (double)i + 0.5D;
            d0 = p_70489_5_ - (double)k;
        }
        else if (d9 == 0.0D)
        {
            p_70489_5_ = (double)k + 0.5D;
            d0 = p_70489_1_ - (double)i;
        }
        else
        {
            double d10 = p_70489_1_ - d1;
            double d11 = p_70489_5_ - d3;
            d0 = (d10 * d7 + d11 * d9) * 2.0D;
        }

        p_70489_1_ = d1 + d7 * d0;
        p_70489_3_ = d2 + d8 * d0;
        p_70489_5_ = d3 + d9 * d0;

        if (d8 < 0.0D)
        {
            ++p_70489_3_;
        }

        if (d8 > 0.0D)
        {
            p_70489_3_ += 0.5D;
        }

        return new Vec3(p_70489_1_, p_70489_3_, p_70489_5_);
    }
    else
    {
        return null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:67,代码来源:EntityMinecart.java

示例12: dispenseStack

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
    World world = source.getWorld();
    double d0 = source.getX() + (double)enumfacing.getFrontOffsetX() * 1.125D;
    double d1 = Math.floor(source.getY()) + (double)enumfacing.getFrontOffsetY();
    double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ() * 1.125D;
    BlockPos blockpos = source.getBlockPos().offset(enumfacing);
    IBlockState iblockstate = world.getBlockState(blockpos);
    BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
    double d3;

    if (BlockRailBase.isRailBlock(iblockstate))
    {
        if (blockrailbase$enumraildirection.isAscending())
        {
            d3 = 0.6D;
        }
        else
        {
            d3 = 0.1D;
        }
    }
    else
    {
        if (iblockstate.getBlock().getMaterial() != Material.air || !BlockRailBase.isRailBlock(world.getBlockState(blockpos.down())))
        {
            return this.behaviourDefaultDispenseItem.dispense(source, stack);
        }

        IBlockState iblockstate1 = world.getBlockState(blockpos.down());
        BlockRailBase.EnumRailDirection blockrailbase$enumraildirection1 = iblockstate1.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate1.getValue(((BlockRailBase)iblockstate1.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;

        if (enumfacing != EnumFacing.DOWN && blockrailbase$enumraildirection1.isAscending())
        {
            d3 = -0.4D;
        }
        else
        {
            d3 = -0.9D;
        }
    }

    EntityMinecart entityminecart = EntityMinecart.func_180458_a(world, d0, d1 + d3, d2, ((ItemMinecart)stack.getItem()).minecartType);

    if (stack.hasDisplayName())
    {
        entityminecart.setCustomNameTag(stack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    stack.splitStack(1);
    return stack;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:55,代码来源:ItemMinecart.java

示例13: getPos

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
public Vec3d getPos(double p_70489_1_, double p_70489_3_, double p_70489_5_)
{
    int i = MathHelper.floor_double(p_70489_1_);
    int j = MathHelper.floor_double(p_70489_3_);
    int k = MathHelper.floor_double(p_70489_5_);

    if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(i, j - 1, k)))
    {
        --j;
    }

    IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(i, j, k));

    if (BlockRailBase.isRailBlock(iblockstate))
    {
        BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty());
        int[][] aint = MATRIX[blockrailbase$enumraildirection.getMetadata()];
        double d0 = (double)i + 0.5D + (double)aint[0][0] * 0.5D;
        double d1 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D;
        double d2 = (double)k + 0.5D + (double)aint[0][2] * 0.5D;
        double d3 = (double)i + 0.5D + (double)aint[1][0] * 0.5D;
        double d4 = (double)j + 0.0625D + (double)aint[1][1] * 0.5D;
        double d5 = (double)k + 0.5D + (double)aint[1][2] * 0.5D;
        double d6 = d3 - d0;
        double d7 = (d4 - d1) * 2.0D;
        double d8 = d5 - d2;
        double d9;

        if (d6 == 0.0D)
        {
            d9 = p_70489_5_ - (double)k;
        }
        else if (d8 == 0.0D)
        {
            d9 = p_70489_1_ - (double)i;
        }
        else
        {
            double d10 = p_70489_1_ - d0;
            double d11 = p_70489_5_ - d2;
            d9 = (d10 * d6 + d11 * d8) * 2.0D;
        }

        p_70489_1_ = d0 + d6 * d9;
        p_70489_3_ = d1 + d7 * d9;
        p_70489_5_ = d2 + d8 * d9;

        if (d7 < 0.0D)
        {
            ++p_70489_3_;
        }

        if (d7 > 0.0D)
        {
            p_70489_3_ += 0.5D;
        }

        return new Vec3d(p_70489_1_, p_70489_3_, p_70489_5_);
    }
    else
    {
        return null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:65,代码来源:EntityMinecart.java

示例14: func_70495_a

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
public Vec3 func_70495_a(double p_70495_1_, double p_70495_3_, double p_70495_5_, double p_70495_7_)
{
    int i = MathHelper.floor_double(p_70495_1_);
    int j = MathHelper.floor_double(p_70495_3_);
    int k = MathHelper.floor_double(p_70495_5_);

    if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(i, j - 1, k)))
    {
        --j;
    }

    IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(i, j, k));

    if (BlockRailBase.isRailBlock(iblockstate))
    {
        BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty());
        p_70495_3_ = (double)j;

        if (blockrailbase$enumraildirection.isAscending())
        {
            p_70495_3_ = (double)(j + 1);
        }

        int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()];
        double d0 = (double)(aint[1][0] - aint[0][0]);
        double d1 = (double)(aint[1][2] - aint[0][2]);
        double d2 = Math.sqrt(d0 * d0 + d1 * d1);
        d0 = d0 / d2;
        d1 = d1 / d2;
        p_70495_1_ = p_70495_1_ + d0 * p_70495_7_;
        p_70495_5_ = p_70495_5_ + d1 * p_70495_7_;

        if (aint[0][1] != 0 && MathHelper.floor_double(p_70495_1_) - i == aint[0][0] && MathHelper.floor_double(p_70495_5_) - k == aint[0][2])
        {
            p_70495_3_ += (double)aint[0][1];
        }
        else if (aint[1][1] != 0 && MathHelper.floor_double(p_70495_1_) - i == aint[1][0] && MathHelper.floor_double(p_70495_5_) - k == aint[1][2])
        {
            p_70495_3_ += (double)aint[1][1];
        }

        return this.func_70489_a(p_70495_1_, p_70495_3_, p_70495_5_);
    }
    else
    {
        return null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:49,代码来源:EntityMinecart.java

示例15: getPosOffset

import net.minecraft.block.BlockRailBase; //导入方法依赖的package包/类
@Nullable
public Vec3d getPosOffset(double x, double y, double z, double offset)
{
    int i = MathHelper.floor(x);
    int j = MathHelper.floor(y);
    int k = MathHelper.floor(z);

    if (BlockRailBase.isRailBlock(this.world, new BlockPos(i, j - 1, k)))
    {
        --j;
    }

    IBlockState iblockstate = this.world.getBlockState(new BlockPos(i, j, k));

    if (BlockRailBase.isRailBlock(iblockstate))
    {
        BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty());
        y = (double)j;

        if (blockrailbase$enumraildirection.isAscending())
        {
            y = (double)(j + 1);
        }

        int[][] aint = MATRIX[blockrailbase$enumraildirection.getMetadata()];
        double d0 = (double)(aint[1][0] - aint[0][0]);
        double d1 = (double)(aint[1][2] - aint[0][2]);
        double d2 = Math.sqrt(d0 * d0 + d1 * d1);
        d0 = d0 / d2;
        d1 = d1 / d2;
        x = x + d0 * offset;
        z = z + d1 * offset;

        if (aint[0][1] != 0 && MathHelper.floor(x) - i == aint[0][0] && MathHelper.floor(z) - k == aint[0][2])
        {
            y += (double)aint[0][1];
        }
        else if (aint[1][1] != 0 && MathHelper.floor(x) - i == aint[1][0] && MathHelper.floor(z) - k == aint[1][2])
        {
            y += (double)aint[1][1];
        }

        return this.getPos(x, y, z);
    }
    else
    {
        return null;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:50,代码来源:EntityMinecart.java


注:本文中的net.minecraft.block.BlockRailBase.EnumRailDirection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。