mirror of
https://github.com/SimplexDevelopment/SimplexCore.git
synced 2024-12-22 08:37:37 +00:00
Cuboid.java Generate Method Fix
This commit is contained in:
parent
dda0477372
commit
7e4d2499f7
@ -1 +1,49 @@
|
||||
since I can't
|
||||
package io.github.paldiu.simplexcore.math;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class Cuboid {
|
||||
private final int x, y, z;
|
||||
|
||||
public Cuboid() {
|
||||
this(3, 3, 3);
|
||||
}
|
||||
|
||||
public Cuboid(int xSize, int ySize, int zSize) {
|
||||
this.x = xSize;
|
||||
this.y = ySize;
|
||||
this.z = zSize;
|
||||
}
|
||||
|
||||
public Cuboid(Size size) {
|
||||
this(size.getX(), size.getY(), size.getZ());
|
||||
}
|
||||
|
||||
public void generate(Location location, Material material) {
|
||||
Consumer<BukkitTask> task = bukkitTask -> {
|
||||
int t1 = location.getBlockX();
|
||||
int t2 = location.getBlockY();
|
||||
int t3 = location.getBlockZ();
|
||||
|
||||
int a = t1 + x;
|
||||
int b = t2 + y;
|
||||
int c = t3 + z;
|
||||
|
||||
for (int currentX = t1; currentX < a; currentX++) {
|
||||
for (int currentY = t2; currentY < b; currentY++) {
|
||||
for (int currentZ = t3; currentZ < c; currentZ++) {
|
||||
location.getWorld().getBlockAt(currentX, currentY, currentZ).setType(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Constants.getScheduler().runTaskLaterAsynchronously(Constants.getPlugin(), task, Constants.getTimeValues().SECOND());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user