diff --git a/src/main/java/cr0s/warpdrive/config/structures/Orb.java b/src/main/java/cr0s/warpdrive/config/structures/Orb.java index e63ab0bcd..085fd871e 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/Orb.java +++ b/src/main/java/cr0s/warpdrive/config/structures/Orb.java @@ -22,6 +22,23 @@ public abstract class Orb extends DeployableStructure implements XmlRepresentabl private ArrayList shells; private String name; + /** + * @return the radius + */ + public int getRadius() { + return super.height / 2; + } + + /** + * @param radius the radius to set + */ + public void setRadius(int radius) { + + super.height = radius * 2; + super.length = radius * 2; + super.width = radius * 2; + } + public String getName() { return name; } @@ -30,8 +47,10 @@ public void setName(String name) { this.name = name; } - public Orb(int diameter) { - super(diameter, diameter, diameter); + public Orb(int radius) { + super(radius * 2, radius * 2, radius * 2); + + setRadius(radius); } @@ -49,6 +68,7 @@ public void loadFromXmlElement(Element e) throws InvalidXmlException { OrbShell shell = new OrbShell(); shell.loadFromXmlElement(tmp); + shell.finishContruction(); totalThickness += shell.thickness; newShells.add(shell); @@ -63,6 +83,8 @@ public void loadFromXmlElement(Element e) throws InvalidXmlException { shellRelative[index++] = shell; } + setRadius(totalThickness - 1); + } @@ -78,7 +100,7 @@ public void saveToXmlElement(Element e, Document d) { @Override public boolean generate(World world, Random p_76484_2_, int x, int y, int z) { - EntitySphereGen entitySphereGen = new EntitySphereGen(world, x, y, z, getHeight() / 2, this, true); + EntitySphereGen entitySphereGen = new EntitySphereGen(world, x, y, z, getRadius(), this, true); world.spawnEntityInWorld(entitySphereGen); return false; }