Fire CauldronLevelChange on initial fill

Also don't fire level events or game events if stalactite
drip is cancelled
This commit is contained in:
Jake Potrebic
2022-03-29 13:46:23 -07:00
parent 2e86b22228
commit f40a8e5f0c
3 changed files with 45 additions and 11 deletions

View File

@@ -31,7 +31,7 @@
if (potioncontents != null && potioncontents.is(Potions.WATER)) {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
+ return InteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
@@ -69,7 +69,7 @@
if (potioncontents != null && potioncontents.is(Potions.WATER)) {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
+ return InteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
@@ -86,7 +86,7 @@
} else {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChangeEvent
+ return InteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
@@ -105,7 +105,7 @@
static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
+ return InteractionResult.SUCCESS;
+ }
+ // CraftBukkit end