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


Java AxisDirection.NEGATIVE属性代码示例

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


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

示例1: internalGetCoreOffset

private BlockPos internalGetCoreOffset(EnumFacing facing)
{
    BlockPos rtn = BlockPos.ORIGIN;

    if (this.getLength() % 2 == 0 || this.getWidth() % 2 == 0)
    {
        if (this.getWidth() % 2 == 0 && facing.getAxis() == Axis.Z
                && facing.getAxisDirection() == AxisDirection.NEGATIVE)
            rtn = rtn.add(-1, 0, 0);
        if (this.getWidth() % 2 == 0 && facing.getAxis() == Axis.X
                && facing.getAxisDirection() == AxisDirection.POSITIVE)
            rtn = rtn.add(0, 0, -1);
        if (this.getLength() % 2 == 0 && facing.getAxis() == Axis.Z
                && facing.getAxisDirection() == AxisDirection.NEGATIVE)
            rtn = rtn.add(0, 0, -1);
        if (this.getLength() % 2 == 0 && facing.getAxis() == Axis.X
                && facing.getAxisDirection() == AxisDirection.NEGATIVE)
            rtn = rtn.add(-1, 0, 0);
    }
    return rtn;
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:21,代码来源:MultiblockComponent.java

示例2: onRuneActivatedbyPlayer

@Override
public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) {
	World world = player.world;
	if(!world.isRemote){
		//take xp if not negated
		if(!negated){
			if(player.experienceLevel>=10){
				player.addExperienceLevel(-10);
			}else{
				//kill the rune
				this.onPatternBrokenByPlayer(player);
				return;
			}
		}
		double x,y,z,offset=0.25;
		x=y=z=0;
		int dir = face.getAxisDirection()==AxisDirection.NEGATIVE? -1:1;
		switch(face.getAxis()){
		case X:x=offset*dir;
			break;
		case Y:y=offset*dir;
			break;
		case Z:z=offset*dir;
			break;
		}
		entity.setupStar(0xFFFFFF, 0xFFFFFF,1,1,new Vec3d(x, y, z));
		entity.setDrawStar(true);
	}
}
 
开发者ID:Xilef11,项目名称:runesofwizardry-classics,代码行数:29,代码来源:RuneEntityRebirth.java

示例3: getPlacementResults

public List<Pair<BlockPos, ItemStack>> getPlacementResults(EntityPlayer playerIn, World worldIn, BlockPos posOn, EnumHand hand, EnumFacing facing, float hitX,
        float hitY, float hitZ, ItemStack stack)
{

    if(!(stack.getItem() instanceof SuperItemBlock)) return Collections.emptyList();
    
    PlacementItem item = (PlacementItem)stack.getItem();
    
    if(item.isBlockOrientationFixed(stack)) 
        return CubicPlacementHandler.INSTANCE.getPlacementResults(playerIn, worldIn, posOn, hand, facing, hitX, hitY, hitZ, stack);

    final SuperBlock stackBlock = (SuperBlock) ((SuperItemBlock)stack.getItem()).getBlock();
    final ModelState stackModelState = PlacementItem.getStackModelState(stack);

    final IBlockState onBlockState = worldIn.getBlockState(posOn);

    if(onBlockState.getBlock() instanceof SuperBlock)
    {
        final SuperBlock onBlock = (SuperBlock) onBlockState.getBlock();
        final ModelState onModelState = onBlock.getModelStateAssumeStateIsCurrent(onBlockState, worldIn, posOn, true);

        if(onBlock == stackBlock 
                && onModelState != null
                && onModelState.getShape() == stackModelState.getShape()
                && onModelState.doesAppearanceMatch(stackModelState)) 
        {
            // target is this additive block

            if(!onModelState.hasAxis() 
                    || (onModelState.getAxis() == facing.getAxis()
                    && (!onModelState.hasAxisOrientation() || onModelState.isAxisInverted() == (facing.getAxisDirection() == AxisDirection.NEGATIVE))))
            {
                // we clicked on an additive face
                
                // confirm have space to add - the ItemStack handler will allow us to get 
                // here if the adjacent position contains another additive block
                if(onModelState.getMetaData() < 0xF || WorldHelper.isBlockReplaceable(worldIn, posOn.offset(facing), !VirtualBlock.isVirtualBlock(stackBlock)))
                {
                    return addToBlockAtPosition(worldIn, stack, stackModelState, onModelState, posOn);
                }
            }
        }
    }
    
    // is there an additive block against the face we clicked?
    final BlockPos facePos = posOn.offset(facing);
    final IBlockState faceBlockState = worldIn.getBlockState(facePos);
    if(faceBlockState.getBlock() instanceof SuperBlock)
    {
        final SuperBlock faceBlock = (SuperBlock) faceBlockState.getBlock();
        final ModelState faceModelState = faceBlock.getModelStateAssumeStateIsCurrent(faceBlockState, worldIn, facePos, true);

        if((    faceBlock == stackBlock 
                && faceModelState.getShape() == stackModelState.getShape())
                && faceModelState.doesAppearanceMatch(stackModelState)) 
         {
            // add to the adjacent block 
            return addToBlockAtPosition(worldIn, stack, stackModelState, faceModelState, facePos);
         }
    }

    // fall back to standard placement logic
    return CubicPlacementHandler.INSTANCE.getPlacementResults(playerIn, worldIn, posOn, hand, facing, hitX, hitY, hitZ, stack);

}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:65,代码来源:AdditivePlacementHandler.java


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