]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/models/BoundingBoxBiomeBorder.java
Fix Z-ordering of boxes
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / models / BoundingBoxBiomeBorder.java
1 package com.irtimaled.bbor.client.models;
2
3 import com.irtimaled.bbor.common.BoundingBoxType;
4 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
5 import com.irtimaled.bbor.common.models.Coords;
6
7 public class BoundingBoxBiomeBorder extends AbstractBoundingBox {
8     private final Coords coords;
9     private final boolean north;
10     private final boolean east;
11     private final boolean south;
12     private final boolean west;
13
14     private BoundingBoxBiomeBorder(Coords coords, boolean north, boolean east, boolean south, boolean west) {
15         super(BoundingBoxType.BiomeBorder);
16         this.coords = coords;
17         this.north = north;
18         this.east = east;
19         this.south = south;
20         this.west = west;
21     }
22
23     public static BoundingBoxBiomeBorder from(Coords coords, boolean north, boolean east, boolean south, boolean west) {
24         return new BoundingBoxBiomeBorder(coords, north, east, south, west);
25     }
26
27     @Override
28     public Boolean intersectsBounds(int minX, int minZ, int maxX, int maxZ) {
29         return coords.getX() >= minX &&
30                 coords.getZ() >= minZ &&
31                 coords.getX() <= maxX &&
32                 coords.getZ() <= maxZ;
33     }
34
35     @Override
36     protected double getDistanceX(double x) {
37         return x - coords.getX();
38     }
39
40     @Override
41     protected double getDistanceY(double y) {
42         return y - coords.getY();
43     }
44
45     @Override
46     protected double getDistanceZ(double z) {
47         return z - coords.getZ();
48     }
49
50     public Coords getCoords() {
51         return coords;
52     }
53
54     public boolean renderNorth() {
55         return north;
56     }
57
58     public boolean renderEast() {
59         return east;
60     }
61
62     public boolean renderSouth() {
63         return south;
64     }
65
66     public boolean renderWest() {
67         return west;
68     }
69
70 }