Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-12-08 03:00:00 +11:00
parent a13136ada2
commit 8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions

View File

@@ -1,24 +1,19 @@
--- a/net/minecraft/world/level/block/BlockNote.java
+++ b/net/minecraft/world/level/block/BlockNote.java
@@ -51,7 +51,8 @@
@@ -77,6 +77,7 @@
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
if (flag1) {
- this.playNote((Entity) null, world, blockposition);
+ this.playNote((Entity) null, world, blockposition, iblockdata); // CraftBukkit
this.playNote((Entity) null, iblockdata, world, blockposition);
+ iblockdata = world.getBlockState(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
}
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
@@ -59,11 +60,18 @@
@@ -86,6 +87,12 @@
}
- private void playNote(@Nullable Entity entity, World world, BlockPosition blockposition) {
+ private void playNote(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData data) { // CraftBukkit
if (world.getBlockState(blockposition.above()).isAir()) {
private void playNote(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
if (!((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).requiresAirAbove() || world.getBlockState(blockposition.above()).isAir()) {
+ // CraftBukkit start
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(BlockNote.INSTRUMENT), data.getValue(BlockNote.NOTE));
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, iblockdata.getValue(BlockNote.INSTRUMENT), iblockdata.getValue(BlockNote.NOTE));
+ if (event.isCancelled()) {
+ return;
+ }
@@ -26,25 +21,3 @@
world.blockEvent(blockposition, this, 0, 0);
world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, blockposition);
}
+
}
@Override
@@ -73,7 +81,7 @@
} else {
iblockdata = (IBlockData) iblockdata.cycle(BlockNote.NOTE);
world.setBlock(blockposition, iblockdata, 3);
- this.playNote(entityhuman, world, blockposition);
+ this.playNote(entityhuman, world, blockposition, iblockdata); // CraftBukkit
entityhuman.awardStat(StatisticList.TUNE_NOTEBLOCK);
return EnumInteractionResult.CONSUME;
}
@@ -82,7 +90,7 @@
@Override
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
if (!world.isClientSide) {
- this.playNote(entityhuman, world, blockposition);
+ this.playNote(entityhuman, world, blockposition, iblockdata); // CraftBukkit
entityhuman.awardStat(StatisticList.PLAY_NOTEBLOCK);
}
}