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


Java EnumFacing类代码示例

本文整理汇总了Java中net.minecraft.util.EnumFacing的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing类的具体用法?Java EnumFacing怎么用?Java EnumFacing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: calculateInputStrength

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:BlockRedstoneDiode.java

示例2: onBlockActivated

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
@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;
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:17,代码来源:BlockAnimusMaterializer.java

示例3: onBlockActivated

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:BlockFenceGate.java

示例4: onItemUse

import net.minecraft.util.EnumFacing; //导入依赖的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)
{
    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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:ItemFlintAndSteel.java

示例5: getMetaFromState

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:BlockRedstoneComparator.java

示例6: onBlockActivated

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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;
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:BlockChest.java

示例7: checkForDrop

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:BlockTorch.java

示例8: getFacing

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:BlockTrapDoor.java

示例9: getNextComponentZ

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:StructureNetherBridgePieces.java

示例10: getNextComponentZ

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:StructureNetherBridgePieces.java

示例11: shouldSideBeRendered

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:BlockFarmland.java

示例12: readStructureBaseNBT

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:StructureComponent.java

示例13: shouldExecute

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:32,代码来源:EntitySilverfish.java

示例14: getMetaFromState

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:34,代码来源:BlockTorch.java

示例15: getCollisionBoundingBox

import net.minecraft.util.EnumFacing; //导入依赖的package包/类
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));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:BlockFenceGate.java


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