This commit is contained in:
Owen1212055
2024-04-24 08:11:27 -04:00
parent 27c46717f6
commit babd22019c
19 changed files with 48 additions and 41 deletions

View File

@@ -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

View File

@@ -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) {

View File

@@ -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();
+ Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
if (!blockposition1.equals(pos) || f1 != angle) {
+ org.bukkit.Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent
this.levelData.setSpawn(pos, angle); this.levelData.setSpawn(pos, angle);
+ new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper - Call SpawnChangeEvent + new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper - Call SpawnChangeEvent
if (this.keepSpawnInMemory) { this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle));
// 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

View File

@@ -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,10 +50,10 @@ 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