Skip to content

Commit

Permalink
Merge pull request #18 from game-design-driven/yarden/fix/barrel-and-…
Browse files Browse the repository at this point in the history
…crate-do-not-delete-state-on-break

fix blockstate being used twice instead of blockstate2, which is now …
  • Loading branch information
Yarden-zamir authored Feb 3, 2024
2 parents 00dbb97 + 54e6c93 commit b1647a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/main/java/com/kikis/ptdyeplus/block/Barrel.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ public InteractionResult use(BlockState blockState, Level level, BlockPos blockP
}

@Override
public void onRemove(BlockState blockState, Level level, BlockPos blockPos, BlockState blockState2, boolean p_60519_) {
if (!blockState.is(blockState2.getBlock())) {
public void onRemove(BlockState blockState, Level level, BlockPos blockPos, BlockState newBlockState, boolean p_60519_) {
if (!blockState.is(newBlockState.getBlock())) {
BlockEntity entity = level.getBlockEntity(blockPos);
if (entity instanceof Container container) {
Containers.dropContents(level, blockPos, container);
level.updateNeighbourForOutputSignal(blockPos, this);
}

super.onRemove(blockState, level, blockPos, blockState, p_60519_);
super.onRemove(blockState, level, blockPos, newBlockState, p_60519_);
}

}

@Nullable
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/kikis/ptdyeplus/block/Crate.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public InteractionResult use(BlockState blockState, Level level, BlockPos blockP
}

@Override
public void onRemove(BlockState blockState, Level level, BlockPos blockPos, BlockState blockState2, boolean p_60519_) {
if (!blockState.is(blockState2.getBlock())) {
public void onRemove(BlockState blockState, Level level, BlockPos blockPos, BlockState newBlockState, boolean p_60519_) {
if (!blockState.is(newBlockState.getBlock())) {
BlockEntity entity = level.getBlockEntity(blockPos);
if (entity instanceof Container container) {
Containers.dropContents(level, blockPos, container);
level.updateNeighbourForOutputSignal(blockPos, this);
}

super.onRemove(blockState, level, blockPos, blockState, p_60519_);
super.onRemove(blockState, level, blockPos, newBlockState, p_60519_);
}
}

Expand Down

0 comments on commit b1647a3

Please sign in to comment.