Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.

Commit e872b7d

Browse files
committed
Revert "Retain BoundingBoxEvent instance"
This reverts commit a973814 It was evidently problematic
1 parent b2dd72b commit e872b7d

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

src/main/java/clientapi/event/defaults/game/world/BoundingBoxEvent.java

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,23 @@
2525
import 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
*/
3434
public 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
}

src/main/java/clientapi/load/mixin/MixinBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void canCollideCheck(IBlockState state, boolean hitIfLiquid, CallbackInf
6464
private void addCollisionBox(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean isActualState, CallbackInfo ci) {
6565
synchronized (this) {
6666
Block block = (Block) (Object) (this);
67-
bbEvent = BoundingBoxEvent.get(block, pos, block.getCollisionBoundingBox(state, world, pos), collidingBoxes, entity);
67+
bbEvent = new BoundingBoxEvent(block, pos, block.getCollisionBoundingBox(state, world, pos), collidingBoxes, entity);
6868
ClientAPI.EVENT_BUS.post(bbEvent);
6969
}
7070
}

0 commit comments

Comments
 (0)