From 3e9e7acd0b1a93a41d02f6b987bd7792a68c3a8c Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Sun, 5 Jun 2022 21:41:22 -0400 Subject: [PATCH] Mock SculkChargeEventConfiguration --- ... 0384-Event-Effect-API-Improvements.patch} | 16 +++++++------- ... 0913-Event-Effect-API-Improvements.patch} | 21 ++++++++++++++++--- 2 files changed, 27 insertions(+), 10 deletions(-) rename patches/api/{0384-Block-World-Event-API.patch => 0384-Event-Effect-API-Improvements.patch} (98%) rename patches/server/{0913-Block-World-Event-API.patch => 0913-Event-Effect-API-Improvements.patch} (92%) diff --git a/patches/api/0384-Block-World-Event-API.patch b/patches/api/0384-Event-Effect-API-Improvements.patch similarity index 98% rename from patches/api/0384-Block-World-Event-API.patch rename to patches/api/0384-Event-Effect-API-Improvements.patch index f0e8d33cde..3169715e07 100644 --- a/patches/api/0384-Block-World-Event-API.patch +++ b/patches/api/0384-Event-Effect-API-Improvements.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Sun, 5 Jun 2022 21:19:40 -0400 -Subject: [PATCH] Block/World Event API +Subject: [PATCH] Event/Effect API Improvements diff --git a/src/main/java/io/papermc/paper/block/event/BlockEvent.java b/src/main/java/io/papermc/paper/block/event/BlockEvent.java @@ -169,17 +169,19 @@ index 0000000000000000000000000000000000000000..f3a0bde72d5e8b9edca46ea2f376359f +} diff --git a/src/main/java/io/papermc/paper/world/event/SculkChargeEventConfiguration.java b/src/main/java/io/papermc/paper/world/event/SculkChargeEventConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..379357a7ff1e08a49697c4c82097d0ca3f1ee980 +index 0000000000000000000000000000000000000000..59f77614f8c2e21c07be44be00f2a8b4e3b450c9 --- /dev/null +++ b/src/main/java/io/papermc/paper/world/event/SculkChargeEventConfiguration.java -@@ -0,0 +1,24 @@ +@@ -0,0 +1,26 @@ +package io.papermc.paper.world.event; + +import org.bukkit.block.BlockFace; -+import org.jetbrains.annotations.Nullable; ++import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Range; + -+public record SculkChargeEventConfiguration(@Range(from = 0, to = 1000) int charge, @Nullable BlockFace... blockFaces) { ++import java.util.Collection; ++ ++public record SculkChargeEventConfiguration(@Range(from = 0, to = 1000) int charge, @NotNull Collection blockFaces) { + + /** + * Gets the charge of this current sculk charge event. @@ -192,8 +194,8 @@ index 0000000000000000000000000000000000000000..379357a7ff1e08a49697c4c82097d0ca + /** + * Gets the block faces that this sculk charge effects. + */ -+ @Nullable -+ public BlockFace[] blockFaces() { ++ @NotNull ++ public Collection blockFaces() { + return this.blockFaces; + } +} diff --git a/patches/server/0913-Block-World-Event-API.patch b/patches/server/0913-Event-Effect-API-Improvements.patch similarity index 92% rename from patches/server/0913-Block-World-Event-API.patch rename to patches/server/0913-Event-Effect-API-Improvements.patch index 45c4931487..9f9a90c2cd 100644 --- a/patches/server/0913-Block-World-Event-API.patch +++ b/patches/server/0913-Event-Effect-API-Improvements.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Sun, 5 Jun 2022 21:19:33 -0400 -Subject: [PATCH] Block/World Event API +Subject: [PATCH] Event/Effect API Improvements diff --git a/src/main/java/io/papermc/paper/block/event/PaperBlockEvent.java b/src/main/java/io/papermc/paper/block/event/PaperBlockEvent.java @@ -76,10 +76,10 @@ index 0000000000000000000000000000000000000000..6985c1783dc286818c7a82ded825e9f6 +} diff --git a/src/main/java/io/papermc/paper/world/event/PaperWorldEvent.java b/src/main/java/io/papermc/paper/world/event/PaperWorldEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..aedcb1b294c1f9eece252547d4f1e95fc12f6d51 +index 0000000000000000000000000000000000000000..52769b41471f314ed7e2017c04ef7729bccf2317 --- /dev/null +++ b/src/main/java/io/papermc/paper/world/event/PaperWorldEvent.java -@@ -0,0 +1,72 @@ +@@ -0,0 +1,87 @@ +package io.papermc.paper.world.event; + +import net.minecraft.network.protocol.game.ClientboundLevelEventPacket; @@ -87,6 +87,7 @@ index 0000000000000000000000000000000000000000..aedcb1b294c1f9eece252547d4f1e95f +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.Item; ++import net.minecraft.world.level.block.MultifaceBlock; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; @@ -97,6 +98,9 @@ index 0000000000000000000000000000000000000000..aedcb1b294c1f9eece252547d4f1e95f +import org.bukkit.craftbukkit.util.CraftMagicNumbers; +import org.jetbrains.annotations.Nullable; + ++import java.util.Collection; ++import java.util.List; ++ +public class PaperWorldEvent { + + public static int getData(ConfigurableWorldEvent event, T data) { @@ -131,6 +135,17 @@ index 0000000000000000000000000000000000000000..aedcb1b294c1f9eece252547d4f1e95f + } + + return CraftBlock.blockFaceToNotch(face).get3DDataValue(); ++ } else if (configurationClass == SculkChargeEventConfiguration.class) { ++ SculkChargeEventConfiguration chargeEventConfiguration = (SculkChargeEventConfiguration) data; ++ if (chargeEventConfiguration.charge() <= 0) { ++ return 0; ++ } else { ++ // SculkSpreader#updateCursors ++ int charge = (int)(Math.log1p((double) chargeEventConfiguration.charge()) / 2.3F) + 1; ++ Collection faces = chargeEventConfiguration.blockFaces(); ++ ++ return (charge << 6) + /*MultifaceBlock.pack(faces)*/0; ++ } + } + + throw new UnsupportedOperationException();