Skip to content

Commit

Permalink
fixed a funny bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CammiePone committed Oct 15, 2021
1 parent 64e16b1 commit 927e0f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public void clear() {

public void notifyListeners() {
this.markDirty();
world.updateListeners(getPos(), getCachedState(), getCachedState(), Block.NOTIFY_ALL);

if(world != null)
world.updateListeners(getPos(), getCachedState(), getCachedState(), Block.NOTIFY_ALL);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ public void clear() {

public void notifyListeners() {
this.markDirty();
BlockState oldState = getCachedState();
world.setBlockState(getPos(), world.getBlockState(getPos()).with(FillableBookshelfBlock.BOOK_COUNT, fullSlots()));
world.updateListeners(getPos(), oldState, getCachedState(), Block.NOTIFY_ALL);

if(world != null) {
BlockState oldState = getCachedState();
world.setBlockState(getPos(), world.getBlockState(getPos()).with(FillableBookshelfBlock.BOOK_COUNT, fullSlots()));
world.updateListeners(getPos(), oldState, getCachedState(), Block.NOTIFY_ALL);
}
}

public int fullSlots() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
"accessWidener": "META-INF/arcanus.accesswidener",
"depends": {
"fabricloader": ">=0.12.0-",
"fabricloader": ">=0.11.0-",
"fabric": "*",
"minecraft": "1.17.x",
"cloth-config2": ">=5.0.38",
Expand Down

0 comments on commit 927e0f2

Please sign in to comment.