IChunkBounds.java
package com.hypixel.hytale.server.worldgen.util.bounds;
import com.hypixel.hytale.math.util.ChunkUtil;
import com.hypixel.hytale.server.core.prefab.PrefabRotation;
import java.util.Random;
import javax.annotation.Nonnull;
public interface IChunkBounds {
int getLowBoundX();
int getLowBoundZ();
int getHighBoundX();
int getHighBoundZ();
default int getLowBoundX(@Nonnull PrefabRotation rotation) {
return Math.min(rotation.getX(this.getLowBoundX(), this.getLowBoundZ()), rotation.getX(this.getHighBoundX(), this.getHighBoundZ()));
}
default int getLowBoundZ(@Nonnull PrefabRotation rotation) {
return Math.min(rotation.getZ(this.getLowBoundX(), this.getLowBoundZ()), rotation.getZ(this.getHighBoundX(), this.getHighBoundZ()));
}
{
Math.max(rotation.getX(.getLowBoundX(), .getLowBoundZ()), rotation.getX(.getHighBoundX(), .getHighBoundZ()));
}
{
Math.max(rotation.getZ(.getLowBoundX(), .getLowBoundZ()), rotation.getZ(.getHighBoundX(), .getHighBoundZ()));
}
{
.intersectsChunk(ChunkUtil.xOfChunkIndex(chunkIndex), ChunkUtil.zOfChunkIndex(chunkIndex));
}
{
ChunkUtil.maxBlock(chunkX) >= .getLowBoundX() && ChunkUtil.minBlock(chunkX) <= .getHighBoundX() && ChunkUtil.maxBlock(chunkZ) >= .getLowBoundZ() && ChunkUtil.minBlock(chunkZ) <= .getHighBoundZ();
}
{
random.nextInt(.getHighBoundX() - .getLowBoundX()) + .getLowBoundX();
}
{
random.nextInt(.getHighBoundZ() - .getLowBoundZ()) + .getLowBoundZ();
}
{
()(.getHighBoundX() - .getLowBoundX()) * d + ().getLowBoundX();
}
{
()(.getHighBoundZ() - .getLowBoundZ()) * d + ().getLowBoundZ();
}
{
ChunkUtil.chunkCoordinate(.getLowBoundX());
}
{
ChunkUtil.chunkCoordinate(.getLowBoundZ());
}
{
ChunkUtil.chunkCoordinate(.getHighBoundX());
}
{
ChunkUtil.chunkCoordinate(.getHighBoundZ());
}
}