]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/models/BoundingBoxFlowerForest.java
3f0abbf75110e8e85c88a4e4b9e611afe1b77126
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / models / BoundingBoxFlowerForest.java
1 /*
2 package com.irtimaled.bbor.client.models;
3
4 import com.irtimaled.bbor.client.RenderCulling;
5 import com.irtimaled.bbor.client.config.ColorHelper;
6 import com.irtimaled.bbor.client.config.HexColor;
7 import com.irtimaled.bbor.client.config.Setting;
8 import com.irtimaled.bbor.client.renderers.AbstractRenderer;
9 import com.irtimaled.bbor.client.renderers.FlowerForestRenderer;
10 import com.irtimaled.bbor.common.BoundingBoxType;
11 import com.irtimaled.bbor.common.interop.CommonInterop;
12 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
13 import com.irtimaled.bbor.common.models.Coords;
14
15 import java.awt.*;
16
17 public class BoundingBoxFlowerForest extends AbstractBoundingBox {
18     private static final AbstractRenderer<BoundingBoxFlowerForest> RENDERER = CommonInterop.registerRenderer(BoundingBoxFlowerForest.class, () -> new FlowerForestRenderer());
19
20     private final Coords coords;
21     private final Setting<HexColor> colorSetting;
22
23     public BoundingBoxFlowerForest(Coords coords, Setting<HexColor> colorSetting) {
24         super(BoundingBoxType.FlowerForest);
25         this.coords = coords;
26         this.colorSetting = colorSetting;
27     }
28
29     @Override
30     public Boolean intersectsBounds(int minX, int minZ, int maxX, int maxZ) {
31         return coords.getX() >= minX && coords.getZ() >= minZ && coords.getX() <= maxX && coords.getZ() <= maxZ;
32     }
33
34     public Color getColor() {
35         return ColorHelper.getColor(colorSetting);
36     }
37
38     public Coords getCoords() {
39         return coords;
40     }
41
42     @Override
43     public double getDistanceX(double x) {
44         return x - coords.getX();
45     }
46
47     @Override
48     public double getDistanceY(double y) {
49         return y - coords.getY();
50     }
51
52     @Override
53     public double getDistanceZ(double z) {
54         return z - coords.getZ();
55     }
56
57     @Override
58     public AbstractRenderer<?> getRenderer() {
59         return RENDERER;
60     }
61
62     @Override
63     public boolean isVisibleCulling() {
64         return RenderCulling.isVisibleCulling(coords.getX(), coords.getY() + 0.01d, coords.getZ(), coords.getX() + 1, coords.getY(), coords.getZ() + 1);
65     }
66 }
67  */