all api patches done*
*still waiting for leaf to port datafixer to 1.18 so i can do entity serialization
This commit is contained in:
parent
4df6820f86
commit
c1d14dc076
34 changed files with 49 additions and 62 deletions
|
@ -1,71 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 17:58:25 -0800
|
||||
Subject: [PATCH] Add BlockBreakBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ac7a60403a9e51fc194f2cc92b0bd60d8879a661
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
|
||||
@@ -0,0 +1,59 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a block forces another block to break and drop items.
|
||||
+ * <p>
|
||||
+ * Currently called for piston's and liquid flows.
|
||||
+ */
|
||||
+public class BlockBreakBlockEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final List<ItemStack> drops;
|
||||
+ private final Block source;
|
||||
+
|
||||
+ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List<ItemStack> drops) {
|
||||
+ super(block);
|
||||
+ this.source = source;
|
||||
+ this.drops = drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the drops of this event
|
||||
+ *
|
||||
+ * @return the drops
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public List<ItemStack> getDrops() {
|
||||
+ return drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block that cause this (e.g. a piston, or adjacent liquid)
|
||||
+ *
|
||||
+ * @return the source
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getSource() {
|
||||
+ return source;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,37 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Madeline Miller <mnmiller1@me.com>
|
||||
Date: Sun, 29 Aug 2021 17:00:56 +1000
|
||||
Subject: [PATCH] Add helpers for left/right hand to Action
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/Action.java b/src/main/java/org/bukkit/event/block/Action.java
|
||||
index 25d26e3fe713311e66d7e634a6c32af61f4cef59..f0b672bbfcd0eb17f3953ffcd0e728f5b3ec909b 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/Action.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/Action.java
|
||||
@@ -29,5 +29,25 @@ public enum Action {
|
||||
* <li>Triggering tripwire
|
||||
* </ul>
|
||||
*/
|
||||
- PHYSICAL,
|
||||
+ // Paper start
|
||||
+ PHYSICAL;
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this action is a result of a left click.
|
||||
+ *
|
||||
+ * @return Whether it's a left click
|
||||
+ */
|
||||
+ public boolean isLeftClick() {
|
||||
+ return this == LEFT_CLICK_AIR || this == LEFT_CLICK_BLOCK;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this action is a result of a right click.
|
||||
+ *
|
||||
+ * @return Whether it's a right click
|
||||
+ */
|
||||
+ public boolean isRightClick() {
|
||||
+ return this == RIGHT_CLICK_AIR || this == RIGHT_CLICK_BLOCK;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 12:57:35 -0700
|
||||
Subject: [PATCH] Option to prevent NBT copy in smithing recipes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/SmithingRecipe.java b/src/main/java/org/bukkit/inventory/SmithingRecipe.java
|
||||
index af04071d37e70b8cc9837d57477c8493be8afb9f..00000f1399b053bb3c7b6d4792559b630d414b81 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/SmithingRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/SmithingRecipe.java
|
||||
@@ -13,6 +13,7 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||
private final ItemStack result;
|
||||
private final RecipeChoice base;
|
||||
private final RecipeChoice addition;
|
||||
+ private final boolean copyNbt; // Paper
|
||||
|
||||
/**
|
||||
* Create a smithing recipe to produce the specified result ItemStack.
|
||||
@@ -23,6 +24,21 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||
* @param addition The addition ingredient
|
||||
*/
|
||||
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
|
||||
+ // Paper start
|
||||
+ this(key, result, base, addition, true);
|
||||
+ }
|
||||
+ /**
|
||||
+ * Create a smithing recipe to produce the specified result ItemStack.
|
||||
+ *
|
||||
+ * @param key The unique recipe key
|
||||
+ * @param result The item you want the recipe to create.
|
||||
+ * @param base The base ingredient
|
||||
+ * @param addition The addition ingredient
|
||||
+ * @param copyNbt whether to copy the nbt from the input base item to the output
|
||||
+ */
|
||||
+ public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyNbt) {
|
||||
+ this.copyNbt = copyNbt;
|
||||
+ // Paper end
|
||||
this.key = key;
|
||||
this.result = result;
|
||||
this.base = base;
|
||||
@@ -60,4 +76,15 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||
public NamespacedKey getKey() {
|
||||
return this.key;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Whether or not to copy the NBT of the input base item to the output.
|
||||
+ *
|
||||
+ * @return true to copy the NBT (default for vanilla smithing recipes)
|
||||
+ */
|
||||
+ public boolean willCopyNbt() {
|
||||
+ return copyNbt;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 28 May 2021 21:47:39 -0700
|
||||
Subject: [PATCH] More CommandBlock API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/command/CommandBlockHolder.java b/src/main/java/io/papermc/paper/command/CommandBlockHolder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..09e57f495e3cbf3c6f434d12ab34830862faeb88
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/command/CommandBlockHolder.java
|
||||
@@ -0,0 +1,58 @@
|
||||
+package io.papermc.paper.command;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public interface CommandBlockHolder {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command that this CommandBlock will run when powered.
|
||||
+ * This will never return null. If the CommandBlock does not have a
|
||||
+ * command, an empty String will be returned instead.
|
||||
+ *
|
||||
+ * @return Command that this CommandBlock will run when activated.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getCommand();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the command that this CommandBlock will run when powered.
|
||||
+ * Setting the command to null is the same as setting it to an empty
|
||||
+ * String.
|
||||
+ *
|
||||
+ * @param command Command that this CommandBlock will run when activated.
|
||||
+ */
|
||||
+ void setCommand(@Nullable String command);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the last output from this command block.
|
||||
+ *
|
||||
+ * @return the last output
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Component lastOutput();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the last output from this command block.
|
||||
+ *
|
||||
+ * @param lastOutput the last output
|
||||
+ */
|
||||
+ void lastOutput(@Nullable Component lastOutput);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the success count from this command block.
|
||||
+ * @see <a href="https://minecraft.fandom.com/wiki/Command_Block#Success_count">Command_Block#Success_count</a>
|
||||
+ *
|
||||
+ * @return the success count
|
||||
+ */
|
||||
+ int getSuccessCount();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the success count from this command block.
|
||||
+ * @see <a href="https://minecraft.fandom.com/wiki/Command_Block#Success_count">Command_Block#Success_count</a>
|
||||
+ *
|
||||
+ * @param successCount the success count
|
||||
+ */
|
||||
+ void setSuccessCount(int successCount);
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/block/CommandBlock.java b/src/main/java/org/bukkit/block/CommandBlock.java
|
||||
index 73dce588d1f7a5048300073bf8c2b14d6da1e857..d63da691fb8cfa04bb699adb2eb55278e8b76200 100644
|
||||
--- a/src/main/java/org/bukkit/block/CommandBlock.java
|
||||
+++ b/src/main/java/org/bukkit/block/CommandBlock.java
|
||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a command block.
|
||||
*/
|
||||
-public interface CommandBlock extends TileState {
|
||||
+public interface CommandBlock extends TileState, io.papermc.paper.command.CommandBlockHolder { // Paper
|
||||
|
||||
/**
|
||||
* Gets the command that this CommandBlock will run when powered.
|
||||
diff --git a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
|
||||
index 91cab8b13d5bba34007f124838b32a1df58c5ac7..6a6021ad3a0e6aaf51f5144fa126e81bada9cfcf 100644
|
||||
--- a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
|
||||
+++ b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
|
||||
@@ -4,7 +4,7 @@ import org.bukkit.entity.Minecart;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
-public interface CommandMinecart extends Minecart {
|
||||
+public interface CommandMinecart extends Minecart, io.papermc.paper.command.CommandBlockHolder { // Paper
|
||||
|
||||
/**
|
||||
* Gets the command that this CommandMinecart will run when activated.
|
|
@ -1,27 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nassim Jahnke <jahnke.nassim@gmail.com>
|
||||
Date: Fri, 1 Oct 2021 09:47:00 +0200
|
||||
Subject: [PATCH] Fix plugin provides load order
|
||||
|
||||
Fixes https://hub.spigotmc.org/jira/browse/SPIGOT-6740
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index c57a59d337a41c083e88e36637d839db027b9289..1366496271c4c7f72d1e5f990e51775b1c371f99 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -281,6 +281,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
// Paper end
|
||||
missingDependency = false;
|
||||
pluginIterator.remove();
|
||||
+ pluginsProvided.values().removeIf(s -> s.equals(plugin)); // Paper - remove provided plugins
|
||||
softDependencies.remove(plugin);
|
||||
dependencies.remove(plugin);
|
||||
|
||||
@@ -314,6 +315,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
// We're clear to load, no more soft or hard dependencies left
|
||||
File file = plugins.get(plugin);
|
||||
pluginIterator.remove();
|
||||
+ pluginsProvided.values().removeIf(s -> s.equals(plugin)); // Paper - remove provided plugins
|
||||
missingDependency = false;
|
||||
|
||||
try {
|
|
@ -1,69 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 1 Oct 2021 08:04:43 -0700
|
||||
Subject: [PATCH] Add missing team sidebar display slots
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
||||
index 5d58a18b3625fd01ea34969200edc3bc80cbb587..fe7d0a19f970ac5b4e0c4bef4ff7c4ceae60bb86 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
||||
@@ -1,10 +1,55 @@
|
||||
package org.bukkit.scoreboard;
|
||||
|
||||
+import net.kyori.adventure.text.format.NamedTextColor; // Paper
|
||||
/**
|
||||
* Locations for displaying objectives to the player
|
||||
*/
|
||||
public enum DisplaySlot {
|
||||
- BELOW_NAME,
|
||||
- PLAYER_LIST,
|
||||
- SIDEBAR;
|
||||
+ // Paper start
|
||||
+ BELOW_NAME("belowName"),
|
||||
+ PLAYER_LIST("list"),
|
||||
+ SIDEBAR("sidebar"),
|
||||
+ SIDEBAR_TEAM_BLACK(NamedTextColor.BLACK),
|
||||
+ SIDEBAR_TEAM_DARK_BLUE(NamedTextColor.DARK_BLUE),
|
||||
+ SIDEBAR_TEAM_DARK_GREEN(NamedTextColor.DARK_GREEN),
|
||||
+ SIDEBAR_TEAM_DARK_AQUA(NamedTextColor.DARK_AQUA),
|
||||
+ SIDEBAR_TEAM_DARK_RED(NamedTextColor.DARK_RED),
|
||||
+ SIDEBAR_TEAM_DARK_PURPLE(NamedTextColor.DARK_PURPLE),
|
||||
+ SIDEBAR_TEAM_GOLD(NamedTextColor.GOLD),
|
||||
+ SIDEBAR_TEAM_GRAY(NamedTextColor.GRAY),
|
||||
+ SIDEBAR_TEAM_DARK_GRAY(NamedTextColor.DARK_GRAY),
|
||||
+ SIDEBAR_TEAM_BLUE(NamedTextColor.BLUE),
|
||||
+ SIDEBAR_TEAM_GREEN(NamedTextColor.GREEN),
|
||||
+ SIDEBAR_TEAM_AQUA(NamedTextColor.AQUA),
|
||||
+ SIDEBAR_TEAM_RED(NamedTextColor.RED),
|
||||
+ SIDEBAR_TEAM_LIGHT_PURPLE(NamedTextColor.LIGHT_PURPLE),
|
||||
+ SIDEBAR_TEAM_YELLOW(NamedTextColor.YELLOW),
|
||||
+ SIDEBAR_TEAM_WHITE(NamedTextColor.WHITE);
|
||||
+
|
||||
+ public static final net.kyori.adventure.util.Index<String, DisplaySlot> NAMES = net.kyori.adventure.util.Index.create(DisplaySlot.class, DisplaySlot::getId);
|
||||
+
|
||||
+ private final String id;
|
||||
+
|
||||
+ DisplaySlot(@org.jetbrains.annotations.NotNull String id) {
|
||||
+ this.id = id;
|
||||
+ }
|
||||
+
|
||||
+ DisplaySlot(@org.jetbrains.annotations.NotNull NamedTextColor color) {
|
||||
+ this.id = "sidebar.team." + color;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the string id of this display slot.
|
||||
+ *
|
||||
+ * @return the string id
|
||||
+ */
|
||||
+ public @org.jetbrains.annotations.NotNull String getId() {
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return this.id;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 12 May 2021 02:49:28 -0700
|
||||
Subject: [PATCH] add back EntityPortalExitEvent
|
||||
|
||||
Was removed here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/a2d787f6ebeb72fa7d5750788221fb9a0d838ac4
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java
|
||||
index 869ad3b12ebd8275d04b0c21b5ecc0389da01490..0a87e2934901eb1bcaec72ed8141cd4828a4efce 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java
|
||||
@@ -11,6 +11,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
* <p>
|
||||
* This event allows you to modify the velocity of the entity after they have
|
||||
* successfully exited the portal.
|
||||
+ * <p>
|
||||
+ * Cancelling this event does not prevent the teleport, but it does prevent
|
||||
+ * any changes to velocity and location from taking place.
|
||||
*/
|
||||
public class EntityPortalExitEvent extends EntityTeleportEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
|
@ -1,48 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Zacek <dawon@dawon.eu>
|
||||
Date: Mon, 4 Oct 2021 08:29:36 +0200
|
||||
Subject: [PATCH] Add methods to find targets for lightning strikes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 77577de113b1413ed1474850b4ef8e7fd0c07dd6..4f673e9123145dc78564dc3eef0edf75795dafc2 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -757,6 +757,37 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@NotNull
|
||||
public LightningStrike strikeLightningEffect(@NotNull Location loc);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Finds the location of the nearest unobstructed Lightning Rod in a 128-block
|
||||
+ * radius around the given location. Returns {@code null} if no Lightning Rod is found.
|
||||
+ *
|
||||
+ * <p>Note: To activate a Lightning Rod, the position one block above it must be struck by lightning.</p>
|
||||
+ *
|
||||
+ * @param location {@link Location} to search for Lightning Rod around
|
||||
+ * @return {@link Location} of Lightning Rod or {@code null}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location findLightningRod(@NotNull Location location);
|
||||
+
|
||||
+ /**
|
||||
+ * Finds a target {@link Location} for lightning to strike.
|
||||
+ * <p>It selects from (in the following order):</p>
|
||||
+ * <ol>
|
||||
+ * <li>the block above the nearest Lightning Rod, found using {@link World#findLightningRod(Location)}</li>
|
||||
+ * <li>a random {@link LivingEntity} that can see the sky in a 6x6 cuboid
|
||||
+ * around input X/Z coordinates. Y ranges from <i>the highest motion-blocking
|
||||
+ * block at the input X/Z - 3</i> to <i>the height limit + 3</i></li>
|
||||
+ * </ol>
|
||||
+ * <p>Returns {@code null} if no target is found.</p>
|
||||
+ *
|
||||
+ * @param location {@link Location} to search for target around
|
||||
+ * @return lightning target or {@code null}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location findLightningTarget(@NotNull Location location);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get a list of all entities in this World
|
||||
*
|
|
@ -1,62 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 20 Aug 2021 13:03:55 -0700
|
||||
Subject: [PATCH] Get entity default attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 379acee1b5f2d06e6a96f3444783f4a29ca24095..0b15fe8b5da29bf691c394098f0203a49504242e 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -183,5 +183,22 @@ public interface UnsafeValues {
|
||||
* @return the server's protocol version
|
||||
*/
|
||||
int getProtocolVersion();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the entity represented by the namespaced key has default attributes.
|
||||
+ *
|
||||
+ * @param entityKey the entity's key
|
||||
+ * @return true if it has default attributes
|
||||
+ */
|
||||
+ boolean hasDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the default attributes for the entity represented by the namespaced key.
|
||||
+ *
|
||||
+ * @param entityKey the entity's key
|
||||
+ * @return an unmodifiable instance of Attributable for reading default attributes.
|
||||
+ * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first)
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
|
||||
index d36d314383713bac3b11f18d95b0809dce3cd6e0..48aa290dbcf93715ce58d56d6cf3216948f2f3f2 100644
|
||||
--- a/src/main/java/org/bukkit/entity/EntityType.java
|
||||
+++ b/src/main/java/org/bukkit/entity/EntityType.java
|
||||
@@ -441,5 +441,24 @@ public enum EntityType implements Keyed, net.kyori.adventure.translation.Transla
|
||||
Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys");
|
||||
return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the entity has default attributes.
|
||||
+ *
|
||||
+ * @return true if it has default attributes
|
||||
+ */
|
||||
+ public boolean hasDefaultAttributes() {
|
||||
+ return org.bukkit.Bukkit.getUnsafe().hasDefaultEntityAttributes(this.key);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the default attributes for the entity.
|
||||
+ *
|
||||
+ * @return an unmodifiable instance of Attributable for reading default attributes.
|
||||
+ * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultAttributes()} first)
|
||||
+ */
|
||||
+ public @NotNull org.bukkit.attribute.Attributable getDefaultAttributes() {
|
||||
+ return org.bukkit.Bukkit.getUnsafe().getDefaultEntityAttributes(this.key);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 12:36:46 -0500
|
||||
Subject: [PATCH] Left handed API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
||||
index 07bedbc15ba2463d3c629ae68d229286d4033f79..984ad873f36c3dcc73703eb6902c4eab5f1e72b6 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Mob.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Mob.java
|
||||
@@ -148,4 +148,20 @@ public interface Mob extends LivingEntity, Lootable {
|
||||
* @return whether the mob is aware
|
||||
*/
|
||||
public boolean isAware();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Check if Mob is left-handed
|
||||
+ *
|
||||
+ * @return True if left-handed
|
||||
+ */
|
||||
+ public boolean isLeftHanded();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if Mob is left-handed
|
||||
+ *
|
||||
+ * @param leftHanded True if left-handed
|
||||
+ */
|
||||
+ public void setLeftHanded(boolean leftHanded);
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: syldium <syldium@mailo.com>
|
||||
Date: Fri, 9 Jul 2021 18:49:40 +0200
|
||||
Subject: [PATCH] Add advancement display API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..67341bb70762a2326030abd2548372b92474f544
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java
|
||||
@@ -0,0 +1,156 @@
|
||||
+package io.papermc.paper.advancement;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import net.kyori.adventure.translation.Translatable;
|
||||
+import net.kyori.adventure.util.Index;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Describes the display of an advancement.
|
||||
+ * <p>
|
||||
+ * The display is used in the chat, in the toast messages and the advancements
|
||||
+ * screen.
|
||||
+ */
|
||||
+public interface AdvancementDisplay {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link Frame}.
|
||||
+ * <p>
|
||||
+ * This defines the appearance of the tile in the advancements screen and
|
||||
+ * the text when it's completed.
|
||||
+ *
|
||||
+ * @return the frame type
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Frame frame();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the advancement title.
|
||||
+ *
|
||||
+ * @return the title
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Component title();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the description.
|
||||
+ *
|
||||
+ * @return the description
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Component description();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the icon shown in the frame in the advancements screen.
|
||||
+ *
|
||||
+ * @return a copy of the icon
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ ItemStack icon();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether a toast should be displayed.
|
||||
+ * <p>
|
||||
+ * A toast is a notification that will be displayed in the top right corner
|
||||
+ * of the screen.
|
||||
+ *
|
||||
+ * @return {@code true} if a toast should be shown
|
||||
+ */
|
||||
+ boolean doesShowToast();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether a message should be sent in the chat.
|
||||
+ *
|
||||
+ * @return {@code true} if a message should be sent
|
||||
+ * @see org.bukkit.event.player.PlayerAdvancementDoneEvent#message() to edit
|
||||
+ * the message
|
||||
+ */
|
||||
+ boolean doesAnnounceToChat();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this advancement is hidden.
|
||||
+ * <p>
|
||||
+ * Hidden advancements cannot be viewed by the player until they have been
|
||||
+ * unlocked.
|
||||
+ *
|
||||
+ * @return {@code true} if hidden
|
||||
+ */
|
||||
+ boolean isHidden();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the texture displayed behind the advancement tree when selected.
|
||||
+ * <p>
|
||||
+ * This only affects root advancements without any parent. If the background
|
||||
+ * is not specified or doesn't exist, the tab background will be the missing
|
||||
+ * texture.
|
||||
+ *
|
||||
+ * @return the background texture path
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ NamespacedKey backgroundPath();
|
||||
+
|
||||
+ /**
|
||||
+ * Defines how the {@link #icon()} appears in the advancements screen and
|
||||
+ * the color used with the {@link #title() advancement name}.
|
||||
+ */
|
||||
+ enum Frame implements Translatable {
|
||||
+
|
||||
+ /**
|
||||
+ * "Challenge complete" advancement.
|
||||
+ * <p>
|
||||
+ * The client will play the {@code ui.toast.challenge_complete} sound
|
||||
+ * when the challenge is completed and the toast is shown.
|
||||
+ */
|
||||
+ CHALLENGE("challenge", NamedTextColor.DARK_PURPLE),
|
||||
+
|
||||
+ /**
|
||||
+ * "Goal reached" advancement.
|
||||
+ */
|
||||
+ GOAL("goal", NamedTextColor.GREEN),
|
||||
+
|
||||
+ /**
|
||||
+ * "Advancement made" advancement.
|
||||
+ */
|
||||
+ TASK("task", NamedTextColor.GREEN);
|
||||
+
|
||||
+ /**
|
||||
+ * The name map.
|
||||
+ */
|
||||
+ public static final Index<String, Frame> NAMES = Index.create(Frame.class, frame -> frame.name);
|
||||
+ private final String name;
|
||||
+ private final TextColor color;
|
||||
+
|
||||
+ Frame(String name, TextColor color) {
|
||||
+ this.name = name;
|
||||
+ this.color = color;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link TextColor} used for the advancement name.
|
||||
+ *
|
||||
+ * @return the text color
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public TextColor color() {
|
||||
+ return this.color;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the translation key used when an advancement is completed.
|
||||
+ * <p>
|
||||
+ * This is the first line of the toast displayed by the client.
|
||||
+ *
|
||||
+ * @return the toast message key
|
||||
+ */
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public String translationKey() {
|
||||
+ return "advancements.toast." + this.name;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java
|
||||
index 7c5009974ac8d64d0e738e60cec45acb0d4ca89a..3bbc7dffc36fa31099a8794ceeec77aeae0c49cb 100644
|
||||
--- a/src/main/java/org/bukkit/advancement/Advancement.java
|
||||
+++ b/src/main/java/org/bukkit/advancement/Advancement.java
|
||||
@@ -17,4 +17,41 @@ public interface Advancement extends Keyed {
|
||||
*/
|
||||
@NotNull
|
||||
Collection<String> getCriteria();
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the display info of this advancement.
|
||||
+ * <p>
|
||||
+ * Will be {@code null} when totally hidden, for example with crafting
|
||||
+ * recipes.
|
||||
+ *
|
||||
+ * @return the display info
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ io.papermc.paper.advancement.AdvancementDisplay getDisplay();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the parent advancement, if any.
|
||||
+ *
|
||||
+ * @return the parent advancement
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ Advancement getParent();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all the direct children advancements.
|
||||
+ *
|
||||
+ * @return the children advancements
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @org.jetbrains.annotations.Unmodifiable
|
||||
+ Collection<Advancement> getChildren();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the root advancement of the tree this is located in.
|
||||
+ *
|
||||
+ * @return the root advancement
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Advancement getRoot();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 12:09:28 -0500
|
||||
Subject: [PATCH] Add ItemFactory#getMonsterEgg API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 0a4466c6ca519c3a5da76ff870fb2a4e3a06effd..8677e273641a46aae7107361f23f6ded59a50dc0 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
@@ -241,5 +241,14 @@ public interface ItemFactory {
|
||||
@NotNull
|
||||
@Deprecated
|
||||
net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName);
|
||||
+
|
||||
+ /**
|
||||
+ * Get a spawn egg ItemStack from an EntityType
|
||||
+ *
|
||||
+ * @param type EntityType
|
||||
+ * @return ItemStack spawner egg
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ ItemStack getSpawnEgg(@Nullable org.bukkit.entity.EntityType type);
|
||||
// Paper end
|
||||
}
|
|
@ -24,7 +24,7 @@ index c8c2e5bc2ec1d8d7ea445a1203c9d5a904dfc666..014c9984018ad5e51a26228a137e1ba4
|
|||
* Return the translation key for the Material, so the client can translate it into the active
|
||||
* locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index d515de1c316f14165ee327bc81f0be98b60db3bf..350384ba10435b1115e4386a78d8145f748b6b29 100644
|
||||
index 18795003815d5bb6e04a15256430f69a31b2ace5..bafad5764cc3933fcd9602d37bd2e68424cbd575 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -767,5 +767,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|
@ -1,51 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: dodison <kacpik@mapik.eu>
|
||||
Date: Mon, 26 Jul 2021 17:35:20 +0200
|
||||
Subject: [PATCH] Add critical damage API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
|
||||
index 869bad7405ec7fa67728e90d8b9f2e11b542611f..7ce8f1a26c1b33dd0eb6e6435952fd73abf49879 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
|
||||
@@ -11,15 +11,40 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class EntityDamageByEntityEvent extends EntityDamageEvent {
|
||||
private final Entity damager;
|
||||
|
||||
+ @Deprecated // Paper - add critical damage API
|
||||
public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
super(damagee, cause, damage);
|
||||
this.damager = damager;
|
||||
+ this.critical = false; // Paper - add critical damage API
|
||||
}
|
||||
|
||||
+ @Deprecated // Paper - add critical damage API
|
||||
public EntityDamageByEntityEvent(@NotNull final Entity 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) {
|
||||
+ // Paper start - add critical damage API
|
||||
+ this(damager, damagee, cause, modifiers, modifierFunctions, false);
|
||||
+ }
|
||||
+
|
||||
+ private final boolean critical;
|
||||
+ public EntityDamageByEntityEvent(@NotNull final Entity 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, boolean critical) {
|
||||
+ // Paper end
|
||||
super(damagee, cause, modifiers, modifierFunctions);
|
||||
this.damager = damager;
|
||||
+ // Paper start - add critical damage API
|
||||
+ this.critical = critical;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Shows this damage instance was critical.
|
||||
+ * The damage instance can be critical if the attacking player met the respective conditions.
|
||||
+ * Furthermore arrows may also cause a critical damage event if the arrow {@link org.bukkit.entity.AbstractArrow#isCritical()}.
|
||||
+ *
|
||||
+ * @return if the hit was critical.
|
||||
+ * @see <a href="https://minecraft.fandom.com/wiki/Damage#Critical_hit">https://minecraft.fandom.com/wiki/Damage#Critical_hit</a>
|
||||
+ */
|
||||
+ public boolean isCritical() {
|
||||
+ return this.critical;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Returns the entity that damaged the defender.
|
|
@ -1,34 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 24 Oct 2021 20:29:27 -0700
|
||||
Subject: [PATCH] Fix issues with mob conversion
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/PiglinAbstract.java b/src/main/java/org/bukkit/entity/PiglinAbstract.java
|
||||
index 87f4b7ad7c0a95a7123d142fa023c5da5c760341..70a45e657c6cab6058d1a56fc51c5df79fdce60f 100644
|
||||
--- a/src/main/java/org/bukkit/entity/PiglinAbstract.java
|
||||
+++ b/src/main/java/org/bukkit/entity/PiglinAbstract.java
|
||||
@@ -31,14 +31,17 @@ public interface PiglinAbstract extends Monster, Ageable {
|
||||
public int getConversionTime();
|
||||
|
||||
/**
|
||||
- * Sets the amount of ticks until this entity will be converted to a
|
||||
- * Zombified Piglin.
|
||||
+ * Sets the conversion counter value. The counter is incremented
|
||||
+ * every tick the {@link #isConverting()} returns true. Setting this
|
||||
+ * value will not start the conversion if the {@link PiglinAbstract} is
|
||||
+ * not in a valid environment ({@link org.bukkit.World#isPiglinSafe})
|
||||
+ * to convert or {@link #isImmuneToZombification()} is true or
|
||||
+ * has no AI.
|
||||
*
|
||||
- * When this reaches 0, the entity will be converted. A value of less than 0
|
||||
- * will stop the current conversion process without converting the current
|
||||
- * entity.
|
||||
+ * When this reaches 300, the entity will be converted. To stop the
|
||||
+ * conversion use {@link #setImmuneToZombification(boolean)}.
|
||||
*
|
||||
- * @param time new conversion time
|
||||
+ * @param time new conversion counter
|
||||
*/
|
||||
public void setConversionTime(int time);
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 4 Nov 2021 11:50:35 -0700
|
||||
Subject: [PATCH] Add isCollidable methods to various places
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||
index d849908850025a078ec5127870ec0f61d77a72e9..f24820f14d689d49dfea25605199d5299ec28e7c 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -4026,6 +4026,16 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata
|
||||
public com.google.common.collect.Multimap<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
|
||||
return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this material is collidable.
|
||||
+ *
|
||||
+ * @return true if collidable
|
||||
+ * @throws IllegalArgumentException if {@link #isBlock()} is false
|
||||
+ */
|
||||
+ public boolean isCollidable() {
|
||||
+ return Bukkit.getUnsafe().isCollidable(this);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 0b15fe8b5da29bf691c394098f0203a49504242e..c8c2e5bc2ec1d8d7ea445a1203c9d5a904dfc666 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -200,5 +200,14 @@ public interface UnsafeValues {
|
||||
* @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first)
|
||||
*/
|
||||
@org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this material is collidable.
|
||||
+ *
|
||||
+ * @param material the material to check
|
||||
+ * @return true if collidable
|
||||
+ * @throws IllegalArgumentException if {@link Material#isBlock()} is false
|
||||
+ */
|
||||
+ boolean isCollidable(@org.jetbrains.annotations.NotNull Material material);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 0006a5a53dfa9fc81c608423e8740a9c820659a3..70caaf05be813ba390412714ba0a39981edc2475 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -471,6 +471,13 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
* @return true if block is solid
|
||||
*/
|
||||
boolean isSolid();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this block is collidable.
|
||||
+ *
|
||||
+ * @return true if collidable
|
||||
+ */
|
||||
+ boolean isCollidable();
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java
|
||||
index 631cbf2be51040eee00aa39a39c5ec4003f91843..96cde879922c796f3ac8d14ee99d7b190ff67bd9 100644
|
||||
--- a/src/main/java/org/bukkit/block/BlockState.java
|
||||
+++ b/src/main/java/org/bukkit/block/BlockState.java
|
||||
@@ -221,4 +221,13 @@ public interface BlockState extends Metadatable {
|
||||
* or 'virtual' (e.g. on an itemstack)
|
||||
*/
|
||||
boolean isPlaced();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Checks if this block state is collidable.
|
||||
+ *
|
||||
+ * @return true if collidable
|
||||
+ */
|
||||
+ boolean isCollidable();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Seggan <segganew@gmail.com>
|
||||
Date: Thu, 5 Aug 2021 13:10:31 -0400
|
||||
Subject: [PATCH] Goat ram API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Goat.java b/src/main/java/org/bukkit/entity/Goat.java
|
||||
index 90e9028b5ee7fcf9488d37090875b7163bdcd1d0..01827c4118df36fe1b77115f181fb4d225c3c866 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Goat.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Goat.java
|
||||
@@ -24,4 +24,12 @@ public interface Goat extends Animals {
|
||||
* @param screaming screaming status
|
||||
*/
|
||||
void setScreaming(boolean screaming);
|
||||
+
|
||||
+ // Paper start - Goat ram API
|
||||
+ /**
|
||||
+ * Makes the goat ram at the specified entity
|
||||
+ * @param entity the entity to ram at
|
||||
+ */
|
||||
+ void ram(@org.jetbrains.annotations.NotNull LivingEntity entity);
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: booky10 <boooky10@gmail.com>
|
||||
Date: Fri, 5 Nov 2021 21:01:36 +0100
|
||||
Subject: [PATCH] Add API for resetting a single score
|
||||
|
||||
It was only possible to reset all scores for a specific entry, instead of resetting only specific scores.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
index d25b4d04932da7e7562cd1acf67ebec33af5b6ef..07bfad4a908de26e9aa6291e4ad20006e88ffe87 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
@@ -73,4 +73,14 @@ public interface Score {
|
||||
*/
|
||||
@Nullable
|
||||
Scoreboard getScoreboard();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Resets this score, if a value has been set.
|
||||
+ *
|
||||
+ * @throws IllegalStateException if the associated objective has been
|
||||
+ * unregistered
|
||||
+ */
|
||||
+ void resetScore() throws IllegalStateException;
|
||||
+ // Paper end
|
||||
}
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 996f09eaf7d1d6c5e27e2bb2630a6bcb18854172..6d2cc9d1813c862dfd23cb6897d4f4f4845af529 100644
|
||||
index dcfc726ab96dccc05848219e824ad7612dbfbdab..7713f26d4a97df94c27694d28881d298e4c54147 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2008,6 +2008,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -1788,6 +1788,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ index ee50ea695585639d0ff184b675f3fb3b205b9f86..0bd800e1aeda87689a6c56ee6fadda38
|
|||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index eb11abe4bc8f06d457da674848b39fc3b3873d1a..424f3a9a645d57ad43c52932f5b388b5f146b9f0 100644
|
||||
index 691b110e8a64081b68868456089908fe38fbc1cf..673b5192c32ee1b3c0d15462d3fadb0f31cd6a03 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -421,6 +421,29 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|
@ -1,86 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 17:58:11 -0800
|
||||
Subject: [PATCH] Add BlockBreakBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 1a5605b11170dfe1bd37165de886bad0f2e38ecd..8c30e28b97ac7e8b54322c903e0b75ee8135620b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -331,6 +331,23 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}
|
||||
|
||||
}
|
||||
+ // Paper start
|
||||
+ public static boolean dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity, BlockPos source) {
|
||||
+ if (world instanceof ServerLevel) {
|
||||
+ List<org.bukkit.inventory.ItemStack> items = com.google.common.collect.Lists.newArrayList();
|
||||
+ for (net.minecraft.world.item.ItemStack drop : net.minecraft.world.level.block.Block.getDrops(state, world.getMinecraftWorld(), pos, blockEntity)) {
|
||||
+ items.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(drop));
|
||||
+ }
|
||||
+ io.papermc.paper.event.block.BlockBreakBlockEvent event = new io.papermc.paper.event.block.BlockBreakBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.block.CraftBlock.at(world, source), items);
|
||||
+ event.callEvent();
|
||||
+ for (var drop : event.getDrops()) {
|
||||
+ popResource(world.getMinecraftWorld(), pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(drop));
|
||||
+ }
|
||||
+ state.spawnAfterBreak(world.getMinecraftWorld(), pos, ItemStack.EMPTY);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) {
|
||||
if (world instanceof ServerLevel) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index 3678f75822b55c3c4c77565893269af4b7f9d8c9..d770649a9e9e9bb28b52d00cd082b87de5814593 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -410,7 +410,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
iblockdata1 = world.getBlockState(blockposition3);
|
||||
BlockEntity tileentity = iblockdata1.hasBlockEntity() ? world.getBlockEntity(blockposition3) : null;
|
||||
|
||||
- dropResources(iblockdata1, (LevelAccessor) world, blockposition3, tileentity);
|
||||
+ dropResources(iblockdata1, (LevelAccessor) world, blockposition3, tileentity, pos); // Paper
|
||||
world.setBlock(blockposition3, Blocks.AIR.defaultBlockState(), 18);
|
||||
if (!iblockdata1.is((Tag) BlockTags.FIRE)) {
|
||||
world.addDestroyBlockEffect(blockposition3, iblockdata1);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 6e3e873efa1f50f53cb6503bde8a981f9cefd006..7fda7da544b2d0bbd3803d88ee34c92350a8b8ef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -295,7 +295,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState);
|
||||
} else {
|
||||
if (!state.isAir()) {
|
||||
- this.beforeDestroyingBlock(world, pos, state);
|
||||
+ this.beforeDestroyingBlock(world, pos, state, pos.relative(direction.getOpposite())); // Paper
|
||||
}
|
||||
|
||||
world.setBlock(pos, fluidState.createLegacyBlock(), 3);
|
||||
@@ -303,6 +303,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
|
||||
}
|
||||
|
||||
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(world, pos, state); } // Paper - add source parameter
|
||||
protected abstract void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state);
|
||||
|
||||
private static short getCacheKey(BlockPos blockposition, BlockPos blockposition1) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
index c2beaba9095c9163f25a46c8b2c423e820639cf6..56d50b9310d30e0f81f3d2549ff5c256eb07cc2a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -63,6 +63,13 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) {
|
||||
+ BlockEntity tileentity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
|
||||
+ Block.dropResources(state, world, pos, tileentity, source);
|
||||
+ }
|
||||
+ // Paper end
|
||||
@Override
|
||||
protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state) {
|
||||
BlockEntity blockEntity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
|
|
@ -1,84 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 12:57:28 -0700
|
||||
Subject: [PATCH] Option to prevent NBT copy in smithing recipes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/UpgradeRecipe.java b/src/main/java/net/minecraft/world/item/crafting/UpgradeRecipe.java
|
||||
index 21e9ce106cb7c1cdeabbad38a83d2439570e452b..88d99451748bfbd2cd24b1f29971a275dc6df597 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/UpgradeRecipe.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/UpgradeRecipe.java
|
||||
@@ -26,8 +26,15 @@ public class UpgradeRecipe implements net.minecraft.world.item.crafting.Recipe<C
|
||||
final Ingredient addition;
|
||||
final ItemStack result;
|
||||
private final ResourceLocation id;
|
||||
+ final boolean copyNbt; // Paper
|
||||
|
||||
public UpgradeRecipe(ResourceLocation id, Ingredient base, Ingredient addition, ItemStack result) {
|
||||
+ // Paper start
|
||||
+ this(id, base, addition, result, true);
|
||||
+ }
|
||||
+ public UpgradeRecipe(ResourceLocation id, Ingredient base, Ingredient addition, ItemStack result, boolean copyNbt) {
|
||||
+ this.copyNbt = copyNbt;
|
||||
+ // Paper end
|
||||
this.id = id;
|
||||
this.base = base;
|
||||
this.addition = addition;
|
||||
@@ -42,11 +49,13 @@ public class UpgradeRecipe implements net.minecraft.world.item.crafting.Recipe<C
|
||||
@Override
|
||||
public ItemStack assemble(Container inventory) {
|
||||
ItemStack itemstack = this.result.copy();
|
||||
+ if (copyNbt) { // Paper - copy nbt conditionally
|
||||
CompoundTag nbttagcompound = inventory.getItem(0).getTag();
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
itemstack.setTag(nbttagcompound.copy());
|
||||
}
|
||||
+ } // Paper
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -97,7 +106,7 @@ public class UpgradeRecipe implements net.minecraft.world.item.crafting.Recipe<C
|
||||
public Recipe toBukkitRecipe() {
|
||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
|
||||
- CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+ CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper
|
||||
|
||||
return recipe;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java
|
||||
index 0353ba44015cb72efa3892c527568902c9fa626b..bfd6b859fcfed89d0ebaca5200b7ca6f5d353d04 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java
|
||||
@@ -8,15 +8,21 @@ import org.bukkit.inventory.RecipeChoice;
|
||||
import org.bukkit.inventory.SmithingRecipe;
|
||||
|
||||
public class CraftSmithingRecipe extends SmithingRecipe implements CraftRecipe {
|
||||
+ @Deprecated // Paper
|
||||
public CraftSmithingRecipe(NamespacedKey key, ItemStack result, RecipeChoice base, RecipeChoice addition) {
|
||||
super(key, result, base, addition);
|
||||
}
|
||||
+ // Paper start
|
||||
+ public CraftSmithingRecipe(NamespacedKey key, ItemStack result, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
|
||||
+ super(key, result, base, addition, copyNbt);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static CraftSmithingRecipe fromBukkitRecipe(SmithingRecipe recipe) {
|
||||
if (recipe instanceof CraftSmithingRecipe) {
|
||||
return (CraftSmithingRecipe) recipe;
|
||||
}
|
||||
- CraftSmithingRecipe ret = new CraftSmithingRecipe(recipe.getKey(), recipe.getResult(), recipe.getBase(), recipe.getAddition());
|
||||
+ CraftSmithingRecipe ret = new CraftSmithingRecipe(recipe.getKey(), recipe.getResult(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -24,6 +30,6 @@ public class CraftSmithingRecipe extends SmithingRecipe implements CraftRecipe {
|
||||
public void addToCraftingManager() {
|
||||
ItemStack result = this.getResult();
|
||||
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.UpgradeRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result)));
|
||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.UpgradeRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt())); // Paper
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 10:40:09 -0700
|
||||
Subject: [PATCH] More CommmandBlock API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0b42306f17bf8850a13a51067c2d19e7583187e5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package io.papermc.paper.commands;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import io.papermc.paper.command.CommandBlockHolder;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.world.level.BaseCommandBlock;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public interface PaperCommandBlockHolder extends CommandBlockHolder {
|
||||
+
|
||||
+ BaseCommandBlock getCommandBlockHandle();
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull Component lastOutput() {
|
||||
+ return PaperAdventure.asAdventure(getCommandBlockHandle().getLastOutput());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default void lastOutput(@Nullable Component lastOutput) {
|
||||
+ getCommandBlockHandle().setLastOutput(PaperAdventure.asVanilla(lastOutput));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int getSuccessCount() {
|
||||
+ return getCommandBlockHandle().getSuccessCount();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default void setSuccessCount(int successCount) {
|
||||
+ getCommandBlockHandle().setSuccessCount(successCount);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
||||
index 5df1e8c7277759bda57253db449907eb1185cce3..f36aa9d37facc5f1e2c6ae95f27c7020b5d0002b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
||||
@@ -5,7 +5,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.CommandBlock;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
|
||||
-public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock {
|
||||
+public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock, io.papermc.paper.commands.PaperCommandBlockHolder {
|
||||
|
||||
public CraftCommandBlock(World world, CommandBlockEntity tileEntity) {
|
||||
super(world, tileEntity);
|
||||
@@ -41,5 +41,10 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity>
|
||||
public void name(net.kyori.adventure.text.Component name) {
|
||||
getSnapshot().getCommandBlock().setName(name == null ? new net.minecraft.network.chat.TextComponent("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() {
|
||||
+ return getSnapshot().getCommandBlock();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
||||
index f9863e138994f6c7a7975a852f106faa96d52315..b709a1d909c189f60d0c3aa97b4b96623e7c1db0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
||||
@@ -14,7 +14,7 @@ import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
-public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart {
|
||||
+public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart, io.papermc.paper.commands.PaperCommandBlockHolder {
|
||||
private final PermissibleBase perm = new PermissibleBase(this);
|
||||
|
||||
public CraftMinecartCommand(CraftServer server, MinecartCommandBlock entity) {
|
||||
@@ -70,6 +70,17 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
|
||||
public net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component name() {
|
||||
return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getHandle().getCommandBlock().getName());
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() {
|
||||
+ return getHandle().getCommandBlock();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void lastOutput(net.kyori.adventure.text.Component lastOutput) {
|
||||
+ io.papermc.paper.commands.PaperCommandBlockHolder.super.lastOutput(lastOutput);
|
||||
+ getCommandBlockHandle().onUpdated();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
|
@ -1,65 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 1 Oct 2021 08:04:39 -0700
|
||||
Subject: [PATCH] Add missing team sidebar display slots
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||
index f1be7a4f96a556569e4a607959bfd085fa0cb64c..ca58cde37f4e5abeb33e2f583b3d53e80697eba9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||
@@ -7,7 +7,8 @@ import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.RenderType;
|
||||
|
||||
public final class CraftScoreboardTranslations {
|
||||
- static final int MAX_DISPLAY_SLOT = 3;
|
||||
+ static final int MAX_DISPLAY_SLOT = Scoreboard.getDisplaySlotNames().length; // Paper
|
||||
+ @Deprecated // Paper
|
||||
static ImmutableBiMap<DisplaySlot, String> SLOTS = ImmutableBiMap.of(
|
||||
DisplaySlot.BELOW_NAME, "belowName",
|
||||
DisplaySlot.PLAYER_LIST, "list",
|
||||
@@ -16,10 +17,12 @@ public final class CraftScoreboardTranslations {
|
||||
private CraftScoreboardTranslations() {}
|
||||
|
||||
public static DisplaySlot toBukkitSlot(int i) {
|
||||
+ if (true) return org.bukkit.scoreboard.DisplaySlot.NAMES.value(Scoreboard.getDisplaySlotName(i)); // Paper
|
||||
return CraftScoreboardTranslations.SLOTS.inverse().get(Scoreboard.getDisplaySlotName(i));
|
||||
}
|
||||
|
||||
public static int fromBukkitSlot(DisplaySlot slot) {
|
||||
+ if (true) return Scoreboard.getDisplaySlotByName(slot.getId()); // Paper
|
||||
return Scoreboard.getDisplaySlotByName(CraftScoreboardTranslations.SLOTS.get(slot));
|
||||
}
|
||||
|
||||
diff --git a/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bb41a2f2c0a5e3b4cb3fe1b584e0ceb7a7116afb
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
||||
@@ -0,0 +1,26 @@
|
||||
+package io.papermc.paper.scoreboard;
|
||||
+
|
||||
+import net.minecraft.world.scores.Scoreboard;
|
||||
+import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
|
||||
+import org.bukkit.scoreboard.DisplaySlot;
|
||||
+import org.junit.Test;
|
||||
+
|
||||
+import static org.junit.Assert.assertNotEquals;
|
||||
+import static org.junit.Assert.assertNotNull;
|
||||
+
|
||||
+public class DisplaySlotTest {
|
||||
+
|
||||
+ @Test
|
||||
+ public void testBukkitToMinecraftDisplaySlots() {
|
||||
+ for (DisplaySlot value : DisplaySlot.values()) {
|
||||
+ assertNotEquals(-1, CraftScoreboardTranslations.fromBukkitSlot(value));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testMinecraftToBukkitDisplaySlots() {
|
||||
+ for (String name : Scoreboard.getDisplaySlotNames()) {
|
||||
+ assertNotNull(CraftScoreboardTranslations.toBukkitSlot(Scoreboard.getDisplaySlotByName(name)));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
|
@ -1,47 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 16 May 2021 09:39:46 -0700
|
||||
Subject: [PATCH] Add back EntityPortalExitEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 4f164f238177b5e2b18c76b7cc14596ec93409d1..e17bda0d13bae337cfad5ae31b118aa7a85499fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3181,6 +3181,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
worldserver = shapedetectorshape.world;
|
||||
+
|
||||
+ // Paper start - Call EntityPortalExitEvent
|
||||
+ CraftEntity bukkitEntity = this.getBukkitEntity();
|
||||
+ Vec3 position = shapedetectorshape.pos;
|
||||
+ float yaw = shapedetectorshape.yRot;
|
||||
+ float pitch = bukkitEntity.getLocation().getPitch(); // Keep entity pitch as per moveTo line below
|
||||
+ Vec3 velocity = shapedetectorshape.speed;
|
||||
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(bukkitEntity,
|
||||
+ bukkitEntity.getLocation(), new Location(worldserver.getWorld(), position.x, position.y, position.z, yaw, pitch),
|
||||
+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(shapedetectorshape.speed));
|
||||
+ if (event.callEvent() && event.getTo() != null && this.isAlive()) {
|
||||
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ position = new Vec3(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
+ yaw = event.getTo().getYaw();
|
||||
+ pitch = event.getTo().getPitch();
|
||||
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
this.unRide();
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -3194,8 +3213,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
|
||||
if (entity != null) {
|
||||
entity.restoreFrom(this);
|
||||
- entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
- entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - use EntityPortalExitEvent values
|
||||
+ entity.setDeltaMovement(velocity); // Paper - use EntityPortalExitEvent values
|
||||
worldserver.addDuringTeleport(entity);
|
||||
if (worldserver.getTypeKey() == DimensionType.END_LOCATION) { // CraftBukkit
|
||||
ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
|
@ -1,58 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Zacek <dawon@dawon.eu>
|
||||
Date: Mon, 4 Oct 2021 10:16:44 +0200
|
||||
Subject: [PATCH] Add methods to find targets for lightning strikes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 08c6ea9f19fa9218af089ed3bd2dcda1e83591ed..710a1064cec9c7ec93e1258b0786e74ab9af0c12 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -956,6 +956,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
|
||||
protected BlockPos findLightningTargetAround(BlockPos pos) {
|
||||
+ // Paper start
|
||||
+ return this.findLightningTargetAround(pos, false);
|
||||
+ }
|
||||
+ public BlockPos findLightningTargetAround(BlockPos pos, boolean returnNullWhenNoTarget) {
|
||||
+ // Paper end
|
||||
BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
|
||||
Optional<BlockPos> optional = this.findLightningRod(blockposition1);
|
||||
|
||||
@@ -970,6 +975,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (!list.isEmpty()) {
|
||||
return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition();
|
||||
} else {
|
||||
+ if (returnNullWhenNoTarget) return null; // Paper
|
||||
if (blockposition1.getY() == this.getMinBuildHeight() - 1) {
|
||||
blockposition1 = blockposition1.above(2);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index e5e23c907d49ee64218f3302e2a2323d6937a8a1..858e29ad77aee8a1b7797c2d82902abbfd662da2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -701,6 +701,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return (LightningStrike) lightning.getBukkitEntity();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public Location findLightningRod(Location location) {
|
||||
+ return this.world.findLightningRod(net.minecraft.server.MCUtil.toBlockPosition(location))
|
||||
+ .map(blockPos -> net.minecraft.server.MCUtil.toLocation(this.world, blockPos)
|
||||
+ // get the actual rod pos
|
||||
+ .subtract(0, 1, 0))
|
||||
+ .orElse(null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Location findLightningTarget(Location location) {
|
||||
+ final BlockPos pos = this.world.findLightningTargetAround(net.minecraft.server.MCUtil.toBlockPosition(location), true);
|
||||
+ return pos == null ? null : net.minecraft.server.MCUtil.toLocation(this.world, pos);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean generateTree(Location loc, TreeType type) {
|
||||
return generateTree(loc, CraftWorld.rand, type);
|
|
@ -1,159 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 20 Aug 2021 13:03:21 -0700
|
||||
Subject: [PATCH] Get entity default attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..12135ffeacd648f6bc4d7d327059ea1a7e8c79c4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java
|
||||
@@ -0,0 +1,30 @@
|
||||
+package io.papermc.paper.attribute;
|
||||
+
|
||||
+import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
+import org.bukkit.attribute.Attribute;
|
||||
+import org.bukkit.attribute.AttributeModifier;
|
||||
+import org.bukkit.craftbukkit.attribute.CraftAttributeInstance;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+
|
||||
+public class UnmodifiableAttributeInstance extends CraftAttributeInstance {
|
||||
+
|
||||
+ public UnmodifiableAttributeInstance(AttributeInstance handle, Attribute attribute) {
|
||||
+ super(handle, attribute);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBaseValue(double d) {
|
||||
+ throw new UnsupportedOperationException("Cannot modify default attributes");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void addModifier(AttributeModifier modifier) {
|
||||
+ throw new UnsupportedOperationException("Cannot modify default attributes");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void removeModifier(AttributeModifier modifier) {
|
||||
+ throw new UnsupportedOperationException("Cannot modify default attributes");
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeMap.java b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeMap.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4ecba0b02c2813a890aecc558698787946d2ccb8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeMap.java
|
||||
@@ -0,0 +1,43 @@
|
||||
+package io.papermc.paper.attribute;
|
||||
+
|
||||
+import com.google.common.collect.Maps;
|
||||
+import com.google.common.util.concurrent.Callables;
|
||||
+import com.google.common.util.concurrent.Runnables;
|
||||
+import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
+import org.bukkit.attribute.Attributable;
|
||||
+import org.bukkit.attribute.Attribute;
|
||||
+import org.bukkit.attribute.AttributeInstance;
|
||||
+import org.bukkit.craftbukkit.attribute.CraftAttributeInstance;
|
||||
+import org.bukkit.craftbukkit.attribute.CraftAttributeMap;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+import java.util.function.Consumer;
|
||||
+import java.util.function.Function;
|
||||
+
|
||||
+public class UnmodifiableAttributeMap implements Attributable {
|
||||
+
|
||||
+
|
||||
+ private final Map<Attribute, AttributeInstance> attributes = Maps.newHashMap();
|
||||
+ private final AttributeSupplier handle;
|
||||
+
|
||||
+ public UnmodifiableAttributeMap(@NotNull AttributeSupplier handle) {
|
||||
+ this.handle = handle;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable AttributeInstance getAttribute(@NotNull Attribute attribute) {
|
||||
+ var nmsAttribute = CraftAttributeMap.toMinecraft(attribute);
|
||||
+ var nmsAttributeInstance = this.handle.instances.get(nmsAttribute);
|
||||
+ if (nmsAttribute == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return new UnmodifiableAttributeInstance(nmsAttributeInstance, attribute);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void registerAttribute(@NotNull Attribute attribute) {
|
||||
+ throw new UnsupportedOperationException("Cannot register new attributes here");
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index ff1f178b69efc4f167cb34095b7fd3acd4d00680..26273a6b9d49f0e12fe1ff3206c7f017a2f36e44 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -516,6 +516,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public int getProtocolVersion() {
|
||||
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
|
||||
+ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.attribute.Attributable getDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
|
||||
+ Preconditions.checkArgument(hasDefaultEntityAttributes(bukkitEntityKey), bukkitEntityKey + " doesn't have default attributes");
|
||||
+ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java b/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7b999deba66aa6d22cd7520f6c13550a44ca327d
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java
|
||||
@@ -0,0 +1,39 @@
|
||||
+package io.papermc.paper.attribute;
|
||||
+
|
||||
+import org.bukkit.attribute.Attributable;
|
||||
+import org.bukkit.attribute.Attribute;
|
||||
+import org.bukkit.attribute.AttributeInstance;
|
||||
+import org.bukkit.attribute.AttributeModifier;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.support.AbstractTestingBase;
|
||||
+import org.junit.Test;
|
||||
+
|
||||
+import static org.junit.Assert.assertFalse;
|
||||
+import static org.junit.Assert.assertNotNull;
|
||||
+import static org.junit.Assert.assertThrows;
|
||||
+import static org.junit.Assert.assertTrue;
|
||||
+
|
||||
+public class EntityTypeAttributesTest extends AbstractTestingBase {
|
||||
+
|
||||
+ @Test
|
||||
+ public void testIllegalEntity() {
|
||||
+ assertFalse(EntityType.EGG.hasDefaultAttributes());
|
||||
+ assertThrows(IllegalArgumentException.class, () -> EntityType.EGG.getDefaultAttributes());
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testLegalEntity() {
|
||||
+ assertTrue(EntityType.ZOMBIE.hasDefaultAttributes());
|
||||
+ EntityType.ZOMBIE.getDefaultAttributes();
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testUnmodifiabilityOfAttributable() {
|
||||
+ Attributable attributable = EntityType.ZOMBIE.getDefaultAttributes();
|
||||
+ assertThrows(UnsupportedOperationException.class, () -> attributable.registerAttribute(Attribute.GENERIC_ATTACK_DAMAGE));
|
||||
+ AttributeInstance instance = attributable.getAttribute(Attribute.GENERIC_FOLLOW_RANGE);
|
||||
+ assertNotNull(instance);
|
||||
+ assertThrows(UnsupportedOperationException.class, () -> instance.addModifier(new AttributeModifier("test", 3, AttributeModifier.Operation.ADD_NUMBER)));
|
||||
+ assertThrows(UnsupportedOperationException.class, () -> instance.setBaseValue(3.2));
|
||||
+ }
|
||||
+}
|
|
@ -1,26 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 12:36:58 -0500
|
||||
Subject: [PATCH] Left handed API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
index 2386edf499cb292241f6ba60c1cdb46f2fe704ff..5a43e420f14fa52d71d41ff3694a179e7a1a5be3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
@@ -134,5 +134,15 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||
public int getMaxHeadPitch() {
|
||||
return getHandle().getMaxHeadXRot();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLeftHanded() {
|
||||
+ return getHandle().isLeftHanded();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setLeftHanded(boolean leftHanded) {
|
||||
+ getHandle().setLeftHanded(leftHanded);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: syldium <syldium@mailo.com>
|
||||
Date: Fri, 9 Jul 2021 18:50:40 +0200
|
||||
Subject: [PATCH] Add advancement display API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0567e500c40d3d424ddc19062c4f6da902e8586e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java
|
||||
@@ -0,0 +1,63 @@
|
||||
+package io.papermc.paper.advancement;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.advancements.DisplayInfo;
|
||||
+import net.minecraft.advancements.FrameType;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public record PaperAdvancementDisplay(DisplayInfo handle) implements AdvancementDisplay {
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Frame frame() {
|
||||
+ return asPaperFrame(this.handle.getFrame());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Component title() {
|
||||
+ return PaperAdventure.asAdventure(this.handle.getTitle());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Component description() {
|
||||
+ return PaperAdventure.asAdventure(this.handle.getDescription());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull ItemStack icon() {
|
||||
+ return CraftItemStack.asBukkitCopy(this.handle.getIcon());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean doesShowToast() {
|
||||
+ return this.handle.shouldShowToast();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean doesAnnounceToChat() {
|
||||
+ return this.handle.shouldAnnounceChat();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isHidden() {
|
||||
+ return this.handle.isHidden();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable NamespacedKey backgroundPath() {
|
||||
+ return this.handle.getBackground() == null ? null : CraftNamespacedKey.fromMinecraft(this.handle.getBackground());
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull Frame asPaperFrame(@NotNull FrameType frameType) {
|
||||
+ return switch (frameType) {
|
||||
+ case TASK -> Frame.TASK;
|
||||
+ case CHALLENGE -> Frame.CHALLENGE;
|
||||
+ case GOAL -> Frame.GOAL;
|
||||
+ };
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/advancements/DisplayInfo.java b/src/main/java/net/minecraft/advancements/DisplayInfo.java
|
||||
index dea17bc7a6e4db470afaaad3c98940297a50e4e4..0b78ccceb55a1c0fa1f27f9ff1e303396c8f447d 100644
|
||||
--- a/src/main/java/net/minecraft/advancements/DisplayInfo.java
|
||||
+++ b/src/main/java/net/minecraft/advancements/DisplayInfo.java
|
||||
@@ -27,6 +27,7 @@ public class DisplayInfo {
|
||||
private final boolean hidden;
|
||||
private float x;
|
||||
private float y;
|
||||
+ public final io.papermc.paper.advancement.AdvancementDisplay paper = new io.papermc.paper.advancement.PaperAdvancementDisplay(this); // Paper
|
||||
|
||||
public DisplayInfo(ItemStack icon, Component title, Component description, @Nullable ResourceLocation background, FrameType frame, boolean showToast, boolean announceToChat, boolean hidden) {
|
||||
this.title = title;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
||||
index 20d51358b4b47cbf43c3d172765243e96aa1966c..fd42cf61699337acde751249131c016555fd1ea5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
||||
@@ -27,4 +27,33 @@ public class CraftAdvancement implements org.bukkit.advancement.Advancement {
|
||||
public Collection<String> getCriteria() {
|
||||
return Collections.unmodifiableCollection(this.handle.getCriteria().keySet());
|
||||
}
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public io.papermc.paper.advancement.AdvancementDisplay getDisplay() {
|
||||
+ return this.handle.getDisplay() == null ? null : this.handle.getDisplay().paper;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.advancement.Advancement getParent() {
|
||||
+ return this.handle.getParent() == null ? null : this.handle.getParent().bukkit;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Collection<org.bukkit.advancement.Advancement> getChildren() {
|
||||
+ final var children = com.google.common.collect.ImmutableList.<org.bukkit.advancement.Advancement>builder();
|
||||
+ for (Advancement advancement : this.handle.getChildren()) {
|
||||
+ children.add(advancement.bukkit);
|
||||
+ }
|
||||
+ return children.build();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.advancement.Advancement getRoot() {
|
||||
+ Advancement advancement = this.handle;
|
||||
+ while (advancement.getParent() != null) {
|
||||
+ advancement = advancement.getParent();
|
||||
+ }
|
||||
+ return advancement.bukkit;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..520801e294a33ae62d9aa24dc0247591e379311d
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package io.papermc.paper.advancement;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import net.minecraft.advancements.FrameType;
|
||||
+import net.minecraft.network.chat.TranslatableComponent;
|
||||
+import org.junit.Test;
|
||||
+
|
||||
+import static org.junit.Assert.assertEquals;
|
||||
+
|
||||
+public class AdvancementFrameTest {
|
||||
+
|
||||
+ @Test
|
||||
+ public void test() {
|
||||
+ for (FrameType nmsFrameType : FrameType.values()) {
|
||||
+ final TextColor expectedColor = PaperAdventure.asAdventure(nmsFrameType.getChatColor());
|
||||
+ final String expectedTranslationKey = ((TranslatableComponent) nmsFrameType.getDisplayName()).getKey();
|
||||
+ final var frame = PaperAdvancementDisplay.asPaperFrame(nmsFrameType);
|
||||
+ assertEquals("The translation keys should be the same", expectedTranslationKey, frame.translationKey());
|
||||
+ assertEquals("The frame colors should be the same", expectedColor, frame.color());
|
||||
+ assertEquals(nmsFrameType.getName(), AdvancementDisplay.Frame.NAMES.key(frame));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
|
@ -1,28 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 12:09:39 -0500
|
||||
Subject: [PATCH] Add ItemFactory#getMonsterEgg API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
index fcbd28fdeab4815c005c7dca547aee246f52fd26..1c0ecd8bb3156a8e1718e84455dd9af667adaf7a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -410,5 +410,17 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
entity.getUniqueId().toString(),
|
||||
new net.md_5.bungee.api.chat.TextComponent(customName));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack getSpawnEgg(org.bukkit.entity.EntityType type) {
|
||||
+ if (type == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ String typeId = type.getKey().toString();
|
||||
+ net.minecraft.resources.ResourceLocation typeKey = new net.minecraft.resources.ResourceLocation(typeId);
|
||||
+ net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.Registry.ENTITY_TYPE.get(typeKey);
|
||||
+ net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.BY_ID.get(nmsType);
|
||||
+ return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: dodison <kacpik@mapik.eu>
|
||||
Date: Mon, 26 Jul 2021 17:32:36 +0200
|
||||
Subject: [PATCH] Add critical damage API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
index 80d19af2ad423bd3de0e039c5bb8f97af536aaa9..a828cad27fcd39f8bfbaefa97052a2a3b6650ee7 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -64,6 +64,19 @@ public class DamageSource {
|
||||
return this;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - add critical damage API
|
||||
+ private boolean critical;
|
||||
+ public boolean isCritical() {
|
||||
+ return this.critical;
|
||||
+ }
|
||||
+ public DamageSource critical() {
|
||||
+ return this.critical(true);
|
||||
+ }
|
||||
+ public DamageSource critical(boolean critical) {
|
||||
+ this.critical = critical;
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static DamageSource sting(LivingEntity attacker) {
|
||||
return new EntityDamageSource("sting", attacker);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 1018f4640bab5876c5e0afb5b88f71437fb79662..cbdff14b26f67b5040c13659f9d64d9ec4c7eaed 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2571,15 +2571,27 @@ public abstract class LivingEntity extends Entity {
|
||||
return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D;
|
||||
}
|
||||
|
||||
+ protected long lastJumpTime = 0L; // Paper - add critical damage API
|
||||
protected void jumpFromGround() {
|
||||
double d0 = (double) this.getJumpPower() + this.getJumpBoostPower();
|
||||
Vec3 vec3d = this.getDeltaMovement();
|
||||
+ // Paper start - add critical damage API
|
||||
+ long time = System.nanoTime();
|
||||
+ boolean canCrit = true;
|
||||
+ if (this instanceof net.minecraft.world.entity.player.Player) {
|
||||
+ canCrit = false;
|
||||
+ if (time - this.lastJumpTime > (long)(0.250e9)) {
|
||||
+ this.lastJumpTime = time;
|
||||
+ canCrit = true;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - add critical damage API
|
||||
|
||||
this.setDeltaMovement(vec3d.x, d0, vec3d.z);
|
||||
if (this.isSprinting()) {
|
||||
float f = this.getYRot() * 0.017453292F;
|
||||
|
||||
- this.setDeltaMovement(this.getDeltaMovement().add((double) (-Mth.sin(f) * 0.2F), 0.0D, (double) (Mth.cos(f) * 0.2F)));
|
||||
+ if (canCrit) this.setDeltaMovement(this.getDeltaMovement().add((double) (-Mth.sin(f) * 0.2F), 0.0D, (double) (Mth.cos(f) * 0.2F))); // Paper - add critical damage API
|
||||
}
|
||||
|
||||
this.hasImpulse = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index ce713e1857121ca52467ad561c4fbb30ae054d87..94e76e295dbd0f3bac4b30a3e7338cd56a971207 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1218,7 +1218,7 @@ public abstract class Player extends LivingEntity {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity;
|
||||
+ boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API - conflict on change
|
||||
|
||||
flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper
|
||||
flag2 = flag2 && !this.isSprinting();
|
||||
@@ -1258,7 +1258,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
Vec3 vec3d = target.getDeltaMovement();
|
||||
- boolean flag5 = target.hurt(DamageSource.playerAttack(this), f);
|
||||
+ boolean flag5 = target.hurt(DamageSource.playerAttack(this).critical(flag2), f); // Paper - add critical damage API
|
||||
|
||||
if (flag5) {
|
||||
if (i > 0) {
|
||||
@@ -1286,7 +1286,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
if (entityliving != this && entityliving != target && !this.isAlliedTo(entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
- if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) {
|
||||
+ if (entityliving.hurt(DamageSource.playerAttack(this).sweep().critical(flag2), f4)) { // Paper - add critical damage API
|
||||
entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 6636845ea044c3810e1880aad8b679134cd33668..52e4948fd1657fa1776ac6b0142e8c21e7567976 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -381,6 +381,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (this.isCritArrow()) damagesource = damagesource.critical(); // Paper - add critical damage API
|
||||
boolean flag = entity.getType() == EntityType.ENDERMAN;
|
||||
int k = entity.getRemainingFireTicks();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 2b2654ec04e8abca9db09d6257edf11099bb0d9b..c0b46ff81994e037e734b75afadcce372c2ddd7f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -964,7 +964,7 @@ public class CraftEventFactory {
|
||||
} else {
|
||||
damageCause = DamageCause.ENTITY_EXPLOSION;
|
||||
}
|
||||
- event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions);
|
||||
+ event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions, source.isCritical()); // Paper - add critical damage API
|
||||
}
|
||||
event.setCancelled(cancelled);
|
||||
|
||||
@@ -989,7 +989,7 @@ public class CraftEventFactory {
|
||||
cause = DamageCause.THORNS;
|
||||
}
|
||||
|
||||
- return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled);
|
||||
+ return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API
|
||||
} else if (source == DamageSource.OUT_OF_WORLD) {
|
||||
EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions);
|
||||
event.setCancelled(cancelled);
|
||||
@@ -1044,7 +1044,7 @@ public class CraftEventFactory {
|
||||
} else {
|
||||
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.msgId));
|
||||
}
|
||||
- EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions);
|
||||
+ EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions, source.isCritical()); // Paper - add critical damage API
|
||||
event.setCancelled(cancelled);
|
||||
CraftEventFactory.callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
@@ -1087,20 +1087,28 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
if (cause != null) {
|
||||
- return CraftEventFactory.callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions, cancelled);
|
||||
+ return CraftEventFactory.callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Unhandled damage of %s from %s", entity, source.msgId));
|
||||
}
|
||||
|
||||
+ @Deprecated // Paper - Add critical damage API
|
||||
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) {
|
||||
return CraftEventFactory.callEntityDamageEvent(damager, damagee, cause, modifiers, modifierFunctions, false);
|
||||
}
|
||||
|
||||
+ // Paper start - Add critical damage API
|
||||
+ @Deprecated
|
||||
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
|
||||
+ return CraftEventFactory.callEntityDamageEvent(damager, damagee, cause, modifiers, modifierFunctions, false, false);
|
||||
+ }
|
||||
+
|
||||
+ private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled, boolean critical) {
|
||||
+ // Paper end
|
||||
EntityDamageEvent event;
|
||||
if (damager != null) {
|
||||
- event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions);
|
||||
+ event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions, critical); // Paper - add critical damage API
|
||||
} else {
|
||||
event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, modifiers, modifierFunctions);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 24 Oct 2021 20:29:45 -0700
|
||||
Subject: [PATCH] Fix issues with mob conversion
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
|
||||
index 116709ba2b298268ac806e6e45f2e910ca600706..1eeaf0cc9b00afd54f38f9cb50404ec9f9ba51f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
|
||||
@@ -86,10 +86,15 @@ public class Skeleton extends AbstractSkeleton {
|
||||
}
|
||||
|
||||
protected void doFreezeConversion() {
|
||||
- this.convertTo(EntityType.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
|
||||
- if (!this.isSilent()) {
|
||||
+ Stray stray = this.convertTo(EntityType.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons // Paper - track result of conversion
|
||||
+ if (stray != null && !this.isSilent()) { // Paper - only send event if conversion succeeded
|
||||
this.level.levelEvent((Player) null, 1048, this.blockPosition(), 0);
|
||||
}
|
||||
+ // Paper start - reset conversion time to prevent event spam
|
||||
+ if (stray == null) {
|
||||
+ this.conversionTime = 300;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
|
||||
index cbf181b30bae134150933c721f22161e3e9ffca3..12a1cb536d5cb109cac75636369ed1b2bfa3a0a4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
|
||||
@@ -105,6 +105,11 @@ public abstract class AbstractPiglin extends Monster {
|
||||
if (entitypigzombie != null) {
|
||||
entitypigzombie.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0));
|
||||
}
|
||||
+ // Paper start - reset to prevent event spam
|
||||
+ else {
|
||||
+ this.timeInOverworld = 0;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
index 61e2841fea6603e3e5fbd004de7ffdfb79fc9981..4a873a278a4dc76d868d789574a7890bf53832d7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
@@ -28,7 +28,7 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton {
|
||||
this.getHandle().conversionTime = -1;
|
||||
this.getHandle().getEntityData().set(net.minecraft.world.entity.monster.Skeleton.DATA_STRAY_CONVERSION_ID, false);
|
||||
} else {
|
||||
- this.getHandle().getSwimAmount(time); // PAIL rename startStrayConversion
|
||||
+ this.getHandle().startFreezeConversion(time); // PAIL rename startStrayConversion // Paper - nope, that's not the right method
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 4 Nov 2021 11:50:40 -0700
|
||||
Subject: [PATCH] Add isCollidable methods to various places
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index e3944d0f4fd18ef6c545dc4a131c0b120dff753a..5154cfffc414e1f6039e55f1a256bbaacb56bc55 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -470,6 +470,11 @@ public class CraftBlock implements Block {
|
||||
public boolean isSolid() {
|
||||
return getNMS().getMaterial().blocksMotion();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCollidable() {
|
||||
+ return getNMS().getBlock().hasCollision;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33db67320a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
@@ -324,4 +324,11 @@ public class CraftBlockState implements BlockState {
|
||||
throw new IllegalStateException("The blockState must be placed to call this method");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean isCollidable() {
|
||||
+ return this.data.getBlock().hasCollision;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 26273a6b9d49f0e12fe1ff3206c7f017a2f36e44..eb11abe4bc8f06d457da674848b39fc3b3873d1a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -528,6 +528,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCollidable(Material material) {
|
||||
+ Preconditions.checkArgument(material.isBlock(), material + " is not a block");
|
||||
+ return getBlock(material).hasCollision;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
|
@ -1,44 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Seggan <segganew@gmail.com>
|
||||
Date: Thu, 5 Aug 2021 13:10:27 -0400
|
||||
Subject: [PATCH] Goat ram API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
index 32d0387b6c66462ca965add78a562dec3c4b95a9..c7e24da48aaff9fbd1a8272483231744326e3a8e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -279,6 +279,17 @@ public class Goat extends Animal {
|
||||
return new Goat.GoatPathNavigation(this, world);
|
||||
}
|
||||
|
||||
+ // Paper start - Goat ram API
|
||||
+ public void ram(LivingEntity entity) {
|
||||
+ Brain<Goat> brain = this.getBrain();
|
||||
+ brain.setMemory(MemoryModuleType.RAM_TARGET, entity.position());
|
||||
+ brain.eraseMemory(MemoryModuleType.RAM_COOLDOWN_TICKS);
|
||||
+ brain.eraseMemory(MemoryModuleType.BREED_TARGET);
|
||||
+ brain.eraseMemory(MemoryModuleType.TEMPTING_PLAYER);
|
||||
+ brain.setActiveActivityIfPossible(net.minecraft.world.entity.schedule.Activity.RAM);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private static class GoatPathNavigation extends GroundPathNavigation {
|
||||
|
||||
GoatPathNavigation(Goat goat, Level world) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java
|
||||
index ae74df5c9845ac125968a52897f4343b0f348217..436aa41563b8fab112d03c8cc516cf6ff37587bd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java
|
||||
@@ -34,4 +34,11 @@ public class CraftGoat extends CraftAnimals implements Goat {
|
||||
public void setScreaming(boolean screaming) {
|
||||
this.getHandle().setScreamingGoat(screaming);
|
||||
}
|
||||
+
|
||||
+ // Paper start - Goat ram API
|
||||
+ @Override
|
||||
+ public void ram(@org.jetbrains.annotations.NotNull org.bukkit.entity.LivingEntity entity) {
|
||||
+ this.getHandle().ram(((CraftLivingEntity) entity).getHandle());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: booky10 <boooky10@gmail.com>
|
||||
Date: Fri, 5 Nov 2021 21:01:36 +0100
|
||||
Subject: [PATCH] Add API for resetting a single score
|
||||
|
||||
It was only possible to reset all scores for a specific entry, instead of resetting only specific scores.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
|
||||
index 2c4ffed5e828f051c44f494a8ed599a8197d7450..3b26793b67282c3a20c023b9c13a2a9b54d5d932 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
|
||||
@@ -68,4 +68,12 @@ final class CraftScore implements Score {
|
||||
public CraftScoreboard getScoreboard() {
|
||||
return this.objective.getScoreboard();
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void resetScore() {
|
||||
+ Scoreboard board = this.objective.checkState().board;
|
||||
+ board.resetPlayerScore(entry, this.objective.getHandle());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue