Skip to content

Commit 33fb2df

Browse files
committed
i think this builds
1 parent 9841952 commit 33fb2df

10 files changed

Lines changed: 325 additions & 80 deletions

File tree

parchment-api/paper-patches/files/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java.patch

Lines changed: 0 additions & 50 deletions
This file was deleted.

parchment-api/paper-patches/files/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java.patch

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88

99
@ApiStatus.Internal
1010
@Deprecated(since = "1.20.4", forRemoval = true)
11-
@@ -39,14 +_,35 @@
11+
@@ -34,20 +_,41 @@
12+
super(damagee, cause, damageSource, damage);
13+
this.damager = damager;
14+
this.damagerState = damagerState;
15+
+ this.location = damager.getLocation();
16+
}
17+
1218
@ApiStatus.Internal
1319
@Deprecated(since = "1.20.4", forRemoval = true)
1420
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
@@ -22,6 +28,7 @@
2228
super(damagee, cause, damageSource, modifiers, modifierFunctions);
2329
this.damager = damager;
2430
this.damagerState = damagerState;
31+
- }
2532
+ // Parchment start
2633
+ if (damageLocation != null)
2734
+ this.location = damageLocation;
@@ -43,9 +50,9 @@
4350
+ return location;
4451
+ }
4552
+ // Parchment end
46-
}
4753

4854
/**
55+
* Returns the block that damaged the player.
4956
@@ -71,4 +_,5 @@
5057
public BlockState getDamagerBlockState() {
5158
return this.damagerState;

parchment-api/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public final class SoundEvent extends Event implements Cancellable {
4242
.toList();
4343
});
4444

45-
private @Nullable HumanEntity except;
45+
private @Nullable Entity except;
4646
private @NotNull Function<@NotNull Sound, @NotNull Double> distanceFunction;
4747
private @NotNull Function<@NotNull SoundEvent, @NotNull List<@NotNull Player>> recipientsFunction;
4848
private @NotNull Sound sound;
@@ -51,7 +51,7 @@ public final class SoundEvent extends Event implements Cancellable {
5151
private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Sound> soundOverrideFunction;
5252
private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Emitter> emitterOverrideFunction;
5353

54-
public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull Emitter emitter, @Nullable Function<Sound, Double> distanceFunction, @Nullable Function<SoundEvent, List<Player>> recipientsFunction) {
54+
public SoundEvent(@Nullable Entity except, @NotNull Sound sound, @NotNull Emitter emitter, @Nullable Function<Sound, Double> distanceFunction, @Nullable Function<SoundEvent, List<Player>> recipientsFunction) {
5555
super(true);
5656
this.except = except;
5757
this.sound = Objects.requireNonNull(sound, "sound cannot be null");
@@ -65,7 +65,7 @@ public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull E
6565
*
6666
* @return player excluded from receiving this sound
6767
*/
68-
public @Nullable HumanEntity getException() {
68+
public @Nullable Entity getException() {
6969
return except;
7070
}
7171

@@ -74,7 +74,7 @@ public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull E
7474
*
7575
* @param except player excluded from receiving this sound
7676
*/
77-
public void setException(@Nullable HumanEntity except) {
77+
public void setException(@Nullable Entity except) {
7878
this.except = except;
7979
}
8080

@@ -295,7 +295,7 @@ private record WrappedRecipientsFunction(@NotNull Function<SoundEvent, List<Play
295295
@Override
296296
public @NotNull List<Player> apply(@NotNull SoundEvent event) {
297297
List<Player> recipients = wrapped.apply(event);
298-
HumanEntity except = event.getException();
298+
Entity except = event.getException();
299299
if (except != null) {
300300
List<Player> filteredRecipients = new ArrayList<>(recipients.size());
301301
for (Player player : recipients) {

parchment-server/build.gradle.kts.patch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,12 @@
7373
"Build-Number" to (build ?: ""),
7474
"Build-Time" to buildTime.toString(),
7575
"Git-Branch" to gitBranch,
76+
@@ -266,7 +_,7 @@
77+
jvmArgumentProviders.add(provider)
78+
}
79+
80+
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
81+
+val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-server/src/generated/java").asFile.toPath()
82+
idea {
83+
module {
84+
generatedSourceDirs.add(generatedDir.toFile())

parchment-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
- );
2727
+ // Parchment start - sound event
2828
+ org.bukkit.craftbukkit.event.CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
29-
+ player == null ? null : player.getBukkitEntity(),
29+
+ entity == null ? null : entity.getBukkitEntity(),
3030
+ net.kyori.adventure.sound.Sound.sound()
3131
+ .type(sound.unwrap().<net.kyori.adventure.key.Key>map(
3232
+ key -> io.papermc.paper.adventure.PaperAdventure.asAdventure(key.location()),
3333
+ soundEvent -> io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEvent.location())
3434
+ ))
35-
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
35+
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(source))
3636
+ .volume(volume)
3737
+ .pitch(pitch)
3838
+ .seed(seed)
@@ -61,13 +61,13 @@
6161
- );
6262
+ // Parchment start - sound event
6363
+ org.bukkit.craftbukkit.event.CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
64-
+ player == null ? null : player.getBukkitEntity(),
64+
+ entity == null ? null : entity.getBukkitEntity(),
6565
+ net.kyori.adventure.sound.Sound.sound()
6666
+ .type(sound.unwrap().<net.kyori.adventure.key.Key>map(
6767
+ key -> io.papermc.paper.adventure.PaperAdventure.asAdventure(key.location()),
6868
+ soundEvent -> io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEvent.location())
6969
+ ))
70-
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
70+
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(source))
7171
+ .volume(volume)
7272
+ .pitch(pitch)
7373
+ .seed(seed)

parchment-server/minecraft-patches/sources/net/minecraft/world/item/BowItem.java.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
--- a/net/minecraft/world/item/BowItem.java
22
+++ b/net/minecraft/world/item/BowItem.java
3-
@@ -38,6 +_,10 @@
3+
@@ -38,7 +_,11 @@
44
} else {
55
List<ItemStack> list = draw(stack, projectile, player);
66
if (level instanceof ServerLevel serverLevel && !list.isEmpty()) {
7+
- this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, powerForTime * 3.0F, 1.0F, powerForTime == 1.0F, null, powerForTime); // Paper - Pass draw strength
78
+ // Parchment start
89
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(player.getBukkitEntity(), stack.asBukkitCopy(), stack.asBukkitCopy());
910
+ if (!preEvent.callEvent()) return false;
1011
+ // Parchment end
11-
this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, powerForTime * 3.0F, 1.0F, powerForTime == 1.0F, null, powerForTime); // Paper - Pass draw strength
12+
+ this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, powerForTime * 3.0F, 1.0F, powerForTime == 1.0F, null, powerForTime, preEvent.isRelative()); // Paper - Pass draw strength
1213
}
1314

15+
level.playSound(
1416
@@ -60,9 +_,9 @@
1517

1618
@Override

0 commit comments

Comments
 (0)