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


Java Skript.EPSILON属性代码示例

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


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

示例1: difference

@Override
public Money difference(final Money first, final Money second) {
	final double d = Math.abs(first.getAmount() - second.getAmount());
	if (d < Skript.EPSILON)
		return new Money(0);
	return new Money(d);
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:7,代码来源:Money.java

示例2: getOnBlock

final static int getOnBlock(final Location l) {
	int id = l.getWorld().getBlockTypeIdAt(l.getBlockX(), (int) Math.ceil(l.getY()) - 1, l.getBlockZ());
	if (id == 0 && Math.abs((l.getY() - l.getBlockY()) - 0.5) < Skript.EPSILON) { // fences
		id = l.getWorld().getBlockTypeIdAt(l.getBlockX(), l.getBlockY() - 1, l.getBlockZ());
		if (id != Material.FENCE.getId() && id != 107 && id != 113) // fence gate // nether fence
			return 0;
	}
	return id;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:9,代码来源:EvtMoveOn.java

示例3: compare

@Override
public Relation compare(final Number n1, final Number n2) {
	if (n1 instanceof Long && n2 instanceof Long)
		return Relation.get(n1.longValue() - n2.longValue());
	final double diff = n1.doubleValue() - n2.doubleValue();
	if (Math.abs(diff) < Skript.EPSILON)
		return Relation.EQUAL;
	return Relation.get(diff);
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:9,代码来源:DefaultComparators.java

示例4: execute

@SuppressWarnings("deprecation")
@Override
protected void execute(final Event e) {
	Location to = location.getSingle(e);
	if (to == null)
		return;
	if (Math.abs(to.getX() - to.getBlockX() - 0.5) < Skript.EPSILON && Math.abs(to.getZ() - to.getBlockZ() - 0.5) < Skript.EPSILON) {
		final Block on = to.getBlock().getRelative(BlockFace.DOWN);
		if (on.getType() != Material.AIR) {
			to = to.clone();
			to.setY(on.getY() + Utils.getBlockHeight(on.getTypeId(), on.getData()));
		}
	}
	for (final Entity entity : entities.getArray(e)) {
		final Location loc;
		if (ignoreDirection(to.getYaw(), to.getPitch())) {
			loc = to.clone();
			loc.setPitch(entity.getLocation().getPitch());
			loc.setYaw(entity.getLocation().getYaw());
		} else {
			loc = to;
		}
		loc.getChunk().load();
		if (e instanceof PlayerRespawnEvent && entity.equals(((PlayerRespawnEvent) e).getPlayer()) && !Delay.isDelayed(e)) {
			((PlayerRespawnEvent) e).setRespawnLocation(loc);
		} else {
			entity.teleport(loc);
		}
	}
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:30,代码来源:EffTeleport.java

示例5: contains

public boolean contains(final Location l) {
	if (l.getWorld() != world)
		return false;
	return lowerBound.getX() - Skript.EPSILON < l.getX() && l.getX() < upperBound.getX() + Skript.EPSILON
			&& lowerBound.getY() - Skript.EPSILON < l.getY() && l.getY() < upperBound.getY() + Skript.EPSILON
			&& lowerBound.getZ() - Skript.EPSILON < l.getZ() && l.getZ() < upperBound.getZ() + Skript.EPSILON;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:7,代码来源:AABB.java

示例6: fitInWorld

@SuppressWarnings("null")
private final static Vector fitInWorld(final Location l, final Vector dir) {
	if (0 <= l.getBlockY() && l.getBlockY() < l.getWorld().getMaxHeight())
		return l.toVector();
	final double y = Math2.fit(0, l.getY(), l.getWorld().getMaxHeight());
	if (Math.abs(dir.getY()) < Skript.EPSILON)
		return new Vector(l.getX(), y, l.getZ());
	final double dy = y - l.getY();
	final double n = dy / dir.getY();
	return l.toVector().add(dir.clone().multiply(n));
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:11,代码来源:BlockLineIterator.java

示例7: getBlockY

final static int getBlockY(final double y, final int id) {
	if ((id == Material.FENCE.getId() || id == 107 || id == 113) && Math.abs((y - Math.floor(y)) - 0.5) < Skript.EPSILON) // fence gate // nether fence
		return (int) Math.floor(y) - 1;
	return (int) Math.ceil(y) - 1;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:5,代码来源:EvtMoveOn.java

示例8: ignoreDirection

/**
 * @param yaw Notch-yaw
 * @param pitch Notch-pitch
 * @return Whether the given pitch and yaw represent a cartesian coordinate direction
 */
private final static boolean ignoreDirection(final float yaw, final float pitch) {
	return (pitch == 0 || Math.abs(pitch - 90) < Skript.EPSILON || Math.abs(pitch + 90) < Skript.EPSILON)
			&& (yaw == 0 || Math.abs(Math.sin(Math.toRadians(yaw))) < Skript.EPSILON || Math.abs(Math.cos(Math.toRadians(yaw))) < Skript.EPSILON);
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:9,代码来源:EffTeleport.java


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