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


Java EnumFacing.getOpposite方法代码示例

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


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

示例1: addToNewDoorsList

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
private void addToNewDoorsList(BlockPos doorBlock)
{
    EnumFacing enumfacing = BlockDoor.getFacing(this.worldObj, doorBlock);
    EnumFacing enumfacing1 = enumfacing.getOpposite();
    int i = this.countBlocksCanSeeSky(doorBlock, enumfacing, 5);
    int j = this.countBlocksCanSeeSky(doorBlock, enumfacing1, i + 1);

    if (i != j)
    {
        this.newDoors.add(new VillageDoorInfo(doorBlock, i < j ? enumfacing : enumfacing1, this.tickCounter));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:VillageCollection.java

示例2: randomDisplayTick

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    double d0 = (double)pos.getX() + 0.5D;
    double d1 = (double)pos.getY() + 0.7D;
    double d2 = (double)pos.getZ() + 0.5D;
    double d3 = 0.22D;
    double d4 = 0.27D;

    if (enumfacing.getAxis().isHorizontal())
    {
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]);
    }
    else
    {
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:BlockTorch.java

示例3: randomDisplayTick

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (this.isOn)
    {
        double d0 = (double)pos.getX() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D;
        double d1 = (double)pos.getY() + 0.7D + (rand.nextDouble() - 0.5D) * 0.2D;
        double d2 = (double)pos.getZ() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D;
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);

        if (enumfacing.getAxis().isHorizontal())
        {
            EnumFacing enumfacing1 = enumfacing.getOpposite();
            double d3 = 0.27D;
            d0 += 0.27D * (double)enumfacing1.getFrontOffsetX();
            d1 += 0.22D;
            d2 += 0.27D * (double)enumfacing1.getFrontOffsetZ();
        }

        worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:BlockRedstoneTorch.java

示例4: 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 (((Boolean)state.getValue(OPEN)).booleanValue())
    {
        state = state.withProperty(OPEN, Boolean.valueOf(false));
        worldIn.setBlockState(pos, state, 2);
    }
    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, 2);
    }

    worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
    return true;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:BlockFenceGate.java

示例5: BlockPistonStructureHelper

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public BlockPistonStructureHelper(World worldIn, BlockPos posIn, EnumFacing pistonFacing, boolean extending)
{
    this.world = worldIn;
    this.pistonPos = posIn;

    if (extending)
    {
        this.moveDirection = pistonFacing;
        this.blockToMove = posIn.offset(pistonFacing);
    }
    else
    {
        this.moveDirection = pistonFacing.getOpposite();
        this.blockToMove = posIn.offset(pistonFacing, 2);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:BlockPistonStructureHelper.java

示例6: canConnectTo

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
protected static boolean canConnectTo(IBlockState blockState, @Nullable EnumFacing side)
{
    Block block = blockState.getBlock();

    if (block == Blocks.REDSTONE_WIRE)
    {
        return true;
    }
    else if (Blocks.UNPOWERED_REPEATER.isSameDiode(blockState))
    {
        EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING);
        return enumfacing == side || enumfacing.getOpposite() == side;
    }
    else
    {
        return Blocks.field_190976_dk == blockState.getBlock() ? side == blockState.getValue(BlockObserver.FACING) : blockState.canProvidePower() && side != null;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:BlockRedstoneWire.java

示例7: onChange

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public void onChange(){
    this.handlerPull = null;
    this.handlerPush = null;

    TileEntity from = this.worldObj.getTileEntity(this.pos.up());
    if(from != null && from.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)){
        this.handlerPull = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
    }

    IBlockState state = this.worldObj.getBlockState(this.pos);
    EnumFacing facing = state.getValue(BlockWopper.FACING);
    BlockPos toPos = this.pos.offset(facing);

    if(this.worldObj.isBlockLoaded(toPos)){
        TileEntity to = this.worldObj.getTileEntity(toPos);
        if(to != null){
            EnumFacing opp = facing.getOpposite();
            if(to.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, opp)){
                this.handlerPush = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, opp);
            }
        }
    }

    this.isEnabled = !Wopper.canBeDeactivated || this.worldObj.isBlockIndirectlyGettingPowered(this.pos) <= 0;
}
 
开发者ID:Ellpeck,项目名称:Wopper,代码行数:26,代码来源:TileEntityWopper.java

示例8: canConnectTo

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
protected static boolean canConnectTo(IBlockState blockState, EnumFacing side)
{
    Block block = blockState.getBlock();

    if (block == Blocks.redstone_wire)
    {
        return true;
    }
    else if (Blocks.unpowered_repeater.isAssociated(block))
    {
        EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING);
        return enumfacing == side || enumfacing.getOpposite() == side;
    }
    else
    {
        return block.canProvidePower() && side != null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:BlockRedstoneWire.java

示例9: setTargetPosition

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public void setTargetPosition(BlockPos targetpos, EnumFacing side) {
    EnumFacing facing = world.getBlockState(pos).getValue(BlockEmberEmitter.facing);
    if(side != facing.getOpposite()) {
        targets[side.getIndex()] = targetpos;
        markDirty();
    }
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:9,代码来源:TileEntityEmberBurst.java

示例10: match

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Calculates whether the given world position matches the pattern. Warning, fairly heavy function. @return a
 * BlockPattern.PatternHelper if found, null otherwise.
 */
public BlockPattern.PatternHelper match(World worldIn, BlockPos pos)
{
    LoadingCache<BlockPos, BlockWorldState> loadingcache = func_181627_a(worldIn, false);
    int i = Math.max(Math.max(this.palmLength, this.thumbLength), this.fingerLength);

    for (BlockPos blockpos : BlockPos.getAllInBox(pos, pos.add(i - 1, i - 1, i - 1)))
    {
        for (EnumFacing enumfacing : EnumFacing.values())
        {
            for (EnumFacing enumfacing1 : EnumFacing.values())
            {
                if (enumfacing1 != enumfacing && enumfacing1 != enumfacing.getOpposite())
                {
                    BlockPattern.PatternHelper blockpattern$patternhelper = this.checkPatternAt(blockpos, enumfacing, enumfacing1, loadingcache);

                    if (blockpattern$patternhelper != null)
                    {
                        return blockpattern$patternhelper;
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:BlockPattern.java

示例11: func_191110_a

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
private void func_191110_a(WoodlandMansionPieces.SimpleGrid p_191110_1_, int p_191110_2_, int p_191110_3_, EnumFacing p_191110_4_, int p_191110_5_)
{
    if (p_191110_5_ > 0)
    {
        p_191110_1_.func_191144_a(p_191110_2_, p_191110_3_, 1);
        p_191110_1_.func_191141_a(p_191110_2_ + p_191110_4_.getFrontOffsetX(), p_191110_3_ + p_191110_4_.getFrontOffsetZ(), 0, 1);

        for (int i = 0; i < 8; ++i)
        {
            EnumFacing enumfacing = EnumFacing.getHorizontal(this.field_191117_a.nextInt(4));

            if (enumfacing != p_191110_4_.getOpposite() && (enumfacing != EnumFacing.EAST || !this.field_191117_a.nextBoolean()))
            {
                int j = p_191110_2_ + p_191110_4_.getFrontOffsetX();
                int k = p_191110_3_ + p_191110_4_.getFrontOffsetZ();

                if (p_191110_1_.func_191145_a(j + enumfacing.getFrontOffsetX(), k + enumfacing.getFrontOffsetZ()) == 0 && p_191110_1_.func_191145_a(j + enumfacing.getFrontOffsetX() * 2, k + enumfacing.getFrontOffsetZ() * 2) == 0)
                {
                    this.func_191110_a(p_191110_1_, p_191110_2_ + p_191110_4_.getFrontOffsetX() + enumfacing.getFrontOffsetX(), p_191110_3_ + p_191110_4_.getFrontOffsetZ() + enumfacing.getFrontOffsetZ(), enumfacing, p_191110_5_ - 1);
                    break;
                }
            }
        }

        EnumFacing enumfacing1 = p_191110_4_.rotateY();
        EnumFacing enumfacing2 = p_191110_4_.rotateYCCW();
        p_191110_1_.func_191141_a(p_191110_2_ + enumfacing1.getFrontOffsetX(), p_191110_3_ + enumfacing1.getFrontOffsetZ(), 0, 2);
        p_191110_1_.func_191141_a(p_191110_2_ + enumfacing2.getFrontOffsetX(), p_191110_3_ + enumfacing2.getFrontOffsetZ(), 0, 2);
        p_191110_1_.func_191141_a(p_191110_2_ + p_191110_4_.getFrontOffsetX() + enumfacing1.getFrontOffsetX(), p_191110_3_ + p_191110_4_.getFrontOffsetZ() + enumfacing1.getFrontOffsetZ(), 0, 2);
        p_191110_1_.func_191141_a(p_191110_2_ + p_191110_4_.getFrontOffsetX() + enumfacing2.getFrontOffsetX(), p_191110_3_ + p_191110_4_.getFrontOffsetZ() + enumfacing2.getFrontOffsetZ(), 0, 2);
        p_191110_1_.func_191141_a(p_191110_2_ + p_191110_4_.getFrontOffsetX() * 2, p_191110_3_ + p_191110_4_.getFrontOffsetZ() * 2, 0, 2);
        p_191110_1_.func_191141_a(p_191110_2_ + enumfacing1.getFrontOffsetX() * 2, p_191110_3_ + enumfacing1.getFrontOffsetZ() * 2, 0, 2);
        p_191110_1_.func_191141_a(p_191110_2_ + enumfacing2.getFrontOffsetX() * 2, p_191110_3_ + enumfacing2.getFrontOffsetZ() * 2, 0, 2);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:WoodlandMansionPieces.java

示例12: onBlockPlaced

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    EnumFacing enumfacing = facing.getOpposite();

    if (enumfacing == EnumFacing.UP)
    {
        enumfacing = EnumFacing.DOWN;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ENABLED, Boolean.valueOf(true));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:BlockHopper.java

示例13: searchForConsumers

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public static void searchForConsumers(World world, BlockPos pos, EnumFacing dir, Set<BlockPos> searchedNodes, Set<BlockPos> consumers) {
	searchedNodes.add(pos); //Make sure we're on the list of searched nodes.
	BlockPos cur = pos;
	for(int i=0; i<16; i++) {
		cur = cur.offset(dir);
		if (!isAxle(world,cur)) {
			if (isConsumer(world,cur,dir)) {
				if (!searchedNodes.contains(cur)) {
					consumers.add(cur);
					searchedNodes.add(cur);
				}
				
				break;
			} else {
				if (isGearbox(world,cur)) {
					//Recursive search
					if (!searchedNodes.contains(cur)) {
						searchedNodes.add(cur);
						for(EnumFacing f : EnumFacing.values()) {
							if (f != dir.getOpposite()) searchForConsumers(world, cur, f, searchedNodes, consumers);
						}
					}
				}
				
				break;
			}
		}
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:30,代码来源:RotaryTransport.java

示例14: getHorizontalRotation

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public static Rotation getHorizontalRotation(EnumFacing from, EnumFacing to) {
	if(from.getAxis().isVertical() || to.getAxis().isVertical()) return Rotation.NONE;
	if(from.getOpposite() == to) {
		return Rotation.CLOCKWISE_180;
	} else if(from != to) {
		int indexFrom = from.getHorizontalIndex();
		int indexTo = to.getHorizontalIndex();
		if(indexFrom < indexTo || (indexFrom == 3 && indexTo == 0)) {
			return Rotation.CLOCKWISE_90;
		} else {
			return Rotation.COUNTERCLOCKWISE_90;
		}
	}
	return Rotation.NONE;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:16,代码来源:FacingHelper.java

示例15: correctFacing

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public IBlockState correctFacing(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = null;

    for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.offset(enumfacing1));

        if (iblockstate.getBlock() == this)
        {
            return state;
        }

        if (iblockstate.getBlock().isFullBlock())
        {
            if (enumfacing != null)
            {
                enumfacing = null;
                break;
            }

            enumfacing = enumfacing1;
        }
    }

    if (enumfacing != null)
    {
        return state.withProperty(FACING, enumfacing.getOpposite());
    }
    else
    {
        EnumFacing enumfacing2 = (EnumFacing)state.getValue(FACING);

        if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock())
        {
            enumfacing2 = enumfacing2.getOpposite();
        }

        if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock())
        {
            enumfacing2 = enumfacing2.rotateY();
        }

        if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock())
        {
            enumfacing2 = enumfacing2.getOpposite();
        }

        return state.withProperty(FACING, enumfacing2);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:52,代码来源:BlockChest.java


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