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

项目:Backmemed    文件:BlockRedstoneDiode.java   
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    int i = worldIn.getRedstonePower(blockpos, enumfacing);

    if (i >= 15)
    {
        return i;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(blockpos);
        return Math.max(i, iblockstate.getBlock() == Blocks.REDSTONE_WIRE ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0);
    }
}
项目:ArcaneMagic    文件:BlockAnimusMaterializer.java   
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
        EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (world.isRemote)
    {
        return true;
    }
    TileEntity te = world.getTileEntity(pos);
    if (!(te instanceof TileEntityAnimusMaterializer))
    {
        return false;
    }
    player.openGui(ArcaneMagic.instance, GUI_ID, world, pos.getX(), pos.getY(), pos.getZ());
    return true;
}
项目:Backmemed    文件:BlockFenceGate.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
    if (((Boolean)state.getValue(OPEN)).booleanValue())
    {
        state = state.withProperty(OPEN, Boolean.valueOf(false));
        worldIn.setBlockState(pos, state, 10);
    }
    else
    {
        EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw);

        if (state.getValue(FACING) == enumfacing.getOpposite())
        {
            state = state.withProperty(FACING, enumfacing);
        }

        state = state.withProperty(OPEN, Boolean.valueOf(true));
        worldIn.setBlockState(pos, state, 10);
    }

    worldIn.playEvent(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1008 : 1014, pos, 0);
    return true;
}
项目:BaseClient    文件:ItemFlintAndSteel.java   
/**
 * 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)
{
    pos = pos.offset(side);

    if (!playerIn.canPlayerEdit(pos, side, stack))
    {
        return false;
    }
    else
    {
        if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air)
        {
            worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
            worldIn.setBlockState(pos, Blocks.fire.getDefaultState());
        }

        stack.damageItem(1, playerIn);
        return true;
    }
}
项目:DecompiledMinecraft    文件:BlockRedstoneComparator.java   
/**
 * Convert the BlockState into the correct metadata value
 */
public int getMetaFromState(IBlockState state)
{
    int i = 0;
    i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();

    if (((Boolean)state.getValue(POWERED)).booleanValue())
    {
        i |= 8;
    }

    if (state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT)
    {
        i |= 4;
    }

    return i;
}
项目:BaseClient    文件:BlockChest.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
        EnumFacing side, float hitX, float hitY, float hitZ) {
    if (worldIn.isRemote) {
        return true;
    } else {
        ILockableContainer ilockablecontainer = this.getLockableContainer(worldIn, pos);

        if (ilockablecontainer != null) {
            playerIn.displayGUIChest(ilockablecontainer);

            if (this.chestType == 0) {
                playerIn.triggerAchievement(StatList.field_181723_aa);
            } else if (this.chestType == 1) {
                playerIn.triggerAchievement(StatList.field_181737_U);
            }
        }

        return true;
    }
}
项目:Backmemed    文件:BlockTorch.java   
protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state)
{
    if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, (EnumFacing)state.getValue(FACING)))
    {
        return true;
    }
    else
    {
        if (worldIn.getBlockState(pos).getBlock() == this)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
        }

        return false;
    }
}
项目:DecompiledMinecraft    文件:BlockTrapDoor.java   
protected static EnumFacing getFacing(int meta)
{
    switch (meta & 3)
    {
        case 0:
            return EnumFacing.NORTH;

        case 1:
            return EnumFacing.SOUTH;

        case 2:
            return EnumFacing.WEST;

        case 3:
        default:
            return EnumFacing.EAST;
    }
}
项目:CustomWorldGen    文件:StructureNetherBridgePieces.java   
/**
 * Gets the next component in the +/- Z direction
 */
protected StructureComponent getNextComponentZ(StructureNetherBridgePieces.Start p_74965_1_, List<StructureComponent> p_74965_2_, Random p_74965_3_, int p_74965_4_, int p_74965_5_, boolean p_74965_6_)
{
    EnumFacing enumfacing = this.getCoordBaseMode();

    if (enumfacing != null)
    {
        switch (enumfacing)
        {
            case NORTH:
                return this.generateAndAddPiece(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_);
            case SOUTH:
                return this.generateAndAddPiece(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_);
            case WEST:
                return this.generateAndAddPiece(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_);
            case EAST:
                return this.generateAndAddPiece(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_);
        }
    }

    return null;
}
项目:BaseClient    文件:StructureNetherBridgePieces.java   
protected StructureComponent getNextComponentZ(StructureNetherBridgePieces.Start p_74965_1_, List<StructureComponent> p_74965_2_, Random p_74965_3_, int p_74965_4_, int p_74965_5_, boolean p_74965_6_)
{
    if (this.coordBaseMode != null)
    {
        switch (this.coordBaseMode)
        {
            case NORTH:
                return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_);

            case SOUTH:
                return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_);

            case WEST:
                return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_);

            case EAST:
                return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_);
        }
    }

    return null;
}
项目:CustomWorldGen    文件:BlockFarmland.java   
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
    switch (side)
    {
        case UP:
            return true;
        case NORTH:
        case SOUTH:
        case WEST:
        case EAST:
            IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
            Block block = iblockstate.getBlock();
            return !iblockstate.isOpaqueCube() && block != Blocks.FARMLAND && block != Blocks.GRASS_PATH;
        default:
            return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
    }
}
项目:Backmemed    文件:StructureComponent.java   
/**
 * Reads and sets structure base data (boundingbox, {@link
 * net.minecraft.world.gen.structure.StructureComponent#coordBaseMode coordBase} and {@link
 * net.minecraft.world.gen.structure.StructureComponent#componentType componentType})
 */
public void readStructureBaseNBT(World worldIn, NBTTagCompound tagCompound)
{
    if (tagCompound.hasKey("BB"))
    {
        this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB"));
    }

    int i = tagCompound.getInteger("O");
    this.setCoordBaseMode(i == -1 ? null : EnumFacing.getHorizontal(i));
    this.componentType = tagCompound.getInteger("GD");
    this.readStructureFromNBT(tagCompound, worldIn.getSaveHandler().getStructureTemplateManager());
}
项目:DecompiledMinecraft    文件:EntitySilverfish.java   
public boolean shouldExecute()
{
    if (this.field_179485_a.getAttackTarget() != null)
    {
        return false;
    }
    else if (!this.field_179485_a.getNavigator().noPath())
    {
        return false;
    }
    else
    {
        Random random = this.field_179485_a.getRNG();

        if (random.nextInt(10) == 0)
        {
            this.facing = EnumFacing.random(random);
            BlockPos blockpos = (new BlockPos(this.field_179485_a.posX, this.field_179485_a.posY + 0.5D, this.field_179485_a.posZ)).offset(this.facing);
            IBlockState iblockstate = this.field_179485_a.worldObj.getBlockState(blockpos);

            if (BlockSilverfish.canContainSilverfish(iblockstate))
            {
                this.field_179484_c = true;
                return true;
            }
        }

        this.field_179484_c = false;
        return super.shouldExecute();
    }
}
项目:DecompiledMinecraft    文件:BlockTorch.java   
/**
 * Convert the BlockState into the correct metadata value
 */
public int getMetaFromState(IBlockState state)
{
    int i = 0;

    switch ((EnumFacing)state.getValue(FACING))
    {
        case EAST:
            i = i | 1;
            break;

        case WEST:
            i = i | 2;
            break;

        case SOUTH:
            i = i | 3;
            break;

        case NORTH:
            i = i | 4;
            break;

        case DOWN:
        case UP:
        default:
            i = i | 5;
    }

    return i;
}
项目:BaseClient    文件:BlockFenceGate.java   
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
    if (((Boolean)state.getValue(OPEN)).booleanValue())
    {
        return null;
    }
    else
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();
        return enumfacing$axis == EnumFacing.Axis.Z ? new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)((float)pos.getZ() + 0.375F), (double)(pos.getX() + 1), (double)((float)pos.getY() + 1.5F), (double)((float)pos.getZ() + 0.625F)) : new AxisAlignedBB((double)((float)pos.getX() + 0.375F), (double)pos.getY(), (double)pos.getZ(), (double)((float)pos.getX() + 0.625F), (double)((float)pos.getY() + 1.5F), (double)(pos.getZ() + 1));
    }
}
项目:CustomWorldGen    文件:Block.java   
/**
 * Currently only called by fire when it is on top of this block.
 * Returning true will prevent the fire from naturally dying during updating.
 * Also prevents firing from dying from rain.
 *
 * @param world The current world
 * @param pos Block position in world
 * @param metadata The blocks current metadata
 * @param side The face that the fire is coming from
 * @return True if this block sustains fire, meaning it will never go out.
 */
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
    if (this == net.minecraft.init.Blocks.NETHERRACK && side == EnumFacing.UP)
    {
        return true;
    }
    if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.BEDROCK && side == EnumFacing.UP)
    {
        return true;
    }
    return false;
}
项目:Backmemed    文件:BlockRedstoneComparator.java   
@Nullable
private EntityItemFrame findItemFrame(World worldIn, final EnumFacing facing, BlockPos pos)
{
    List<EntityItemFrame> list = worldIn.<EntityItemFrame>getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)), new Predicate<Entity>()
    {
        public boolean apply(@Nullable Entity p_apply_1_)
        {
            return p_apply_1_ != null && p_apply_1_.getHorizontalFacing() == facing;
        }
    });
    return list.size() == 1 ? (EntityItemFrame)list.get(0) : null;
}
项目:BaseClient    文件:S10PacketSpawnPainting.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityID = buf.readVarIntFromBuffer();
    this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.field_180001_A);
    this.position = buf.readBlockPos();
    this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
项目:rezolve    文件:RemoteShellOverlay.java   
@Override
public void draw() {

    GlStateManager.disableLighting();
    ScaledResolution scaled = new ScaledResolution(mc);
    int width = scaled.getScaledWidth();
    int height = scaled.getScaledHeight();

    BlockPos pos = this.entity.getClientActivatedMachine();
    ItemStack stack = null;

    if (pos != null)
        stack = RemoteShellGuiContainer.getItemFromBlock(this.entity, pos);

    int x = 4;
    int y = 4;

    if (stack == null) {
        x += drawText("No activated machine.  ", x, y, 0xFFAA00);
    } else {
        x += drawText(stack.getDisplayName()+"  ", x, y, 0xFFAA00);
    }

    this.remoteShellX = x;
    this.remoteShellY = y;
    x += (this.remoteShellWidth = drawText("Remote Shell ", x, 4, this.remoteShellColor));

    x += drawText(this.entity.getEnergyStored(EnumFacing.UP) +" RF ", x, y, 0xff4f63);

}
项目:BaseClient    文件:BlockModelRenderer.java   
private EnumNeighborInfo(String p_i5_3_, int p_i5_4_, EnumFacing[] p_i5_5_, float p_i5_6_, boolean p_i5_7_, BlockModelRenderer.Orientation[] p_i5_8_, BlockModelRenderer.Orientation[] p_i5_9_, BlockModelRenderer.Orientation[] p_i5_10_, BlockModelRenderer.Orientation[] p_i5_11_)
{
    this.field_178276_g = p_i5_5_;
    this.field_178288_h = p_i5_6_;
    this.field_178289_i = p_i5_7_;
    this.field_178286_j = p_i5_8_;
    this.field_178287_k = p_i5_9_;
    this.field_178284_l = p_i5_10_;
    this.field_178285_m = p_i5_11_;
}
项目:BaseClient    文件:BlockDispenser.java   
private void setDefaultDirection(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        boolean flag = worldIn.getBlockState(pos.north()).getBlock().isFullBlock();
        boolean flag1 = worldIn.getBlockState(pos.south()).getBlock().isFullBlock();

        if (enumfacing == EnumFacing.NORTH && flag && !flag1)
        {
            enumfacing = EnumFacing.SOUTH;
        }
        else if (enumfacing == EnumFacing.SOUTH && flag1 && !flag)
        {
            enumfacing = EnumFacing.NORTH;
        }
        else
        {
            boolean flag2 = worldIn.getBlockState(pos.west()).getBlock().isFullBlock();
            boolean flag3 = worldIn.getBlockState(pos.east()).getBlock().isFullBlock();

            if (enumfacing == EnumFacing.WEST && flag2 && !flag3)
            {
                enumfacing = EnumFacing.EAST;
            }
            else if (enumfacing == EnumFacing.EAST && flag3 && !flag2)
            {
                enumfacing = EnumFacing.WEST;
            }
        }

        worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing).withProperty(TRIGGERED, Boolean.valueOf(false)), 2);
    }
}
项目:BaseClient    文件:ItemRedstone.java   
/**
 * 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)
{
    boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
    BlockPos blockpos = flag ? pos : pos.offset(side);

    if (!playerIn.canPlayerEdit(blockpos, side, stack))
    {
        return false;
    }
    else
    {
        Block block = worldIn.getBlockState(blockpos).getBlock();

        if (!worldIn.canBlockBePlaced(block, blockpos, false, side, (Entity)null, stack))
        {
            return false;
        }
        else if (Blocks.redstone_wire.canPlaceBlockAt(worldIn, blockpos))
        {
            --stack.stackSize;
            worldIn.setBlockState(blockpos, Blocks.redstone_wire.getDefaultState());
            return true;
        }
        else
        {
            return false;
        }
    }
}
项目:BaseClient    文件:BlockStem.java   
/**
 * Get the actual Block state of this Block at the given position. This
 * applies properties not visible in the metadata, such as fence
 * connections.
 */
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    state = state.withProperty(FACING, EnumFacing.UP);

    for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
        EnumFacing enumfacing = (EnumFacing) enumfacing0;
        if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() == this.crop) {
            state = state.withProperty(FACING, enumfacing);
            break;
        }
    }

    return state;
}
项目:UniversalRemote    文件:WorldServerProxy.java   
@Override
public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) {
    if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) {
        return m_proxyWorld.isSideSolid(pos, side, _default);
    } else if (m_realWorld != null) {
        return m_realWorld.isSideSolid(pos, side, _default);
    } else {
        return super.isSideSolid(pos, side, _default);
    }
}
项目:BaseClient    文件:ConnectedTextures.java   
private static TextureAtlasSprite getConnectedTextureMultiPass(IBlockAccess p_getConnectedTextureMultiPass_0_, IBlockState p_getConnectedTextureMultiPass_1_, BlockPos p_getConnectedTextureMultiPass_2_, EnumFacing p_getConnectedTextureMultiPass_3_, TextureAtlasSprite p_getConnectedTextureMultiPass_4_, RenderEnv p_getConnectedTextureMultiPass_5_)
{
    TextureAtlasSprite textureatlassprite = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, p_getConnectedTextureMultiPass_4_, true, p_getConnectedTextureMultiPass_5_);

    if (!multipass)
    {
        return textureatlassprite;
    }
    else if (textureatlassprite == p_getConnectedTextureMultiPass_4_)
    {
        return textureatlassprite;
    }
    else
    {
        TextureAtlasSprite textureatlassprite1 = textureatlassprite;

        for (int i = 0; i < 3; ++i)
        {
            TextureAtlasSprite textureatlassprite2 = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, textureatlassprite1, false, p_getConnectedTextureMultiPass_5_);

            if (textureatlassprite2 == textureatlassprite1)
            {
                break;
            }

            textureatlassprite1 = textureatlassprite2;
        }

        return textureatlassprite1;
    }
}
项目:CustomWorldGen    文件:ItemFireball.java   
/**
 * 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)
{
    if (worldIn.isRemote)
    {
        return EnumActionResult.SUCCESS;
    }
    else
    {
        pos = pos.offset(facing);

        if (!playerIn.canPlayerEdit(pos, facing, stack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            if (worldIn.getBlockState(pos).getMaterial() == Material.AIR)
            {
                worldIn.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2F + 1.0F);
                worldIn.setBlockState(pos, Blocks.FIRE.getDefaultState());
            }

            if (!playerIn.capabilities.isCreativeMode)
            {
                --stack.stackSize;
            }

            return EnumActionResult.SUCCESS;
        }
    }
}
项目:ExPetrum    文件:BlockShrub.java   
@Override
public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
{
    IBlockState at = world.getBlockState(pos);
    IBlockState self = world.getBlockState(pos.offset(facing));
    return at.getBlock() instanceof IShrub  && ((IShrub)at.getBlock()).getShrubInternalType() == this.getShrubInternalType() && at.getValue(ExPBlockProperties.SHRUB_TYPE) == self.getValue(ExPBlockProperties.SHRUB_TYPE);
}
项目:CustomWorldGen    文件:SimpleBakedModel.java   
private void addGeneralQuads(IBlockState p_188645_1_, IBakedModel p_188645_2_, TextureAtlasSprite p_188645_3_, long p_188645_4_)
{
    for (BakedQuad bakedquad : p_188645_2_.getQuads(p_188645_1_, (EnumFacing)null, p_188645_4_))
    {
        this.addGeneralQuad(new BakedQuadRetextured(bakedquad, p_188645_3_));
    }
}
项目:pnc-repressurized    文件:TOPCallback.java   
public static void handlePressureTube(ProbeMode mode, IProbeInfo probeInfo, TileEntityPressureTube te, EnumFacing face) {
    if (face != null) {
        TubeModule module = te.modules[face.ordinal()];
        if (module != null) {
            IProbeInfo vert = probeInfo.vertical(new LayoutStyle().borderColor(0xFF4040FF).spacing(3));
            List<String> currenttip = new ArrayList<>();
            module.addInfo(currenttip);
            for (String s : currenttip) vert.text(s);
        }
    }
}
项目:DecompiledMinecraft    文件:RenderManager.java   
public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks)
{
    this.worldObj = worldIn;
    this.options = optionsIn;
    this.livingPlayer = livingPlayerIn;
    this.pointedEntity = pointedEntityIn;
    this.textRenderer = textRendererIn;

    if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping())
    {
        IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn));
        Block block = iblockstate.getBlock();

        if (block == Blocks.bed)
        {
            int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex();
            this.playerViewY = (float)(i * 90 + 180);
            this.playerViewX = 0.0F;
        }
    }
    else
    {
        this.playerViewY = livingPlayerIn.prevRotationYaw + (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks;
        this.playerViewX = livingPlayerIn.prevRotationPitch + (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks;
    }

    if (optionsIn.thirdPersonView == 2)
    {
        this.playerViewY += 180.0F;
    }

    this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks;
    this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks;
    this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks;
}
项目:rezolve    文件:MachineEntity.java   
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
    if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
        return (T) new MachineItemHandler(this);
    }

    return super.getCapability(capability, facing);
}
项目:DecompiledMinecraft    文件:BlockRedstoneTorch.java   
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (this.isOn)
    {
        for (EnumFacing enumfacing : EnumFacing.values())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
        }
    }
}
项目:Got-Wood    文件:BlockSpecialFire.java   
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && !canCatchFire(worldIn, pos.down(), EnumFacing.UP)) {
        return state.withProperty(NORTH, this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)).withProperty(EAST, this.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)).withProperty(SOUTH, this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)).withProperty(WEST, this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)).withProperty(UPPER, this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN));
    }
    return this.getDefaultState();
}
项目:Soot    文件:TileEntityAlchemyGlobe.java   
public EnumFacing getFacing()
{
    IBlockState state = world.getBlockState(pos);
    if(state.getBlock() instanceof BlockAlchemyGlobe)
        return state.getValue(BlockAlchemyGlobe.FACING);
    return null;
}
项目:Backmemed    文件:StructureOceanMonument.java   
private void create(World worldIn, Random random, int chunkX, int chunkZ)
{
    random.setSeed(worldIn.getSeed());
    long i = random.nextLong();
    long j = random.nextLong();
    long k = (long)chunkX * i;
    long l = (long)chunkZ * j;
    random.setSeed(k ^ l ^ worldIn.getSeed());
    int i1 = chunkX * 16 + 8 - 29;
    int j1 = chunkZ * 16 + 8 - 29;
    EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(random);
    this.components.add(new StructureOceanMonumentPieces.MonumentBuilding(random, i1, j1, enumfacing));
    this.updateBoundingBox();
    this.wasCreated = true;
}
项目:DecompiledMinecraft    文件:StructureOceanMonumentPieces.java   
public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_)
{
    if (p_175969_1_.field_175966_c[EnumFacing.NORTH.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d && p_175969_1_.field_175966_c[EnumFacing.UP.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d)
    {
        StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = p_175969_1_.field_175965_b[EnumFacing.NORTH.getIndex()];
        return structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.UP.getIndex()] && !structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d;
    }
    else
    {
        return false;
    }
}
项目:Wurst-MC-1.12    文件:BlockUtils.java   
public static boolean breakBlockSimple(BlockPos pos)
{
    Vec3d eyesPos = RotationUtils.getEyesPos();
    Vec3d posVec = new Vec3d(pos).addVector(0.5, 0.5, 0.5);
    double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);

    for(EnumFacing side : EnumFacing.values())
    {
        Vec3d hitVec =
            posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5));
        double distanceSqHitVec = eyesPos.squareDistanceTo(hitVec);

        // check if hitVec is within range (6 blocks)
        if(distanceSqHitVec > 36)
            continue;

        // check if side is facing towards player
        if(distanceSqHitVec >= distanceSqPosVec)
            continue;

        // AutoTool
        WurstClient.INSTANCE.mods.autoToolMod.setSlot(pos);

        // face block
        RotationUtils.faceVectorPacket(hitVec);

        // damage block
        if(!mc.playerController.onPlayerDamageBlock(pos, side))
            return false;

        // swing arm
        WPlayer.swingArmPacket();

        return true;
    }

    return false;
}
项目:UniversalRemote    文件:EntityPlayerProxy.java   
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
    if (m_realPlayer == null) {
        return super.getCapability(capability, facing);
    } else {
        return m_realPlayer.getCapability(capability, facing);
    }
}
项目:harshencastle    文件:TileEntityHarshenDimensionalPedestal.java   
@Override
public void tick() {
    boolean flag = handler.getStackInSlot(0).getItem() == Item.getItemFromBlock(Blocks.AIR);
    if(flag)
        timer = 0;
    if(flag != hasItem)
    {
        hasItem = flag;
        dirty();
    }
    if(isActive && workingRecipe != null && !flag)
        if(checkForCompleation(true))
        {
            BlockPos pos = workingRecipe.getPositionOfRitual();
            for(EnumFacing facing : EnumFacing.HORIZONTALS)
                if(!((TileEntityHarshenDimensionalPedestal)world.getTileEntity(pos.offset(facing))).getItem().isEmpty())
                    HarshenNetwork.sendToPlayersInWorld(world, new MessagePacketSpawnItemParticles(
                                    ((TileEntityHarshenDimensionalPedestal)world.getTileEntity(pos.offset(facing))).getItem(),
                                    new Vec3d(pos.offset(facing)).addVector(0.5, 0.85, 0.5),
                                    HarshenUtils.speedToPos(new Vec3d(pos.offset(facing)).addVector(0.5, 0.85, 0.5),
                                    new Vec3d(pos).addVector(0.5, 1, 0.5), 15D), 1f, false, 20, workingRecipe.getTag()));

            HarshenNetwork.sendToPlayersInWorld(world, new MessagePacketSpawnItemParticles(workingRecipe.getOutput(),
                    new Vec3d(pos).addVector(0.5, 1, 0.5), new Vec3d((randPos() - 0.5D) / 30D, (new Random().nextBoolean() ? -1 : 1 ) / 50D, (randPos() - 0.5D) / 30D), 1.5f, false,
                    (int) ((activeTimer / 20f) * (activeTimer / 20f)), workingRecipe.getTag()));
        }
        else
            deactivateAll();
    if(isActiveNonController)
        activeNonControllerTimer++;
}
项目:DecompiledMinecraft    文件:ItemDoor.java   
/**
 * 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)
{
    if (side != EnumFacing.UP)
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();

        if (!block.isReplaceable(worldIn, pos))
        {
            pos = pos.offset(side);
        }

        if (!playerIn.canPlayerEdit(pos, side, stack))
        {
            return false;
        }
        else if (!this.block.canPlaceBlockAt(worldIn, pos))
        {
            return false;
        }
        else
        {
            placeDoor(worldIn, pos, EnumFacing.fromAngle((double)playerIn.rotationYaw), this.block);
            --stack.stackSize;
            return true;
        }
    }
}