mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
Mock SculkChargeEventConfiguration
This commit is contained in:
parent
28fbb5a218
commit
3e9e7acd0b
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||||
Date: Sun, 5 Jun 2022 21:19:40 -0400
|
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
|
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
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..379357a7ff1e08a49697c4c82097d0ca3f1ee980
|
index 0000000000000000000000000000000000000000..59f77614f8c2e21c07be44be00f2a8b4e3b450c9
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/world/event/SculkChargeEventConfiguration.java
|
+++ 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;
|
+package io.papermc.paper.world.event;
|
||||||
+
|
+
|
||||||
+import org.bukkit.block.BlockFace;
|
+import org.bukkit.block.BlockFace;
|
||||||
+import org.jetbrains.annotations.Nullable;
|
+import org.jetbrains.annotations.NotNull;
|
||||||
+import org.jetbrains.annotations.Range;
|
+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<BlockFace> blockFaces) {
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Gets the charge of this current sculk charge event.
|
+ * 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.
|
+ * Gets the block faces that this sculk charge effects.
|
||||||
+ */
|
+ */
|
||||||
+ @Nullable
|
+ @NotNull
|
||||||
+ public BlockFace[] blockFaces() {
|
+ public Collection<BlockFace> blockFaces() {
|
||||||
+ return this.blockFaces;
|
+ return this.blockFaces;
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||||
Date: Sun, 5 Jun 2022 21:19:33 -0400
|
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
|
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
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..aedcb1b294c1f9eece252547d4f1e95fc12f6d51
|
index 0000000000000000000000000000000000000000..52769b41471f314ed7e2017c04ef7729bccf2317
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/world/event/PaperWorldEvent.java
|
+++ 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;
|
+package io.papermc.paper.world.event;
|
||||||
+
|
+
|
||||||
+import net.minecraft.network.protocol.game.ClientboundLevelEventPacket;
|
+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.ServerLevel;
|
||||||
+import net.minecraft.server.level.ServerPlayer;
|
+import net.minecraft.server.level.ServerPlayer;
|
||||||
+import net.minecraft.world.item.Item;
|
+import net.minecraft.world.item.Item;
|
||||||
|
+import net.minecraft.world.level.block.MultifaceBlock;
|
||||||
+import org.bukkit.Color;
|
+import org.bukkit.Color;
|
||||||
+import org.bukkit.Location;
|
+import org.bukkit.Location;
|
||||||
+import org.bukkit.Material;
|
+import org.bukkit.Material;
|
||||||
@ -97,6 +98,9 @@ index 0000000000000000000000000000000000000000..aedcb1b294c1f9eece252547d4f1e95f
|
|||||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||||
+import org.jetbrains.annotations.Nullable;
|
+import org.jetbrains.annotations.Nullable;
|
||||||
+
|
+
|
||||||
|
+import java.util.Collection;
|
||||||
|
+import java.util.List;
|
||||||
|
+
|
||||||
+public class PaperWorldEvent {
|
+public class PaperWorldEvent {
|
||||||
+
|
+
|
||||||
+ public static <T> int getData(ConfigurableWorldEvent<T> event, T data) {
|
+ public static <T> int getData(ConfigurableWorldEvent<T> event, T data) {
|
||||||
@ -131,6 +135,17 @@ index 0000000000000000000000000000000000000000..aedcb1b294c1f9eece252547d4f1e95f
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return CraftBlock.blockFaceToNotch(face).get3DDataValue();
|
+ 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<BlockFace> faces = chargeEventConfiguration.blockFaces();
|
||||||
|
+
|
||||||
|
+ return (charge << 6) + /*MultifaceBlock.pack(faces)*/0;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ throw new UnsupportedOperationException();
|
+ throw new UnsupportedOperationException();
|
Loading…
Reference in New Issue
Block a user