geforkt von Mirrors/Paper
Patches!
Dieser Commit ist enthalten in:
Ursprung
c844ac9d01
Commit
717c16dc69
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockEntity {
|
||||
|
||||
// CraftBukkit start - read container
|
||||
public void load(CompoundTag nbt) {
|
||||
protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
|
||||
- this.persistentDataContainer = new CraftPersistentDataContainer(BlockEntity.DATA_TYPE_REGISTRY);
|
||||
+ this.persistentDataContainer.clear(); // Paper - clear instead of init
|
||||
|
||||
@ -100,10 +100,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
protected CraftBlockEntityState(CraftBlockEntityState<T> state) {
|
||||
protected CraftBlockEntityState(CraftBlockEntityState<T> state, Location location) {
|
||||
@@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat
|
||||
public CraftBlockEntityState<T> copy() {
|
||||
return new CraftBlockEntityState<>(this);
|
||||
public CraftBlockEntityState<T> copy(Location location) {
|
||||
return new CraftBlockEntityState<>(this, location);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
@ -147,7 +147,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public static BlockState getBlockState(Material material, @Nullable CompoundTag blockEntityTag) {
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end - Add EntityZapEvent
|
||||
+
|
||||
entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null);
|
||||
entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null);
|
||||
entitywitch.setNoAi(this.isNoAi());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
ItemStack itemstack2 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
if (this.equipmentHasChanged(itemstack, itemstack1)) {
|
||||
if (this.equipmentHasChanged(itemstack1, itemstack2)) {
|
||||
+ // Paper start - PlayerArmorChangeEvent
|
||||
+ if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) {
|
||||
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack2);
|
||||
+ new com.destroystokyo.paper.event.player.PlayerArmorChangeEvent((Player) this.getBukkitEntity(), com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
|
||||
+ }
|
||||
+ // Paper end - PlayerArmorChangeEvent
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
boolean flag = d7 > 0.0D;
|
||||
boolean flag1 = d7 > 0.0D;
|
||||
|
||||
if (this.player.onGround() && !packet.isOnGround() && flag) {
|
||||
if (this.player.onGround() && !packet.isOnGround() && flag1) {
|
||||
- this.player.jumpFromGround();
|
||||
+ // Paper start - Add PlayerJumpEvent
|
||||
+ Player player = this.getCraftPlayer();
|
||||
@ -43,4 +43,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end - Add PlayerJumpEvent
|
||||
}
|
||||
|
||||
boolean flag1 = this.player.verticalCollisionBelow;
|
||||
boolean flag2 = this.player.verticalCollisionBelow;
|
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||
return "/" + s;
|
||||
});
|
||||
- ContextChain contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
|
||||
- ContextChain<CommandSourceStack> contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
|
||||
+ ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent
|
||||
|
||||
try {
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ if (!world.paperConfig().environment.frostedIce.enabled) return; // Paper - Frosted ice options
|
||||
if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4))
|
||||
&& world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos)
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
double d0 = DimensionType.getTeleportationScale(this.level().dimensionType(), destination.dimensionType());
|
||||
BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
|
||||
// CraftBukkit start
|
@ -53,18 +53,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||
@@ -0,0 +0,0 @@ public class OldUsersConverter {
|
||||
try {
|
||||
root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap());
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
|
||||
- io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
|
||||
+ // Paper start
|
||||
+ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception);
|
||||
+ exception.printStackTrace();
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
if (root != null) {
|
||||
@@ -0,0 +0,0 @@ public class OldUsersConverter {
|
||||
try {
|
||||
NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
|
||||
- io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
|
||||
+ // Paper start
|
||||
+ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception);
|
||||
+ exception.printStackTrace();
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception);
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -73,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
@@ -0,0 +0,0 @@ public class VillageSiege implements CustomSpawner {
|
||||
entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null, (CompoundTag) null);
|
||||
entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null);
|
||||
} catch (Exception exception) {
|
||||
VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception);
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
|
@ -0,0 +1,56 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
Date: Wed, 13 Apr 2016 20:21:38 -0700
|
||||
Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
handshaking logic themselves
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
this.connection.disconnect(ichatmutablecomponent);
|
||||
} else {
|
||||
this.connection.setupInboundProtocol(LoginProtocols.SERVERBOUND, new ServerLoginPacketListenerImpl(this.server, this.connection, transfer));
|
||||
+ // Paper start - PlayerHandshakeEvent
|
||||
+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee;
|
||||
+ boolean handledByEvent = false;
|
||||
+ // Try and handle the handshake through the event
|
||||
+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me?
|
||||
+ java.net.SocketAddress socketAddress = this.connection.address;
|
||||
+ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress();
|
||||
+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packet.hostName(), hostnameOfRemote, !proxyLogicEnabled);
|
||||
+ if (event.callEvent()) {
|
||||
+ // If we've failed somehow, let the client know so and go no further.
|
||||
+ if (event.isFailed()) {
|
||||
+ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage());
|
||||
+ this.connection.send(new ClientboundLoginDisconnectPacket(component));
|
||||
+ this.connection.disconnect(component);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getServerHostname() != null) {
|
||||
+ // change hostname
|
||||
+ packet = new ClientIntentionPacket(
|
||||
+ packet.protocolVersion(),
|
||||
+ event.getServerHostname(),
|
||||
+ packet.port(),
|
||||
+ packet.intention()
|
||||
+ );
|
||||
+ }
|
||||
+ if (event.getSocketAddressHostname() != null) this.connection.address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
|
||||
+ this.connection.spoofedUUID = event.getUniqueId();
|
||||
+ this.connection.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
||||
+ handledByEvent = true; // Hooray, we did it!
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
// Spigot Start
|
||||
String[] split = packet.hostName().split("\00");
|
||||
- if (org.spigotmc.SpigotConfig.bungee) {
|
||||
+ if (!handledByEvent && proxyLogicEnabled) { // Paper
|
||||
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||||
this.connection.hostname = split[0];
|
||||
this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
return optional;
|
||||
@@ -0,0 +0,0 @@ public class GameProfileCache {
|
||||
return arraylist;
|
||||
return list;
|
||||
}
|
||||
|
||||
- public void save() {
|
@ -634,8 +634,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
ConfigurationSerialization.registerClass(CraftPlayerProfile.class);
|
||||
+ ConfigurationSerialization.registerClass(com.destroystokyo.paper.profile.CraftPlayerProfile.class); // Paper
|
||||
CraftItemFactory.instance();
|
||||
CraftEntityFactory.instance();
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
public boolean suggestPlayerNamesWhenNullTabCompletions() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
|
@ -9,15 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
|
||||
// CraftBukkit end
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
+ private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads
|
||||
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
|
||||
private static final Component DISCONNECT_UNEXPECTED_QUERY = Component.translatable("multiplayer.disconnect.unexpected_query_response");
|
||||
private final byte[] challenge;
|
||||
final MinecraftServer server;
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge));
|
||||
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true));
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
- Thread thread = new Thread("User Authenticator #" + ServerLoginPacketListenerImpl.UNIQUE_THREAD_ID.incrementAndGet()) {
|
@ -15,7 +15,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
@@ -0,0 +0,0 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
|
||||
buf.writeComponent(this.displayName);
|
||||
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.displayName);
|
||||
buf.writeByte(this.options);
|
||||
buf.writeUtf(this.nametagVisibility);
|
||||
- buf.writeUtf(this.collisionRule);
|
||||
+ buf.writeUtf(!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions ? "never" : this.collisionRule); // Paper - Configurable player collision
|
||||
buf.writeEnum(this.color);
|
||||
buf.writeComponent(this.playerPrefix);
|
||||
buf.writeComponent(this.playerSuffix);
|
||||
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.playerPrefix);
|
||||
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.playerSuffix);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||
this.connection.acceptConnections();
|
||||
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
|
||||
public final WorldOptions worldOptions;
|
||||
public boolean acceptsTransfers;
|
||||
|
||||
+ public final String rconIp; // Paper - Configurable rcon ip
|
||||
+
|
@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
private RemoteChatSession chatSession;
|
||||
public final Object object;
|
||||
private int containerCounter;
|
||||
public boolean wonGame;
|
||||
+ private int containerUpdateDelay; // Paper - Configurable container update tick rate
|
||||
|
||||
// CraftBukkit start
|
||||
public String displayName;
|
||||
public CraftPlayer.TransferCookieConnection transferCookieConnection;
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
--this.invulnerableTime;
|
||||
}
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
|
||||
if (++this.aboveGroundTickCount > 80) {
|
||||
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
|
||||
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
|
||||
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message
|
||||
@ -18,8 +18,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
|
||||
if (++this.aboveGroundVehicleTickCount > 80) {
|
||||
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
|
||||
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
|
||||
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
|
||||
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -0,0 +0,0 @@ public class FarmBlock extends Block {
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
int i = (Integer) state.getValue(FarmBlock.MOISTURE);
|
||||
+ if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||
+ if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||
@ -25,19 +25,11 @@ diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlo
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
@@ -0,0 +0,0 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||
if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
@ -14,7 +14,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
@Nullable
|
||||
public PlayerTeam getTeam() {
|
||||
@ -27,10 +27,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (nbt.contains("Team", 8)) {
|
||||
String s = nbt.getString("Team");
|
||||
PlayerTeam scoreboardteam = this.level().getScoreboard().getPlayerTeam(s);
|
||||
Scoreboard scoreboard = this.level().getScoreboard();
|
||||
PlayerTeam scoreboardteam = scoreboard.getPlayerTeam(s);
|
||||
+ if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper - Perf: Disable Scoreboards for non players by default
|
||||
boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||
boolean flag = scoreboardteam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||
|
||||
if (!flag) {
|
24
patches/server/Do-not-load-chunks-for-Pathfinding.patch
Normale Datei
24
patches/server/Do-not-load-chunks-for-Pathfinding.patch
Normale Datei
@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 31 Mar 2016 19:17:58 -0400
|
||||
Subject: [PATCH] Do not load chunks for Pathfinding
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
@@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
}
|
||||
|
||||
protected static PathType getPathTypeFromState(BlockGetter world, BlockPos pos) {
|
||||
- BlockState blockState = world.getBlockState(pos);
|
||||
+ // Paper start - Do not load chunks during pathfinding
|
||||
+ BlockState blockState = world.getBlockStateIfLoaded(pos);
|
||||
+ if (blockState == null) {
|
||||
+ return BlockPathTypes.BLOCKED;
|
||||
+ }
|
||||
+ // Paper end
|
||||
Block block = blockState.getBlock();
|
||||
if (blockState.isAir()) {
|
||||
return PathType.OPEN;
|
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ });
|
||||
+ // Paper end - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||
private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss", Locale.ROOT);
|
||||
private static final int LINEAR_LOOKUP_THRESHOLD = 8;
|
||||
public static final int LINEAR_LOOKUP_THRESHOLD = 8;
|
||||
public static final long NANOS_PER_MILLI = 1000000L;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -54,14 +54,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
} else {
|
||||
return Optional.empty();
|
||||
ProfileResult profileResult = apiServices.sessionService().fetchProfile(uuid, true);
|
||||
return Optional.ofNullable(profileResult).map(ProfileResult::profile);
|
||||
}
|
||||
- }, Util.backgroundExecutor());
|
||||
+ }, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||
}
|
||||
|
||||
@Override
|
||||
public static void clear() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
@ -15,4 +15,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper - Don't save empty scoreboard teams to scoreboard.dat
|
||||
CompoundTag compoundTag = new CompoundTag();
|
||||
compoundTag.putString("Name", playerTeam.getName());
|
||||
compoundTag.putString("DisplayName", Component.Serializer.toJson(playerTeam.getDisplayName()));
|
||||
compoundTag.putString("DisplayName", Component.Serializer.toJson(playerTeam.getDisplayName(), registries));
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
protected int numCollisions = 0; // Paper - Cap entity collisions
|
||||
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// Paper start - Entity origin API
|
||||
@javax.annotation.Nullable
|
||||
private org.bukkit.util.Vector origin;
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
|
||||
}
|
||||
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// Paper end
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.originWorld = originWorld;
|
||||
origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
|
||||
}
|
@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
throw new UnsupportedOperationException("Invalid intention " + packet.intention());
|
||||
// Spigot End
|
||||
}
|
||||
|
||||
+ // Paper start - NetworkClient implementation
|
||||
@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
this.getHandle().transferCookieConnection.send(new ClientboundTransferPacket(host, port));
|
||||
}
|
||||
|
||||
+ // Paper start - Implement NetworkClient
|
@ -32,9 +32,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public static final int RESTART_DELAY = 160;
|
||||
@@ -0,0 +0,0 @@ public class RedstoneTorchBlock extends BaseTorchBlock {
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
boolean flag = this.hasNeighborSignal(world, pos, state);
|
||||
- List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world);
|
||||
- List<RedstoneTorchBlock.Toggle> list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world);
|
||||
-
|
||||
- while (list != null && !list.isEmpty() && world.getGameTime() - ((RedstoneTorchBlock.Toggle) list.get(0)).when > 60L) {
|
||||
- list.remove(0);
|
@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -0,0 +0,0 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
||||
}
|
||||
|
||||
nbt.putInt("LifeTime", this.lifetime);
|
||||
nbt.put("FireworksItem", this.getItem().save(this.registryAccess()));
|
||||
nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE));
|
||||
+ // Paper start
|
||||
+ if (this.spawningEntity != null) {
|
||||
@ -42,24 +42,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
||||
private List<FireworkExplosion> getExplosions() {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
|
||||
if (flag1) {
|
||||
object = new FireworkRocketEntity(world, projectile, shooter, shooter.getX(), shooter.getEyeY() - 0.15000000596046448D, shooter.getZ(), true);
|
||||
+ ((FireworkRocketEntity) object).spawningEntity = shooter.getUUID(); // Paper
|
||||
} else {
|
||||
object = CrossbowItem.getArrow(world, shooter, crossbow, projectile);
|
||||
if (creative || simulated != 0.0F) {
|
||||
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
@Override
|
||||
protected Projectile createProjectile(Level world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) {
|
||||
if (projectileStack.is(Items.FIREWORK_ROCKET)) {
|
||||
- return new FireworkRocketEntity(world, projectileStack, shooter, shooter.getX(), shooter.getEyeY() - 0.15F, shooter.getZ(), true);
|
||||
+ // Paper start
|
||||
+ FireworkRocketEntity entity = new FireworkRocketEntity(world, projectileStack, shooter, shooter.getX(), shooter.getEyeY() - 0.15F, shooter.getZ(), true);
|
||||
+ entity.spawningEntity = shooter.getUUID(); // Paper
|
||||
+ return entity;
|
||||
+ // Paper end
|
||||
} else {
|
||||
Projectile projectile = super.createProjectile(world, shooter, weaponStack, projectileStack, critical);
|
||||
if (projectile instanceof AbstractArrow abstractArrow) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item {
|
||||
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
|
||||
vec3.z + (double)direction.getStepZ() * 0.15,
|
||||
itemStack
|
||||
);
|
||||
@ -67,14 +72,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
level.addFreshEntity(fireworkRocketEntity);
|
||||
itemStack.shrink(1);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item {
|
||||
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
|
||||
ItemStack itemStack = user.getItemInHand(hand);
|
||||
if (!world.isClientSide) {
|
||||
FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user);
|
||||
+ fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper
|
||||
world.addFreshEntity(fireworkRocketEntity);
|
||||
if (!user.getAbilities().instabuild) {
|
||||
itemStack.shrink(1);
|
||||
itemStack.consume(1, user);
|
||||
user.awardStat(Stats.ITEM_USED.get(this));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
Calendar deadline = Calendar.getInstance();
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -28);
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -3);
|
||||
if (buildDate.before(deadline.getTime())) {
|
||||
- System.err.println("*** Error, this build is outdated ***");
|
||||
+ // Paper start - This is some stupid bullshit
|
@ -17,58 +17,64 @@ was added, resulting in 2 different ways to modify an items enchantments.
|
||||
For consistency, the old API methods now forward to use the
|
||||
ItemMeta API equivalents, and should deprecate the old API's.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java b/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
return this.getItem().getTooltipImage(this);
|
||||
}
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.component.TooltipProvider;
|
||||
+// Paper start
|
||||
+import it.unimi.dsi.fastutil.objects.Object2IntAVLTreeMap;
|
||||
+// Paper end
|
||||
|
||||
public class ItemEnchantments implements TooltipProvider {
|
||||
- public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntOpenHashMap<>(), true);
|
||||
+ // Paper start
|
||||
+ private static final java.util.Comparator<? super CompoundTag> enchantSorter = java.util.Comparator.comparing(o -> o.getString("id"));
|
||||
+ private void processEnchantOrder(@Nullable CompoundTag tag) {
|
||||
+ if (tag == null || !tag.contains("Enchantments", net.minecraft.nbt.Tag.TAG_LIST)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ ListTag list = tag.getList("Enchantments", net.minecraft.nbt.Tag.TAG_COMPOUND);
|
||||
+ if (list.size() < 2) {
|
||||
+ return;
|
||||
+ }
|
||||
+ try {
|
||||
+ //noinspection unchecked
|
||||
+ list.sort((java.util.Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
|
||||
+ } catch (Exception ignored) {}
|
||||
+ }
|
||||
+ private static final java.util.Comparator<Holder<Enchantment>> ENCHANTMENT_ORDER = java.util.Comparator.comparing(Holder::getRegisteredName);
|
||||
+ public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), true);
|
||||
+ // Paper end
|
||||
+
|
||||
public ItemStack(ItemLike item) {
|
||||
this(item, 1);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
this.count = nbttagcompound.getByte("Count");
|
||||
if (nbttagcompound.contains("tag", 10)) {
|
||||
this.tag = nbttagcompound.getCompound("tag").copy();
|
||||
+ this.processEnchantOrder(this.tag); // Paper
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
}
|
||||
public static final int MAX_LEVEL = 255;
|
||||
private static final Codec<Integer> LEVEL_CODEC = Codec.intRange(0, 255);
|
||||
- private static final Codec<Object2IntOpenHashMap<Holder<Enchantment>>> LEVELS_CODEC = Codec.unboundedMap(
|
||||
+ private static final Codec<Object2IntAVLTreeMap<Holder<Enchantment>>> LEVELS_CODEC = Codec.unboundedMap( // Paper
|
||||
BuiltInRegistries.ENCHANTMENT.holderByNameCodec(), LEVEL_CODEC
|
||||
)
|
||||
- .xmap(Object2IntOpenHashMap::new, Function.identity());
|
||||
+ .xmap(Object2IntAVLTreeMap::new, Function.identity()); // Paper
|
||||
private static final Codec<ItemEnchantments> FULL_CODEC = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
LEVELS_CODEC.fieldOf("levels").forGetter(component -> component.enchantments),
|
||||
@@ -0,0 +0,0 @@ public class ItemEnchantments implements TooltipProvider {
|
||||
);
|
||||
public static final Codec<ItemEnchantments> CODEC = Codec.withAlternative(FULL_CODEC, LEVELS_CODEC, map -> new ItemEnchantments(map, true));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, ItemEnchantments> STREAM_CODEC = StreamCodec.composite(
|
||||
- ByteBufCodecs.map(Object2IntOpenHashMap::new, ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT),
|
||||
+ ByteBufCodecs.map((v) -> new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT), // Paper
|
||||
component -> component.enchantments,
|
||||
ByteBufCodecs.BOOL,
|
||||
component -> component.showInTooltip,
|
||||
ItemEnchantments::new
|
||||
);
|
||||
- final Object2IntOpenHashMap<Holder<Enchantment>> enchantments;
|
||||
+ final Object2IntAVLTreeMap<Holder<Enchantment>> enchantments; // Paper
|
||||
public final boolean showInTooltip;
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
- ItemEnchantments(Object2IntOpenHashMap<Holder<Enchantment>> enchantments, boolean showInTooltip) {
|
||||
+ ItemEnchantments(Object2IntAVLTreeMap<Holder<Enchantment>> enchantments, boolean showInTooltip) { // Paper
|
||||
this.enchantments = enchantments;
|
||||
this.showInTooltip = showInTooltip;
|
||||
|
||||
public void setTag(@Nullable CompoundTag nbt) {
|
||||
this.tag = nbt;
|
||||
+ this.processEnchantOrder(this.tag); // Paper
|
||||
if (this.getItem().canBeDepleted()) {
|
||||
this.setDamageValue(this.getDamageValue());
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
ListTag nbttaglist = this.tag.getList("Enchantments", 10);
|
||||
|
||||
nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level));
|
||||
+ processEnchantOrder(this.tag); // Paper
|
||||
@@ -0,0 +0,0 @@ public class ItemEnchantments implements TooltipProvider {
|
||||
}
|
||||
|
||||
public boolean isEnchanted() {
|
||||
public static class Mutable {
|
||||
- private final Object2IntOpenHashMap<Holder<Enchantment>> enchantments = new Object2IntOpenHashMap<>();
|
||||
+ private final Object2IntAVLTreeMap<Holder<Enchantment>> enchantments = new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER); // Paper
|
||||
public boolean showInTooltip;
|
||||
|
||||
public Mutable(ItemEnchantments enchantmentsComponent) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@ -80,25 +86,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- if (!CraftItemStack.makeTag(this.handle)) {
|
||||
- return;
|
||||
- }
|
||||
- ListTag list = CraftItemStack.getEnchantmentList(this.handle);
|
||||
- ItemEnchantments list = CraftItemStack.getEnchantmentList(this.handle);
|
||||
- if (list == null) {
|
||||
- list = new ListTag();
|
||||
- this.handle.getTag().put(ENCHANTMENTS.NBT, list);
|
||||
- list = ItemEnchantments.EMPTY;
|
||||
- }
|
||||
- int size = list.size();
|
||||
-
|
||||
- for (int i = 0; i < size; i++) {
|
||||
- CompoundTag tag = (CompoundTag) list.get(i);
|
||||
- String id = tag.getString(ENCHANTMENTS_ID.NBT);
|
||||
- if (ench.getKey().equals(NamespacedKey.fromString(id))) {
|
||||
- tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level);
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- CompoundTag tag = new CompoundTag();
|
||||
- tag.putString(ENCHANTMENTS_ID.NBT, ench.getKey().toString());
|
||||
- tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level);
|
||||
- list.add(tag);
|
||||
- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list);
|
||||
- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), level);
|
||||
- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable());
|
||||
+ // Paper start - Replace whole method
|
||||
+ final ItemMeta itemMeta = this.getItemMeta();
|
||||
+ itemMeta.addEnchant(ench, level, true);
|
||||
@ -111,41 +105,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public int removeEnchantment(Enchantment ench) {
|
||||
Preconditions.checkArgument(ench != null, "Enchantment cannot be null");
|
||||
|
||||
- ListTag list = CraftItemStack.getEnchantmentList(this.handle), listCopy;
|
||||
- ItemEnchantments list = CraftItemStack.getEnchantmentList(this.handle);
|
||||
- if (list == null) {
|
||||
- return 0;
|
||||
- }
|
||||
- int index = Integer.MIN_VALUE;
|
||||
- int level = Integer.MIN_VALUE;
|
||||
- int size = list.size();
|
||||
-
|
||||
- for (int i = 0; i < size; i++) {
|
||||
- CompoundTag enchantment = (CompoundTag) list.get(i);
|
||||
- String id = enchantment.getString(ENCHANTMENTS_ID.NBT);
|
||||
- if (ench.getKey().equals(NamespacedKey.fromString(id))) {
|
||||
- index = i;
|
||||
- level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (index == Integer.MIN_VALUE) {
|
||||
- int level = this.getEnchantmentLevel(ench);
|
||||
- if (level <= 0) {
|
||||
- return 0;
|
||||
- }
|
||||
- if (size == 1) {
|
||||
- this.handle.getTag().remove(ENCHANTMENTS.NBT);
|
||||
- if (this.handle.getTag().isEmpty()) {
|
||||
- this.handle.setTag(null);
|
||||
- }
|
||||
- return level;
|
||||
- }
|
||||
- int size = list.size();
|
||||
-
|
||||
- // This is workaround for not having an index removal
|
||||
- listCopy = new ListTag();
|
||||
- for (int i = 0; i < size; i++) {
|
||||
- if (i != index) {
|
||||
- listCopy.add(list.get(i));
|
||||
- }
|
||||
- if (size == 1) {
|
||||
- this.handle.remove(DataComponents.ENCHANTMENTS);
|
||||
- return level;
|
||||
+ // Paper start - replace entire method
|
||||
+ int level = getEnchantmentLevel(ench);
|
||||
+ if (level > 0) {
|
||||
@ -154,7 +126,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ itemMeta.removeEnchant(ench);
|
||||
+ this.setItemMeta(itemMeta);
|
||||
}
|
||||
- this.handle.getTag().put(ENCHANTMENTS.NBT, listCopy);
|
||||
-
|
||||
- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list);
|
||||
- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), -1); // Negative to remove
|
||||
- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable());
|
||||
+ // Paper end
|
||||
|
||||
return level;
|
||||
@ -180,40 +155,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
@@ -0,0 +0,0 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -0,0 +0,0 @@ import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
+import java.util.Comparator; // Paper
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -0,0 +0,0 @@ import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
+import java.util.TreeMap; // Paper
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
private List<String> lore; // null and empty are two different states internally
|
||||
private List<Component> lore; // null and empty are two different states internally
|
||||
private Integer customModelData;
|
||||
private CompoundTag blockData;
|
||||
private Map<String, String> blockData;
|
||||
- private Map<Enchantment, Integer> enchantments;
|
||||
+ private EnchantmentMap enchantments; // Paper
|
||||
private Multimap<Attribute, AttributeModifier> attributeModifiers;
|
||||
private int repairCost;
|
||||
private int hideFlag;
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||
|
||||
private CompoundTag internalTag;
|
||||
- final Map<String, Tag> unhandledTags = new HashMap<String, Tag>(); // Visible for testing only
|
||||
+ final Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper
|
||||
private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY);
|
||||
|
||||
private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
this.blockData = meta.blockData;
|
||||
|
||||
@ -227,20 +193,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
}
|
||||
|
||||
- static Map<Enchantment, Integer> buildEnchantments(CompoundTag tag, ItemMetaKey key) {
|
||||
+ static EnchantmentMap buildEnchantments(CompoundTag tag, ItemMetaKey key) { // Paper
|
||||
if (!tag.contains(key.NBT)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ListTag ench = tag.getList(key.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
|
||||
- Map<Enchantment, Integer> enchantments = new LinkedHashMap<Enchantment, Integer>(ench.size());
|
||||
- static Map<Enchantment, Integer> buildEnchantments(ItemEnchantments tag) {
|
||||
- Map<Enchantment, Integer> enchantments = new LinkedHashMap<Enchantment, Integer>(tag.size());
|
||||
+ static EnchantmentMap buildEnchantments(ItemEnchantments tag) { // Paper
|
||||
+ EnchantmentMap enchantments = new EnchantmentMap(); // Paper
|
||||
|
||||
for (int i = 0; i < ench.size(); i++) {
|
||||
String id = ((CompoundTag) ench.get(i)).getString(CraftMetaItem.ENCHANTMENTS_ID.NBT);
|
||||
tag.entrySet().forEach((entry) -> {
|
||||
Holder<net.minecraft.world.item.enchantment.Enchantment> id = entry.getKey();
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
}
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
- static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) {
|
||||
@ -282,8 +243,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (this.hasAttributeModifiers()) {
|
||||
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return CraftMetaItem.HANDLED_TAGS;
|
||||
}
|
||||
|
||||
return (result != null) ? result : Optional.empty();
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
|
||||
ItemEntity entityitem = (ItemEntity) iterator.next();
|
||||
|
||||
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
|
@ -507,7 +507,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
// Paper end - Share random for entities to make them more random
|
||||
|
||||
@ -520,7 +520,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
public ResourceLocation lootTable;
|
||||
public ResourceKey<LootTable> lootTable;
|
||||
public long lootTableSeed;
|
||||
|
||||
+ // Paper start
|
||||
@ -545,14 +545,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
protected void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
+ this.lootableData.saveNbt(nbt); // Paper
|
||||
this.addChestVehicleSaveData(nbt);
|
||||
this.addChestVehicleSaveData(nbt, this.registryAccess());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
+ this.lootableData.loadNbt(nbt); // Paper
|
||||
this.readChestVehicleSaveData(nbt);
|
||||
this.readChestVehicleSaveData(nbt, this.registryAccess());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
@ -564,18 +564,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
protected void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
+ this.lootableData.saveNbt(nbt); // Paper
|
||||
this.addChestVehicleSaveData(nbt);
|
||||
this.addChestVehicleSaveData(nbt, this.registryAccess());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
+ this.lootableData.loadNbt(nbt); // Paper
|
||||
this.readChestVehicleSaveData(nbt);
|
||||
this.readChestVehicleSaveData(nbt, this.registryAccess());
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
||||
this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of((Entity) player));
|
||||
this.level().gameEvent((Holder) GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of((Entity) player));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
@ -604,20 +604,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
nbt.putLong("LootTableSeed", this.getLootTableSeed());
|
||||
}
|
||||
- } else {
|
||||
- ContainerHelper.saveAllItems(nbt, this.getItemStacks());
|
||||
- ContainerHelper.saveAllItems(nbt, this.getItemStacks(), registriesLookup);
|
||||
}
|
||||
+ ContainerHelper.saveAllItems(nbt, this.getItemStacks()); // Paper - always save the items, table may still remain
|
||||
+ ContainerHelper.saveAllItems(nbt, this.getItemStacks(), registriesLookup); // Paper - always save the items, table may still remain
|
||||
}
|
||||
|
||||
default void readChestVehicleSaveData(CompoundTag nbt) {
|
||||
default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registriesLookup) {
|
||||
@@ -0,0 +0,0 @@ public interface ContainerEntity extends Container, MenuProvider {
|
||||
if (nbt.contains("LootTable", 8)) {
|
||||
this.setLootTable(new ResourceLocation(nbt.getString("LootTable")));
|
||||
this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable"))));
|
||||
this.setLootTableSeed(nbt.getLong("LootTableSeed"));
|
||||
- } else {
|
||||
- ContainerHelper.loadAllItems(nbt, this.getItemStacks());
|
||||
- ContainerHelper.loadAllItems(nbt, this.getItemStacks(), registriesLookup);
|
||||
}
|
||||
+ ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain
|
||||
+ ContainerHelper.loadAllItems(nbt, this.getItemStacks(), registriesLookup); // Paper - always save the items, table may still remain
|
||||
}
|
||||
|
||||
default void chestVehicleDestroyed(DamageSource source, Level world, Entity vehicle) {
|
||||
@ -627,7 +627,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
MinecraftServer minecraftServer = this.level().getServer();
|
||||
- if (this.getLootTable() != null && minecraftServer != null) {
|
||||
+ if (this.getLootableData().shouldReplenish(player) && minecraftServer != null) { // Paper
|
||||
LootTable lootTable = minecraftServer.getLootData().getLootTable(this.getLootTable());
|
||||
LootTable lootTable = minecraftServer.reloadableRegistries().getLootTable(this.getLootTable());
|
||||
if (player != null) {
|
||||
CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getLootTable());
|
||||
}
|
||||
@ -639,7 +639,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
|
||||
@@ -0,0 +0,0 @@ public interface ContainerEntity extends Container, MenuProvider {
|
||||
default boolean isChestVehicleStillValid(Player player) {
|
||||
return !this.isRemoved() && this.position().closerThan(player.position(), 8.0);
|
||||
return !this.isRemoved() && player.canInteractWithEntity(this.getBoundingBox(), 4.0);
|
||||
}
|
||||
+ // Paper start
|
||||
+ default Entity getEntity() {
|
||||
@ -657,8 +657,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||
@Nullable
|
||||
public ResourceLocation lootTable;
|
||||
public long lootTableSeed;
|
||||
public ResourceKey<LootTable> lootTable;
|
||||
public long lootTableSeed = 0L;
|
||||
+ public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper
|
||||
|
||||
protected RandomizableContainerBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
@ -726,9 +726,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- private void setLootTable(LootTable table, long seed) {
|
||||
+ public void setLootTable(LootTable table, long seed) { // Paper - make public since it overrides a public method
|
||||
ResourceLocation key = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
|
||||
this.getSnapshot().setLootTable(key, seed);
|
||||
this.getSnapshot().setLootTable(CraftLootTable.bukkitToMinecraft(table), seed);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
|
||||
@ -748,7 +748,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftLootTable;
|
||||
import org.bukkit.loot.LootTable;
|
||||
import org.bukkit.loot.Lootable;
|
||||
|
||||
@ -761,7 +761,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java b/s
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.loot.LootTable;
|
||||
|
||||
@ -777,9 +777,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- private void setLootTable(LootTable table, long seed) {
|
||||
+ public void setLootTable(LootTable table, long seed) { // Paper - change visibility since it overrides a public method
|
||||
ResourceLocation newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
|
||||
this.getHandle().setLootTable(newKey);
|
||||
this.getHandle().setLootTable(CraftLootTable.bukkitToMinecraft(table));
|
||||
this.getHandle().setLootTableSeed(seed);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
|
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
|
||||
|
||||
this.profiler.push(() -> {
|
||||
return worldserver + " " + worldserver.dimension().location();
|
||||
String s = String.valueOf(worldserver);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BushBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BushBlock.java
|
||||
@@ -0,0 +0,0 @@ public abstract class BushBlock extends Block {
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
// CraftBukkit start
|
||||
if (!state.canSurvive(world, pos)) {
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) {
|
109
patches/server/Player-Tab-List-and-Title-APIs.patch
Normale Datei
109
patches/server/Player-Tab-List-and-Title-APIs.patch
Normale Datei
@ -0,0 +1,109 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Thu, 3 Mar 2016 02:32:10 -0600
|
||||
Subject: [PATCH] Player Tab List and Title APIs
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
||||
+ if (header != null) {
|
||||
+ String headerJson = net.md_5.bungee.chat.ComponentSerializer.toString(header);
|
||||
+ playerListHeader = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(headerJson);
|
||||
+ } else {
|
||||
+ playerListHeader = null;
|
||||
+ }
|
||||
+
|
||||
+ if (footer != null) {
|
||||
+ String footerJson = net.md_5.bungee.chat.ComponentSerializer.toString(footer);
|
||||
+ playerListFooter = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(footerJson);
|
||||
+ } else {
|
||||
+ playerListFooter = null;
|
||||
+ }
|
||||
+
|
||||
+ updatePlayerListHeaderFooter();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setPlayerListHeaderFooter(BaseComponent header, BaseComponent footer) {
|
||||
+ this.setPlayerListHeaderFooter(header == null ? null : new BaseComponent[]{header},
|
||||
+ footer == null ? null : new BaseComponent[]{footer});
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) {
|
||||
+ getHandle().connection.send(new ClientboundSetTitlesAnimationPacket(fadeInTicks, stayTicks, fadeOutTicks));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSubtitle(BaseComponent[] subtitle) {
|
||||
+ final ClientboundSetSubtitleTextPacket packet = new ClientboundSetSubtitleTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(subtitle)));
|
||||
+ getHandle().connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSubtitle(BaseComponent subtitle) {
|
||||
+ setSubtitle(new BaseComponent[]{subtitle});
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent[] title) {
|
||||
+ final ClientboundSetTitleTextPacket packet = new ClientboundSetTitleTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(title)));
|
||||
+ getHandle().connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent title) {
|
||||
+ showTitle(new BaseComponent[]{title});
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent[] title, BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
|
||||
+ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks);
|
||||
+ setSubtitle(subtitle);
|
||||
+ showTitle(title);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent title, BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
|
||||
+ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks);
|
||||
+ setSubtitle(subtitle);
|
||||
+ showTitle(title);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendTitle(com.destroystokyo.paper.Title title) {
|
||||
+ Preconditions.checkNotNull(title, "Title is null");
|
||||
+ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut());
|
||||
+ setSubtitle(title.getSubtitle() == null ? new BaseComponent[0] : title.getSubtitle());
|
||||
+ showTitle(title.getTitle());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void updateTitle(com.destroystokyo.paper.Title title) {
|
||||
+ Preconditions.checkNotNull(title, "Title is null");
|
||||
+ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut());
|
||||
+ if (title.getSubtitle() != null) {
|
||||
+ setSubtitle(title.getSubtitle());
|
||||
+ }
|
||||
+ showTitle(title.getTitle());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void hideTitle() {
|
||||
+ getHandle().connection.send(new ClientboundClearTitlesPacket(false));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
if(true) return io.papermc.paper.adventure.DisplayNames.getLegacy(this); // Paper
|
@ -18,4 +18,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ } // Paper - prevent logins to be processed even though disconnect was called
|
||||
}
|
||||
|
||||
if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
|
||||
// CraftBukkit start
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren