Java 类net.minecraft.util.EnumFacing.Axis 实例源码

项目:pnc-repressurized    文件:BlockAphorismTile.java   
/**
 * Called when the block is placed in the world.
 */
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entityLiving, ItemStack iStack) {
    super.onBlockPlacedBy(world, pos, state, entityLiving, iStack);
    EnumFacing rotation = getRotation(world, pos);
    if (rotation.getAxis() == Axis.Y) {
        TileEntity te = world.getTileEntity(pos);
        if (te instanceof TileEntityAphorismTile) {
            TileEntityAphorismTile teAT = (TileEntityAphorismTile) te;
            float yaw = entityLiving.rotationYaw; if (yaw < 0) yaw += 360;
            teAT.textRotation = (((int) yaw + 45) / 90 + 2) % 4;
            if (rotation.getFrontOffsetY() > 0 && (teAT.textRotation == 1 || teAT.textRotation == 3)) {
                // fudge - reverse rotation if placing above, and player is facing on east/west axis
                teAT.textRotation = 4 - teAT.textRotation;
            }
        }
    }
    if (world.isRemote && entityLiving instanceof EntityPlayer) {
        ((EntityPlayer) entityLiving).openGui(PneumaticCraftRepressurized.instance, EnumGuiId.APHORISM_TILE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
        sendEditorMessage((EntityPlayer) entityLiving);
    }
}
项目:CrystalMod    文件:BlockCrate.java   
@Override
  public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
  {
TileEntity te = world.getTileEntity(pos);
      if(te !=null && te instanceof TileCrate){
        TileCrate tile = (TileCrate)te;
        if(axis == tile.facing && axis.getAxis() == Axis.Y){
            tile.rotation++;
            tile.rotation%=4;
            BlockUtil.markBlockForUpdate(world, pos);
            return true;
        }
        int next = tile.getFacing();
        next++;
        next%=6;
        tile.setFacing(next);
        tile.rotation = 0;
        BlockUtil.markBlockForUpdate(world, pos);
        return true;
      }
      return false;
  }
项目:CrystalMod    文件:TileTelePortal.java   
public void travel(Entity entity){
    if(entity.getEntityWorld().isRemote)return;
    if(otherPortalPos !=null){
        World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(otherPortalDim);
        if(world !=null){
            TileEntity tile = world.getTileEntity(otherPortalPos);
            if(tile !=null && tile instanceof TileTelePortal){
                TileTelePortal otherPortal = (TileTelePortal)tile;
                Vector3d motion = new Vector3d(entity.motionX, entity.motionY, entity.motionZ);
                double ejectPower = 0.0;
                if(facing.getAxis() == Axis.X){
                    ejectPower = Math.abs(motion.x);
                }
                if(facing.getAxis() == Axis.Y){
                    ejectPower = Math.abs(motion.y);
                }
                if(facing.getAxis() == Axis.Z){
                    ejectPower = Math.abs(motion.z);
                }
                teleportTo(entity, otherPortal, ejectPower);
            }
        }
    }
}
项目:CrystalMod    文件:TileEntityBattery.java   
@Override
public EnumFacing fixFace(EnumFacing side){
    EnumFacing fixedDir = side;

    if(facing == EnumFacing.SOUTH.ordinal()){
        if(side !=EnumFacing.UP && side !=EnumFacing.DOWN)fixedDir = side.getOpposite();
    }

    if(facing == EnumFacing.WEST.ordinal()){
        if(side !=EnumFacing.UP && side !=EnumFacing.DOWN)fixedDir = side.rotateAround(Axis.Y);
    }

    if(facing == EnumFacing.EAST.ordinal()){
        if(side !=EnumFacing.UP && side !=EnumFacing.DOWN)fixedDir = side.getOpposite().rotateAround(Axis.Y);
    }

    if(facing == EnumFacing.UP.ordinal()){
        fixedDir = side.rotateAround(Axis.X);
    }

    if(facing == EnumFacing.DOWN.ordinal()){
        if(side == EnumFacing.WEST || side == EnumFacing.EAST)fixedDir = side.rotateAround(Axis.X);
        else fixedDir = side.getOpposite().rotateAround(Axis.X);
    }
    return fixedDir;
}
项目:CrystalMod    文件:ItemBlockShieldRack.java   
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
  if(!super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState)) {
    return false;
  }
  if(side.getAxis() == Axis.Y)return false;

  TileEntity te = world.getTileEntity(pos);
  if(te instanceof IFacingTile) {
    IFacingTile tile = (IFacingTile) te;
    EnumFacing face = side;
    tile.setFacing(face.getHorizontalIndex());
    BlockUtil.markBlockForUpdate(world, pos);
  }
  return true;
}
项目:ToroChess    文件:CheckerBoardGenerator.java   
private boolean drawStairBorder(int length) {
  boolean somethingDrawn = false;

  block = STAIRS_SOUTH;
  somethingDrawn = drawLine(Axis.X, length) || somethingDrawn;

  block = STAIRS_WEST;
  somethingDrawn = drawLine(Axis.Z, length) || somethingDrawn;

  block = STAIRS_NORTH;
  somethingDrawn = drawLine(Axis.X, -length) || somethingDrawn;

  block = STAIRS_EAST;
  somethingDrawn = drawLine(Axis.Z, -length) || somethingDrawn;

  return somethingDrawn;
}
项目:ToroChess    文件:CheckerBoardGenerator.java   
private boolean drawLine(Axis axis, int length) {
  int l = computeTravelDistance(length);
  boolean isPositive = length >= 0;
  boolean somethingDrawn = false;
  for (int i = 0; i < l; i++) {
    placeBlock();
    if (i < l - 1) {
      if (isPositive) {
        incrementAxis(axis, 1);
      } else {
        incrementAxis(axis, -1);
      }
    }

    somethingDrawn = somethingDrawn || blockWasDrawable;
  }

  return somethingDrawn;
}
项目:ToroQuest    文件:Canvas.java   
@Override
public void line(Axis axis, int length) {
    int l = computeTravelDistance(length);
    boolean isPositive = length >= 0;
    for (int i = 0; i < l; i++) {
        strokeBlock();
        if (i < l - 1) {
            if (isPositive) {
                incrementAxis(axis, 1);
            } else {
                incrementAxis(axis, -1);
            }
        }

    }
}
项目:Qbar    文件:TileStructure.java   
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
    if (this.blueprint != null && this.cachedBB == null)
    {
        if (BlockMultiblockBase.getFacing(this.meta).getAxis() == Axis.Z)
        {
            this.cachedBB = new AxisAlignedBB(
                    this.pos.add(-this.multiblock.getOffsetX(), -this.multiblock.getOffsetY(),
                            -this.multiblock.getOffsetZ()),
                    this.pos.add(this.multiblock.getWidth(), this.multiblock.getHeight(),
                            this.multiblock.getLength()));
        }
        else
            this.cachedBB = new AxisAlignedBB(
                    this.pos.add(-this.multiblock.getOffsetZ(), -this.multiblock.getOffsetY(),
                            -this.multiblock.getOffsetX()),
                    this.pos.add(this.multiblock.getLength(), this.multiblock.getHeight(),
                            this.multiblock.getWidth()));
    }
    if (this.cachedBB != null)
        return this.cachedBB;
    return super.getRenderBoundingBox();
}
项目:Qbar    文件:MultiblockComponent.java   
private BlockPos internalGetCoreOffset(EnumFacing facing)
{
    BlockPos rtn = BlockPos.ORIGIN;

    if (this.getLength() % 2 == 0 || this.getWidth() % 2 == 0)
    {
        if (this.getWidth() % 2 == 0 && facing.getAxis() == Axis.Z
                && facing.getAxisDirection() == AxisDirection.NEGATIVE)
            rtn = rtn.add(-1, 0, 0);
        if (this.getWidth() % 2 == 0 && facing.getAxis() == Axis.X
                && facing.getAxisDirection() == AxisDirection.POSITIVE)
            rtn = rtn.add(0, 0, -1);
        if (this.getLength() % 2 == 0 && facing.getAxis() == Axis.Z
                && facing.getAxisDirection() == AxisDirection.NEGATIVE)
            rtn = rtn.add(0, 0, -1);
        if (this.getLength() % 2 == 0 && facing.getAxis() == Axis.X
                && facing.getAxisDirection() == AxisDirection.NEGATIVE)
            rtn = rtn.add(-1, 0, 0);
    }
    return rtn;
}
项目:Qbar    文件:MultiblockComponent.java   
public Iterable<BlockPos> getAllInBox(BlockPos pos, final EnumFacing facing)
{
    Iterable<BlockPos> searchables = null;

    pos = pos.add(this.getCoreOffset(facing));
    if (facing.getAxis() == Axis.Z)
        searchables = BlockPos.getAllInBox(
                pos.subtract(new Vec3i(this.getOffsetX(), this.getOffsetY(), this.getOffsetZ())),
                pos.add(this.getWidth() - 1 - this.getOffsetX(), this.getHeight() - 1 - this.getOffsetY(),
                        this.getLength() - 1 - this.getOffsetZ()));
    else
        searchables = BlockPos.getAllInBox(
                pos.subtract(new Vec3i(this.getOffsetZ(), this.getOffsetY(), this.getOffsetX())),
                pos.add(this.getLength() - 1 - this.getOffsetZ(), this.getHeight() - 1 - this.getOffsetY(),
                        this.getWidth() - 1 - this.getOffsetX()));
    return searchables;
}
项目:TeleToro    文件:ItemTeletoryPortalLinker.java   
public static ControlBlockLocation findControllerBlock(World world, BlockPos pos, SizerFactory sizerFactory) {
    Size size = sizerFactory.get(world, pos, Axis.X);

    ControlBlockLocation loc = new ControlBlockLocation();

    if (size.isValid()) {
        loc.pos = size.getBottomLeft();
        loc.axis = Axis.X;
        return loc;
    }

    size = sizerFactory.get(world, pos, Axis.Z);

    if (size.isValid()) {
        loc.pos = size.getBottomLeft();
        loc.axis = Axis.Z;
        return loc;
    }

    return null;
}
项目:TeleToro    文件:BlockAbstractPortal.java   
public boolean trySpawnPortal(World worldIn, BlockPos pos) {
    Size size = getSizer(worldIn, pos, EnumFacing.Axis.X);

    if (size.isValid() && size.portalBlockCount == 0) {
        size.placePortalBlocks();
        return true;
    } else {
        Size size1 = getSizer(worldIn, pos, EnumFacing.Axis.Z);

        if (size1.isValid() && size1.portalBlockCount == 0) {
            size1.placePortalBlocks();
            return true;
        } else {
            return false;
        }
    }
}
项目:TeleToro    文件:BlockAbstractPortal.java   
/**
 * Returns the blockstate with the given rotation from the passed
 * blockstate. If inapplicable, returns the passed blockstate.
 */
public IBlockState withRotation(IBlockState state, Rotation rot) {
    switch (rot) {
    case COUNTERCLOCKWISE_90:
    case CLOCKWISE_90:

        switch ((EnumFacing.Axis) state.getValue(AXIS)) {
        case X:
            return state.withProperty(AXIS, EnumFacing.Axis.Z);
        case Z:
            return state.withProperty(AXIS, EnumFacing.Axis.X);
        default:
            return state;
        }

    default:
        return state;
    }
}
项目:Toms-Mod    文件:VillageHouseScientist.java   
protected boolean placeChest(World world, StructureBoundingBox box, Random rand, int x, int y, int z, EnumFacing f, boolean a) {
    int i1 = this.getXWithOffset(x, z);
    int j1 = this.getYWithOffset(y);
    int k1 = this.getZWithOffset(x, z);
    BlockPos pos = new BlockPos(i1, j1, k1);
    if (f.getAxis() == Axis.Y)
        f = EnumFacing.NORTH;
    if (box.isVecInside(pos) && (world.getBlockState(pos).getBlock() != Blocks.CHEST)) {
        world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, f), 2);
        TileEntity tile = world.getTileEntity(pos);
        if (tile instanceof TileEntityChest)
            ((TileEntityChest) tile).setLootTable(a ? loot2 : rand.nextInt(10) < 2 ? lootB : loot, rand.nextLong());
        return true;
    } else
        return false;
}
项目:Toms-Mod    文件:TabletAccessPoint.java   
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState bs, EntityLivingBase entity, ItemStack itemstack) {
    EnumFacing l = TomsModUtils.getDirectionFacing(entity, true);
    EnumFacing s = l;
    if (l.getAxis() == Axis.Y)
        s = l.getOpposite();
    world.setBlockState(pos, bs.withProperty(FACING, s).withProperty(ACTIVE, false), 2);
    TileEntityTabletAccessPoint te = (TileEntityTabletAccessPoint) world.getTileEntity(pos);
    int d = l.ordinal();
    te.d = l;
    if (d == 5)
        te.direction = 4;
    else if (d == 4)
        te.direction = 5;
    else if (d == 3)
        te.direction = 2;
    else if (d == 2)
        te.direction = 3;
    else if (d == 0)
        te.direction = 1;
    else if (d == 1)
        te.direction = 0;
}
项目:MrCrayfishSkateboardingMod    文件:EntitySkateboard.java   
public void moveToDirectionCenter(float yaw)
{
    EnumFacing facing = EnumFacing.fromAngle(yaw);
    Axis axis = facing.getAxis();
    switch(axis)
    {
    case X:
        this.motionX = 0;
        this.lastTickPosX = this.prevPosX = this.posX = Math.floor(posX) + 0.5;
        PacketHandler.INSTANCE.sendToServer(new MessageUpdatePos(getEntityId(), Math.floor(posX) + 0.5, posY, posZ));
        break;
    case Z:
        this.motionZ = 0;
        this.lastTickPosZ = this.prevPosZ = this.posZ = Math.floor(posZ) + 0.5;
        PacketHandler.INSTANCE.sendToServer(new MessageUpdatePos(getEntityId(), posX, posY, Math.floor(posZ) + 0.5));
        break;
    default:
        break;
    }
    this.updateBoundingBox(posX, posY, posZ);
    this.updatePassenger(getControllingPassenger());
}
项目:MrCrayfishSkateboardingMod    文件:QuadHelper.java   
/**
    * Get the index of this horizontal facing (0-3). The order is S0-W1-N2-E3
    */
public EnumFacing rotateFacing(EnumFacing side)
{
    if(side.getAxis() == Axis.Y) return side;

    switch(facing)
    {
    case NORTH:
        return side.rotateYCCW();
    case WEST:
        return side.getOpposite();
    case SOUTH:
        return side.rotateY();
    default:
        return side;
    }
}
项目:Culinary-Cultivation    文件:TileEntitySeparator.java   
public void checkForFanHousing() {
    //Reset
    isMultiblockFormed = false;

    IBlockState state = world.getBlockState(pos);
    BlockPos left = pos.offset(state.getValue(BlockSeparator.FACING).rotateAround(Axis.Y));
    IBlockState leftState = world.getBlockState(left);
    if (leftState.getBlock() == ModBlocks.FAN_HOUSING) {
        EnumFacing leftFacing = leftState.getValue(BlockFanHousing.FACING);
        EnumFacing thisFacing = state.getValue(BlockSeparator.FACING);
        if (leftFacing == thisFacing) {
            isMultiblockFormed = true;
        }
    }
    this.markDirty();
}
项目:Culinary-Cultivation    文件:TileEntitySeparator.java   
public void onPowered() {
    ItemStack input = inventory.get(0);
    if (!input.isEmpty()) {
        if (timer >= 20) {
            timer = 0;

            WinnowingMachineRecipe recipe = WinnowingMachineRecipes.instance().getProcessingResult(input);
            if (recipe != null) {
                IBlockState state = world.getBlockState(getPos());
                ItemStack output = recipe.getOutput().get();
                ItemStack junk = recipe.getJunk().get();
                EnumFacing facing = state.getValue(BlockFanHousing.FACING);
                if (!output.isEmpty()) outputItems(output, getPos(), facing);
                if (!junk.isEmpty()) outputItems(junk, getPos(), facing.rotateAround(Axis.Y).getOpposite());
                ItemStackHelper.getAndSplit(inventory, 0, 1); //Decrease by 1
            }
        } else timer++;
    }
}
项目:MrCrayfishSkateboardingMod    文件:EntitySkateboard.java   
public void moveToDirectionCenter(float yaw)
{
    EnumFacing facing = EnumFacing.fromAngle(yaw);
    Axis axis = facing.getAxis();
    switch(axis)
    {
    case X:
        this.motionX = 0;
        this.lastTickPosX = this.prevPosX = this.posX = Math.floor(posX) + 0.5;
        PacketHandler.INSTANCE.sendToServer(new MessageUpdatePos(getEntityId(), Math.floor(posX) + 0.5, posY, posZ));
        break;
    case Z:
        this.motionZ = 0;
        this.lastTickPosZ = this.prevPosZ = this.posZ = Math.floor(posZ) + 0.5;
        PacketHandler.INSTANCE.sendToServer(new MessageUpdatePos(getEntityId(), posX, posY, Math.floor(posZ) + 0.5));
        break;
    default:
        break;
    }
    this.updateBoundingBox(posX, posY, posZ);
    this.updatePassenger(getControllingPassenger());
}
项目:MrCrayfishSkateboardingMod    文件:QuadHelper.java   
/**
    * Get the index of this horizontal facing (0-3). The order is S0-W1-N2-E3
    */
public EnumFacing rotateFacing(EnumFacing side)
{
    if(side.getAxis() == Axis.Y) return side;

    switch(facing)
    {
    case NORTH:
        return side.rotateYCCW();
    case WEST:
        return side.getOpposite();
    case SOUTH:
        return side.rotateY();
    default:
        return side;
    }
}
项目:taam    文件:SlotMatrix.java   
/**
 * Checks a rotated state of this matrix. Vertical Axis is ignored &
 * considered unrotated.
 *
 * @param slot
 * @param rotation
 * @return
 */
public boolean isSlotAvailable(int slot, EnumFacing rotation) {
    // Non-Rotation can be skipped, also if we are the ALL instance.
    if (rotation.getAxis() == Axis.Y || this == ALL) {
        return isSlotAvailable(slot);
    }

    if (rotated == null) {
        calculateRotations();
    }
    // Horizontal Index: S-W-N-E
    boolean[] slots = rotated[rotation.getHorizontalIndex()];

    slot = MathHelper.clamp_int(slot, 0, 8);

    return slots[slot];
}
项目:taam    文件:ConveyorUtil.java   
public static RedirectorSide getRedirectorSide(EnumFacing dir, EnumFacing hitSide, float hitX, float hitY,
        float hitZ, boolean topOnly) {
    EnumFacing sideToConsider = hitSide;

    if (hitSide == EnumFacing.UP) {
        if (dir.getAxis() == Axis.Z) {
            // We look in Z direction, need to check X
            sideToConsider = hitX > 0.5 ? EnumFacing.EAST : EnumFacing.WEST;
        } else {
            // We look in X direction, need to check Z
            sideToConsider = hitZ > 0.5 ? EnumFacing.SOUTH : EnumFacing.NORTH;
        }
    } else if (topOnly) {
        return RedirectorSide.None;
    }

    if (sideToConsider == dir.rotateY()) {
        return topOnly ? RedirectorSide.None : RedirectorSide.Right;
    } else if (sideToConsider == dir.rotateYCCW()) {
        return topOnly ? RedirectorSide.None : RedirectorSide.Left;
    } else {
        return RedirectorSide.None;
    }
}
项目:taam    文件:MachineTank.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
    if (capability == Taam.CAPABILITY_PIPE) {
        if (facing == EnumFacing.UP) {
            return (T) pipeEndUP;
        } else if (facing == EnumFacing.DOWN) {
            return (T) pipeEndDOWN;
        } else {
            return null;
        }
    }
    if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && facing.getAxis() == Axis.Y) {
        return (T) tank;
    }
    if (capability == Taam.CAPABILITY_RENDER_TANK) {
        tankRI.setInfo(tank);
        return (T) tankRI.asArray();
    }
    return null;
}
项目:EnderIO    文件:BlockConduitBundle.java   
@SideOnly(Side.CLIENT)
private void addBlockHitEffects(@Nonnull World world, @Nonnull ParticleManager effectRenderer, double xCoord, double yCoord, double zCoord,
    @Nonnull EnumFacing sideEnum, @Nonnull TextureAtlasSprite tex) {

  double d0 = xCoord;
  double d1 = yCoord;
  double d2 = zCoord;
  if (sideEnum.getAxis() != Axis.X) {
    d0 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }
  if (sideEnum.getAxis() != Axis.Y) {
    d1 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }
  if (sideEnum.getAxis() != Axis.Z) {
    d2 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }

  ParticleDigging digFX = (ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1,
      d2, 0, 0, 0, 0);
  if (digFX != null) {
    digFX.init().multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
    digFX.setParticleTexture(tex);
  }
}
项目:pnc-repressurized    文件:BlockPneumaticCraft.java   
@Override
public boolean rotateBlock(World world, EntityPlayer player, BlockPos pos, EnumFacing side) {
    if (player.isSneaking()) {
        if (!player.capabilities.isCreativeMode) dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
        world.setBlockToAir(pos);
        return true;
    } else {
        if (isRotatable()) {
            IBlockState state = world.getBlockState(pos);
            if (!rotateCustom(world, pos, state, side)) {
                if (rotateForgeWay()) {
                    if (!canRotateToTopOrBottom()) side = EnumFacing.UP;
                    if (getRotation(world, pos).getAxis() != side.getAxis()) {
                        setRotation(world, pos, getRotation(world, pos).rotateAround(side.getAxis()));
                    }
                } else {
                    EnumFacing f = getRotation(world, pos);
                    do {
                        f = EnumFacing.getFront(f.ordinal() + 1);
                    } while (!canRotateToTopOrBottom() && f.getAxis() == Axis.Y);
                    setRotation(world, pos, f);
                }
                TileEntityBase te = (TileEntityBase) world.getTileEntity(pos);
                if (te != null) te.onBlockRotated();
            }
            return true;
        } else {
            return false;
        }
    }
}
项目:pnc-repressurized    文件:BlockElevatorCaller.java   
private void updateElevatorButtons(World world, BlockPos pos) {
    for (EnumFacing dir : EnumFacing.VALUES) {
        if (dir.getAxis() != Axis.Y) {
            TileEntityElevatorBase elevator = getElevatorBase(world, pos.offset(dir).offset(EnumFacing.DOWN, 2));
            if (elevator != null) {
                elevator.updateFloors();
            }
        }
    }
}
项目:ExPetrum    文件:BlockLog.java   
@Override
public void initBlock()
{
    this.setHardness(6);
    this.setRegistryName(createRegistryLocation());
    this.setResistance(6);
    this.setSoundType(SoundType.WOOD);
    this.setUnlocalizedName(this.getRegistryName().toString().replace(':', '.'));
    this.setCreativeTab(ExPCreativeTabs.tabPlantlife);
    this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, Axis.Y).withProperty(ExPBlockProperties.TREE_TYPE, EnumTreeType.values()[this.logIndex * 5]));
    Blocks.FIRE.setFireInfo(this, 5, 5);
}
项目:ExPetrum    文件:BlockLog.java   
@Override
public void dropLogItem(World w, IBlockState state, Vec3d at)
{
    state = state.withProperty(AXIS, Axis.Y);
    EntityItem item = new EntityItem(w, at.x, at.y, at.z, new ItemStack(ExPBlocks.logsDeco[this.logIndex], 1, this.getMetaFromState(state)));
    if (!w.isRemote)
    {
        w.spawnEntity(item);
    }
}
项目:metamorph    文件:ShulkerBullet.java   
@Override
public void execute(EntityLivingBase target, @Nullable AbstractMorph morph)
{
    World world = target.worldObj;

    if (world.isRemote)
    {
        return;
    }

    if (target instanceof EntityPlayer && ((EntityPlayer) target).getCooledAttackStrength(0.0F) < 1)
    {
        return;
    }

    Entity toShoot = EntityUtils.getTargetEntity(target, 32);

    if (toShoot != null)
    {
        target.playSound(SoundEvents.ENTITY_SHULKER_SHOOT, 2.0F, (target.getRNG().nextFloat() - target.getRNG().nextFloat()) * 0.2F + 1.0F);

        EntityShulkerBullet fireball = new EntityShulkerBullet(world, target, toShoot, Axis.Z);

        fireball.posX = target.posX;
        fireball.posZ = target.posZ;

        world.spawnEntityInWorld(fireball);
    }

    if (target instanceof EntityPlayer)
    {
        ((EntityPlayer) target).resetCooldown();
    }
}
项目:ToroChess    文件:CheckerBoardGenerator.java   
private void placePodium(EnumFacing facing) {
  block = BORDER;
  drawLine(Axis.X, 2);

  block = Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, facing);
  y++;
  drawLine(Axis.X, -2);
}
项目:ToroChess    文件:CheckerBoardGenerator.java   
private void placeBorderBlocks() {
  block = BORDER;
  y = 0;
  z = x = -1;
  drawLine(Axis.X, 10);
  drawLine(Axis.Z, 10);
  drawLine(Axis.X, -10);
  drawLine(Axis.Z, -10);
}
项目:ToroChess    文件:CheckerBoardGenerator.java   
private void incrementAxis(Axis axis, int amount) {
  switch (axis) {
    case X:
      x += amount;
      break;
    case Y:
      y += amount;
      break;
    case Z:
      z += amount;
      break;
    default:
      break;
  }
}
项目:ToroQuest    文件:Canvas.java   
@Override
public void rectangle(Axis normalAxis, BlockPos pos, int width, int depth) {

    moveTo(pos);
    line(X, width);
    line(Z, depth);
    line(X, -width);
    line(Z, -depth);


}
项目:ToroQuest    文件:Canvas.java   
private void incrementAxis(Axis axis, int amount) {
    switch (axis) {
    case X:
        x += amount;
        break;
    case Y:
        y += amount;
        break;
    case Z:
        z += amount;
        break;
    default:
        break;
    }
}
项目:Qbar    文件:TileOffshorePump.java   
@Override
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing)
{
    if (facing == EnumFacing.UP && capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
        return true;
    if (capability == CapabilitySteamHandler.STEAM_HANDLER_CAPABILITY
            && facing == this.getFacing().rotateAround(Axis.Y).getOpposite())
        return true;
    return super.hasCapability(capability, facing);
}
项目:Qbar    文件:TileOffshorePump.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing)
{
    if (facing == EnumFacing.UP && capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
        return (T) this.tank;
    if (capability == CapabilitySteamHandler.STEAM_HANDLER_CAPABILITY
            && facing == this.getFacing().rotateAround(Axis.Y).getOpposite())
        return (T) this.steamTank;
    return super.getCapability(capability, facing);
}
项目:Qbar    文件:BlockBelt.java   
@Override
public void onEntityWalk(final World w, final BlockPos pos, final Entity e)
{
    if (this.getWorldTile(w, pos).isWorking())
    {
        final double speed = ((TileBelt) w.getTileEntity(pos)).getBeltSpeed();
        final EBeltDirection facing = (EBeltDirection) w.getBlockState(pos).getProperties().get(BlockBelt.FACING);

        if (facing.toFacing().getAxis().equals(Axis.X))
            e.motionX += facing.equals(EBeltDirection.EAST) ? speed : -speed;
        else
            e.motionZ += facing.equals(EBeltDirection.SOUTH) ? speed : -speed;
    }
}
项目:Qbar    文件:BlockBelt.java   
@Override
public boolean onWrench(final EntityPlayer player, final World world, final BlockPos pos, final EnumHand hand,
                        final EnumFacing facing, final IBlockState state, ItemStack wrench)
{
    if (player.isSneaking())
        this.setSlopState(world, pos, this.getSlopState(state).cycle());
    else
        this.rotateBlock(world, pos, this.getFacing(state).toFacing().rotateAround(Axis.Y));
    return true;
}