Package org.spout.vanilla.component.entity.misc

Examples of org.spout.vanilla.component.entity.misc.EntityHead


   *
   * @param item to drop
   */
  public void dropItem(ItemStack item) {
    final Transform dropFrom;
    EntityHead head = getHead();
    if (head != null) {
      dropFrom = head.getHeadTransform();
    } else {
      dropFrom = getOwner().getPhysics().getTransform();
    }
    // Some constants
    final double impulseForce = 0.3;
View Full Code Here


  }

  @Override
  public void onInteract(Entity entity, Action type) {
    super.onInteract(entity, type);
    EntityHead head = entity.get(EntityHead.class);
    if (type == Action.RIGHT_CLICK && head != null) {
      BlockIterator iterator = head.getBlockView();
      if (iterator == null || !iterator.hasNext()) {
        return;
      }
      while (iterator.hasNext()) {
        Block block = iterator.next();
View Full Code Here

  }

  @Override
  public void onInteract(Entity entity, Action action) {
    if (action == Action.RIGHT_CLICK) {
      EntityHead head = entity.get(EntityHead.class);
      if (head == null) {
        return;
      }
      Block block;
      BlockIterator iterator = head.getBlockView();
      while (true) {
        if (!iterator.hasNext()) {
          return;
        }
        block = iterator.next();
View Full Code Here

   * @param entity to look at
   * @return The block facing
   */
  public static BlockFace getBlockFacing(Block block, Entity entity) {
    Point position;
    EntityHead head = entity.get(EntityHead.class);
    position = head != null ? head.getPosition() : entity.getPhysics().getPosition();

    Vector3f diff = position.sub(block.getX(), block.getY(), block.getZ());
    if (Math.abs(diff.getX()) < 2.0f && Math.abs(diff.getZ()) < 2.0f) {
      if (diff.getY() > 1.8f) {
        return BlockFace.TOP;
View Full Code Here

   *
   * @param entity to get the yaw of
   * @return yaw
   */
  public static float getYaw(Entity entity) {
    EntityHead head = entity.get(EntityHead.class);
    return head != null ? head.getOrientation().getAxesAngleDeg().getY() : entity.getPhysics().getRotation().getAxesAngleDeg().getY();
  }
View Full Code Here

  public void onInteract(Entity entity, Action type) {
    if (!(entity instanceof Player) || type != Action.RIGHT_CLICK) {
      return;
    }

    EntityHead head = entity.add(EntityHead.class);
    Block b = head.getBlockView(1).next();
    if (!b.isMaterial(VanillaMaterials.WATER)) {
      return;
    }
    this.spawnEntity(b, new Vector3f(0.0, 0.25, 0.0));
  }
View Full Code Here

            Point tpos = placedBlock.getPosition();
            if (player.getPhysics().getPosition().distance(tpos) < 0.6) {
              refreshClient(player, clickedBlock, clickedFace, rm);
              return;
            }
            EntityHead head = player.get(EntityHead.class);
            if (head != null && head.getPosition().distance(tpos) < 0.6) {
              refreshClient(player, clickedBlock, clickedFace, rm);
              return;
            }
          }
        }
View Full Code Here

  // TODO: handle cauldron
  @Override
  public void onInteract(Entity entity, Action action) {
    if (action == Action.RIGHT_CLICK) {
      EntityHead interact = entity.get(EntityHead.class);
      if (interact == null) {
        return;
      }
      Block block;
      BlockIterator iterator = interact.getBlockView();
      while (true) {
        if (!iterator.hasNext()) {
          return;
        }
        block = iterator.next();
View Full Code Here

  private BlockFace getTracedFace(Block block, Cause<?> cause) {
    if (block.getMaterial().equals(VanillaMaterials.VINES) && cause instanceof EntityCause) {
      //get block by block tracing from the player view
      Entity entity = ((EntityCause) cause).getSource();
      EntityHead head = entity.get(EntityHead.class);
      if (head != null) {
        BlockIterator iter = head.getBlockView();
        Block next;
        while (iter.hasNext()) {
          next = iter.next();
          if (next.equals(block)) {
            Block target = iter.hasNext() ? iter.next() : null;
View Full Code Here

        messages.add(new EntityRelativePositionMessage(entity.getId(), deltaX, deltaY, deltaZ));
      }
    }

    // Head movement
    EntityHead head = entity.get(EntityHead.class);
    if (head != null && head.isDirty()) {
      final int headYawProt = VanillaByteBufUtils.protocolifyYaw(head.getOrientation().getAxesAngleDeg().getY());
      messages.add(new EntityHeadYawMessage(entity.getId(), headYawProt));
    }

    // Physics
    //TODO: Actually not used?
View Full Code Here

TOP

Related Classes of org.spout.vanilla.component.entity.misc.EntityHead

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.