fix powder snow cauldrons not turning to water

Powder snow cauldrons should turn to water when
extinguishing an entity
This commit is contained in:
Jake Potrebic 2021-12-30 14:02:13 -08:00
parent f40a8e5f0c
commit 954f57e596

View file

@ -12,7 +12,7 @@
public class LayeredCauldronBlock extends AbstractCauldronBlock {
@@ -62,41 +67,76 @@
@@ -62,41 +67,86 @@
@Override
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -24,7 +24,7 @@
+ // entity.clearFire();
if (entity.mayInteract(worldserver, pos)) {
- this.handleEntityOnFireInside(state, world, pos);
+ if (this.handleEntityOnFireInside(state, world, pos, entity)) {
+ if (this.handleEntityOnFireInsideWithEvent(state, world, pos, entity)) { // Paper - fix powdered snow cauldron extinguishing entities
+ entity.clearFire();
+ }
+ // CraftBukkit end
@ -36,6 +36,7 @@
- private void handleEntityOnFireInside(BlockState state, Level world, BlockPos pos) {
+ // CraftBukkit start
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - fix powdered snow cauldron extinguishing entities; use #handleEntityOnFireInsideWithEvent
+ private boolean handleEntityOnFireInside(BlockState iblockdata, Level world, BlockPos blockposition, Entity entity) {
if (this.precipitationType == Biome.Precipitation.SNOW) {
- LayeredCauldronBlock.lowerFillLevel((BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, (Integer) state.getValue(LayeredCauldronBlock.LEVEL)), world, pos);
@ -47,6 +48,15 @@
}
}
+ // Paper start - fix powdered snow cauldron extinguishing entities
+ protected boolean handleEntityOnFireInsideWithEvent(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (this.precipitationType == Biome.Precipitation.SNOW) {
+ return LayeredCauldronBlock.lowerFillLevel((BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, (Integer) state.getValue(LayeredCauldronBlock.LEVEL)), world, pos, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH);
+ } else {
+ return LayeredCauldronBlock.lowerFillLevel(state, world, pos, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH);
+ }
+ }
+ // Paper end - fix powdered snow cauldron extinguishing entities
public static void lowerFillLevel(BlockState state, Level world, BlockPos pos) {
- int i = (Integer) state.getValue(LayeredCauldronBlock.LEVEL) - 1;
@ -100,7 +110,7 @@
}
}
@@ -115,8 +155,11 @@
@@ -115,8 +165,11 @@
if (!this.isFull(state)) {
BlockState iblockdata1 = (BlockState) state.setValue(LayeredCauldronBlock.LEVEL, (Integer) state.getValue(LayeredCauldronBlock.LEVEL) + 1);