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


Java Axis.Y属性代码示例

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


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

示例1: onBlockPlacedBy

/**
 * Called when the block is placed in the world.
 */
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entityLiving, ItemStack iStack) {
    super.onBlockPlacedBy(world, pos, state, entityLiving, iStack);
    EnumFacing rotation = getRotation(world, pos);
    if (rotation.getAxis() == Axis.Y) {
        TileEntity te = world.getTileEntity(pos);
        if (te instanceof TileEntityAphorismTile) {
            TileEntityAphorismTile teAT = (TileEntityAphorismTile) te;
            float yaw = entityLiving.rotationYaw; if (yaw < 0) yaw += 360;
            teAT.textRotation = (((int) yaw + 45) / 90 + 2) % 4;
            if (rotation.getFrontOffsetY() > 0 && (teAT.textRotation == 1 || teAT.textRotation == 3)) {
                // fudge - reverse rotation if placing above, and player is facing on east/west axis
                teAT.textRotation = 4 - teAT.textRotation;
            }
        }
    }
    if (world.isRemote && entityLiving instanceof EntityPlayer) {
        ((EntityPlayer) entityLiving).openGui(PneumaticCraftRepressurized.instance, EnumGuiId.APHORISM_TILE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
        sendEditorMessage((EntityPlayer) entityLiving);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:24,代码来源:BlockAphorismTile.java

示例2: rotateBlock

@Override
  public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
  {
TileEntity te = world.getTileEntity(pos);
      if(te !=null && te instanceof TileCrate){
      	TileCrate tile = (TileCrate)te;
      	if(axis == tile.facing && axis.getAxis() == Axis.Y){
      		tile.rotation++;
      		tile.rotation%=4;
          	BlockUtil.markBlockForUpdate(world, pos);
          	return true;
      	}
      	int next = tile.getFacing();
      	next++;
      	next%=6;
      	tile.setFacing(next);
      	tile.rotation = 0;
      	BlockUtil.markBlockForUpdate(world, pos);
      	return true;
      }
      return false;
  }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:22,代码来源:BlockCrate.java

示例3: travel

public void travel(Entity entity){
	if(entity.getEntityWorld().isRemote)return;
	if(otherPortalPos !=null){
		World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(otherPortalDim);
		if(world !=null){
			TileEntity tile = world.getTileEntity(otherPortalPos);
			if(tile !=null && tile instanceof TileTelePortal){
				TileTelePortal otherPortal = (TileTelePortal)tile;
				Vector3d motion = new Vector3d(entity.motionX, entity.motionY, entity.motionZ);
				double ejectPower = 0.0;
				if(facing.getAxis() == Axis.X){
					ejectPower = Math.abs(motion.x);
				}
				if(facing.getAxis() == Axis.Y){
					ejectPower = Math.abs(motion.y);
				}
				if(facing.getAxis() == Axis.Z){
					ejectPower = Math.abs(motion.z);
				}
				teleportTo(entity, otherPortal, ejectPower);
			}
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:24,代码来源:TileTelePortal.java

示例4: placeBlockAt

@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
  if(!super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState)) {
    return false;
  }
  if(side.getAxis() == Axis.Y)return false;
  
  TileEntity te = world.getTileEntity(pos);
  if(te instanceof IFacingTile) {
  	IFacingTile tile = (IFacingTile) te;
  	EnumFacing face = side;
  	tile.setFacing(face.getHorizontalIndex());
  	BlockUtil.markBlockForUpdate(world, pos);
  }
  return true;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:16,代码来源:ItemBlockShieldRack.java

示例5: placeChest

protected boolean placeChest(World world, StructureBoundingBox box, Random rand, int x, int y, int z, EnumFacing f, boolean a) {
	int i1 = this.getXWithOffset(x, z);
	int j1 = this.getYWithOffset(y);
	int k1 = this.getZWithOffset(x, z);
	BlockPos pos = new BlockPos(i1, j1, k1);
	if (f.getAxis() == Axis.Y)
		f = EnumFacing.NORTH;
	if (box.isVecInside(pos) && (world.getBlockState(pos).getBlock() != Blocks.CHEST)) {
		world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, f), 2);
		TileEntity tile = world.getTileEntity(pos);
		if (tile instanceof TileEntityChest)
			((TileEntityChest) tile).setLootTable(a ? loot2 : rand.nextInt(10) < 2 ? lootB : loot, rand.nextLong());
		return true;
	} else
		return false;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:16,代码来源:VillageHouseScientist.java

示例6: onBlockPlacedBy

@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState bs, EntityLivingBase entity, ItemStack itemstack) {
	EnumFacing l = TomsModUtils.getDirectionFacing(entity, true);
	EnumFacing s = l;
	if (l.getAxis() == Axis.Y)
		s = l.getOpposite();
	world.setBlockState(pos, bs.withProperty(FACING, s).withProperty(ACTIVE, false), 2);
	TileEntityTabletAccessPoint te = (TileEntityTabletAccessPoint) world.getTileEntity(pos);
	int d = l.ordinal();
	te.d = l;
	if (d == 5)
		te.direction = 4;
	else if (d == 4)
		te.direction = 5;
	else if (d == 3)
		te.direction = 2;
	else if (d == 2)
		te.direction = 3;
	else if (d == 0)
		te.direction = 1;
	else if (d == 1)
		te.direction = 0;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:23,代码来源:TabletAccessPoint.java

示例7: rotateFacing

/**
    * Get the index of this horizontal facing (0-3). The order is S0-W1-N2-E3
    */
public EnumFacing rotateFacing(EnumFacing side)
{
	if(side.getAxis() == Axis.Y) return side;
	
	switch(facing)
	{
	case NORTH:
		return side.rotateYCCW();
	case WEST:
		return side.getOpposite();
	case SOUTH:
		return side.rotateY();
	default:
		return side;
	}
}
 
开发者ID:MrCrayfish,项目名称:MrCrayfishSkateboardingMod,代码行数:19,代码来源:QuadHelper.java

示例8: isSlotAvailable

/**
 * Checks a rotated state of this matrix. Vertical Axis is ignored &
 * considered unrotated.
 *
 * @param slot
 * @param rotation
 * @return
 */
public boolean isSlotAvailable(int slot, EnumFacing rotation) {
	// Non-Rotation can be skipped, also if we are the ALL instance.
	if (rotation.getAxis() == Axis.Y || this == ALL) {
		return isSlotAvailable(slot);
	}

	if (rotated == null) {
		calculateRotations();
	}
	// Horizontal Index: S-W-N-E
	boolean[] slots = rotated[rotation.getHorizontalIndex()];

	slot = MathHelper.clamp_int(slot, 0, 8);

	return slots[slot];
}
 
开发者ID:Team-IO,项目名称:taam,代码行数:24,代码来源:SlotMatrix.java

示例9: getCapability

@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
	if (capability == Taam.CAPABILITY_PIPE) {
		if (facing == EnumFacing.UP) {
			return (T) pipeEndUP;
		} else if (facing == EnumFacing.DOWN) {
			return (T) pipeEndDOWN;
		} else {
			return null;
		}
	}
	if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && facing.getAxis() == Axis.Y) {
		return (T) tank;
	}
	if (capability == Taam.CAPABILITY_RENDER_TANK) {
		tankRI.setInfo(tank);
		return (T) tankRI.asArray();
	}
	return null;
}
 
开发者ID:Team-IO,项目名称:taam,代码行数:21,代码来源:MachineTank.java

示例10: addBlockHitEffects

@SideOnly(Side.CLIENT)
private void addBlockHitEffects(@Nonnull World world, @Nonnull ParticleManager effectRenderer, double xCoord, double yCoord, double zCoord,
    @Nonnull EnumFacing sideEnum, @Nonnull TextureAtlasSprite tex) {

  double d0 = xCoord;
  double d1 = yCoord;
  double d2 = zCoord;
  if (sideEnum.getAxis() != Axis.X) {
    d0 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }
  if (sideEnum.getAxis() != Axis.Y) {
    d1 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }
  if (sideEnum.getAxis() != Axis.Z) {
    d2 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }

  ParticleDigging digFX = (ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1,
      d2, 0, 0, 0, 0);
  if (digFX != null) {
    digFX.init().multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
    digFX.setParticleTexture(tex);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:24,代码来源:BlockConduitBundle.java

示例11: rotateBlock

@Override
public boolean rotateBlock(World world, EntityPlayer player, BlockPos pos, EnumFacing side) {
    if (player.isSneaking()) {
        if (!player.capabilities.isCreativeMode) dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
        world.setBlockToAir(pos);
        return true;
    } else {
        if (isRotatable()) {
            IBlockState state = world.getBlockState(pos);
            if (!rotateCustom(world, pos, state, side)) {
                if (rotateForgeWay()) {
                    if (!canRotateToTopOrBottom()) side = EnumFacing.UP;
                    if (getRotation(world, pos).getAxis() != side.getAxis()) {
                        setRotation(world, pos, getRotation(world, pos).rotateAround(side.getAxis()));
                    }
                } else {
                    EnumFacing f = getRotation(world, pos);
                    do {
                        f = EnumFacing.getFront(f.ordinal() + 1);
                    } while (!canRotateToTopOrBottom() && f.getAxis() == Axis.Y);
                    setRotation(world, pos, f);
                }
                TileEntityBase te = (TileEntityBase) world.getTileEntity(pos);
                if (te != null) te.onBlockRotated();
            }
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:31,代码来源:BlockPneumaticCraft.java

示例12: updateElevatorButtons

private void updateElevatorButtons(World world, BlockPos pos) {
    for (EnumFacing dir : EnumFacing.VALUES) {
        if (dir.getAxis() != Axis.Y) {
            TileEntityElevatorBase elevator = getElevatorBase(world, pos.offset(dir).offset(EnumFacing.DOWN, 2));
            if (elevator != null) {
                elevator.updateFloors();
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:BlockElevatorCaller.java

示例13: getBoneFacing

private static Axis getBoneFacing(StructureConfiguration configuration, Block foundBlock, BuildBlock block, EnumFacing assumedNorth)
{
	Axis boneFacing = Axis.X;
	
	if (foundBlock instanceof BlockBone)
	{
		if (block.getProperty("axis").getValue().equals("x"))
		{
			boneFacing = Axis.X;
		}
		else if (block.getProperty("axis").getValue().equals("y"))
		{
			boneFacing = Axis.Y;
		}
		else
		{
			boneFacing = Axis.Z;
		}
		
		if (boneFacing != Axis.Y)
		{
			boneFacing = 
					configuration.houseFacing == assumedNorth || configuration.houseFacing == assumedNorth.getOpposite() 
						? boneFacing : 
							boneFacing == Axis.X 
								? Axis.Z : Axis.X; 
		}
	}
	
	return boneFacing;
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:31,代码来源:BuildBlock.java

示例14: getStateFromMeta

@Override
public IBlockState getStateFromMeta(int meta) {
	EnumFacing facing = EnumFacing.getFront(meta % 6);
	if (facing.getAxis() == Axis.Y)
		facing = EnumFacing.NORTH;
	return this.getDefaultState().withProperty(FACING, facing).withProperty(IS_DOWN_SLOPE, meta > 5);
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:7,代码来源:ConveyorBeltSlope.java

示例15: canConnect

@Override
public boolean canConnect(EnumFacing face) {
	switch (type) {
	case NORMAL:
		return face.getAxis() != Axis.Y;
	case VERTICAL:
		return true;
	default:
		break;
	}
	return false;
}
 
开发者ID:BubbleTrouble14,项目名称:ARKCraft,代码行数:12,代码来源:TileEntityCable.java


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