174 lines
10 KiB
Diff
174 lines
10 KiB
Diff
--- a/net/minecraft/core/cauldron/CauldronInteraction.java
|
|
+++ b/net/minecraft/core/cauldron/CauldronInteraction.java
|
|
@@ -29,6 +29,10 @@
|
|
import net.minecraft.world.level.block.state.IBlockData;
|
|
import net.minecraft.world.level.gameevent.GameEvent;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.block.CauldronLevelChangeEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public interface CauldronInteraction {
|
|
|
|
Map<Item, CauldronInteraction> EMPTY = newInteractionMap();
|
|
@@ -51,6 +55,11 @@
|
|
return EnumInteractionResult.PASS;
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX);
|
|
|
|
if (itemstack.hasTag()) {
|
|
@@ -59,7 +68,7 @@
|
|
|
|
entityhuman.setItemInHand(enumhand, itemstack1);
|
|
entityhuman.awardStat(StatisticList.CLEAN_SHULKER_BOX);
|
|
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
|
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
|
}
|
|
|
|
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
|
@@ -70,6 +79,11 @@
|
|
return EnumInteractionResult.PASS;
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
ItemStack itemstack1 = itemstack.copy();
|
|
|
|
itemstack1.setCount(1);
|
|
@@ -87,7 +101,7 @@
|
|
}
|
|
|
|
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
|
|
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
|
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
|
}
|
|
|
|
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
|
@@ -105,9 +119,14 @@
|
|
return EnumInteractionResult.PASS;
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
idyeable.clearColor(itemstack);
|
|
entityhuman.awardStat(StatisticList.CLEAN_ARMOR);
|
|
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
|
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
|
}
|
|
|
|
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
|
@@ -116,7 +135,7 @@
|
|
};
|
|
|
|
static Object2ObjectOpenHashMap<Item, CauldronInteraction> newInteractionMap() {
|
|
- return (Object2ObjectOpenHashMap) SystemUtils.make(new Object2ObjectOpenHashMap(), (object2objectopenhashmap) -> {
|
|
+ return SystemUtils.make(new Object2ObjectOpenHashMap<>(), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
|
|
object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
|
return EnumInteractionResult.PASS;
|
|
});
|
|
@@ -132,12 +151,17 @@
|
|
return EnumInteractionResult.PASS;
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
Item item = itemstack.getItem();
|
|
|
|
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
|
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
|
- world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState());
|
|
+ // world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit
|
|
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
|
}
|
|
@@ -153,12 +177,17 @@
|
|
});
|
|
CauldronInteraction.WATER.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
Item item = itemstack.getItem();
|
|
|
|
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER)));
|
|
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
|
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
|
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
|
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
|
}
|
|
@@ -168,10 +197,15 @@
|
|
CauldronInteraction.WATER.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
|
if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && PotionUtil.getPotion(itemstack) == Potions.WATER) {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
|
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
|
|
- world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL));
|
|
+ // world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL)); // CraftBukkit
|
|
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
|
}
|
|
@@ -243,12 +277,17 @@
|
|
return EnumInteractionResult.PASS;
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
Item item = itemstack.getItem();
|
|
|
|
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1));
|
|
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
|
- world.setBlockAndUpdate(blockposition, Blocks.CAULDRON.defaultBlockState());
|
|
+ // world.setBlockAndUpdate(blockposition, Blocks.CAULDRON.defaultBlockState()); // CraftBukkit
|
|
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
|
}
|
|
@@ -259,12 +298,17 @@
|
|
|
|
static EnumInteractionResult emptyBucket(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit start
|
|
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
Item item = itemstack.getItem();
|
|
|
|
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.BUCKET)));
|
|
entityhuman.awardStat(StatisticList.FILL_CAULDRON);
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
|
- world.setBlockAndUpdate(blockposition, iblockdata);
|
|
+ // world.setBlockAndUpdate(blockposition, iblockdata); // CraftBukkit
|
|
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
|
}
|