Compare commits
31 Commits
update/1.2
...
d4be73c990
| Author | SHA1 | Date | |
|---|---|---|---|
| d4be73c990 | |||
| 02d20ff7eb | |||
| d1810f241c | |||
| 1db3785307 | |||
| 952338b33e | |||
| b9d3147d3b | |||
| f8fa4f6f5e | |||
| b418321d85 | |||
| 3e3b42cdf5 | |||
| f86b435228 | |||
| deaccd2c42 | |||
| 58f12b93f8 | |||
| 284f5adefd | |||
| 3222985e43 | |||
| 1cfc96bcf7 | |||
| 3409e2d73f | |||
| ae512811db | |||
| a211ac2ec5 | |||
| a112d37025 | |||
| 6652bb7612 | |||
| 9cddf136d7 | |||
| 767868ddbf | |||
| 1410a22bb2 | |||
| d05bf33c05 | |||
| 2b50a2ea07 | |||
| 67a5148512 | |||
| a5269d76c0 | |||
| adc22129ae | |||
| cf7e54ea59 | |||
| 5d6f544ed1 | |||
| cb9578f90f |
@ -568,8 +568,8 @@ public class MaterialTags {
|
||||
Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK,
|
||||
Material.BRUSH, Material.CARVED_PUMPKIN, Material.COMPASS, Material.SKELETON_SKULL,
|
||||
Material.WITHER_SKELETON_SKULL, Material.PLAYER_HEAD, Material.ZOMBIE_HEAD,
|
||||
Material.CREEPER_HEAD, Material.DRAGON_HEAD, Material.PIGLIN_HEAD)
|
||||
.ensureSize("ENCHANTABLE", 75).lock();
|
||||
Material.CREEPER_HEAD, Material.DRAGON_HEAD, Material.PIGLIN_HEAD, Material.MACE)
|
||||
.ensureSize("ENCHANTABLE", 76).lock();
|
||||
|
||||
/**
|
||||
* Covers the variants of raw ores.
|
||||
|
||||
@ -367,7 +367,7 @@ public final class DataComponentTypes {
|
||||
// TODO: This is a eitherholder? Why specifically the chicken?? Oh wait this is prolly for chicken egg cause legacy item loading
|
||||
public static final DataComponentType.Valued<Chicken.Variant> CHICKEN_VARIANT = valued("chicken/variant");
|
||||
public static final DataComponentType.Valued<Frog.Variant> FROG_VARIANT = valued("frog/variant");
|
||||
public static final DataComponentType.Valued<Horse.Style> HORSE_VARIANT = valued("horse/variant");
|
||||
public static final DataComponentType.Valued<Horse.Color> HORSE_VARIANT = valued("horse/variant");
|
||||
public static final DataComponentType.Valued<Art> PAINTING_VARIANT = valued("painting/variant");
|
||||
public static final DataComponentType.Valued<Llama.Color> LLAMA_VARIANT = valued("llama/variant");
|
||||
public static final DataComponentType.Valued<Axolotl.Variant> AXOLOTL_VARIANT = valued("axolotl/variant");
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
package io.papermc.paper.event.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.Vault;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.block.BlockEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a vault block changes state.
|
||||
*/
|
||||
@NullMarked
|
||||
public class VaultChangeStateEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final @Nullable Player player;
|
||||
private final Vault.State currentState;
|
||||
private final Vault.State newState;
|
||||
private boolean cancelled = false;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public VaultChangeStateEvent(final Block vaultBlock, final @Nullable Player player, final Vault.State currentState, final Vault.State newState) {
|
||||
super(vaultBlock);
|
||||
this.player = player;
|
||||
this.currentState = currentState;
|
||||
this.newState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player associated with this state change, if applicable.
|
||||
*
|
||||
* @return The associated player, or {@code null} if not known.
|
||||
*/
|
||||
public @Nullable Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state the vault is currently in.
|
||||
*
|
||||
* @return The current vault state.
|
||||
*/
|
||||
public Vault.State getCurrentState() {
|
||||
return currentState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state the vault is attempting to transition to.
|
||||
*
|
||||
* @return The new vault state.
|
||||
*/
|
||||
public Vault.State getNewState() {
|
||||
return newState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@ -525,6 +525,13 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
*/
|
||||
Stream<T> stream();
|
||||
|
||||
/**
|
||||
* Returns a new stream, which contains all registry keys, which are registered to the registry.
|
||||
*
|
||||
* @return a stream of all registry keys
|
||||
*/
|
||||
Stream<NamespacedKey> keyStream();
|
||||
|
||||
/**
|
||||
* Attempts to match the registered object with the given key.
|
||||
* <p>
|
||||
@ -591,6 +598,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
return this.map.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<NamespacedKey> keyStream() {
|
||||
return this.map.keySet().stream();
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@Deprecated(since = "1.20.6", forRemoval = true)
|
||||
public Class<T> getType() {
|
||||
@ -606,6 +618,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
return StreamSupport.stream(this.spliterator(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<NamespacedKey> keyStream() {
|
||||
return stream().map(this::getKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return Iterables.size(this);
|
||||
|
||||
@ -830,9 +830,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param id the id of the map to get
|
||||
* @return a map view if it exists, or null otherwise
|
||||
*/
|
||||
// @Deprecated(since = "1.6.2") // Paper - Not a magic value
|
||||
@Nullable
|
||||
public MapView getMap(int id);
|
||||
MapView getMap(int id);
|
||||
|
||||
/**
|
||||
* Create a new map with an automatically assigned ID.
|
||||
|
||||
@ -817,4 +817,11 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
return this.getBlockData().getDestroySpeed(itemStack, considerEnchants);
|
||||
}
|
||||
// Paper end - destroy speed API
|
||||
|
||||
/**
|
||||
* Checks if the block can suffocate.
|
||||
*
|
||||
* @return {@code true} if the block can suffocate
|
||||
*/
|
||||
boolean isSuffocating();
|
||||
}
|
||||
|
||||
@ -5,12 +5,16 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.metadata.Metadatable;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a block, which will not change
|
||||
@ -226,14 +230,14 @@ public interface BlockState extends Metadatable {
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated(since = "1.6.2", forRemoval = true)
|
||||
public byte getRawData();
|
||||
byte getRawData();
|
||||
|
||||
/**
|
||||
* @param data The new data value for the block.
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated(since = "1.6.2", forRemoval = true)
|
||||
public void setRawData(byte data);
|
||||
void setRawData(byte data);
|
||||
|
||||
/**
|
||||
* Returns whether this state is placed in the world.
|
||||
@ -246,7 +250,6 @@ public interface BlockState extends Metadatable {
|
||||
*/
|
||||
boolean isPlaced();
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* Checks if this block state is collidable.
|
||||
*
|
||||
@ -261,7 +264,7 @@ public interface BlockState extends Metadatable {
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
@NotNull
|
||||
default java.util.@org.jetbrains.annotations.Unmodifiable Collection<org.bukkit.inventory.ItemStack> getDrops() {
|
||||
default @Unmodifiable Collection<ItemStack> getDrops() {
|
||||
return this.getDrops(null);
|
||||
}
|
||||
|
||||
@ -274,7 +277,7 @@ public interface BlockState extends Metadatable {
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
@NotNull
|
||||
default java.util.@org.jetbrains.annotations.Unmodifiable Collection<org.bukkit.inventory.ItemStack> getDrops(@Nullable org.bukkit.inventory.ItemStack tool) {
|
||||
default @Unmodifiable Collection<ItemStack> getDrops(@Nullable ItemStack tool) {
|
||||
return this.getDrops(tool, null);
|
||||
}
|
||||
|
||||
@ -288,6 +291,14 @@ public interface BlockState extends Metadatable {
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
@NotNull
|
||||
java.util.@org.jetbrains.annotations.Unmodifiable Collection<org.bukkit.inventory.ItemStack> getDrops(@Nullable org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity);
|
||||
// Paper end
|
||||
@Unmodifiable
|
||||
Collection<ItemStack> getDrops(@Nullable ItemStack tool, @Nullable Entity entity);
|
||||
|
||||
/**
|
||||
* Checks if the block state can suffocate.
|
||||
*
|
||||
* @return {@code true} if the block state can suffocate
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
boolean isSuffocating();
|
||||
}
|
||||
|
||||
@ -121,7 +121,6 @@ import org.bukkit.block.data.type.WallHangingSign;
|
||||
import org.bukkit.block.data.type.WallSign;
|
||||
import org.bukkit.block.data.type.WallSkull;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -323,7 +324,6 @@ public interface FishHook extends Projectile {
|
||||
BOBBING;
|
||||
}
|
||||
|
||||
// Paper start - More FishHook API
|
||||
/**
|
||||
* Get the number of ticks the hook needs to wait for a fish to bite.
|
||||
*
|
||||
@ -367,5 +367,18 @@ public interface FishHook extends Projectile {
|
||||
* enchantment.
|
||||
*/
|
||||
void resetFishingState();
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
* Retrieve this fishhook back to the casting player.
|
||||
* <p>
|
||||
* This method will trigger and respect API events, which may be subject to cancellation.
|
||||
* Plugins listening to {@link org.bukkit.event.player.PlayerFishEvent} might for example cancel this action.
|
||||
*
|
||||
* @param slot Slot holding the fishing rod (must be HAND/OFF_HAND)
|
||||
* @return The amount of damage which would be applied to the itemstack
|
||||
* @throws IllegalStateException if the fish hook does not have a player casting it.
|
||||
* @throws IllegalStateException if the player casting it is not holding a
|
||||
* {@link org.bukkit.inventory.ItemType#FISHING_ROD} in the specified equipment slot.
|
||||
*/
|
||||
int retrieve(@NotNull EquipmentSlot slot);
|
||||
}
|
||||
|
||||
@ -2109,6 +2109,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*
|
||||
* @param other The other {@link Player} to list.
|
||||
* @return True if the {@code other} player was not listed.
|
||||
* @throws IllegalStateException if this player can't see the other player
|
||||
* @see #canSee(Player)
|
||||
*/
|
||||
boolean listPlayer(Player other);
|
||||
// Paper end
|
||||
|
||||
@ -203,10 +203,10 @@ public class InventoryClickEvent extends InventoryInteractEvent {
|
||||
|
||||
/**
|
||||
* If the ClickType is NUMBER_KEY, this method will return the index of
|
||||
* the pressed key (0-8).
|
||||
* the pressed key (0-8) and -1 if player swapped with off-hand (or the action is not NUMBER_KEY).
|
||||
*
|
||||
* @return the number on the key minus 1 (range 0-8); or -1 if not
|
||||
* a NUMBER_KEY action
|
||||
* @return the number on the key minus 1 (range 0-8);
|
||||
* or -1 if ClickType is NUMBER_KEY and player did an off-hand swap. Is also -1 if ClickType is not NUMBER_KEY
|
||||
*/
|
||||
public int getHotbarButton() {
|
||||
return this.hotbarKey;
|
||||
|
||||
@ -28202,10 +28202,10 @@ index b30f56fbc1fd17259a1d05dc9155fffcab292ca1..11fed81a4696ba18440e755c3b8a5ca3
|
||||
this.generatingStep = generatingStep;
|
||||
this.cache = cache;
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 73717609fccd9af12e2cc39824106f49426b581c..72524ff3399a4477dfa3db2f4e79bb14f6519a8b 100644
|
||||
index 5ec9e3b37e575e9805bf9f0ce5cae5c1284461d8..78201407a37eced73998b97d5d5c412eaba69af1 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1321,7 +1321,7 @@ public abstract class PlayerList {
|
||||
@@ -1320,7 +1320,7 @@ public abstract class PlayerList {
|
||||
|
||||
public void setViewDistance(int viewDistance) {
|
||||
this.viewDistance = viewDistance;
|
||||
@ -28214,7 +28214,7 @@ index 73717609fccd9af12e2cc39824106f49426b581c..72524ff3399a4477dfa3db2f4e79bb14
|
||||
|
||||
for (ServerLevel serverLevel : this.server.getAllLevels()) {
|
||||
if (serverLevel != null) {
|
||||
@@ -1332,7 +1332,7 @@ public abstract class PlayerList {
|
||||
@@ -1331,7 +1331,7 @@ public abstract class PlayerList {
|
||||
|
||||
public void setSimulationDistance(int simulationDistance) {
|
||||
this.simulationDistance = simulationDistance;
|
||||
|
||||
@ -60,7 +60,7 @@ index 1463c31ba980ab0eb2174e3e891d1423a505e9dc..886340232b58afd59caa6df29e211589
|
||||
} else if (this.seenBy.remove(player.connection)) {
|
||||
this.serverEntity.removePairing(player);
|
||||
diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
|
||||
index 0005a1784ccaa00e5d6d67e7be98445150487982..257ecbcf7d463eefb951867a5426eaf24e356305 100644
|
||||
index a1ae77b70f69852d9e4332bf1cb3409c33b21de0..b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954 100644
|
||||
--- a/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -103,6 +103,13 @@ public class ServerEntity {
|
||||
@ -77,7 +77,7 @@ index 0005a1784ccaa00e5d6d67e7be98445150487982..257ecbcf7d463eefb951867a5426eaf2
|
||||
public void sendChanges() {
|
||||
// Paper start - optimise collisions
|
||||
if (((ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity)this.entity).moonrise$isHardColliding()) {
|
||||
@@ -136,7 +143,7 @@ public class ServerEntity {
|
||||
@@ -141,7 +148,7 @@ public class ServerEntity {
|
||||
this.sendDirtyEntityData();
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ index 0005a1784ccaa00e5d6d67e7be98445150487982..257ecbcf7d463eefb951867a5426eaf2
|
||||
byte b = Mth.packDegrees(this.entity.getYRot());
|
||||
byte b1 = Mth.packDegrees(this.entity.getXRot());
|
||||
boolean flag = Math.abs(b - this.lastSentYRot) >= 1 || Math.abs(b1 - this.lastSentXRot) >= 1;
|
||||
@@ -171,7 +178,7 @@ public class ServerEntity {
|
||||
@@ -176,7 +183,7 @@ public class ServerEntity {
|
||||
long l1 = this.positionCodec.encodeY(vec3);
|
||||
long l2 = this.positionCodec.encodeZ(vec3);
|
||||
boolean flag5 = l < -32768L || l > 32767L || l1 < -32768L || l1 > 32767L || l2 < -32768L || l2 > 32767L;
|
||||
@ -95,7 +95,7 @@ index 0005a1784ccaa00e5d6d67e7be98445150487982..257ecbcf7d463eefb951867a5426eaf2
|
||||
this.wasOnGround = this.entity.onGround();
|
||||
this.teleportDelay = 0;
|
||||
packet = ClientboundEntityPositionSyncPacket.of(this.entity);
|
||||
@@ -236,6 +243,7 @@ public class ServerEntity {
|
||||
@@ -241,6 +248,7 @@ public class ServerEntity {
|
||||
}
|
||||
|
||||
this.entity.hasImpulse = false;
|
||||
|
||||
@ -5,7 +5,7 @@ Subject: [PATCH] Incremental chunk and player saving
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 00f7f4356d6bffdd31f58b9d798c755edd9cd3ff..ea85cac4a41075efe8525c40755e7ebac6ca9dea 100644
|
||||
index 094ef7f54ad71795a2d8c2a8d03a32bef6ff2164..79bc1b7d9f640d2322814177eb3e921da8671e87 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -952,7 +952,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@ -50,7 +50,7 @@ index 00f7f4356d6bffdd31f58b9d798c755edd9cd3ff..ea85cac4a41075efe8525c40755e7eba
|
||||
ProfilerFiller profilerFiller = Profiler.get();
|
||||
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index debc511cf18d0be813803c200bd1cf0b07ba7974..2a4a40976215ea858c562c3f530db378896c6fcb 100644
|
||||
index 32db2b9e375c12cbf7abab69cc01e8ac2c7c3b6e..d50d2928ad9f8b34a14621b1fe5c188547e04bd1 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1317,6 +1317,28 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
@ -83,7 +83,7 @@ index debc511cf18d0be813803c200bd1cf0b07ba7974..2a4a40976215ea858c562c3f530db378
|
||||
// Paper start - add close param
|
||||
this.save(progress, flush, skipSave, false);
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index bc901bc689c2690ac19e590bff1ae612b7071ee9..8e7ee4dc951eb53ccf65ab71214a0b89bd932ba0 100644
|
||||
index 3e73c69c9db8cbded28a001b20d9989acb11c638..d1de5aff81da465be79f2f747466734e80ec50dc 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -189,6 +189,7 @@ import org.slf4j.Logger;
|
||||
@ -95,7 +95,7 @@ index bc901bc689c2690ac19e590bff1ae612b7071ee9..8e7ee4dc951eb53ccf65ab71214a0b89
|
||||
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
|
||||
private static final int FLY_STAT_RECORDING_SPEED = 25;
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 72524ff3399a4477dfa3db2f4e79bb14f6519a8b..6e22aedd36add8e39a82248193f324b36dfa27b5 100644
|
||||
index 78201407a37eced73998b97d5d5c412eaba69af1..f057e682ccd378f11710dc2e7129cba95788bb18 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -486,6 +486,7 @@ public abstract class PlayerList {
|
||||
@ -106,7 +106,7 @@ index 72524ff3399a4477dfa3db2f4e79bb14f6519a8b..6e22aedd36add8e39a82248193f324b3
|
||||
this.playerIo.save(player);
|
||||
ServerStatsCounter serverStatsCounter = player.getStats(); // CraftBukkit
|
||||
if (serverStatsCounter != null) {
|
||||
@@ -1068,9 +1069,23 @@ public abstract class PlayerList {
|
||||
@@ -1067,9 +1068,23 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void saveAll() {
|
||||
|
||||
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..24a2090e068ad3c0d08705050944abdf
|
||||
+ }
|
||||
+}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index ea85cac4a41075efe8525c40755e7ebac6ca9dea..7af29d3dc7b337d74cee5df7cbca35c420643370 100644
|
||||
index 79bc1b7d9f640d2322814177eb3e921da8671e87..f1373fd5fdebb9f4600ba7f32a5df6188de3a0e9 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1706,6 +1706,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@ -60,10 +60,10 @@ index ea85cac4a41075efe8525c40755e7ebac6ca9dea..7af29d3dc7b337d74cee5df7cbca35c4
|
||||
/* Drop global time updates
|
||||
if (this.tickCount % 20 == 0) {
|
||||
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
||||
index 5329dc9259f30011d277336bfc76da18c15d5d81..8391f51b7dd584dd346bda5dccbee900d4fa9c2d 100644
|
||||
index 72cd623a1a3ce4b7a570a853456b067cd93736b1..ad7852a19ff73368ec9e7e63dcb7a064f78eefa0 100644
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -832,10 +832,16 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@@ -831,10 +831,16 @@ public final class ItemStack implements DataComponentHolder {
|
||||
}
|
||||
|
||||
public ItemStack copy() {
|
||||
|
||||
@ -1,126 +1,13 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Sun, 30 Mar 2025 12:00:51 +0200
|
||||
Date: Sun, 30 Mar 2025 12:00:50 +0200
|
||||
Subject: [PATCH] SW Disable Commands
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index 9dd86cf63dd93620adb539a7a80a8d01c7ac08a2..3289d9f441aa219f019b63531b0ab431fcfe9115 100644
|
||||
index 9dd86cf63dd93620adb539a7a80a8d01c7ac08a2..ca59e02fa0b2bbf2fdf53f088b0a6a876330fd73 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -155,67 +155,67 @@ public class Commands {
|
||||
}
|
||||
public Commands(Commands.CommandSelection selection, CommandBuildContext context, final boolean modern) {
|
||||
// Paper end - Brigadier API - modern minecraft overloads that do not use redirects but are copies instead
|
||||
- AdvancementCommands.register(this.dispatcher);
|
||||
- AttributeCommand.register(this.dispatcher, context);
|
||||
- ExecuteCommand.register(this.dispatcher, context);
|
||||
- BossBarCommands.register(this.dispatcher, context);
|
||||
+ //AdvancementCommands.register(this.dispatcher);
|
||||
+ //AttributeCommand.register(this.dispatcher, context);
|
||||
+ //ExecuteCommand.register(this.dispatcher, context);
|
||||
+ //BossBarCommands.register(this.dispatcher, context);
|
||||
ClearInventoryCommands.register(this.dispatcher, context);
|
||||
- CloneCommands.register(this.dispatcher, context);
|
||||
- DamageCommand.register(this.dispatcher, context);
|
||||
- DataCommands.register(this.dispatcher);
|
||||
- DataPackCommand.register(this.dispatcher);
|
||||
- DebugCommand.register(this.dispatcher);
|
||||
- DefaultGameModeCommands.register(this.dispatcher);
|
||||
- DifficultyCommand.register(this.dispatcher);
|
||||
+ //CloneCommands.register(this.dispatcher, context);
|
||||
+ //DamageCommand.register(this.dispatcher, context);
|
||||
+ //DataCommands.register(this.dispatcher);
|
||||
+ //DataPackCommand.register(this.dispatcher);
|
||||
+ //DebugCommand.register(this.dispatcher);
|
||||
+ //DefaultGameModeCommands.register(this.dispatcher);
|
||||
+ //DifficultyCommand.register(this.dispatcher);
|
||||
EffectCommands.register(this.dispatcher, context);
|
||||
- EmoteCommands.register(this.dispatcher);
|
||||
+ //EmoteCommands.register(this.dispatcher);
|
||||
EnchantCommand.register(this.dispatcher, context);
|
||||
- ExperienceCommand.register(this.dispatcher);
|
||||
- FillCommand.register(this.dispatcher, context);
|
||||
+ //ExperienceCommand.register(this.dispatcher);
|
||||
+ //FillCommand.register(this.dispatcher, context);
|
||||
FillBiomeCommand.register(this.dispatcher, context);
|
||||
- ForceLoadCommand.register(this.dispatcher);
|
||||
- FunctionCommand.register(this.dispatcher);
|
||||
+ //ForceLoadCommand.register(this.dispatcher);
|
||||
+ //FunctionCommand.register(this.dispatcher);
|
||||
GameModeCommand.register(this.dispatcher);
|
||||
GameRuleCommand.register(this.dispatcher, context);
|
||||
GiveCommand.register(this.dispatcher, context);
|
||||
- HelpCommand.register(this.dispatcher);
|
||||
- ItemCommands.register(this.dispatcher, context);
|
||||
+ //HelpCommand.register(this.dispatcher);
|
||||
+ //ItemCommands.register(this.dispatcher, context);
|
||||
KickCommand.register(this.dispatcher);
|
||||
KillCommand.register(this.dispatcher);
|
||||
- ListPlayersCommand.register(this.dispatcher);
|
||||
- LocateCommand.register(this.dispatcher, context);
|
||||
- LootCommand.register(this.dispatcher, context);
|
||||
- MsgCommand.register(this.dispatcher);
|
||||
- ParticleCommand.register(this.dispatcher, context);
|
||||
- PlaceCommand.register(this.dispatcher);
|
||||
- PlaySoundCommand.register(this.dispatcher);
|
||||
- RandomCommand.register(this.dispatcher);
|
||||
- ReloadCommand.register(this.dispatcher);
|
||||
- RecipeCommand.register(this.dispatcher);
|
||||
- ReturnCommand.register(this.dispatcher);
|
||||
- RideCommand.register(this.dispatcher);
|
||||
+ //ListPlayersCommand.register(this.dispatcher);
|
||||
+ //LocateCommand.register(this.dispatcher, context);
|
||||
+ //LootCommand.register(this.dispatcher, context);
|
||||
+ //MsgCommand.register(this.dispatcher);
|
||||
+ //ParticleCommand.register(this.dispatcher, context);
|
||||
+ //PlaceCommand.register(this.dispatcher);
|
||||
+ //PlaySoundCommand.register(this.dispatcher);
|
||||
+ //RandomCommand.register(this.dispatcher);
|
||||
+ //ReloadCommand.register(this.dispatcher);
|
||||
+ //RecipeCommand.register(this.dispatcher);
|
||||
+ //ReturnCommand.register(this.dispatcher);
|
||||
+ //RideCommand.register(this.dispatcher);
|
||||
RotateCommand.register(this.dispatcher);
|
||||
- SayCommand.register(this.dispatcher);
|
||||
- ScheduleCommand.register(this.dispatcher);
|
||||
- ScoreboardCommand.register(this.dispatcher, context);
|
||||
- SeedCommand.register(this.dispatcher, selection != Commands.CommandSelection.INTEGRATED);
|
||||
- SetBlockCommand.register(this.dispatcher, context);
|
||||
- SetSpawnCommand.register(this.dispatcher);
|
||||
+ //SayCommand.register(this.dispatcher);
|
||||
+ //ScheduleCommand.register(this.dispatcher);
|
||||
+ //ScoreboardCommand.register(this.dispatcher, context);
|
||||
+ //SeedCommand.register(this.dispatcher, selection != Commands.CommandSelection.INTEGRATED);
|
||||
+ //SetBlockCommand.register(this.dispatcher, context);
|
||||
+ //SetSpawnCommand.register(this.dispatcher);
|
||||
SetWorldSpawnCommand.register(this.dispatcher);
|
||||
SpectateCommand.register(this.dispatcher);
|
||||
- SpreadPlayersCommand.register(this.dispatcher);
|
||||
- StopSoundCommand.register(this.dispatcher);
|
||||
+ //SpreadPlayersCommand.register(this.dispatcher);
|
||||
+ //StopSoundCommand.register(this.dispatcher);
|
||||
SummonCommand.register(this.dispatcher, context);
|
||||
- TagCommand.register(this.dispatcher);
|
||||
- TeamCommand.register(this.dispatcher, context);
|
||||
- TeamMsgCommand.register(this.dispatcher);
|
||||
+ //TagCommand.register(this.dispatcher);
|
||||
+ //TeamCommand.register(this.dispatcher, context);
|
||||
+ //TeamMsgCommand.register(this.dispatcher);
|
||||
TeleportCommand.register(this.dispatcher);
|
||||
- TellRawCommand.register(this.dispatcher, context);
|
||||
- TestCommand.register(this.dispatcher, context);
|
||||
+ //TellRawCommand.register(this.dispatcher, context);
|
||||
+ //TestCommand.register(this.dispatcher, context);
|
||||
TickCommand.register(this.dispatcher);
|
||||
TimeCommand.register(this.dispatcher);
|
||||
- TitleCommand.register(this.dispatcher, context);
|
||||
- TriggerCommand.register(this.dispatcher);
|
||||
+ //TitleCommand.register(this.dispatcher, context);
|
||||
+ //TriggerCommand.register(this.dispatcher);
|
||||
WeatherCommand.register(this.dispatcher);
|
||||
WorldBorderCommand.register(this.dispatcher);
|
||||
if (JvmProfiler.INSTANCE.isAvailable()) {
|
||||
@@ -235,20 +235,20 @@ public class Commands {
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,15 @@
|
||||
this.level = level;
|
||||
this.broadcast = broadcast;
|
||||
this.entity = entity;
|
||||
@@ -106,13 +_,14 @@
|
||||
@@ -103,16 +_,22 @@
|
||||
if (!passengers.equals(this.lastPassengers)) {
|
||||
List<UUID> list = this.mountedOrDismounted(passengers).map(Entity::getUUID).toList();
|
||||
this.broadcastWithIgnore.accept(new ClientboundSetPassengersPacket(this.entity), list);
|
||||
+ // Paper start - Allow riding players
|
||||
+ if (this.entity instanceof ServerPlayer player) {
|
||||
+ player.connection.send(new ClientboundSetPassengersPacket(this.entity));
|
||||
+ }
|
||||
+ // Paper end - Allow riding players
|
||||
this.lastPassengers = passengers;
|
||||
}
|
||||
|
||||
|
||||
@ -1237,14 +1237,21 @@
|
||||
} else {
|
||||
Component component1 = Component.translatable("build.tooHigh", maxY).withStyle(ChatFormatting.RED);
|
||||
this.player.sendSystemMessage(component1, true);
|
||||
@@ -1268,6 +_,7 @@
|
||||
@@ -1268,13 +_,7 @@
|
||||
|
||||
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos));
|
||||
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos.relative(direction)));
|
||||
- } else {
|
||||
- LOGGER.warn(
|
||||
- "Rejecting UseItemOnPacket from {}: Location {} too far away from hit block {}.",
|
||||
- this.player.getGameProfile().getName(),
|
||||
- location,
|
||||
- blockPos
|
||||
- );
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdates(); // Paper - Force update attributes.
|
||||
} else {
|
||||
LOGGER.warn(
|
||||
"Rejecting UseItemOnPacket from {}: Location {} too far away from hit block {}.",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1284,6 +_,8 @@
|
||||
@Override
|
||||
public void handleUseItem(ServerboundUseItemPacket packet) {
|
||||
@ -2559,7 +2566,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1997,6 +_,7 @@
|
||||
@@ -1997,27 +_,32 @@
|
||||
|
||||
private void resetPlayerChatState(RemoteChatSession chatSession) {
|
||||
this.chatSession = chatSession;
|
||||
@ -2567,16 +2574,19 @@
|
||||
this.signedMessageDecoder = chatSession.createMessageDecoder(this.player.getUUID());
|
||||
this.chatMessageChain
|
||||
.append(
|
||||
@@ -2005,7 +_,7 @@
|
||||
() -> {
|
||||
+ server.executeBlocking(() -> { // Paper - Broadcast chat session update sync
|
||||
this.player.setChatSession(chatSession);
|
||||
this.server
|
||||
.getPlayerList()
|
||||
.broadcastAll(
|
||||
- new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player))
|
||||
+ new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)), this.player // Paper - Use single player info update packet on join
|
||||
);
|
||||
+ });
|
||||
}
|
||||
);
|
||||
@@ -2013,11 +_,13 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
||||
|
||||
@ -756,7 +756,7 @@
|
||||
|
||||
return serverPlayer;
|
||||
}
|
||||
@@ -488,24 +_,60 @@
|
||||
@@ -488,24 +_,59 @@
|
||||
}
|
||||
|
||||
public void sendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) {
|
||||
@ -800,12 +800,11 @@
|
||||
|
||||
+ // CraftBukkit start - add a world/entity limited version
|
||||
+ public void broadcastAll(Packet packet, net.minecraft.world.entity.player.Player entityhuman) {
|
||||
+ for (int i = 0; i < this.players.size(); ++i) {
|
||||
+ ServerPlayer entityplayer = this.players.get(i);
|
||||
+ for (ServerPlayer entityplayer : this.players) { // Paper - replace for i with for each for thread safety
|
||||
+ if (entityhuman != null && !entityplayer.getBukkitEntity().canSee(entityhuman.getBukkitEntity())) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ ((ServerPlayer) this.players.get(i)).connection.send(packet);
|
||||
+ ((ServerPlayer) entityplayer).connection.send(packet); // Paper - replace for i with for each for thread safety
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
--- a/net/minecraft/world/InteractionResult.java
|
||||
+++ b/net/minecraft/world/InteractionResult.java
|
||||
@@ -30,18 +_,34 @@
|
||||
public record Pass() implements InteractionResult {
|
||||
}
|
||||
|
||||
- public record Success(InteractionResult.SwingSource swingSource, InteractionResult.ItemContext itemContext) implements InteractionResult {
|
||||
+ // Paper start - track more context in interaction result
|
||||
+ public record PaperSuccessContext(net.minecraft.core.@org.jspecify.annotations.Nullable BlockPos placedBlockPosition) {
|
||||
+ static PaperSuccessContext DEFAULT = new PaperSuccessContext(null);
|
||||
+
|
||||
+ public PaperSuccessContext placedBlockAt(final net.minecraft.core.BlockPos blockPos) {
|
||||
+ return new PaperSuccessContext(blockPos);
|
||||
+ }
|
||||
+ }
|
||||
+ public record Success(InteractionResult.SwingSource swingSource, InteractionResult.ItemContext itemContext, PaperSuccessContext paperSuccessContext) implements InteractionResult {
|
||||
+ public InteractionResult.Success configurePaper(final java.util.function.UnaryOperator<PaperSuccessContext> edit) {
|
||||
+ return new InteractionResult.Success(this.swingSource, this.itemContext, edit.apply(this.paperSuccessContext));
|
||||
+ }
|
||||
+
|
||||
+ public Success(final net.minecraft.world.InteractionResult.SwingSource swingSource, final net.minecraft.world.InteractionResult.ItemContext itemContext) {
|
||||
+ this(swingSource, itemContext, PaperSuccessContext.DEFAULT);
|
||||
+ }
|
||||
+ // Paper end - track more context in interaction result
|
||||
@Override
|
||||
public boolean consumesAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public InteractionResult.Success heldItemTransformedTo(ItemStack stack) {
|
||||
- return new InteractionResult.Success(this.swingSource, new InteractionResult.ItemContext(true, stack));
|
||||
+ return new InteractionResult.Success(this.swingSource, new InteractionResult.ItemContext(true, stack), this.paperSuccessContext); // Paper - track more context in interaction result
|
||||
}
|
||||
|
||||
public InteractionResult.Success withoutItem() {
|
||||
- return new InteractionResult.Success(this.swingSource, InteractionResult.ItemContext.NONE);
|
||||
+ return new InteractionResult.Success(this.swingSource, InteractionResult.ItemContext.NONE, this.paperSuccessContext); // Paper - track more context in interaction result
|
||||
}
|
||||
|
||||
public boolean wasItemInteraction() {
|
||||
@ -56,6 +56,15 @@
|
||||
level.playSound(
|
||||
player,
|
||||
clickedPos,
|
||||
@@ -88,7 +_,7 @@
|
||||
);
|
||||
level.gameEvent(GameEvent.BLOCK_PLACE, clickedPos, GameEvent.Context.of(player, blockState));
|
||||
itemInHand.consume(1, player);
|
||||
- return InteractionResult.SUCCESS;
|
||||
+ return InteractionResult.SUCCESS.configurePaper(e -> e.placedBlockAt(clickedPos.immutable())); // Paper - track placed block position from block item
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,8 +_,19 @@
|
||||
|
||||
protected boolean canPlace(BlockPlaceContext context, BlockState state) {
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -373,10 +_,167 @@
|
||||
@@ -373,10 +_,166 @@
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
Item item = this.getItem();
|
||||
@ -175,10 +175,9 @@
|
||||
+ }
|
||||
+
|
||||
+ // SPIGOT-1288 - play sound stripped from BlockItem
|
||||
+ if (this.item instanceof BlockItem) {
|
||||
+ if (this.item instanceof BlockItem && success.paperSuccessContext().placedBlockPosition() != null) {
|
||||
+ // Paper start - Fix spigot sound playing for BlockItem ItemStacks
|
||||
+ BlockPos pos = new net.minecraft.world.item.context.BlockPlaceContext(context).getClickedPos();
|
||||
+ net.minecraft.world.level.block.state.BlockState state = serverLevel.getBlockState(pos);
|
||||
+ net.minecraft.world.level.block.state.BlockState state = serverLevel.getBlockState(success.paperSuccessContext().placedBlockPosition());
|
||||
+ net.minecraft.world.level.block.SoundType soundType = state.getSoundType();
|
||||
+ // Paper end - Fix spigot sound playing for BlockItem ItemStacks
|
||||
+ serverLevel.playSound(player, clickedPos, soundType.getPlaceSound(), net.minecraft.sounds.SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
|
||||
|
||||
@ -1,17 +1,52 @@
|
||||
--- a/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java
|
||||
@@ -260,6 +_,11 @@
|
||||
@@ -260,7 +_,12 @@
|
||||
if (!list.isEmpty()) {
|
||||
player.awardStat(Stats.ITEM_USED.get(stack.getItem()));
|
||||
stack.consume(config.keyItem().getCount(), player);
|
||||
- unlock(level, state, pos, config, serverData, sharedData, list);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.block.BlockDispenseLootEvent vaultDispenseLootEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDispenseLootEvent(level, pos, player, list);
|
||||
+ if (vaultDispenseLootEvent.isCancelled()) return;
|
||||
+ list = vaultDispenseLootEvent.getDispensedLoot().stream().map(org.bukkit.craftbukkit.inventory.CraftItemStack::asNMSCopy).toList();
|
||||
+ // CraftBukkit end
|
||||
unlock(level, state, pos, config, serverData, sharedData, list);
|
||||
+ unlock(level, state, pos, config, serverData, sharedData, list, player); // Paper - Vault API
|
||||
serverData.addToRewardedPlayers(player);
|
||||
sharedData.updateConnectedPlayersWithinRange(level, pos, serverData, config, config.deactivationRange());
|
||||
}
|
||||
@@ -269,8 +_,30 @@
|
||||
}
|
||||
|
||||
static void setVaultState(ServerLevel level, BlockPos pos, BlockState oldState, BlockState newState, VaultConfig config, VaultSharedData sharedData) {
|
||||
- VaultState vaultState = oldState.getValue(VaultBlock.STATE);
|
||||
- VaultState vaultState1 = newState.getValue(VaultBlock.STATE);
|
||||
+ // Paper start - Vault API
|
||||
+ setVaultState(level, pos, oldState, newState, config,sharedData, null);
|
||||
+ }
|
||||
+
|
||||
+ static void setVaultState(ServerLevel level, BlockPos pos, BlockState oldState, BlockState newState, VaultConfig config, VaultSharedData sharedData, @Nullable Player associatedPlayer) {
|
||||
+ VaultState vaultState = oldState.getValue(VaultBlock.STATE); final VaultState oldVaultState = vaultState;
|
||||
+ VaultState vaultState1 = newState.getValue(VaultBlock.STATE); final VaultState newVaultState = vaultState1;
|
||||
+ org.bukkit.entity.Player apiAssociatedPlayer = null;
|
||||
+ if (associatedPlayer != null) {
|
||||
+ apiAssociatedPlayer = (org.bukkit.entity.Player) associatedPlayer.getBukkitEntity();
|
||||
+ } else if (newVaultState == VaultState.ACTIVE) {
|
||||
+ final Set<UUID> connectedPlayers = sharedData.getConnectedPlayers();
|
||||
+ if (!connectedPlayers.isEmpty()) { // Used over sharedData#hasConnectedPlayers to ensure belows iterator#next is always okay.
|
||||
+ apiAssociatedPlayer = level.getCraftServer().getPlayer(connectedPlayers.iterator().next());
|
||||
+ }
|
||||
+ }
|
||||
+ final io.papermc.paper.event.block.VaultChangeStateEvent event = new io.papermc.paper.event.block.VaultChangeStateEvent(
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(level, pos),
|
||||
+ apiAssociatedPlayer,
|
||||
+ org.bukkit.craftbukkit.block.data.CraftBlockData.toBukkit(oldVaultState, org.bukkit.block.data.type.Vault.State.class),
|
||||
+ org.bukkit.craftbukkit.block.data.CraftBlockData.toBukkit(newVaultState, org.bukkit.block.data.type.Vault.State.class)
|
||||
+ );
|
||||
+ if (!event.callEvent()) return;
|
||||
+ // Paper end - Vault API
|
||||
level.setBlock(pos, newState, 3);
|
||||
vaultState.onTransition(level, pos, vaultState1, config, sharedData, newState.getValue(VaultBlock.OMINOUS));
|
||||
}
|
||||
@@ -282,6 +_,11 @@
|
||||
ItemStack randomDisplayItemFromLootTable = getRandomDisplayItemFromLootTable(
|
||||
level, pos, config.overrideLootTableToDisplay().orElse(config.lootTable())
|
||||
@ -24,3 +59,29 @@
|
||||
sharedData.setDisplayItem(randomDisplayItemFromLootTable);
|
||||
}
|
||||
}
|
||||
@@ -304,10 +_,24 @@
|
||||
VaultSharedData sharedData,
|
||||
List<ItemStack> itemsToEject
|
||||
) {
|
||||
+ // Paper start - Vault API
|
||||
+ unlock(level, state, pos, config, serverData, sharedData, itemsToEject, null);
|
||||
+ }
|
||||
+ private static void unlock(
|
||||
+ ServerLevel level,
|
||||
+ BlockState state,
|
||||
+ BlockPos pos,
|
||||
+ VaultConfig config,
|
||||
+ VaultServerData serverData,
|
||||
+ VaultSharedData sharedData,
|
||||
+ List<ItemStack> itemsToEject,
|
||||
+ final @Nullable Player associatedPlayer
|
||||
+ ) {
|
||||
+ // Paper end - Vault API
|
||||
serverData.setItemsToEject(itemsToEject);
|
||||
sharedData.setDisplayItem(serverData.getNextItemToEject());
|
||||
serverData.pauseStateUpdatingUntil(level.getGameTime() + 14L);
|
||||
- setVaultState(level, pos, state, state.setValue(VaultBlock.STATE, VaultState.UNLOCKING), config, sharedData);
|
||||
+ setVaultState(level, pos, state, state.setValue(VaultBlock.STATE, VaultState.UNLOCKING), config, sharedData, associatedPlayer); // Paper - Vault API
|
||||
}
|
||||
|
||||
private static List<ItemStack> resolveItemsToEject(ServerLevel level, VaultConfig config, BlockPos pos, Player player, ItemStack key) {
|
||||
|
||||
@ -122,7 +122,7 @@
|
||||
}
|
||||
+ // CraftBukkit start - left and right
|
||||
+ blocks.setBlock(checkPos.set(pos).move(Direction.UP, i).move(direction, -1), level.getBlockState(checkPos), 18);
|
||||
+ blocks.setBlock(checkPos.set(pos).move(Direction.UP, i).move(direction, i), level.getBlockState(checkPos), 18);
|
||||
+ blocks.setBlock(checkPos.set(pos).move(Direction.UP, i).move(direction, width), level.getBlockState(checkPos), 18); // Paper - fix block list
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@ -50,21 +50,24 @@ import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.util.Unit;
|
||||
import net.minecraft.world.item.EitherHolder;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.item.component.InstrumentComponent;
|
||||
import net.minecraft.world.item.component.MapPostProcessing;
|
||||
import net.minecraft.world.item.component.ProvidesTrimMaterial;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.craftbukkit.CraftArt;
|
||||
import org.bukkit.craftbukkit.CraftMusicInstrument;
|
||||
import org.bukkit.craftbukkit.entity.CraftAxolotl;
|
||||
import org.bukkit.craftbukkit.CraftRegistry;
|
||||
import org.bukkit.craftbukkit.entity.CraftCat;
|
||||
import org.bukkit.craftbukkit.entity.CraftChicken;
|
||||
import org.bukkit.craftbukkit.entity.CraftCow;
|
||||
import org.bukkit.craftbukkit.entity.CraftFrog;
|
||||
import org.bukkit.craftbukkit.entity.CraftPainting;
|
||||
import org.bukkit.craftbukkit.entity.CraftPig;
|
||||
import org.bukkit.craftbukkit.entity.CraftVillager;
|
||||
import org.bukkit.craftbukkit.entity.CraftWolf;
|
||||
import org.bukkit.craftbukkit.inventory.CraftMetaFirework;
|
||||
import org.bukkit.craftbukkit.inventory.trim.CraftTrimMaterial;
|
||||
import org.bukkit.craftbukkit.util.Handleable;
|
||||
import org.bukkit.entity.Axolotl;
|
||||
import org.bukkit.entity.Horse;
|
||||
@ -139,9 +142,8 @@ public final class DataComponentAdapters {
|
||||
// entity data
|
||||
// bucket entity data
|
||||
// block entity data
|
||||
//register(DataComponents.INSTRUMENT, CraftMusicInstrument::minecraftHolderToBukkit, CraftMusicInstrument::bukkitToMinecraftHolder); // TODO
|
||||
registerIdentity(DataComponents.INSTRUMENT);
|
||||
registerIdentity(DataComponents.PROVIDES_TRIM_MATERIAL); // TODO
|
||||
register(DataComponents.INSTRUMENT, nms -> CraftMusicInstrument.minecraftHolderToBukkit(nms.instrument().unwrap(CraftRegistry.getMinecraftRegistry()).orElseThrow()), api -> new InstrumentComponent(CraftMusicInstrument.bukkitToMinecraftHolder(api)));
|
||||
register(DataComponents.PROVIDES_TRIM_MATERIAL, nms -> CraftTrimMaterial.minecraftHolderToBukkit(nms.material().unwrap(CraftRegistry.getMinecraftRegistry()).orElseThrow()), api -> new ProvidesTrimMaterial(CraftTrimMaterial.bukkitToMinecraftHolder(api)));
|
||||
register(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, PaperOminousBottleAmplifier::new);
|
||||
register(DataComponents.JUKEBOX_PLAYABLE, PaperJukeboxPlayable::new);
|
||||
register(DataComponents.PROVIDES_BANNER_PATTERNS, PaperRegistries::fromNms, PaperRegistries::toNms);
|
||||
@ -162,8 +164,7 @@ public final class DataComponentAdapters {
|
||||
// bees
|
||||
// register(DataComponents.LOCK, PaperLockCode::new);
|
||||
register(DataComponents.CONTAINER_LOOT, PaperSeededContainerLoot::new);
|
||||
register(DataComponents.BREAK_SOUND, nms -> PaperAdventure.asAdventureKey(nms.unwrapKey().get()), api -> BuiltInRegistries.SOUND_EVENT.getOrThrow(PaperAdventure.asVanilla(Registries.SOUND_EVENT, api)));
|
||||
// TODO break_sound, provides_, entity data
|
||||
register(DataComponents.BREAK_SOUND, nms -> PaperAdventure.asAdventure(nms.value().location()), PaperAdventure::resolveSound);
|
||||
register(DataComponents.TOOLTIP_DISPLAY, PaperTooltipDisplay::new);
|
||||
register(DataComponents.WEAPON, PaperWeapon::new);
|
||||
register(DataComponents.BLOCKS_ATTACKS, PaperBlocksAttacks::new);
|
||||
@ -173,22 +174,22 @@ public final class DataComponentAdapters {
|
||||
register(DataComponents.WOLF_COLLAR, nms -> DyeColor.getByWoolData((byte) nms.getId()), api -> net.minecraft.world.item.DyeColor.byId(api.getWoolData()));
|
||||
register(DataComponents.WOLF_SOUND_VARIANT, CraftWolf.CraftSoundVariant::minecraftHolderToBukkit, CraftWolf.CraftSoundVariant::bukkitToMinecraftHolder);
|
||||
register(DataComponents.FOX_VARIANT, nms -> org.bukkit.entity.Fox.Type.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.Fox.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.SALMON_SIZE, (nms) -> Salmon.Variant.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.Salmon.Variant.values()[api.ordinal()]);
|
||||
register(DataComponents.PARROT_VARIANT, (nms) -> Parrot.Variant.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.Parrot.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.TROPICAL_FISH_PATTERN, (nms) -> TropicalFish.Pattern.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.TropicalFish.Pattern.byId(api.ordinal()));
|
||||
register(DataComponents.SALMON_SIZE, nms -> Salmon.Variant.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.Salmon.Variant.values()[api.ordinal()]);
|
||||
register(DataComponents.PARROT_VARIANT, nms -> Parrot.Variant.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.Parrot.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.TROPICAL_FISH_PATTERN, nms -> TropicalFish.Pattern.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.TropicalFish.Pattern.values()[api.ordinal()]);
|
||||
register(DataComponents.TROPICAL_FISH_BASE_COLOR, nms -> DyeColor.getByWoolData((byte) nms.getId()), api -> net.minecraft.world.item.DyeColor.byId(api.getWoolData()));
|
||||
register(DataComponents.TROPICAL_FISH_PATTERN_COLOR, nms -> DyeColor.getByWoolData((byte) nms.getId()), api -> net.minecraft.world.item.DyeColor.byId(api.getWoolData()));
|
||||
register(DataComponents.MOOSHROOM_VARIANT, (nms) -> MushroomCow.Variant.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.MushroomCow.Variant.values()[api.ordinal()]);
|
||||
register(DataComponents.RABBIT_VARIANT, (nms) -> Rabbit.Type.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.Rabbit.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.MOOSHROOM_VARIANT, nms -> MushroomCow.Variant.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.MushroomCow.Variant.values()[api.ordinal()]);
|
||||
register(DataComponents.RABBIT_VARIANT, nms -> Rabbit.Type.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.Rabbit.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.PIG_VARIANT, CraftPig.CraftVariant::minecraftHolderToBukkit, CraftPig.CraftVariant::bukkitToMinecraftHolder);
|
||||
register(DataComponents.COW_VARIANT, CraftCow.CraftVariant::minecraftHolderToBukkit, CraftCow.CraftVariant::bukkitToMinecraftHolder);
|
||||
// TODO: We should probably find a cleaner pattern for handling this which retains the EitherHolder, this does kinda suck in terms of exposure, however
|
||||
register(DataComponents.CHICKEN_VARIANT, CraftChicken.CraftVariant::minecraftEitherHolderToBukkit, CraftChicken.CraftVariant::bukkitToMinecraftEitherHolder);
|
||||
// TODO: We should probably find a better pattern for handling this which retains the EitherHolder, this does kinda suck in terms of exposure, however
|
||||
register(DataComponents.CHICKEN_VARIANT, nms -> CraftChicken.CraftVariant.minecraftHolderToBukkit(nms.unwrap(CraftRegistry.getMinecraftRegistry()).orElseThrow()), api -> new EitherHolder<>(CraftChicken.CraftVariant.bukkitToMinecraftHolder(api)));
|
||||
register(DataComponents.FROG_VARIANT, CraftFrog.CraftVariant::minecraftHolderToBukkit, CraftFrog.CraftVariant::bukkitToMinecraftHolder);
|
||||
register(DataComponents.HORSE_VARIANT, (nms) -> Horse.Style.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.horse.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.HORSE_VARIANT, nms -> Horse.Color.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.horse.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.PAINTING_VARIANT, CraftArt::minecraftHolderToBukkit, CraftArt::bukkitToMinecraftHolder);
|
||||
register(DataComponents.LLAMA_VARIANT, (nms) -> Llama.Color.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.horse.Llama.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.AXOLOTL_VARIANT, (nms) -> Axolotl.Variant.values()[nms.ordinal()], (api) -> net.minecraft.world.entity.animal.axolotl.Axolotl.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.LLAMA_VARIANT, nms -> Llama.Color.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.horse.Llama.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.AXOLOTL_VARIANT, nms -> Axolotl.Variant.values()[nms.ordinal()], api -> net.minecraft.world.entity.animal.axolotl.Axolotl.Variant.byId(api.ordinal()));
|
||||
register(DataComponents.CAT_VARIANT, CraftCat.CraftType::minecraftHolderToBukkit, CraftCat.CraftType::bukkitToMinecraftHolder);
|
||||
register(DataComponents.CAT_COLLAR, nms -> DyeColor.getByWoolData((byte) nms.getId()), api -> net.minecraft.world.item.DyeColor.byId(api.getWoolData()));
|
||||
register(DataComponents.SHEEP_COLOR, nms -> DyeColor.getByWoolData((byte) nms.getId()), api -> net.minecraft.world.item.DyeColor.byId(api.getWoolData()));
|
||||
|
||||
@ -49,6 +49,11 @@ public final class DelayedRegistry<T extends Keyed, R extends Registry<T>> imple
|
||||
return this.delegate().stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<NamespacedKey> keyStream() {
|
||||
return this.delegate().keyStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.delegate().size();
|
||||
|
||||
@ -233,6 +233,12 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
|
||||
return this.minecraftRegistry.keySet().stream().map(minecraftKey -> this.get(CraftNamespacedKey.fromMinecraft(minecraftKey)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Stream<NamespacedKey> keyStream() {
|
||||
return this.minecraftRegistry.keySet().stream().map(CraftNamespacedKey::fromMinecraft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.minecraftRegistry.size();
|
||||
|
||||
@ -40,6 +40,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.imageio.ImageIO;
|
||||
import net.minecraft.Optionull;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
@ -1943,12 +1944,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public CraftMapView getMap(int id) {
|
||||
MapItemSavedData mapData = this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD).getMapData(new MapId(id));
|
||||
if (mapData == null) {
|
||||
return null;
|
||||
}
|
||||
final net.minecraft.world.level.Level overworld = this.console.overworld();
|
||||
if (overworld == null) return null;
|
||||
|
||||
final MapItemSavedData mapData = overworld.getMapData(new MapId(id));
|
||||
if (mapData == null) return null;
|
||||
|
||||
return mapData.mapView;
|
||||
}
|
||||
|
||||
@ -2261,7 +2263,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public GameMode getDefaultGameMode() {
|
||||
return GameMode.getByValue(this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD).serverLevelData.getGameType().getId());
|
||||
return GameMode.getByValue(Optionull.mapOrDefault(
|
||||
this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD),
|
||||
l -> l.serverLevelData.getGameType(),
|
||||
this.console.getProperties().gamemode
|
||||
).getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -697,6 +697,11 @@ public class CraftBlock implements Block {
|
||||
return this.getNMS().getBlock().getDescriptionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuffocating() {
|
||||
return this.getNMS().isSuffocating(this.world, this.position);
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() {
|
||||
|
||||
@ -75,6 +75,7 @@ public class CraftBlockState implements BlockState {
|
||||
|
||||
// Returns null if weakWorld is not available and the BlockState is not placed.
|
||||
// If this returns a World instead of only a GeneratorAccess, this implies that this BlockState is placed.
|
||||
@Nullable
|
||||
public LevelAccessor getWorldHandle() {
|
||||
if (this.weakWorld == null) {
|
||||
return this.isPlaced() ? this.world.getHandle() : null;
|
||||
@ -177,7 +178,7 @@ public class CraftBlockState implements BlockState {
|
||||
|
||||
@Override
|
||||
public Material getType() {
|
||||
return this.data.getBukkitMaterial(); // Paper - optimise getType calls
|
||||
return this.data.getBukkitMaterial();
|
||||
}
|
||||
|
||||
public void setFlags(int flags) {
|
||||
@ -357,7 +358,6 @@ public class CraftBlockState implements BlockState {
|
||||
return new CraftBlockState(this, location);
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public boolean isCollidable() {
|
||||
return this.data.getBlock().hasCollision;
|
||||
@ -381,5 +381,10 @@ public class CraftBlockState implements BlockState {
|
||||
return java.util.Collections.emptyList();
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
public boolean isSuffocating() {
|
||||
this.requirePlaced();
|
||||
return this.data.isSuffocating(this.getWorldHandle(), this.position);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ public class CraftBlockData implements BlockData {
|
||||
* @throws IllegalStateException if the Enum could not be converted
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <B extends Enum<B>> B toBukkit(Enum<?> nms, Class<B> bukkit) {
|
||||
public static <B extends Enum<B>> B toBukkit(Enum<?> nms, Class<B> bukkit) {
|
||||
if (nms instanceof Direction) {
|
||||
return (B) CraftBlock.notchToBlockFace((Direction) nms);
|
||||
}
|
||||
|
||||
@ -1,19 +1,14 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import io.papermc.paper.adventure.PaperAdventure;
|
||||
import io.papermc.paper.registry.HolderableBase;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.entity.animal.ChickenVariant;
|
||||
import net.minecraft.world.item.EitherHolder;
|
||||
import org.bukkit.craftbukkit.CraftRegistry;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import java.util.Optional;
|
||||
|
||||
@NullMarked
|
||||
public class CraftChicken extends CraftAnimals implements Chicken {
|
||||
@ -54,26 +49,6 @@ public class CraftChicken extends CraftAnimals implements Chicken {
|
||||
return CraftRegistry.minecraftHolderToBukkit(minecraft, Registries.CHICKEN_VARIANT);
|
||||
}
|
||||
|
||||
public static Variant minecraftEitherHolderToBukkit(EitherHolder<ChickenVariant> minecraft) {
|
||||
final Optional<Holder<ChickenVariant>> left = minecraft.contents().left();
|
||||
if (left.isPresent()) {
|
||||
return CraftRegistry.minecraftHolderToBukkit(left.get(), Registries.CHICKEN_VARIANT);
|
||||
}
|
||||
final Optional<ResourceKey<ChickenVariant>> right = minecraft.contents().right();
|
||||
if (right.isPresent()) {
|
||||
final Holder.Reference<ChickenVariant> orThrow = CraftRegistry.getMinecraftRegistry(right.get().registryKey()).getOrThrow(right.get());
|
||||
return minecraftToBukkit(orThrow.value());
|
||||
}
|
||||
throw new IllegalStateException("Cannot map entry for " + minecraft);
|
||||
}
|
||||
|
||||
public static EitherHolder<ChickenVariant> bukkitToMinecraftEitherHolder(Variant variant) {
|
||||
final Registry<ChickenVariant> chickenVariantRegistry = CraftRegistry.getMinecraftRegistry(Registries.CHICKEN_VARIANT);
|
||||
final Optional<Holder.Reference<ChickenVariant>> chickenVariantReference = chickenVariantRegistry.get(PaperAdventure.asVanilla(variant.key()));
|
||||
return chickenVariantReference.map(EitherHolder::new).orElseGet(() -> new EitherHolder<>(PaperAdventure.asVanilla(chickenVariantRegistry.key(), variant.key())));
|
||||
|
||||
}
|
||||
|
||||
public static ChickenVariant bukkitToMinecraft(Variant bukkit) {
|
||||
return CraftRegistry.bukkitToMinecraft(bukkit);
|
||||
}
|
||||
|
||||
@ -2,10 +2,16 @@ package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.FishingHook;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.bukkit.craftbukkit.CraftEquipmentSlot;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
public class CraftFishHook extends CraftProjectile implements FishHook {
|
||||
private double biteChance = -1;
|
||||
@ -233,4 +239,18 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
|
||||
hook.resetTimeUntilLured();
|
||||
hook.timeUntilHooked = 0; // Reset time until hooked, will be repopulated once lured time is ticked down.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int retrieve(EquipmentSlot slot) {
|
||||
Preconditions.checkArgument(slot == EquipmentSlot.HAND || slot == EquipmentSlot.OFF_HAND, "Equipment slot must be HAND or OFF_HAND");
|
||||
final FishingHook fishingHook = getHandle();
|
||||
final Player playerOwner = fishingHook.getPlayerOwner();
|
||||
Preconditions.checkState(playerOwner != null, "Player owner cannot be null");
|
||||
|
||||
final InteractionHand hand = CraftEquipmentSlot.getHand(slot);
|
||||
final ItemStack itemInHand = playerOwner.getItemInHand(hand);
|
||||
Preconditions.checkState(itemInHand.is(Items.FISHING_ROD), "Item in slot is not a FISHING_ROD");
|
||||
|
||||
return fishingHook.retrieve(itemInHand, hand);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public final class CraftJukeboxComponent implements JukeboxPlayableComponent {
|
||||
@Override
|
||||
public JukeboxSong getSong() {
|
||||
Optional<Holder<net.minecraft.world.item.JukeboxSong>> song = this.handle.song().unwrap(CraftRegistry.getMinecraftRegistry());
|
||||
return (song.isPresent()) ? CraftJukeboxSong.minecraftHolderToBukkit(song.get()) : null;
|
||||
return song.map(CraftJukeboxSong::minecraftHolderToBukkit).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
# If you need help with the configuration or have any questions related to Paper,
|
||||
# join us in our Discord or check the docs page.
|
||||
#
|
||||
# File Reference: https://docs.papermc.io/paper/reference/bukkit-help-configuration/
|
||||
# Docs: https://docs.papermc.io/
|
||||
# Discord: https://discord.gg/papermc
|
||||
# Website: https://papermc.io/
|
||||
|
||||
@ -4,8 +4,8 @@ build:
|
||||
- "JAVA_HOME=/usr/lib/jvm/openjdk-21 ./gradlew --stop"
|
||||
|
||||
artifacts:
|
||||
"/binarys/paper-1.21.4.jar": "paper-server/build/libs/paper-bundler-1.21.4-R0.1-SNAPSHOT-mojmap.jar"
|
||||
"/binarys/spigot-1.21.4-inner.jar": "paper-server/build/libs/paper-server-1.21.4-R0.1-SNAPSHOT.jar"
|
||||
"/jars/paper-1.21.5.jar": "paper-server/build/libs/paper-bundler-1.21.5-R0.1-SNAPSHOT-mojmap.jar"
|
||||
"/jars/spigot-1.21.5-inner.jar": "paper-server/build/libs/paper-server-1.21.5-R0.1-SNAPSHOT.jar"
|
||||
|
||||
release:
|
||||
- "mvn deploy:deploy-file -DgroupId=de.steamwar -DartifactId=spigot -Dversion=1.21.4 -Dpackaging=jar -Dfile=paper-server/build/libs/paper-server-1.21.4-R0.1-SNAPSHOT.jar -Durl=file:///var/www/maven/"
|
||||
- "mvn deploy:deploy-file -DgroupId=de.steamwar -DartifactId=spigot -Dversion=1.21.5 -Dpackaging=jar -Dfile=paper-server/build/libs/paper-server-1.21.5-R0.1-SNAPSHOT.jar -Durl=file:///var/www/maven/"
|
||||
|
||||
Reference in New Issue
Block a user