本文整理汇总了Java中com.flowpowered.math.GenericMath.floor方法的典型用法代码示例。如果您正苦于以下问题:Java GenericMath.floor方法的具体用法?Java GenericMath.floor怎么用?Java GenericMath.floor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.flowpowered.math.GenericMath
的用法示例。
在下文中一共展示了GenericMath.floor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LanternChunkPreGenerateTask
import com.flowpowered.math.GenericMath; //导入方法依赖的package包/类
private LanternChunkPreGenerateTask(PluginContainer plugin, World world, Vector3d center, double diameter,
int chunkCount, float tickPercent, int tickInterval, Cause cause, List<Consumer<ChunkPreGenerationEvent>> eventListeners) {
final int preferredTickInterval = Lantern.getScheduler().getPreferredTickInterval();
this.plugin = plugin;
this.world = world;
this.chunkRadius = GenericMath.floor(diameter / 32);
this.chunkCount = chunkCount;
this.tickPercent = tickPercent;
this.tickTimeLimit = Math.round(preferredTickInterval * tickPercent);
this.cause = cause;
this.tickInterval = tickInterval;
final Optional<Vector3i> currentPosition = LanternChunkLayout.INSTANCE.toChunk(center.toInt());
if (currentPosition.isPresent()) {
this.currentPosition = currentPosition.get();
} else {
throw new IllegalArgumentException("Center is not a valid chunk coordinate");
}
this.currentGenCount = 4;
this.currentLayer = 0;
this.currentIndex = 0;
this.nextJump = 0;
this.totalChunksToGenerate = (int) Math.pow(this.chunkRadius * 2 + 1, 2);
this.spongeTask = Lantern.getScheduler()
.createTaskBuilder()
.intervalTicks(preferredTickInterval)
.execute(this)
.submit(plugin);
if (!eventListeners.isEmpty()) {
this.eventListener = new LanternChunkPreGenerateListener(this.spongeTask.getUniqueId(), eventListeners);
Sponge.getEventManager().registerListener(plugin, ChunkPreGenerationEvent.class, this.eventListener);
} else {
this.eventListener = null;
}
}
示例2: wrapAngle
import com.flowpowered.math.GenericMath; //导入方法依赖的package包/类
/**
* Wraps the double angle into a byte.
*
* @param angle The angle
* @return The byte value
*/
public static byte wrapAngle(double angle) {
while (angle >= 180.0) {
angle -= 360.0;
}
while (angle < -180.0) {
angle += 360.0;
}
return (byte) GenericMath.floor(angle / 360.0 * 256.0);
}
示例3: getFlooredAmount
import com.flowpowered.math.GenericMath; //导入方法依赖的package包/类
/**
* Gets the amount as if from {@link #getAmount(Random)} but floored to the
* nearest integer equivalent.
*
* @param random The random object
* @return The floored amount
*/
default int getFlooredAmount(@Nonnull Random random) {
return GenericMath.floor(getAmount(random));
}