75 lines
1.9 KiB
Java
75 lines
1.9 KiB
Java
package gq.unurled.raxen.components.dungeons;
|
|
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Material;
|
|
|
|
import java.util.Random;
|
|
import java.util.UUID;
|
|
|
|
public class Gate {
|
|
|
|
private String name;
|
|
|
|
private Location loc;
|
|
private Integer portalRadius;
|
|
|
|
|
|
public Gate(String name, Location loc, Integer portalRadius) {
|
|
this.loc = loc;
|
|
this.portalRadius = portalRadius;
|
|
this.name = name;
|
|
}
|
|
|
|
public void teleport() {
|
|
|
|
}
|
|
|
|
public void genGate() {
|
|
// get which side it's gonna expand with radius
|
|
Random r = new Random();
|
|
Boolean xExpend = false;
|
|
if (r.nextInt(2) == 0) {
|
|
xExpend = true;
|
|
}
|
|
|
|
// place blocks
|
|
for (double i = 0; i <= Math.PI; i += Math.PI / portalRadius) {
|
|
double radius = Math.sin(i);
|
|
double y = Math.cos(i);
|
|
for (double a = 0; a < Math.PI * 2; a+= Math.PI / portalRadius) {
|
|
double x = Math.cos(a) * radius;
|
|
double z = Math.sin(a) * radius;
|
|
Location locc = new Location(loc.getWorld(), x, y, z);
|
|
loc.getBlock().setType(Material.NETHER_PORTAL);
|
|
}
|
|
}
|
|
/*
|
|
for (int n=0; n<portalRadius ; n++) {
|
|
Double x = loc.getX();
|
|
Double y = loc.getY();
|
|
Double z = loc.getZ();
|
|
if (xExpend) {
|
|
Location locc = new Location(loc.getWorld(), x + n, y + n, z);
|
|
locc.getBlock().setType(Material.NETHER_PORTAL);
|
|
locc = new Location(loc.getWorld(), loc.getX() - n, y-n, z);
|
|
locc.getBlock().setType(Material.NETHER_PORTAL);
|
|
|
|
}
|
|
}
|
|
|
|
*/
|
|
}
|
|
|
|
|
|
public Location getLoc() {
|
|
return loc;
|
|
}
|
|
|
|
public Integer getPortalRadius() {
|
|
return portalRadius;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
}
|