Package com.bergerkiller.bukkit.common.bases

Examples of com.bergerkiller.bukkit.common.bases.IntVector3


      if (hitToFace == railDirection && Util.isVerticalAbove(posBlock, railDirection)) {
        return false;
      }

      // Cancel collisions with blocks 'right above' the next rail when going down the slope
      IntVector3 diff = new IntVector3(hitBlock).subtract(posBlock.getX(), posBlock.getY(), posBlock.getZ());
      if (diff.x == hitToFace.getModX() && diff.z == hitToFace.getModZ() &&
          (diff.y > 1 || (diff.y == 1 && railDirection != hitToFace))) {
        return false;
      }
    }
View Full Code Here


    owner.vertToSlope = false;

    // Find the rail - first step
    this.railType = RailType.NONE;
    for (RailType type : RailType.values()) {
      IntVector3 pos = type.findRail(owner, world, this.blockPos);
      if (pos != null) {
        this.railType = type;
        this.blockPos = pos;
        break;
      }
View Full Code Here

      // In all other cases, we will no longer be using this (horizontal) rail.
      // If we came from a vertical rail and need to move onto a slope
      // Vertical -> Slope UP
      RailTracker railTracker = member.getRailTracker();
      if (railTracker.getLastRailType() == RailType.VERTICAL) {
        IntVector3 nextPos = pos.add(railTracker.getLastLogic().getDirection());
        Material type = WorldUtil.getBlockType(world, nextPos.x, nextPos.y, nextPos.z);
        int data = WorldUtil.getBlockData(world, nextPos);
        if (this.isRail(type, data)) {
          // Check that the direction of the rail is correct
          Rails rails = CommonUtil.tryCast(BlockUtil.getData(type, data), Rails.class);
View Full Code Here

    if (dx == this.getDirection().getModX() && dz == this.getDirection().getModZ()) {
      entity.loc.y.subtract(1.0);
    }

    RailLogic logic = member.getRailTracker().getLastLogic();
    IntVector3 lastRailPos = new IntVector3(member.getRailTracker().getLastBlock());

    // Get from and to rail-fixed positions
    Vector startVector = logic.getFixedPosition(entity, entity.last, lastRailPos);
    Vector endVector = getFixedPosition(entity, entity.loc, member.getBlockPos());
View Full Code Here

    }
    final double railFactor = MathUtil.invert(MathUtil.normalize(this.dx, this.dz, entity.vel.getX(), entity.vel.getZ()), invert);
    entity.vel.set(railFactor * this.dx, 0.0, railFactor * this.dz);

    // Adjust position of Entity on rail
    IntVector3 railPos = member.getBlockPos();
    entity.loc.set(getFixedPosition(entity, entity.loc.getX(), entity.loc.getY(), entity.loc.getZ(), railPos));
    entity.loc.y.add((double) entity.getHeight() - 0.5);
  }
View Full Code Here

    return null;
  }

  @Override
  public IntVector3 findRail(MinecartMember<?> member, World world, IntVector3 pos) {
    IntVector3 next;
    if (isRail(world, pos.x, pos.y, pos.z)) {
      next = pos;
    } else if (member.getRailTracker().getLastRailType() != RailType.VERTICAL && isRail(world, pos.x, pos.y - 1, pos.z)) {
      next = pos.add(BlockFace.DOWN);
    } else {
View Full Code Here

    }
    // We are still in loaded chunks, go on!
    this.movingPoint.next();
    if (this.movingPoint.hasNext()) {
      // If already contained, skip it
      if (!this.coordinates.add(new IntVector3(this.movingPoint.nextTrack))) {
        this.movingPoint.clearNext();
      }
    }
  }
View Full Code Here

  public static MinecartMember<?> get(Object o) {
    return MemberConverter.toMember.convert(o);
  }

  public static MinecartMember<?> getAt(Block block) {
    return getAt(block.getWorld(), new IntVector3(block));
  }
View Full Code Here

    if (!getRailType().onBlockCollision(this, getBlock(), hitBlock, hitFace)) {
      return false;
    }
    // Stop the entire Group if hitting head-on
    final boolean hitHeadOn;
    IntVector3 delta = new IntVector3(hitBlock).subtract(this.getEntity().loc.block());
    if (FaceUtil.isVertical(this.getDirectionTo())) {
      hitHeadOn = delta.x == 0 && delta.z == 0 && delta.y == this.getDirectionTo().getModY();
    } else {
      hitHeadOn = delta.x == this.getDirectionTo().getModX() && delta.z == this.getDirectionTo().getModZ();
    }
View Full Code Here

   * @param railsBlock
   *            to get the Minecart Member for
   * @return the Minecart Member, or null if not found
   */
  public MinecartMember<?> getMemberFromRails(Block railsBlock) {
    return getMemberFromRails(new IntVector3(railsBlock));
  }
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.common.bases.IntVector3

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.