當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。