Skip to content

Commit

Permalink
fix: crash when enabling hopper pickup area display
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Jul 28, 2022
1 parent 7fe5c6a commit e949391
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/mendedminecarts/MinecartDisplayData.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ public ArrayList<Text> getInfoTexts() {
return infoTexts;
}

public Box[] hopperPickupArea1() {
public Object[] hopperPickupArea1() {
if (!(this.entity() instanceof HopperMinecartEntity hopper)) {
return new Box[0];
}
VoxelShape inputAreaShape = hopper.getInputAreaShape();
return (Box[]) inputAreaShape.getBoundingBoxes().stream().map(box -> box.offset(this.pos.x - 0.5, this.pos.y + 0.5 - 0.5, this.pos.z - 0.5)).toArray();
return inputAreaShape.getBoundingBoxes().stream().map(box -> box.offset(this.pos.x - 0.5, this.pos.y + 0.5 - 0.5, this.pos.z - 0.5)).toArray();
}

public Box hopperPickupArea2() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ private <E extends Entity> void renderMinecartInfo(Entity entity, double cameraX
WorldRenderer.drawBox(matrices, buffer, pickupArea2, 0.7f, 0.3f, 0.3f, 1.0f);
}

Box[] pickupArea1 = displayInfo.hopperPickupArea1();
for (Box pickupArea : pickupArea1) {
WorldRenderer.drawBox(matrices, buffer, pickupArea, 0.7f, 0.3f, 0.3f, 1.0f);
Object[] pickupArea1 = displayInfo.hopperPickupArea1();
for (Object pickupArea : pickupArea1) {
if (pickupArea instanceof Box box) {
WorldRenderer.drawBox(matrices, buffer, box, 0.7f, 0.3f, 0.3f, 1.0f);
}
}
}
if (MendedMinecartsMod.DISPLAY_CART_DATA_HOPPER_EXTRACT_BLOCK.isEnabled()) {
Expand Down

0 comments on commit e949391

Please sign in to comment.