mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-03 13:42:25 -07:00
Patches!
This commit is contained in:
@@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.player.clientBrandName = brandPayload.brand();
|
+ this.player.clientBrandName = brandPayload.brand();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Brand support
|
+ // Paper end - Brand support
|
||||||
if (!(packet.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) {
|
if (!(packet.payload() instanceof DiscardedPayload)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
@@ -28,16 +28,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end - Buffer joins to world
|
+ // Paper end - Buffer joins to world
|
||||||
PacketListener packetlistener = this.packetListener;
|
PacketListener packetlistener = this.packetListener;
|
||||||
|
|
||||||
if (packetlistener instanceof TickablePacketListener) {
|
if (packetlistener instanceof TickablePacketListener tickablepacketlistener) {
|
||||||
TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener;
|
|
||||||
|
|
||||||
+ // Paper start - Buffer joins to world
|
+ // Paper start - Buffer joins to world
|
||||||
+ if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
|
+ if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
|
||||||
+ || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.VERIFYING
|
+ || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.VERIFYING
|
||||||
+ || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
|
+ || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
|
||||||
tickablepacketlistener.tick();
|
tickablepacketlistener.tick();
|
||||||
+ }
|
+ } // Paper end - Buffer joins to world
|
||||||
+ // Paper end - Buffer joins to world
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isConnected() && !this.disconnectionHandled) {
|
if (!this.isConnected() && !this.disconnectionHandled) {
|
@@ -9,17 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
public void setDefaultSpawnPos(BlockPos pos, float angle) {
|
float f1 = this.levelData.getSpawnAngle();
|
||||||
// Paper start - Configurable Keep Spawn Loaded range per world
|
|
||||||
BlockPos prevSpawn = this.getSharedSpawnPos();
|
if (!blockposition1.equals(pos) || f1 != angle) {
|
||||||
+ Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent
|
+ org.bukkit.Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent
|
||||||
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
|
this.levelData.setSpawn(pos, angle);
|
||||||
|
+ new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper - Call SpawnChangeEvent
|
||||||
|
this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle));
|
||||||
|
}
|
||||||
|
|
||||||
this.levelData.setSpawn(pos, angle);
|
|
||||||
+ new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper - Call SpawnChangeEvent
|
|
||||||
if (this.keepSpawnInMemory) {
|
|
||||||
// if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add
|
|
||||||
this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn);
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
@@ -9,25 +9,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
+++ b/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
|
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
||||||
- MutableComponent ichatmutablecomponent;
|
- MutableComponent ichatmutablecomponent;
|
||||||
+ net.kyori.adventure.text.Component adventureComponent; // Paper - Fix hex colors not working in some kick messages
|
+ net.kyori.adventure.text.Component adventureComponent; // Paper - Fix hex colors not working in some kick messages
|
||||||
|
|
||||||
if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Spigot - SPIGOT-7546: Handle version check correctly for outdated client message
|
if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Spigot - SPIGOT-7546: Handle version check correctly for outdated client message
|
||||||
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
|
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
|
||||||
+ adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // Spigot // Paper - Fix hex colors not working in some kick messages
|
+ adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // Spigot // Paper - Fix hex colors not working in some kick messages
|
||||||
} else {
|
} else {
|
||||||
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
|
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
|
||||||
+ adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // Spigot // Paper - Fix hex colors not working in some kick messages
|
+ adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // Spigot // Paper - Fix hex colors not working in some kick messages
|
||||||
}
|
}
|
||||||
|
|
||||||
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper - Fix hex colors not working in some kick messages
|
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper - Fix hex colors not working in some kick messages
|
||||||
+
|
+
|
||||||
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
||||||
this.connection.disconnect(ichatmutablecomponent);
|
this.connection.disconnect(ichatmutablecomponent);
|
||||||
} else {
|
} else {
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
@@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition);
|
net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition);
|
||||||
|
|
||||||
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
|
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
|
||||||
- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true);
|
- block.onPlace(world, newblockposition, oldBlock, true);
|
||||||
+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, context); // Paper - pass context
|
+ block.onPlace(world, newblockposition, oldBlock, true, context); // Paper - pass context
|
||||||
}
|
}
|
||||||
|
|
||||||
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||||
@@ -24,13 +24,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public abstract class BaseFireBlock extends Block {
|
@@ -0,0 +0,0 @@ public abstract class BaseFireBlock extends Block {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||||
+ // Paper start - UseOnContext param
|
+ // Paper start - UseOnContext param
|
||||||
+ this.onPlace(state, world, pos, oldState, notify, null);
|
+ this.onPlace(state, world, pos, oldState, notify, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
+ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
||||||
+ // Paper end - UseOnContext param
|
+ // Paper end - UseOnContext param
|
||||||
if (!oldState.is(state.getBlock())) {
|
if (!oldState.is(state.getBlock())) {
|
||||||
if (BaseFireBlock.inPortalDimension(world)) {
|
if (BaseFireBlock.inPortalDimension(world)) {
|
||||||
@@ -50,12 +50,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
- public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
- protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||||
- super.onPlace(state, world, pos, oldState, notify);
|
- super.onPlace(state, world, pos, oldState, notify);
|
||||||
+ // Paper start - UseOnContext param
|
+ // Paper start - UseOnContext param
|
||||||
+ public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
+ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
||||||
+ super.onPlace(state, world, pos, oldState, notify, context);
|
+ super.onPlace(state, world, pos, oldState, notify, context);
|
||||||
+ // Paper end - UseOnContext param
|
+ // Paper end - UseOnContext param
|
||||||
world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world.random));
|
world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world.random));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,15 +68,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - UseOnContext param
|
+ // Paper start - UseOnContext param
|
||||||
+ @Deprecated
|
+ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
||||||
+ public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
|
||||||
+ this.onPlace(state, world, pos, oldState, notify);
|
+ this.onPlace(state, world, pos, oldState, notify);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - UseOnContext param
|
+ // Paper end - UseOnContext param
|
||||||
+
|
+
|
||||||
/** @deprecated */
|
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||||
@Deprecated
|
org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot
|
||||||
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
|
this.getBlock().updateIndirectNeighbourShapes(this.asState(), world, pos, flags, maxUpdateDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Paper start
|
||||||
|
+ public void onPlace(Level world, BlockPos pos, BlockState state, boolean notify, net.minecraft.world.item.context.UseOnContext context) {
|
||||||
|
+ this.getBlock().onPlace(this.asState(), world, pos, state, notify, context);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+
|
||||||
|
public void onPlace(Level world, BlockPos pos, BlockState state, boolean notify) {
|
||||||
|
this.getBlock().onPlace(this.asState(), world, pos, state, notify);
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
Reference in New Issue
Block a user