net.minecraft.util.EnumFacing#DOWN源码实例Demo

下面列出了net.minecraft.util.EnumFacing#DOWN 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: enderutilities   文件: EntityUtils.java
public static EnumFacing getClosestLookingDirectionNotOnAxis(Entity entity, EnumFacing notOnAxis)
{
    EnumFacing facing = getClosestLookingDirection(entity);

    if (facing == notOnAxis || facing.getOpposite() == notOnAxis)
    {
        if (notOnAxis == EnumFacing.UP || notOnAxis == EnumFacing.DOWN)
        {
            facing = getHorizontalLookingDirection(entity);
        }
        else
        {
            facing = getVerticalLookingDirection(entity);
        }
    }

    return facing;
}
 
源代码2 项目: YouTubeModdingTutorial   文件: PuzzleTESR.java
private void setupRotation(IBlockState state) {
    EnumFacing facing = state.getValue(BlockPuzzle.FACING);
    if (facing == EnumFacing.UP) {
        GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, 0.0F, -0.68F);
    } else if (facing == EnumFacing.DOWN) {
        GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, 0.0F, -.184F);
    } else {
        float rotY = 0.0F;
        if (facing == EnumFacing.NORTH) {
            rotY = 180.0F;
        } else if (facing == EnumFacing.WEST) {
            rotY = 90.0F;
        } else if (facing == EnumFacing.EAST) {
            rotY = -90.0F;
        }
        GlStateManager.rotate(-rotY, 0.0F, 1.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.2500F, -0.4375F);
    }
}
 
源代码3 项目: TFC2   文件: BlockStairsTFC.java
@Override
public boolean isSideSolid(IBlockState state,IBlockAccess world, BlockPos pos, EnumFacing side)
{
	boolean flipped = state.getValue(BlockStairs.HALF) == EnumHalf.TOP;
	EnumShape shape = (EnumShape)state.getValue(BlockStairs.SHAPE);
	EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING);
	if (side == EnumFacing.UP) return flipped;
	if (side == EnumFacing.DOWN) return !flipped;
	if (facing == side) return true;
	if (flipped)
	{
		if (shape == EnumShape.INNER_LEFT) return side == facing.rotateYCCW();
		if (shape == EnumShape.INNER_RIGHT) return side == facing.rotateY();
	}
	else
	{
		if (shape == EnumShape.INNER_LEFT) return side == facing.rotateY();
		if (shape == EnumShape.INNER_RIGHT) return side == facing.rotateYCCW();
	}
	return false;
}
 
源代码4 项目: TFC2   文件: BlockStairsTFC.java
@Override
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
{
	if (net.minecraftforge.common.ForgeModContainer.disableStairSlabCulling)
		return super.doesSideBlockRendering(state, world, pos, face);

	if ( state.isOpaqueCube() )
		return true;

	state = this.getActualState(state, world, pos);

	EnumHalf half = state.getValue(BlockStairs.HALF);
	EnumFacing side = state.getValue(BlockStairs.FACING);
	EnumShape shape = state.getValue(BlockStairs.SHAPE);
	if (face == EnumFacing.UP) return half == EnumHalf.TOP;
	if (face == EnumFacing.DOWN) return half == EnumHalf.BOTTOM;
	if (shape == EnumShape.OUTER_LEFT || shape == EnumShape.OUTER_RIGHT) return false;
	if (face == side) return true;
	if (shape == EnumShape.INNER_LEFT && face.rotateY() == side) return true;
	if (shape == EnumShape.INNER_RIGHT && face.rotateYCCW() == side) return true;
	return false;
}
 
源代码5 项目: seppuku   文件: ScaffoldModule.java
private void placeBlock(BlockPos pos) {
    final Minecraft mc = Minecraft.getMinecraft();
    
    BlockPos[][] posit = {{pos.add(0, 0, 1), pos.add(0, 0, -1)}, {pos.add(0, 1, 0), pos.add(0, -1, 0)}, {pos.add(1, 0, 0),pos.add(-1, 0, 0)}};
    EnumFacing[][] facing = {{EnumFacing.NORTH, EnumFacing.SOUTH}, {EnumFacing.DOWN, EnumFacing.UP}, {EnumFacing.WEST, EnumFacing.EAST}}; // Facing reversed as blocks are placed while facing in the opposite direction

    for (int i=0; i<6; i++) {
        final Block block = mc.world.getBlockState(posit[i/2][i%2]).getBlock();
        final boolean activated = block.onBlockActivated(mc.world, pos, mc.world.getBlockState(pos), mc.player, EnumHand.MAIN_HAND, EnumFacing.UP, 0, 0, 0);
        if (block != null && block != Blocks.AIR && !(block instanceof BlockLiquid)) {
            if (activated)
                mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING));
            if (mc.playerController.processRightClickBlock(mc.player, mc.world, posit[i/2][i%2], facing[i/2][i%2], new Vec3d(0d, 0d, 0d), EnumHand.MAIN_HAND) != EnumActionResult.FAIL)
                mc.player.swingArm(EnumHand.MAIN_HAND);
            if (activated)
                mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING));
        }
    }
}
 
源代码6 项目: TFC2   文件: ItemWoodSupport.java
@Override
public boolean canPlaceBlockOnSide(World world, BlockPos clickedPos, EnumFacing clickedSide, EntityPlayer player, ItemStack is)
{
	if(super.canPlaceBlockOnSide(world, clickedPos, clickedSide, player, is))
	{
		BlockWoodSupport block = (BlockWoodSupport) this.block;
		IBlockState otherState = world.getBlockState(clickedPos);
		if(clickedSide == EnumFacing.UP || clickedSide == EnumFacing.DOWN)
		{
			return block.canBeSupportedBy(block.getDefaultState(), world.getBlockState(clickedPos));
		}
		else
		{
			//If we are placing this block on the side of another block then it needs to be a support beam block.
			if(otherState.getBlock() instanceof BlockWoodSupport)
			{
				BlockWoodSupport otherBlock = (BlockWoodSupport) otherState.getBlock();
				otherState = otherBlock.getActualState(otherState, world, clickedPos);
				if(!otherState.getValue(BlockWoodSupport.SPAN))
				{
					return true;
				}
			}
		}
	}
	return false;
}
 
源代码7 项目: TofuCraftReload   文件: TileEntityTFOven.java
@SuppressWarnings("unchecked")
@Override
@Nullable
public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing) {
    if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
        if (facing == EnumFacing.DOWN)
            return (T) handlerBottom;
        else if (facing == EnumFacing.UP)
            return (T) handlerTop;
        else
            return (T) handlerSide;
    return super.getCapability(capability, facing);
}
 
源代码8 项目: litematica   文件: EntityUtils.java
public static EnumFacing getClosestLookingDirection(Entity entity)
{
    if (entity.rotationPitch > 60.0f)
    {
        return EnumFacing.DOWN;
    }
    else if (-entity.rotationPitch > 60.0f)
    {
        return EnumFacing.UP;
    }

    return getHorizontalLookingDirection(entity);
}
 
源代码9 项目: TofuCraftReload   文件: TileEntityTFCompressor.java
@SuppressWarnings("unchecked")
@Override
@Nullable
public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing) {
    if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
        if (facing == EnumFacing.DOWN)
            return (T) handlerBottom;
        else if (facing == EnumFacing.UP)
            return (T) handlerTop;
        else
            return (T) handlerSide;
    return super.getCapability(capability, facing);
}
 
源代码10 项目: Valkyrien-Skies   文件: BlockNetworkRelay.java
/**
 * Convert the given metadata into a BlockState for this block
 */
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing enumfacing;

    switch (meta & 7) {
        case 0:
            enumfacing = EnumFacing.DOWN;
            break;
        case 1:
            enumfacing = EnumFacing.EAST;
            break;
        case 2:
            enumfacing = EnumFacing.WEST;
            break;
        case 3:
            enumfacing = EnumFacing.SOUTH;
            break;
        case 4:
            enumfacing = EnumFacing.NORTH;
            break;
        case 5:
        default:
            enumfacing = EnumFacing.UP;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
public EntityStationDeployedRocket(World world) {
	super(world);
	launchDirection = EnumFacing.DOWN;
	launchLocation = new HashedBlockPosition(0,0,0);
	atmText = new ModuleText(182, 114, "", 0x2d2d2d);
	gasId = 0;
	ticket = null;
}
 
public void assembleRocket() {

		if(bbCache == null || world.isRemote)
			return;
		//Need to scan again b/c something may have changed
		scanRocket(world, getPos(), bbCache);

		if(status != ErrorCodes.SUCCESS)
			return;
		StorageChunk storageChunk;

		//Breaks if nothing is there
		try {
			storageChunk = StorageChunk.cutWorldBB(world, bbCache);
		} catch(NegativeArraySizeException e) {
			return;
		}


		EntityStationDeployedRocket rocket = new EntityStationDeployedRocket(world, storageChunk, stats.copy(),bbCache.minX + (bbCache.maxX-bbCache.minX)/2f +.5f, getPos().getY() , bbCache.minZ + (bbCache.maxZ-bbCache.minZ)/2f +.5f);

		//TODO: setRocketDirection
		rocket.forwardDirection = RotatableBlock.getFront(world.getBlockState(getPos())).getOpposite();
		rocket.launchDirection = EnumFacing.DOWN;

		//Change engine direction
		for(int x = 0; x < storageChunk.getSizeX(); x++) {
			for(int y = 0; y < storageChunk.getSizeY(); y++) {
				for(int z = 0; z < storageChunk.getSizeZ(); z++) {

					BlockPos pos3 = new BlockPos(x,y,z);
					if(storageChunk.getBlockState(pos3).getBlock() instanceof BlockRocketMotor ) {
						storageChunk.setBlockState(pos3, storageChunk.getBlockState(pos3).withProperty(BlockFullyRotatable.FACING, rocket.forwardDirection)  );
					}
				}		
			}	
		}

		world.spawnEntity(rocket);
		NBTTagCompound nbtdata = new NBTTagCompound();

		rocket.writeToNBT(nbtdata);
		PacketHandler.sendToNearby(new PacketEntity((INetworkEntity)rocket, (byte)0, nbtdata), rocket.world.provider.getDimension(), this.pos, 64);

		stats.reset();
		this.status = ErrorCodes.UNSCANNED;
		this.markDirty();

		for(IInfrastructure infrastructure : getConnectedInfrastructure()) {
			rocket.linkInfrastructure(infrastructure);
		}
	}
 
源代码13 项目: ClientBase   文件: WrapperEnumFacing.java
public WrapperEnumFacing getDOWN() {
    return new WrapperEnumFacing(EnumFacing.DOWN);
}
 
源代码14 项目: Signals   文件: BlockCartHopper.java
@Override
public int getWeakPower(IBlockState state, IBlockAccess worldIn, BlockPos pos, EnumFacing side){
    if(side != EnumFacing.UP && side != EnumFacing.DOWN) return 0;
    TileEntityCartHopper cartHopper = (TileEntityCartHopper)worldIn.getTileEntity(pos);
    return cartHopper.emitsRedstone() ? 15 : 0;
}
 
@Override
public int[] getSlotsForFace(EnumFacing side) {
	if(side == EnumFacing.DOWN)
		return  new int[]{1};
	return  new int[]{0}; 
}
 
源代码16 项目: enderutilities   文件: ItemEnderTool.java
public boolean useHoe(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side)
{
    if (player.canPlayerEdit(pos, side, stack) == false)
    {
        return false;
    }

    int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, player, world, pos);
    if (hook != 0)
    {
        return hook > 0;
    }

    IBlockState state = world.getBlockState(pos);
    Block block = state.getBlock();

    if (side != EnumFacing.DOWN && world.isAirBlock(pos.up()))
    {
        IBlockState newBlockState = null;

        if (block == Blocks.GRASS)
        {
            newBlockState = Blocks.FARMLAND.getDefaultState();
        }
        else if (block == Blocks.DIRT)
        {
            if (state.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT ||
                state.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.COARSE_DIRT)
            {
                newBlockState = Blocks.FARMLAND.getDefaultState();
            }
            else
            {
                return false;
            }
        }
        else
        {
            return false;
        }

        if (newBlockState != null)
        {
            world.setBlockState(pos, newBlockState, 3);
            this.addToolDamage(stack, 1, player, player);

            world.playSound(null, pos.getX() + 0.5d, pos.getY() + 0.5d, pos.getZ() + 0.5d,
                    SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0f, 1.0f);

            return true;
        }
    }

    return false;
}
 
源代码17 项目: TofuCraftReload   文件: TileEntityTFOven.java
/**
 * Returns true if automation can extract the given item in the given slot from the given side.
 */
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
    if (direction == EnumFacing.DOWN && index == 1) return true;
    return false;
}
 
源代码18 项目: enderutilities   文件: EntityUtils.java
public static EnumFacing getVerticalLookingDirection(Entity entity)
{
    return entity.rotationPitch > 0 ? EnumFacing.DOWN : EnumFacing.UP;
}
 
源代码19 项目: enderutilities   文件: BlockPosEU.java
public BlockPosEU(int x, int y, int z, int dim)
{
    this(x, y, z, dim, EnumFacing.DOWN);
}
 
源代码20 项目: customstuff4   文件: BlockWall.java
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
    return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE_THICK : BlockFaceShape.CENTER_BIG;
}