Fixed greenhouse coordinate tracking.
This commit is contained in:
parent
930d29acfc
commit
a3f8333a7b
|
@ -26,6 +26,7 @@ public class Greenhouse implements DataObject {
|
||||||
@Expose
|
@Expose
|
||||||
private Location location;
|
private Location location;
|
||||||
@Expose
|
@Expose
|
||||||
|
// Min coords are inside, max coords are outside
|
||||||
private BoundingBox boundingBox;
|
private BoundingBox boundingBox;
|
||||||
@Expose
|
@Expose
|
||||||
private Biome originalBiome;
|
private Biome originalBiome;
|
||||||
|
@ -43,7 +44,7 @@ public class Greenhouse implements DataObject {
|
||||||
|
|
||||||
public Greenhouse(World world, Walls walls, int ceilingHeight) {
|
public Greenhouse(World world, Walls walls, int ceilingHeight) {
|
||||||
this.location = new Location(world, walls.getMinX(), walls.getFloor(), walls.getMinZ());
|
this.location = new Location(world, walls.getMinX(), walls.getFloor(), walls.getMinZ());
|
||||||
Location location2 = new Location(world, walls.getMaxX(), ceilingHeight, walls.getMaxZ());
|
Location location2 = new Location(world, walls.getMaxX() + 1, ceilingHeight + 1, walls.getMaxZ() + 1);
|
||||||
this.boundingBox = BoundingBox.of(location, location2);
|
this.boundingBox = BoundingBox.of(location, location2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,11 +124,11 @@ public class GreenhouseEvents implements Listener {
|
||||||
User user = User.getInstance(e.getPlayer());
|
User user = User.getInstance(e.getPlayer());
|
||||||
plugin.getManager().getMap().getGreenhouse(e.getBlock().getLocation()).ifPresent(g -> {
|
plugin.getManager().getMap().getGreenhouse(e.getBlock().getLocation()).ifPresent(g -> {
|
||||||
// Check to see if wall or roof block broken
|
// Check to see if wall or roof block broken
|
||||||
if ((e.getBlock().getLocation().getBlockY() == g.getCeilingHeight())
|
if ((e.getBlock().getLocation().getBlockY() == g.getCeilingHeight() - 1)
|
||||||
|| e.getBlock().getLocation().getBlockX() == (int)g.getBoundingBox().getMinX()
|
|| e.getBlock().getLocation().getBlockX() == (int)g.getBoundingBox().getMinX()
|
||||||
|| e.getBlock().getLocation().getBlockX() == (int)g.getBoundingBox().getMaxX()
|
|| e.getBlock().getLocation().getBlockX() == (int)g.getBoundingBox().getMaxX() - 1
|
||||||
|| e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMinY()
|
|| e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMinZ()
|
||||||
|| e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMaxY()
|
|| e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMaxZ() - 1
|
||||||
) {
|
) {
|
||||||
user.sendMessage("greenhouses.broken");
|
user.sendMessage("greenhouses.broken");
|
||||||
plugin.getManager().getMap().removeGreenhouse(g);
|
plugin.getManager().getMap().removeGreenhouse(g);
|
||||||
|
|
Loading…
Reference in New Issue