aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server/patches
diff options
context:
space:
mode:
authorOwen1212055 <[email protected]>2024-12-19 00:00:37 -0500
committerOwen1212055 <[email protected]>2024-12-19 20:44:24 -0500
commit2935905ced6c8543a87eb0f0971542c4531aed6e (patch)
tree2121d8e9218d6e8464a093358a16b677d166fe96 /paper-server/patches
parent413751ae2daf6e981363c76c81f27adcf6756a54 (diff)
downloadPaper-2935905ced6c8543a87eb0f0971542c4531aed6e.tar.gz
Paper-2935905ced6c8543a87eb0f0971542c4531aed6e.zip
Small sculk cleanup
Don't check for empty items anymore in FishingHook. Removes some diff + we handle it gracefully in add fresh entity
Diffstat (limited to 'paper-server/patches')
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch24
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/SculkBlock.java.patch11
2 files changed, 9 insertions, 26 deletions
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch
index 68d1d7f9e5..b433002c90 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch
@@ -171,20 +171,12 @@
} else if (this.nibble > 0) {
LootParams lootParams = new LootParams.Builder((ServerLevel)this.level())
.withParameter(LootContextParams.ORIGIN, this.position())
-@@ -464,19 +_,43 @@
- CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)playerOwner, stack, this, randomItems);
+@@ -465,18 +_,32 @@
for (ItemStack itemStack : randomItems) {
-- ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemStack);
-+ // Paper start - new ItemEntity would throw if for whatever reason (mostly shitty datapacks) the itemStack turns out to be empty
-+ // if the item stack is empty we instead just have our itemEntity as null
-+ ItemEntity itemEntity = null;
-+ if (!itemStack.isEmpty()) {
-+ itemEntity = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemStack);
-+ }
-+ // Paper end
+ ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemStack);
+ // CraftBukkit start
-+ org.bukkit.event.player.PlayerFishEvent playerFishEvent = new org.bukkit.event.player.PlayerFishEvent((org.bukkit.entity.Player) playerOwner.getBukkitEntity(), itemEntity != null ? itemEntity.getBukkitEntity() : null, (org.bukkit.entity.FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), org.bukkit.event.player.PlayerFishEvent.State.CAUGHT_FISH); // Paper - itemEntity may be null // Paper - Add hand parameter to PlayerFishEvent
++ org.bukkit.event.player.PlayerFishEvent playerFishEvent = new org.bukkit.event.player.PlayerFishEvent((org.bukkit.entity.Player) playerOwner.getBukkitEntity(), itemEntity.getBukkitEntity(), (org.bukkit.entity.FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), org.bukkit.event.player.PlayerFishEvent.State.CAUGHT_FISH); // Paper - itemEntity may be null // Paper - Add hand parameter to PlayerFishEvent
+ playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
+ this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
+
@@ -196,20 +188,14 @@
double d1 = playerOwner.getY() - this.getY();
double d2 = playerOwner.getZ() - this.getZ();
double d3 = 0.1;
-- itemEntity.setDeltaMovement(d * 0.1, d1 * 0.1 + Math.sqrt(Math.sqrt(d * d + d1 * d1 + d2 * d2)) * 0.08, d2 * 0.1);
-- this.level().addFreshEntity(itemEntity);
+ itemEntity.setDeltaMovement(d * 0.1, d1 * 0.1 + Math.sqrt(Math.sqrt(d * d + d1 * d1 + d2 * d2)) * 0.08, d2 * 0.1);
+ this.level().addFreshEntity(itemEntity);
- playerOwner.level()
- .addFreshEntity(
- new ExperienceOrb(
- playerOwner.level(), playerOwner.getX(), playerOwner.getY() + 0.5, playerOwner.getZ() + 0.5, this.random.nextInt(6) + 1
- )
- );
-+ // Paper start - entity item can be null, so we need to check against this
-+ if (itemEntity != null) {
-+ itemEntity.setDeltaMovement(d * 0.1, d1 * 0.1 + Math.sqrt(Math.sqrt(d * d + d1 * d1 + d2 * d2)) * 0.08, d2 * 0.1);
-+ this.level().addFreshEntity(itemEntity);
-+ }
-+ // Paper end
+ // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
+ if (playerFishEvent.getExpToDrop() > 0) {
+ playerOwner.level()
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/SculkBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/SculkBlock.java.patch
index 681606e369..f17c4e7aa6 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/SculkBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/SculkBlock.java.patch
@@ -1,16 +1,13 @@
--- a/net/minecraft/world/level/block/SculkBlock.java
+++ b/net/minecraft/world/level/block/SculkBlock.java
-@@ -37,8 +_,11 @@
+@@ -37,8 +_,9 @@
if (random.nextInt(growthSpawnCost) < charge) {
BlockPos blockPos = pos1.above();
BlockState randomGrowthState = this.getRandomGrowthState(level, blockPos, random, spreader.isWorldGeneration());
- level.setBlock(blockPos, randomGrowthState, 3);
-- level.playSound(null, pos1, randomGrowthState.getSoundType().getPlaceSound(), SoundSource.BLOCKS, 1.0F, 1.0F);
-+ // CraftBukkit start - Call BlockSpreadEvent
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(level, pos, blockPos, randomGrowthState, 3)) {
-+ level.playSound(null, pos1, randomGrowthState.getSoundType().getPlaceSound(), SoundSource.BLOCKS, 1.0F, 1.0F);
-+ }
-+ // CraftBukkit end
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(level, pos, blockPos, randomGrowthState, 3)) { // CraftBukkit - Call BlockSpreadEvent
+ level.playSound(null, pos1, randomGrowthState.getSoundType().getPlaceSound(), SoundSource.BLOCKS, 1.0F, 1.0F);
++ } // CraftBukkit - Call BlockSpreadEvent
}
return Math.max(0, charge - growthSpawnCost);