Skip to content

Commit

Permalink
feat: add LiquidHardenEvent#setHardenedBlockState method to allow c…
Browse files Browse the repository at this point in the history
…hanging the hardened block state
  • Loading branch information
smartcmd committed Dec 30, 2024
1 parent b5db654 commit 5ddfe1c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Unless otherwise specified, any version comparison below is the comparison of se

- (API) Added an extra argument to `Dimension#breakBlock` method to control if the block breaking particle should be
played.
- (API) Added `LiquidHardenEvent#setHardenedBlockState` method to allow changing the hardened block state.

### Changed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.allaymc.api.eventbus.event.block;

import lombok.Getter;
import lombok.Setter;
import org.allaymc.api.block.dto.BlockStateWithPos;
import org.allaymc.api.block.type.BlockState;
import org.allaymc.api.eventbus.event.CancellableEvent;
Expand All @@ -19,6 +20,7 @@ public class LiquidHardenEvent extends BlockEvent implements CancellableEvent {
/**
* Represent the harden block state which will replaced the liquid being hardened.
*/
@Setter
protected BlockState hardenedBlockState;

public LiquidHardenEvent(BlockStateWithPos blockState, BlockState cause, BlockState hardenedBlockState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public boolean tryHarden(BlockStateWithPos current, BlockStateWithPos flownIntoB
return false;
}

dimension.setBlockState(pos, hardenedBlockState);
dimension.setBlockState(pos, event.getHardenedBlockState());
dimension.addLevelSoundEvent(MathUtils.center(pos), SoundEvent.FIZZ);
return true;
}
Expand All @@ -144,7 +144,7 @@ public boolean tryHarden(BlockStateWithPos current, BlockStateWithPos flownIntoB
return false;
}

dimension.setBlockState(pos, hardenedBlockState);
dimension.setBlockState(pos, event.getHardenedBlockState());
dimension.addLevelSoundEvent(MathUtils.center(pos), SoundEvent.FIZZ);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public boolean tryHarden(BlockStateWithPos current, BlockStateWithPos flownIntoB
return false;
}

dimension.setBlockState(flownIntoBy.pos(), hardenedBlockState);
dimension.setBlockState(flownIntoBy.pos(), event.getHardenedBlockState());
dimension.addLevelSoundEvent(MathUtils.center(flownIntoBy.pos()), SoundEvent.FIZZ);
return true;
}
Expand Down

0 comments on commit 5ddfe1c

Please sign in to comment.