2525import java .util .List ;
2626
2727/**
28- * Called from {@link Block#addCollisionBoxToList(BlockPos, AxisAlignedBB, List, AxisAlignedBB)} .
28+ * Called from Block#addCollisionBoxToList(BlockPos, AxisAlignedBB, List, AxisAlignedBB).
2929 * Used to hook into block collision, used to modify the bounding boxes of blocks.
3030 *
3131 * @author Brady
3232 * @since 4/10/2017
3333 */
3434public final class BoundingBoxEvent {
3535
36- /**
37- * Singleton instance of this event
38- */
39- private static final BoundingBoxEvent EVENT = new BoundingBoxEvent ();
40-
4136 /**
4237 * The block itself
4338 */
44- private Block block ;
39+ private final Block block ;
4540
4641 /**
4742 * The position of the block
4843 */
49- private BlockPos pos ;
44+ private final BlockPos pos ;
5045
5146 /**
5247 * The bounding box of the block
@@ -56,12 +51,20 @@ public final class BoundingBoxEvent {
5651 /**
5752 * Colliding list being added onto
5853 */
59- private List <AxisAlignedBB > collidingBoxes ;
54+ private final List <AxisAlignedBB > collidingBoxes ;
6055
6156 /**
6257 * Entity being checked, may be {@code null}
6358 */
64- private Entity entity ;
59+ private final Entity entity ;
60+
61+ public BoundingBoxEvent (Block block , BlockPos pos , AxisAlignedBB aabb , List <AxisAlignedBB > collidingBoxes , @ Nullable Entity entity ) {
62+ this .block = block ;
63+ this .pos = pos ;
64+ this .aabb = aabb ;
65+ this .collidingBoxes = collidingBoxes ;
66+ this .entity = entity ;
67+ }
6568
6669 /**
6770 * Sets the block's bounding box. Setting it to
@@ -120,13 +123,4 @@ public String toString() {
120123 ", entity=" + entity +
121124 '}' ;
122125 }
123-
124- public static BoundingBoxEvent get (Block block , BlockPos pos , AxisAlignedBB aabb , List <AxisAlignedBB > collidingBoxes , @ Nullable Entity entity ) {
125- EVENT .block = block ;
126- EVENT .pos = pos ;
127- EVENT .aabb = aabb ;
128- EVENT .collidingBoxes = collidingBoxes ;
129- EVENT .entity = entity ;
130- return EVENT ;
131- }
132126}
0 commit comments