本文整理汇总了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;
}
示例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);
}
}
示例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);
}