/** * Returns the center of the box, halfway between each corner. * * @return The center */ public Vector3d getCenter() { if (this.center == null) { this.center = this.min.add(getSize().div(2)); } return this.center; }
@Override public Vector3d div(double a) { return div(a, a, a); }
public Vector3d div(float a) { return div((double) a); }
public Vector3d div(Vector3d v) { return div(v.x, v.y, v.z); }
@Override public Vector3d div(double a) { return div(a, a, a); }
public Vector3d div(float a) { return div((double) a); }
public Vector3d div(float x, float y, float z) { return div((double) x, (double) y, (double) z); }
public Vector3d div(Vector3d v) { return div(v.x, v.y, v.z); }
public Vector3d div(float x, float y, float z) { return div((double) x, (double) y, (double) z); }
/** * Returns the center of the box, halfway between each corner. * * @return The center */ public Vector3d getCenter() { if (this.center == null) { this.center = this.min.add(getSize().div(2)); } return this.center; }
@Listener public void onEntityMove(MoveEntityEvent event) { if(event.getTargetEntity().isOnGround()) { if(BlockUtil.doesStatePassFilters(allowedBlocks.getValue(), event.getTargetEntity().getLocation().getRelative(Direction.DOWN).getBlock())) { FootprintData data = getFootprintData(event.getTargetEntity().getUniqueId()); if (data.canPlaceFootprint(event.getToTransform().getPosition())) { Vector3d footprintLocation = event.getToTransform().getPosition().add(0, 0.19, 0); //Flip these, it should 'roughly' rotate 90 or -90 degrees. Vector3d footOffset = new Vector3d(footprintLocation.getZ(), 0, footprintLocation.getX()).normalize().div(2); event.getTargetEntity().getWorld().spawnParticles(footprintParticle, footprintLocation.add(footOffset.mul(data.side ? -1 : 1))); data.position = event.getToTransform().getPosition(); data.side = !data.side; } } } }