Archiviert
13
0

Add more breakNaturally functionality (#7379)

Dieser Commit ist enthalten in:
Jake Potrebic 2022-12-14 19:37:16 -08:00 committet von GitHub
Ursprung 1c535f96ac
Commit 66437d059f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
198 geänderte Dateien mit 206 neuen und 146 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,68 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 2 Jan 2020 12:25:16 -0600
Subject: [PATCH] Improve Block#breakNaturally API
Adds bool param to trigger world particle effects
Adds bool param to trigger exp drops for blocks
Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index db441e463b02ee734f85c855f5538cd41041dbae..af705e45204975a342e1454156ba143ed52cecdc 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -480,6 +480,52 @@ public interface Block extends Metadatable {
*/
boolean breakNaturally(@Nullable ItemStack tool);
+ // Paper start
+ /**
+ * Breaks the block and spawns item drops as if a player had broken it
+ *
+ * @param triggerEffect Play the block break particle effect and sound
+ * @return true if the block was destroyed
+ * @see #breakNaturally(boolean, boolean) to trigger exp drops
+ */
+ default boolean breakNaturally(boolean triggerEffect) {
+ return this.breakNaturally(triggerEffect, false);
+ }
+
+ /**
+ * Breaks the block and spawns item drops as if a player had broken it
+ *
+ * @param triggerEffect Play the block break particle effect and sound
+ * @param dropExperience drop exp if the block normally does so
+ * @return true if the block was destroyed
+ */
+ boolean breakNaturally(boolean triggerEffect, boolean dropExperience);
+
+ /**
+ * Breaks the block and spawns item drops as if a player had broken it
+ * with a specific tool
+ *
+ * @param tool The tool or item in hand used for digging
+ * @param triggerEffect Play the block break particle effect and sound
+ * @return true if the block was destroyed
+ * @see #breakNaturally(ItemStack, boolean, boolean) to trigger exp drops
+ */
+ default boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect) {
+ return this.breakNaturally(tool, triggerEffect, false);
+ }
+
+ /**
+ * Breaks the block and spawns item drops as if a player had broken it
+ * with a specific tool
+ *
+ * @param tool The tool or item in hand used for digging
+ * @param triggerEffect Play the block break particle effect and sound
+ * @param dropExperience drop exp if the block normally does so
+ * @return true if the block was destroyed
+ */
+ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
+ // Paper end
+
/**
* Simulate bone meal application to this block (if possible).
*

Datei anzeigen

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 2 Jan 2020 12:25:16 -0600
Subject: [PATCH] Add effect to block break naturally
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index db441e463b02ee734f85c855f5538cd41041dbae..1e7ee68e56f8d4399c2cbf26aa45bf8b599b3b02 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -480,6 +480,26 @@ public interface Block extends Metadatable {
*/
boolean breakNaturally(@Nullable ItemStack tool);
+ // Paper start
+ /**
+ * Breaks the block and spawns item drops as if a player had broken it
+ *
+ * @param triggerEffect Play the block break particle effect and sound
+ * @return true if the block was destroyed
+ */
+ boolean breakNaturally(boolean triggerEffect);
+
+ /**
+ * Breaks the block and spawns item drops as if a player had broken it
+ * with a specific tool
+ *
+ * @param tool The tool or item in hand used for digging
+ * @param triggerEffect Play the block break particle effect and sound
+ * @return true if the block was destroyed
+ */
+ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect);
+ // Paper end
+
/**
* Simulate bone meal application to this block (if possible).
*

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 5f7d0d08be8bca06c9aa89659b7865a7b5a547f8..9d95218b49895ab76b00fe9524d9b25ea9f9b8c2 100644 index bfd3654c02e8ad906c620a86165a38c65a31b62b..d5eeb37d331e205826aa6199bd481cb0db40d721 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@

Datei anzeigen

@ -269,7 +269,7 @@ index 02c5fcbc76b2db6bf4eb7580456b5658c08272b4..d56e1b50dd7da18f40278cec4bfdc941
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 1e7ee68e56f8d4399c2cbf26aa45bf8b599b3b02..2c837ea822f3b0c4ec312f0c956fe1b778cbd5e9 100644 index af705e45204975a342e1454156ba143ed52cecdc..ce3b81c5d83c9747ea0e3410c932460d11bf5c55 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable; @@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
@ -281,7 +281,7 @@ index 1e7ee68e56f8d4399c2cbf26aa45bf8b599b3b02..2c837ea822f3b0c4ec312f0c956fe1b7
/** /**
* Gets the metadata for this block * Gets the metadata for this block
@@ -646,5 +646,15 @@ public interface Block extends Metadatable { @@ -672,5 +672,15 @@ public interface Block extends Metadatable {
* @return the sound group for this block * @return the sound group for this block
*/ */
@NotNull org.bukkit.SoundGroup getBlockSoundGroup(); @NotNull org.bukkit.SoundGroup getBlockSoundGroup();

Datei anzeigen

@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki
index 2c837ea822f3b0c4ec312f0c956fe1b778cbd5e9..4a408361ac86b8c490942686c2709817338f4f59 100644 index 2c837ea822f3b0c4ec312f0c956fe1b778cbd5e9..4a408361ac86b8c490942686c2709817338f4f59 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -656,5 +656,29 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran @@ -682,5 +682,29 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
@NotNull @NotNull
@Deprecated @Deprecated
String getTranslationKey(); String getTranslationKey();

Datei anzeigen

@ -5,13 +5,13 @@ Subject: [PATCH] Block Ticking API
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index e405c279f6135c94c775a856ab88fd3cace6bd5c..9930ebe7a23d306c602840fd43652fbdaba481b3 100644 index 0b02bfce9ee01c6beb14348129ab86c751c01e54..aba40431c5a1ae43106a678445483e0653e130d1 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -562,6 +562,21 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran @@ -588,6 +588,21 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
* @return true if the block was destroyed * @return true if the block was destroyed
*/ */
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect); boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
+ +
+ /** + /**
+ * Causes the block to be ticked, this is different from {@link Block#randomTick()}, + * Causes the block to be ticked, this is different from {@link Block#randomTick()},

Datei anzeigen

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 2 Jan 2020 12:25:07 -0600
Subject: [PATCH] Add effect to block break naturally
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 2e3b675dca8cec906d533141e158e5db6ae87042..7e97b09376b1e9000511f56f3406dba550ba2612 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -477,6 +477,18 @@ public class CraftBlock implements Block {
@Override
public boolean breakNaturally(ItemStack item) {
+ // Paper start
+ return breakNaturally(item, false);
+ }
+
+ @Override
+ public boolean breakNaturally(boolean triggerEffect) {
+ return breakNaturally(null, triggerEffect);
+ }
+
+ @Override
+ public boolean breakNaturally(ItemStack item, boolean triggerEffect) {
+ // Paper end
// Order matters here, need to drop before setting to air so skulls can get their data
net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
net.minecraft.world.level.block.Block block = iblockdata.getBlock();
@@ -486,6 +498,7 @@ public class CraftBlock implements Block {
// Modelled off EntityHuman#hasBlock
if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), position, this.world.getBlockEntity(position), null, nmsItem);
+ if (triggerEffect) world.levelEvent(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.world.level.block.Block.getId(block.defaultBlockState())); // Paper
result = true;
}

Datei anzeigen

@ -14,7 +14,7 @@ light engine on shutdown...
The queue size only puts a cap on max loss, doesn't solve that problem. The queue size only puts a cap on max loss, doesn't solve that problem.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ea1ad3dad6bc9c7603d5dd0bdaec0d4563e90f16..867e7186764057507f6f92b52ea6afc4d08774b4 100644 index c277ccc012bd5011e31d746b08ace1ae5238c937..023119624c0534bedb248099d0e12c76622a363a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -788,7 +788,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -788,7 +788,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -8,7 +8,7 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 750b1f0793efc2e45846d6f6f03852f2d11d949a..e88ee89fba41911da4895e9fa024335f06887690 100644 index 710017f52ad1a0d338bb0a49e44a26cfc09f8b94..381bc42e760c2b652b2b45237587cebd4ae31c47 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1320,6 +1320,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1320,6 +1320,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

Datei anzeigen

@ -252,7 +252,7 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5ecd6a2027f6c0f11d10ca63cd63f0663f05347c..543b42a6f527cb93611781867b5d7c2c63fc6b54 100644 index 381bc42e760c2b652b2b45237587cebd4ae31c47..fcdd8a8570d07e8bd3339275c7b6999be3f726b3 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -149,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -149,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -362,7 +362,7 @@ index c021733342c09adb04ce3f675209543f84ac4bda..d137aa95f670aab516e9e08272f33b21
this.lastSpawnState = spawnercreature_d; this.lastSpawnState = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ecb81ad7ab281eaad7d5b3f9dc30082595824408..33fee57bcd3d82bed27f5e42e2e0f4b0299a1790 100644 index 20861571e8026c3c4fa40b7f8f14a2df0ebcc208..5da6530580c1d0ce298498782e8e7eb8bbf3cb3c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -240,6 +240,11 @@ public class ServerPlayer extends Player { @@ -240,6 +240,11 @@ public class ServerPlayer extends Player {

Datei anzeigen

@ -0,0 +1,95 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 2 Jan 2020 12:25:07 -0600
Subject: [PATCH] Improve Block#breakNaturally API
Adds bool parameter to play world effect on block break
Adds bool parameter to drop xp from blocks
Fixes fluid-logged blocks not leaving fluid behind if
broken
Handles special cases for ice and turtle eggs
== AT ==
public net.minecraft.world.level.block.TurtleEggBlock decreaseEggs(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V
Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
index 0afadbc8515d448b0ef817f4f0f53b1bb0abde43..64206d94a5bf210116d208f9678618b905a61428 100644
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
@@ -25,6 +25,11 @@ public class IceBlock extends HalfTransparentBlock {
@Override
public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) {
super.playerDestroy(world, player, pos, state, blockEntity, stack);
+ // Paper start
+ this.afterDestroy(world, pos, stack);
+ }
+ public void afterDestroy(Level world, BlockPos pos, ItemStack stack) {
+ // Paper end
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) == 0) {
if (world.dimensionType().ultraWarm()) {
world.removeBlock(pos, false);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 2e3b675dca8cec906d533141e158e5db6ae87042..3123a8d52236757c3e7ca3b099cc664485cb3c72 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -477,6 +477,18 @@ public class CraftBlock implements Block {
@Override
public boolean breakNaturally(ItemStack item) {
+ // Paper start
+ return this.breakNaturally(item, false);
+ }
+
+ @Override
+ public boolean breakNaturally(boolean triggerEffect, boolean dropExperience) {
+ return this.breakNaturally(null, triggerEffect, dropExperience);
+ }
+
+ @Override
+ public boolean breakNaturally(ItemStack item, boolean triggerEffect, boolean dropExperience) {
+ // Paper end
// Order matters here, need to drop before setting to air so skulls can get their data
net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
net.minecraft.world.level.block.Block block = iblockdata.getBlock();
@@ -486,11 +498,35 @@ public class CraftBlock implements Block {
// Modelled off EntityHuman#hasBlock
if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), position, this.world.getBlockEntity(position), null, nmsItem);
+ // Paper start - improve Block#breanNaturally
+ if (triggerEffect) {
+ if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.BaseFireBlock) {
+ this.world.levelEvent(net.minecraft.world.level.block.LevelEvent.SOUND_EXTINGUISH_FIRE, this.position, 0);
+ } else {
+ this.world.levelEvent(net.minecraft.world.level.block.LevelEvent.PARTICLES_DESTROY_BLOCK, this.position, net.minecraft.world.level.block.Block.getId(iblockdata));
+ }
+ }
+ if (dropExperience) block.popExperience(this.world.getMinecraftWorld(), this.position, block.getExpDrop(iblockdata, this.world.getMinecraftWorld(), this.position, nmsItem, true));
+ // Paper end
result = true;
}
// SPIGOT-6778: Directly call setBlock instead of setTypeAndData, so that the tile entiy is not removed and custom remove logic is run.
- return this.world.setBlock(position, Blocks.AIR.defaultBlockState(), 3) && result;
+ // Paper start - improve breakNaturally
+ boolean destroyed = this.world.removeBlock(this.position, false);
+ if (destroyed) {
+ block.destroy(this.world, this.position, iblockdata);
+ }
+ if (result) {
+ // special cases
+ if (block instanceof net.minecraft.world.level.block.IceBlock iceBlock) {
+ iceBlock.afterDestroy(this.world.getMinecraftWorld(), this.position, nmsItem);
+ } else if (block instanceof net.minecraft.world.level.block.TurtleEggBlock turtleEggBlock) {
+ turtleEggBlock.decreaseEggs(this.world.getMinecraftWorld(), this.position, iblockdata);
+ }
+ }
+ return destroyed && result;
+ // Paper end
}
@Override

Datei anzeigen

@ -10,10 +10,10 @@ public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/Fir
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com> Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 7e97b09376b1e9000511f56f3406dba550ba2612..89b8abc3e7e946aae2ab3d2c870f2d2c95f9671d 100644 index 3123a8d52236757c3e7ca3b099cc664485cb3c72..eba015c33dcf63ff85569eb7ee7e6b3def2b05ac 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -670,5 +670,15 @@ public class CraftBlock implements Block { @@ -693,5 +693,15 @@ public class CraftBlock implements Block {
public org.bukkit.SoundGroup getBlockSoundGroup() { public org.bukkit.SoundGroup getBlockSoundGroup() {
return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType()); return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType());
} }

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 6d9cddb20a069cada6d20e5f61a2ca2ab2c308a0..9a191f16a4d80cde2b2801526fe386abba6e5302 100644 index 01827f2398cec6e18ab490e664360beed9dbca83..ac831b22930ad02951186b6326b0c542de4c9881 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -680,5 +680,26 @@ public class CraftBlock implements Block { @@ -703,5 +703,26 @@ public class CraftBlock implements Block {
public String translationKey() { public String translationKey() {
return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 1def5d8c61d78c1d9ccacafdbf8a16072cf75c6a..8c5f9f2bb0c200a5ef7ad09b27afa6dad057c6f8 100644 index 30b5a78a93405f3a03624ed1331670770aaa3765..974ab329f92f488aba0999cef25e3b8e7e062209 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -720,5 +720,9 @@ public class CraftBlock implements Block { @@ -743,5 +743,9 @@ public class CraftBlock implements Block {
} }
return speed; return speed;
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix return value of Block#applyBoneMeal always being false
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 8c5f9f2bb0c200a5ef7ad09b27afa6dad057c6f8..6ec8ebdd702424d94821180f65f6344be1a0527a 100644 index 974ab329f92f488aba0999cef25e3b8e7e062209..60aa47a78b9d5921dffd1e205c0b69f453a94851 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -560,7 +560,7 @@ public class CraftBlock implements Block { @@ -583,7 +583,7 @@ public class CraftBlock implements Block {
} }
} }

Datei anzeigen

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 21 Dec 2021 16:28:17 -0800
Subject: [PATCH] Fix fluid-logging on Block#breakNaturally
Leaves fluid if the block broken was fluid-logged which is what
happens if a player breaks a fluid-logged block
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 016f58f452e19a00d72a277d41bcbbb107e4232b..2f5b9083a3d11834fca74d11d6ba10d325a7f7c3 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -517,6 +517,7 @@ public class CraftBlock implements Block {
net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
net.minecraft.world.level.block.Block block = iblockdata.getBlock();
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.level.material.FluidState fluidState = this.world.getFluidState(this.position); // Paper
boolean result = false;
// Modelled off EntityHuman#hasBlock
@@ -527,7 +528,7 @@ public class CraftBlock implements Block {
}
// SPIGOT-6778: Directly call setBlock instead of setTypeAndData, so that the tile entiy is not removed and custom remove logic is run.
- return this.world.setBlock(position, Blocks.AIR.defaultBlockState(), 3) && result;
+ return this.world.setBlock(position, fluidState.createLegacyBlock(), 3) && result; // Paper - leave liquid if waterlogged
}
@Override

Datei anzeigen

@ -31,7 +31,7 @@ index 037cc496670c08fbee3fda1ca192758a7cad577c..ae5421fd85de55eecad2db4041c6552e
biomeProvider = generator.getDefaultBiomeProvider(worldInfo); biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index aaba757b605405e08da7b359bc1fc87252114252..04b4c2f4796046828a73d3911da880ccd3fdf349 100644 index cb7c070c190e63644160ddd9855628547fd37ee1..2cee0f5a746d37fa5b3fbe0ca3af2632af6f5735 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -199,6 +199,30 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -199,6 +199,30 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -7,7 +7,7 @@ Makes the PlayerKickEvent fire on the main thread for
illegal characters or chat out-of-order errors. illegal characters or chat out-of-order errors.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7dff3cff9ec9c87fea7be838a6a34c02f2eeb3b1..25b2bdca86b62e0c76059d87da9214c0bb41fe51 100644 index 6d64870e3142c5114166f9e27206a20aa900e83b..d5bb89bd4948f1aff24c4725def980e6bcbdae84 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2172,7 +2172,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2172,7 +2172,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Implement regenerateChunk
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 04b4c2f4796046828a73d3911da880ccd3fdf349..a71886568581f39f91e3b06eada560aa60cf0c93 100644 index 2cee0f5a746d37fa5b3fbe0ca3af2632af6f5735..498d8e2782d28db0fd35b737d548c1ffba238177 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -138,6 +138,7 @@ import org.bukkit.util.Vector; @@ -138,6 +138,7 @@ import org.bukkit.util.Vector;

Datei anzeigen

@ -24,7 +24,7 @@ index bb486249d409743b0fc9891ac5ae76a38034800b..e365081bf532488f2b41b22deb2fb234
if (Snowball.class.isAssignableFrom(clazz)) { if (Snowball.class.isAssignableFrom(clazz)) {
entity = new net.minecraft.world.entity.projectile.Snowball(world, x, y, z); entity = new net.minecraft.world.entity.projectile.Snowball(world, x, y, z);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a71886568581f39f91e3b06eada560aa60cf0c93..56f1952a4595df2b2647dc9e6632cee44e8299ce 100644 index 498d8e2782d28db0fd35b737d548c1ffba238177..63dff3a4426470cede26fcb03424f8cf63757214 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1394,7 +1394,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1394,7 +1394,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -18,7 +18,7 @@ public net.minecraft.world.entity.projectile.Projectile leftOwner
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
index 1eec7926627d7956ffdd33f76247829453af3bf2..e41f99bdef9f779b3d039bfe7a4e560e9daed9f5 100644 index 740ff3fed9c8d637527fda8544eba2b9d7d7280a..1f1519c1b33d16eba59546c86f20a099486441d7 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
@@ -100,6 +100,11 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie @@ -100,6 +100,11 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie

Datei anzeigen

@ -7,7 +7,7 @@ Bring the vehicle move packet behavior in line with the
regular player move packet. regular player move packet.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 25b2bdca86b62e0c76059d87da9214c0bb41fe51..cdfb47713c690dbdfb54e20f68c3f6361209de0b 100644 index d5bb89bd4948f1aff24c4725def980e6bcbdae84..f4a7ca4a525c4c573992b3ec38f5ad77a9cc04a5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -577,6 +577,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -577,6 +577,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -23,7 +23,7 @@ index e365081bf532488f2b41b22deb2fb2346d4f2322..446657577aa843e6ebc5143b6c511f33
public void setBiome(Location location, Biome biome) { public void setBiome(Location location, Biome biome) {
this.setBiome(location.getBlockX(), location.getBlockY(), location.getBlockZ(), biome); this.setBiome(location.getBlockX(), location.getBlockY(), location.getBlockZ(), biome);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 2f5b9083a3d11834fca74d11d6ba10d325a7f7c3..38408e37cd3d8742a5cbf6711d48b9c7a35159a1 100644 index d6d8929c5332ddd315e67ebceb14f10c447f0f53..cd8ffcbcda3497e79d5e4a5d699ed6e28995571a 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -343,6 +343,13 @@ public class CraftBlock implements Block { @@ -343,6 +343,13 @@ public class CraftBlock implements Block {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] cache resource keys
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 38408e37cd3d8742a5cbf6711d48b9c7a35159a1..47ee348a7042a8e0705bc7d2c4077c0f270a8239 100644 index cd8ffcbcda3497e79d5e4a5d699ed6e28995571a..b6bf79b571c3a82df92e41810f68cdc1d3ec05ca 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -368,12 +368,13 @@ public class CraftBlock implements Block { @@ -368,12 +368,13 @@ public class CraftBlock implements Block {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent tile entity copies loading chunks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cdfb47713c690dbdfb54e20f68c3f6361209de0b..16ae84c100b5548035b7b8b23a6480f47ae22646 100644 index f4a7ca4a525c4c573992b3ec38f5ad77a9cc04a5..84ec466ee96c7ad68f48109e816314827102d7b1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3284,7 +3284,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3284,7 +3284,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Datei anzeigen

@ -18,7 +18,7 @@ index 5b46cabf4f2e2a1f7feaad378dd98d64aeef8671..51b3db0b6c2cede95b584268e035c0fb
if (dedicatedserverproperties.enableQuery) { if (dedicatedserverproperties.enableQuery) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 16ae84c100b5548035b7b8b23a6480f47ae22646..acb4b6bb80b59af28ba3658c11096750dccb5056 100644 index 84ec466ee96c7ad68f48109e816314827102d7b1..f63e29b0783d53a30e0fa16ff2566020c057e4bb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2875,7 +2875,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2875,7 +2875,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -158,7 +158,7 @@ index fa8cd4438c19a262272da47985a57f7e84654f1b..663c1d8c1611af915a1bae733920dd75
this.onChanged(server); this.onChanged(server);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 56f1952a4595df2b2647dc9e6632cee44e8299ce..37a204d35979fb51cab9c228515e35c4b1049ab1 100644 index 63dff3a4426470cede26fcb03424f8cf63757214..01ccb54fb94fc5c03865b12bde63a2cb5a46e0f5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1898,7 +1898,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1898,7 +1898,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Do not accept invalid client settings
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index acb4b6bb80b59af28ba3658c11096750dccb5056..29ba350b026f8bec0654ba1ee7f34d5aa5f1648b 100644 index f63e29b0783d53a30e0fa16ff2566020c057e4bb..b0b4c53cea08153f4d64da848fecced46424fea6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3463,6 +3463,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3463,6 +3463,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen