even more work

This commit is contained in:
Jake Potrebic 2023-09-21 19:17:21 -07:00
parent ef6a41195d
commit 7b29d1f4c5
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
46 changed files with 169 additions and 185 deletions

View File

@ -5832,7 +5832,7 @@ index dcbbbf1d59a60abfc731d9e422c9569e8460d985..5250bf5029825524c239854db7999883
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6dc7999e0cc08efdbffafd80437f31ed590189a9..f2e5f3170a4a54e99a1dab40eb8a5c99ce548adc 100644 index 6dc7999e0cc08efdbffafd80437f31ed590189a9..45a9977abb9abe78dafed455abaa022dfadb1153 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -167,6 +167,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -167,6 +167,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -6056,17 +6056,15 @@ index 6dc7999e0cc08efdbffafd80437f31ed590189a9..f2e5f3170a4a54e99a1dab40eb8a5c99
} else { } else {
SectionPos sectionposition = player.getLastSectionPos(); SectionPos sectionposition = player.getLastSectionPos();
@@ -1190,6 +1267,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1190,6 +1267,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.distanceManager.removePlayer(sectionposition, player); this.distanceManager.removePlayer(sectionposition, player);
} }
+ this.removePlayerFromDistanceMaps(player); // Paper - distance maps + this.removePlayerFromDistanceMaps(player); // Paper - distance maps
+ }
+
this.applyChunkTrackingView(player, ChunkTrackingView.EMPTY); this.applyChunkTrackingView(player, ChunkTrackingView.EMPTY);
} }
@@ -1241,6 +1321,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1241,6 +1319,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.updateChunkTracking(player); this.updateChunkTracking(player);
} }
@ -6074,7 +6072,7 @@ index 6dc7999e0cc08efdbffafd80437f31ed590189a9..f2e5f3170a4a54e99a1dab40eb8a5c99
} }
private void updateChunkTracking(ServerPlayer player) { private void updateChunkTracking(ServerPlayer player) {
@@ -1493,7 +1574,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1493,7 +1572,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private class ChunkDistanceManager extends DistanceManager { private class ChunkDistanceManager extends DistanceManager {
protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {

View File

@ -1010,7 +1010,7 @@ index ff3f00cf1d5180f83b16acac5676aa22cd967c8a..5aa21689e308842fe5b64689265ba45a
// CraftBukkit end // CraftBukkit end
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f2e5f3170a4a54e99a1dab40eb8a5c99ce548adc..c4215430a06983fbedfd21a568d79381b95696c3 100644 index 45a9977abb9abe78dafed455abaa022dfadb1153..9932faa95dcc4f104718dbc57d36180c2bbbcb93 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@ @@ -1,8 +1,10 @@
@ -1040,7 +1040,7 @@ index f2e5f3170a4a54e99a1dab40eb8a5c99ce548adc..c4215430a06983fbedfd21a568d79381
}); });
}, (runnable) -> { }, (runnable) -> {
ProcessorHandle mailbox = this.mainThreadMailbox; ProcessorHandle mailbox = this.mainThreadMailbox;
@@ -1459,6 +1463,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1457,6 +1461,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList(); List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players(); List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator(); ObjectIterator objectiterator = this.entityMap.values().iterator();
@ -1048,7 +1048,7 @@ index f2e5f3170a4a54e99a1dab40eb8a5c99ce548adc..c4215430a06983fbedfd21a568d79381
ChunkMap.TrackedEntity playerchunkmap_entitytracker; ChunkMap.TrackedEntity playerchunkmap_entitytracker;
@@ -1483,14 +1488,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1481,14 +1486,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges(); playerchunkmap_entitytracker.serverEntity.sendChanges();
} }
} }

View File

@ -4493,7 +4493,7 @@ index 5250bf5029825524c239854db7999883459f1a8a..c5cd2c2c28795593712b0de2bbaa7e38
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory; private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
public int oldTicketLevel; public int oldTicketLevel;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index c4215430a06983fbedfd21a568d79381b95696c3..17182c7f130853b4b5d942e7d60adaded14f84f6 100644 index 9932faa95dcc4f104718dbc57d36180c2bbbcb93..4c0eb0dbb5caff7944e7bdde803a9eb66d7631be 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -124,7 +124,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -124,7 +124,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View File

@ -9,7 +9,7 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 17182c7f130853b4b5d942e7d60adaded14f84f6..425a0baa9321e9b484814f38fe28de3c82333443 100644 index 4c0eb0dbb5caff7944e7bdde803a9eb66d7631be..6352e3f0a78822b4d5167a688a5230b599541159 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1193,7 +1193,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1193,7 +1193,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View File

@ -8,10 +8,10 @@ Add -Ddebug.entities=true to your JVM flags to gain more information
1.17: Needs to be reworked for new entity storage system 1.17: Needs to be reworked for new entity storage system
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 425a0baa9321e9b484814f38fe28de3c82333443..65916397278ea0cbbc33a46e501a4b6979e6d4ef 100644 index 6352e3f0a78822b4d5167a688a5230b599541159..62c36060989acb54eb12a145909a68193c5e3035 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1417,6 +1417,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1415,6 +1415,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else { } else {
ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas()); ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas());
@ -19,7 +19,7 @@ index 425a0baa9321e9b484814f38fe28de3c82333443..65916397278ea0cbbc33a46e501a4b69
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.updatePlayers(this.level.players()); playerchunkmap_entitytracker.updatePlayers(this.level.players());
if (entity instanceof ServerPlayer) { if (entity instanceof ServerPlayer) {
@@ -1459,7 +1460,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1457,7 +1458,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (playerchunkmap_entitytracker1 != null) { if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.broadcastRemoved(); playerchunkmap_entitytracker1.broadcastRemoved();
} }

View File

@ -39,10 +39,10 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl state
public net.minecraft.server.network.ServerLoginPacketListenerImpl gameProfile public net.minecraft.server.network.ServerLoginPacketListenerImpl gameProfile
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index ff97e47cb248ade6530e52583b0b3865d77ace15..ed89f2f96088c5c05fd42a6795e6e6e342a0ab54 100644 index ff97e47cb248ade6530e52583b0b3865d77ace15..62df5c51fa11f85ec2fad20c0ea5aa6241294e8a 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -632,6 +632,27 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -632,6 +632,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
packetlistener1.onDisconnect(ichatbasecomponent); packetlistener1.onDisconnect(ichatbasecomponent);
} }
this.pendingActions.clear(); // Free up packet queue. this.pendingActions.clear(); // Free up packet queue.
@ -66,7 +66,6 @@ index ff97e47cb248ade6530e52583b0b3865d77ace15..ed89f2f96088c5c05fd42a6795e6e6e3
+ } + }
+ } + }
+ // Paper end + // Paper end
+ }
} }
} }

View File

@ -10,7 +10,7 @@ Adds CommandRegisteredEvent
- Allows manipulating the CommandNode to add more children/metadata for the client - Allows manipulating the CommandNode to add more children/metadata for the client
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index ae64cbbff21ab56d27fd55a4f21b6241d0a54e98..eecadeb81317834741b083fe8c5da77519d196a3 100644 index 7cb7a4024f53c50d88652cb6c497d815ed67c148..7f005b9a41064f1929e8d9cb53c5ab207d3a333d 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -14,6 +14,7 @@ val alsoShade: Configuration by configurations.creating @@ -14,6 +14,7 @@ val alsoShade: Configuration by configurations.creating
@ -59,7 +59,7 @@ index da6250df1c5f3385b683cffde47754bca4606f5e..3384501f83d445f45aa8233e98c7597d
public void removeCommand(String name) { public void removeCommand(String name) {
this.children.remove(name); this.children.remove(name);
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 34fdef41d1eb3fe78bf688d69aae437d89a337bb..66bd75ee66840f17cc7d00ff89adcb88d83e4dc9 100644 index 902671a335da23d3945c363afc8abde6f5a1d444..e6bf044a0de278c568835e6150ce07ed0e39a44e 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -43,7 +43,7 @@ import net.minecraft.world.phys.Vec2; @@ -43,7 +43,7 @@ import net.minecraft.world.phys.Vec2;
@ -71,7 +71,7 @@ index 34fdef41d1eb3fe78bf688d69aae437d89a337bb..66bd75ee66840f17cc7d00ff89adcb88
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player")); public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity")); public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
@@ -180,6 +180,26 @@ public class CommandSourceStack implements SharedSuggestionProvider { @@ -176,6 +176,26 @@ public class CommandSourceStack implements SharedSuggestionProvider {
return this.textName; return this.textName;
} }
@ -99,10 +99,10 @@ index 34fdef41d1eb3fe78bf688d69aae437d89a337bb..66bd75ee66840f17cc7d00ff89adcb88
public boolean hasPermission(int level) { public boolean hasPermission(int level) {
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index b7f1569c662df13f278fc704cabec0400ba7c382..87ce129e1d592bcf68169feb559f44d5cda7c486 100644 index bbf4db5faf4694e78e01f4e74e277b46a02f7afd..148cfe9eac43cafee016d58a1344a97a2e69aa77 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -434,6 +434,7 @@ public class Commands { @@ -440,6 +440,7 @@ public class Commands {
bukkit.add(node.getName()); bukkit.add(node.getName());
} }
// Paper start - Async command map building // Paper start - Async command map building
@ -110,7 +110,7 @@ index b7f1569c662df13f278fc704cabec0400ba7c382..87ce129e1d592bcf68169feb559f44d5
net.minecraft.server.MinecraftServer.getServer().execute(() -> { net.minecraft.server.MinecraftServer.getServer().execute(() -> {
runSync(player, bukkit, rootcommandnode); runSync(player, bukkit, rootcommandnode);
}); });
@@ -441,6 +442,7 @@ public class Commands { @@ -447,6 +448,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) { private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Async command map building // Paper end - Async command map building
@ -118,7 +118,7 @@ index b7f1569c662df13f278fc704cabec0400ba7c382..87ce129e1d592bcf68169feb559f44d5
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event); event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -459,6 +461,11 @@ public class Commands { @@ -465,6 +467,11 @@ public class Commands {
while (iterator.hasNext()) { while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next(); CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
@ -131,10 +131,10 @@ index b7f1569c662df13f278fc704cabec0400ba7c382..87ce129e1d592bcf68169feb559f44d5
if (commandnode2.canUse(source)) { if (commandnode2.canUse(source)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c5b682d08ab270d153eb600afe9a21bfa1305072..6b49981d61e910d8d8fa09ff091359754e6d09a3 100644 index 08af9c32f8cb40e1e94cfb5c42ee113e8765db86..aed6d2420afeb404b5542f19d7424b6c14d0b636 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -842,8 +842,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -732,8 +732,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -149,7 +149,7 @@ index c5b682d08ab270d153eb600afe9a21bfa1305072..6b49981d61e910d8d8fa09ff09135975
}); });
}); });
} }
@@ -858,7 +862,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -748,7 +752,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip()));
} }
}); });

View File

@ -143,18 +143,18 @@ index 0000000000000000000000000000000000000000..413dfa52760db393ad6a8b5341200ee7
+import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier; +import org.checkerframework.framework.qual.DefaultQualifier;
diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
index c8e9e85728d6b60bb829e69c015ab3c5172afd54..86cc516a6d4e8c64497479ec128d4e8d73667cfa 100644 index 4303f2b4e55191f8a53170435c6d1263782d1c8d..f5440ae9bbce231de06cf184fd0a8490cebfafde 100644
--- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java --- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
+++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java +++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
@@ -33,6 +33,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -34,6 +34,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
this.inventory = entity.getInventory(); this.inventory = entity.getInventory();
if (this.testClearGrid() || entity.isCreative()) { if (this.testClearGrid() || entity.isCreative()) {
this.stackedContents.clear(); this.stackedContents.clear();
+ this.stackedContents.initialize(recipe); // Paper - better exact choice recipes + this.stackedContents.initialize(recipe); // Paper - better exact choice recipes
entity.getInventory().fillStackedContents(this.stackedContents); entity.getInventory().fillStackedContents(this.stackedContents);
this.menu.fillCraftSlotsStackedContents(this.stackedContents); this.menu.fillCraftSlotsStackedContents(this.stackedContents);
if (this.stackedContents.canCraft(recipe, (IntList)null)) { if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) {
@@ -79,7 +80,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -80,7 +81,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
int l = k; int l = k;
for(int m : intList) { for(int m : intList) {
@ -163,7 +163,7 @@ index c8e9e85728d6b60bb829e69c015ab3c5172afd54..86cc516a6d4e8c64497479ec128d4e8d
if (n < l) { if (n < l) {
l = n; l = n;
} }
@@ -96,10 +97,21 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -97,10 +98,21 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
@Override @Override
public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) { public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) {
Slot slot2 = this.menu.getSlot(slot); Slot slot2 = this.menu.getSlot(slot);
@ -187,7 +187,7 @@ index c8e9e85728d6b60bb829e69c015ab3c5172afd54..86cc516a6d4e8c64497479ec128d4e8d
} }
} }
@@ -129,8 +141,14 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -130,8 +142,14 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
return i; return i;
} }
@ -204,10 +204,10 @@ index c8e9e85728d6b60bb829e69c015ab3c5172afd54..86cc516a6d4e8c64497479ec128d4e8d
ItemStack itemStack = this.inventory.getItem(i); ItemStack itemStack = this.inventory.getItem(i);
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
index ba5cd22ec5a0853b48fbc2b0ba271fb79a8af4dc..68d272e98f9e54c9b150c75c27a9ae545be842f6 100644 index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e21d015ebc 100644
--- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java --- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java
+++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java +++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
@@ -20,8 +20,10 @@ import net.minecraft.world.item.crafting.Recipe; @@ -21,8 +21,10 @@ import net.minecraft.world.item.crafting.RecipeHolder;
public class StackedContents { public class StackedContents {
private static final int EMPTY = 0; private static final int EMPTY = 0;
public final Int2IntMap contents = new Int2IntOpenHashMap(); public final Int2IntMap contents = new Int2IntOpenHashMap();
@ -218,7 +218,7 @@ index ba5cd22ec5a0853b48fbc2b0ba271fb79a8af4dc..68d272e98f9e54c9b150c75c27a9ae54
if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) { if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) {
this.accountStack(stack); this.accountStack(stack);
} }
@@ -36,6 +38,7 @@ public class StackedContents { @@ -37,6 +39,7 @@ public class StackedContents {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
int i = getStackingIndex(stack); int i = getStackingIndex(stack);
int j = Math.min(maxCount, stack.getCount()); int j = Math.min(maxCount, stack.getCount());
@ -226,7 +226,7 @@ index ba5cd22ec5a0853b48fbc2b0ba271fb79a8af4dc..68d272e98f9e54c9b150c75c27a9ae54
this.put(i, j); this.put(i, j);
} }
@@ -83,6 +86,23 @@ public class StackedContents { @@ -84,6 +87,23 @@ public class StackedContents {
return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId)); return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId));
} }
@ -250,7 +250,7 @@ index ba5cd22ec5a0853b48fbc2b0ba271fb79a8af4dc..68d272e98f9e54c9b150c75c27a9ae54
public void clear() { public void clear() {
this.contents.clear(); this.contents.clear();
} }
@@ -106,7 +126,7 @@ public class StackedContents { @@ -107,7 +127,7 @@ public class StackedContents {
this.data = new BitSet(this.ingredientCount + this.itemCount + this.ingredientCount + this.ingredientCount * this.itemCount); this.data = new BitSet(this.ingredientCount + this.itemCount + this.ingredientCount + this.ingredientCount * this.itemCount);
for(int i = 0; i < this.ingredients.size(); ++i) { for(int i = 0; i < this.ingredients.size(); ++i) {
@ -296,34 +296,34 @@ index ba5cd22ec5a0853b48fbc2b0ba271fb79a8af4dc..68d272e98f9e54c9b150c75c27a9ae54
} }
} }
diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
index f551651ce2d8b29c4a5cd787f48dedbbb411b2cb..e30af1e639db0c89066e76915884e1a0bef584a3 100644 index c864809c7d656cf8e3f1080c2c57aefd0a417240..760a429137350d8ae100e77273318f3ba1ccfcc5 100644
--- a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java --- a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
@@ -7,7 +7,7 @@ import net.minecraft.world.Container; @@ -6,7 +6,7 @@ import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
-public abstract class AbstractCookingRecipe implements Recipe<Container> { -public abstract class AbstractCookingRecipe implements Recipe<Container> {
+public abstract class AbstractCookingRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<Container> implements Recipe<Container> { // Paper - improve exact recipe choices +public abstract class AbstractCookingRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<Container> implements Recipe<Container> { // Paper - improve exact recipe choices
protected final RecipeType<?> type; protected final RecipeType<?> type;
protected final ResourceLocation id; protected final CookingBookCategory category;
private final CookingBookCategory category; protected final String group;
@@ -26,6 +26,7 @@ public abstract class AbstractCookingRecipe implements Recipe<Container> { @@ -23,6 +23,7 @@ public abstract class AbstractCookingRecipe implements Recipe<Container> {
this.result = output; this.result = result;
this.experience = experience; this.experience = experience;
this.cookingTime = cookTime; this.cookingTime = cookingTime;
+ this.checkExactIngredients(); // Paper - improve exact recipe choices + this.checkExactIngredients(); // Paper - improve exact recipe choices
} }
@Override @Override
diff --git a/src/main/java/net/minecraft/world/item/crafting/Recipe.java b/src/main/java/net/minecraft/world/item/crafting/Recipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/Recipe.java b/src/main/java/net/minecraft/world/item/crafting/Recipe.java
index d1505698ce45bbc7f592a23111391542d01d2b28..f2cf1f30191e14c9e9b5b5e4a3f6d9346125e998 100644 index 75ae978b577b6b2399e1476328114e94abd7d6c4..80387cd1bee2bd4c024073cee74222828f9f2c17 100644
--- a/src/main/java/net/minecraft/world/item/crafting/Recipe.java --- a/src/main/java/net/minecraft/world/item/crafting/Recipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/Recipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/Recipe.java
@@ -68,4 +68,10 @@ public interface Recipe<C extends Container> { @@ -65,4 +65,10 @@ public interface Recipe<C extends Container> {
} }
org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id); // CraftBukkit
+ +
+ // Paper start - improved exact choice recipes + // Paper start - improved exact choice recipes
+ default boolean hasExactIngredients() { + default boolean hasExactIngredients() {
@ -332,10 +332,10 @@ index d1505698ce45bbc7f592a23111391542d01d2b28..f2cf1f30191e14c9e9b5b5e4a3f6d934
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
index 9c1285e31d947f92e0b00149e342e793898e0d7c..6693dd51440da3f0fc338c4e2cb67d3222eed182 100644 index 4430c1161c3316566158ab7286e21495edb38991..17bef91546fa85d401b263c3a69fbf464f290eca 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java --- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
@@ -30,7 +30,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; @@ -26,7 +26,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
import org.bukkit.inventory.RecipeChoice; import org.bukkit.inventory.RecipeChoice;
// CraftBukkit end // CraftBukkit end
@ -344,16 +344,16 @@ index 9c1285e31d947f92e0b00149e342e793898e0d7c..6693dd51440da3f0fc338c4e2cb67d32
final int width; final int width;
final int height; final int height;
@@ -50,6 +50,7 @@ public class ShapedRecipe implements CraftingRecipe { @@ -44,6 +44,7 @@ public class ShapedRecipe implements CraftingRecipe {
this.recipeItems = input; this.recipeItems = ingredients;
this.result = output; this.result = result;
this.showNotification = showNotification; this.showNotification = showNotification;
+ this.checkExactIngredients(); // Paper - improve exact recipe choices + this.checkExactIngredients(); // Paper - improve exact recipe choices
} }
public ShapedRecipe(ResourceLocation id, String group, CraftingBookCategory category, int width, int height, NonNullList<Ingredient> input, ItemStack output) { public ShapedRecipe(String group, CraftingBookCategory category, int width, int height, NonNullList<Ingredient> ingredients, ItemStack result) {
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
index 1023dcb80dfb978dd496ed0f96ca5832fadf0f87..2e60bdc44c33d434bfd9ca5bf8f75de799c6768c 100644 index 7f78490ebf459595460ce656b9b9227e5d6b8de6..38f7d1ece27ec1a3deda21fb6a6f0e788c8ed718 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java --- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
@@ -20,7 +20,7 @@ import org.bukkit.craftbukkit.inventory.CraftRecipe; @@ -20,7 +20,7 @@ import org.bukkit.craftbukkit.inventory.CraftRecipe;
@ -363,17 +363,17 @@ index 1023dcb80dfb978dd496ed0f96ca5832fadf0f87..2e60bdc44c33d434bfd9ca5bf8f75de7
-public class ShapelessRecipe implements CraftingRecipe { -public class ShapelessRecipe implements CraftingRecipe {
+public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingContainer> implements CraftingRecipe { // Paper - improve exact recipe choices +public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingContainer> implements CraftingRecipe { // Paper - improve exact recipe choices
private final ResourceLocation id;
final String group; final String group;
@@ -34,6 +34,7 @@ public class ShapelessRecipe implements CraftingRecipe { final CraftingBookCategory category;
@@ -32,6 +32,7 @@ public class ShapelessRecipe implements CraftingRecipe {
this.category = category; this.category = category;
this.result = output; this.result = result;
this.ingredients = input; this.ingredients = ingredients;
+ this.checkExactIngredients(); // Paper - improve exact recipe choices + this.checkExactIngredients(); // Paper - improve exact recipe choices
} }
// CraftBukkit start // CraftBukkit start
@@ -83,6 +84,7 @@ public class ShapelessRecipe implements CraftingRecipe { @@ -77,6 +78,7 @@ public class ShapelessRecipe implements CraftingRecipe {
public boolean matches(CraftingContainer inventory, Level world) { public boolean matches(CraftingContainer inventory, Level world) {
StackedContents autorecipestackmanager = new StackedContents(); StackedContents autorecipestackmanager = new StackedContents();

View File

@ -22,18 +22,18 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6b49981d61e910d8d8fa09ff091359754e6d09a3..593f017a43153c081f007073926fa4f520bded00 100644 index aed6d2420afeb404b5542f19d7424b6c14d0b636..717f23a92017a589e639c09e15377e30f602d8fe 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -302,6 +302,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -288,6 +288,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private final MessageSignatureCache messageSignatureCache; private final MessageSignatureCache messageSignatureCache;
private final FutureChain chatMessageChain; private final FutureChain chatMessageChain;
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit private boolean waitingForSwitchToConfig;
+ private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper + private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH); super(server, connection, clientData, player); // CraftBukkit
@@ -3189,7 +3190,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3044,7 +3045,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) { public void handleSignUpdate(ServerboundSignUpdatePacket packet) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5657493e215a17f3132f9d411424875160fda6d9..e038240042366e1c491c04016982c91c91ee86cd 100644 index 7b094b859fe4c865cd369108700d5b0d6573c019..b97ffb7746b2be70285addd091711fef0c2b1b87 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1157,6 +1157,7 @@ public abstract class PlayerList { @@ -1151,6 +1151,7 @@ public abstract class PlayerList {
} }
public void setUsingWhiteList(boolean whitelistEnabled) { public void setUsingWhiteList(boolean whitelistEnabled) {

View File

@ -22,10 +22,10 @@ index 2eddeb8d5239bbfeefbf4d3bd363f1ad083299b6..a7c89cdf20cb63792c76de81c1ff9f2c
}); });
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6b157b362cffedae26133fc0f0af1094655ee11f..986a509998d217228eb1dc2b5815787599e02d6b 100644 index af33e4be10c9d571eb6f7ba5730b7ed4d8647761..6978abb97da6c33099db2e4ead3f33b0ca87bed1 100644
--- 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
@@ -1429,6 +1429,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1197,6 +1197,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
return true; return true;
} }
// Paper end // Paper end
@ -34,10 +34,10 @@ index 6b157b362cffedae26133fc0f0af1094655ee11f..986a509998d217228eb1dc2b58157875
// Paper start // Paper start
if (DEBUG_ENTITIES) { if (DEBUG_ENTITIES) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e038240042366e1c491c04016982c91c91ee86cd..cccaf594392a0283f00986f182cc89d56181bc40 100644 index b97ffb7746b2be70285addd091711fef0c2b1b87..3831c724dfcdf97129c6fd8dab0c7a91fa3e7679 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -233,6 +233,11 @@ public abstract class PlayerList { @@ -225,6 +225,11 @@ public abstract class PlayerList {
worldserver1 = worldserver; worldserver1 = worldserver;
} }
@ -47,9 +47,9 @@ index e038240042366e1c491c04016982c91c91ee86cd..cccaf594392a0283f00986f182cc89d5
+ } + }
+ // Paper end + // Paper end
player.setServerLevel(worldserver1); player.setServerLevel(worldserver1);
String s1 = "local"; String s1 = connection.getLoggableAddress(this.server.logIPs());
@@ -373,7 +378,7 @@ public abstract class PlayerList { @@ -356,7 +361,7 @@ public abstract class PlayerList {
// CraftBukkit start // CraftBukkit start
ServerLevel finalWorldServer = worldserver1; ServerLevel finalWorldServer = worldserver1;
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
@ -59,7 +59,7 @@ index e038240042366e1c491c04016982c91c91ee86cd..cccaf594392a0283f00986f182cc89d5
}); });
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index dee47ff97e4f08154866d7628c3588a42f9892b9..0f40361ebfe64fae828f577529200e40e94b0e05 100644 index d0779d38c56ca1c01abd154720d2865d14479a30..7c23f63fd642002cac597da2eafc5f0b4232d5a4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -234,6 +234,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -234,6 +234,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -70,7 +70,7 @@ index dee47ff97e4f08154866d7628c3588a42f9892b9..0f40361ebfe64fae828f577529200e40
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity; private CraftEntity bukkitEntity;
@@ -2181,6 +2182,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2137,6 +2138,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
} }
@ -80,7 +80,7 @@ index dee47ff97e4f08154866d7628c3588a42f9892b9..0f40361ebfe64fae828f577529200e40
// Save entity's from mob spawner status // Save entity's from mob spawner status
if (spawnedViaMobSpawner) { if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true); nbt.putBoolean("Paper.FromMobSpawner", true);
@@ -2327,6 +2331,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2283,6 +2287,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -120,7 +120,7 @@ index a9be524edb03c51300bc45d424fcf87c7491a8c0..a08c2dee792da1a54005f0a65a9eefab
// CraftBukkit start // CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 185b3af59bf72244bbbfc46c3336e4f7f14e73a8..4dc676f29f04ba8d52b2fe3778347d2c2f46eebe 100644 index 0fd9119c710afdd46a60d81ae3f9ce5da88d2541..c7cd18de51c5e7c9d194ba65902084194d4408ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1307,5 +1307,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1307,5 +1307,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cccaf594392a0283f00986f182cc89d56181bc40..94a0d17a0339249c1c97e36d6e13b5958cfa2e49 100644 index 3831c724dfcdf97129c6fd8dab0c7a91fa3e7679..3c4224472ce59d7a2c1748d510e4fc8f58a7d5e1 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -758,9 +758,14 @@ public abstract class PlayerList { @@ -753,9 +753,14 @@ public abstract class PlayerList {
boolean flag2 = false; boolean flag2 = false;
@ -24,7 +24,7 @@ index cccaf594392a0283f00986f182cc89d56181bc40..94a0d17a0339249c1c97e36d6e13b595
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension()); ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
if (worldserver1 != null) { if (worldserver1 != null) {
Optional optional; Optional optional;
@@ -812,6 +817,7 @@ public abstract class PlayerList { @@ -807,6 +812,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation(); location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785 if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index cccaf594392a0283f00986f182cc89d56181bc40..94a0d17a0339249c1c97e36d6e13b595
} else { } else {
location.setWorld(worldserver.getWorld()); location.setWorld(worldserver.getWorld());
} }
@@ -871,6 +877,13 @@ public abstract class PlayerList { @@ -865,6 +871,13 @@ public abstract class PlayerList {
if (entityplayer.connection.isDisconnected()) { if (entityplayer.connection.isDisconnected()) {
this.save(entityplayer); this.save(entityplayer);
} }

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick Fires event at start and end of a server tick
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d84ed437e91a620c294533ddcb098cc11bc16c1f..78465f82b2f3ae2a932b787a489f3d01cc51f5f9 100644 index bace1ff9e64bd8bec334c5e1d1fd1c621a63cd92..8ce9b9444c46956eeace333206eefd3ebca1e0c0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1304,6 +1304,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1292,6 +1292,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}); });
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end // Paper end
@ -17,7 +17,7 @@ index d84ed437e91a620c294533ddcb098cc11bc16c1f..78465f82b2f3ae2a932b787a489f3d01
++this.tickCount; ++this.tickCount;
this.tickChildren(shouldKeepTicking); this.tickChildren(shouldKeepTicking);
@@ -1325,6 +1326,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1313,6 +1314,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.runAllTasks(); this.runAllTasks();
} }
// Paper end // Paper end

View File

@ -11,10 +11,10 @@ Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
public net.minecraft.world.entity.player.Inventory compartments public net.minecraft.world.entity.player.Inventory compartments
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d29e13aa7bbfbab54f8a3d73279891d65e957d7e..3ebb5cd3a0068cf6716ebe6fa6f4f4f4a1d58d08 100644 index 9ad2e953a3b4a7a2f4ce375a1b209820cdef2d47..e66d24174d5834cb9526fa4a238d0765bef827b2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -847,6 +847,46 @@ public class ServerPlayer extends Player { @@ -806,6 +806,46 @@ public class ServerPlayer extends Player {
}); });
} }
@ -61,7 +61,7 @@ index d29e13aa7bbfbab54f8a3d73279891d65e957d7e..3ebb5cd3a0068cf6716ebe6fa6f4f4f4
@Override @Override
public void die(DamageSource damageSource) { public void die(DamageSource damageSource) {
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
@@ -930,7 +970,12 @@ public class ServerPlayer extends Player { @@ -889,7 +929,12 @@ public class ServerPlayer extends Player {
this.dropExperience(); this.dropExperience();
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) { if (!event.getKeepInventory()) {

View File

@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null. just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b3a0f4dd651dda29d2064b629da67378c00a6a78..b1111e644f860f40a944fd43ac900db4615a1c5e 100644 index 9fa7dd67ebe5d7d4125e970dbe2e3b201b01f6aa..4968e036350631b79a8c7e70fdc32db4bcff2ade 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -982,9 +982,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -977,9 +977,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Nullable @Nullable
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) { public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
@ -26,5 +26,5 @@ index b3a0f4dd651dda29d2064b629da67378c00a6a78..b1111e644f860f40a944fd43ac900db4
} }
+ // Paper end + // Paper end
// CraftBukkit end // CraftBukkit end
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && !io.papermc.paper.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE));
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Heightmap API
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 be17e1a4afc2fd5490a59aa7bcb199fb61643d35..537e63ff97afc2ae73e25d3699d249a66f13ba16 100644 index 7d9942004b52b4deae7ca09dafb43795d0d9c31d..00267800750ad2a4817b39c9c19a9336aff2299d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -219,6 +219,29 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -219,6 +219,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 10 May 2019 18:38:19 +0100
Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 988820d6041f3784fec9321c7bc08e2e84a52ad5..d1808bf9dc19fad84da5eb3b4c3d549bc624b00a 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -297,7 +297,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Objects.requireNonNull(this.connection);
// CraftBukkit - Don't wait
- minecraftserver.wrapRunnable(networkmanager::handleDisconnection);
+ minecraftserver.scheduleOnMain(networkmanager::handleDisconnection); // Paper
}
protected boolean isSingleplayerOwner() {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
This lets you disable it for some worlds and lower it for others. This lets you disable it for some worlds and lower it for others.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 78465f82b2f3ae2a932b787a489f3d01cc51f5f9..21d7196cdc694a581c8a3232a39e7454c0b30f56 100644 index 8ce9b9444c46956eeace333206eefd3ebca1e0c0..5b274f766e8cf55151ac6499fa1a68b9a0816b57 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -737,30 +737,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -722,30 +722,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
public void prepareLevels(ChunkProgressListener worldloadlistener, ServerLevel worldserver) { public void prepareLevels(ChunkProgressListener worldloadlistener, ServerLevel worldserver) {
@ -53,7 +53,7 @@ index 78465f82b2f3ae2a932b787a489f3d01cc51f5f9..21d7196cdc694a581c8a3232a39e7454
if (true) { if (true) {
ServerLevel worldserver1 = worldserver; ServerLevel worldserver1 = worldserver;
@@ -783,7 +786,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -768,7 +771,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// this.nextTickTime = SystemUtils.getMillis() + 10L; // this.nextTickTime = SystemUtils.getMillis() + 10L;
this.executeModerately(); this.executeModerately();
// CraftBukkit end // CraftBukkit end
@ -63,11 +63,11 @@ index 78465f82b2f3ae2a932b787a489f3d01cc51f5f9..21d7196cdc694a581c8a3232a39e7454
// this.updateMobSpawningFlags(); // this.updateMobSpawningFlags();
worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 986a509998d217228eb1dc2b5815787599e02d6b..773fea9c2c4bef931439b5663471c010d9a1297c 100644 index 6978abb97da6c33099db2e4ead3f33b0ca87bed1..74bddd7f37af06355549128bb0bfc1d7eedd2bb8 100644
--- 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
@@ -1866,12 +1866,84 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1625,12 +1625,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap(); return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap();
} }
+ // Paper start - helper function for configurable spawn radius + // Paper start - helper function for configurable spawn radius
@ -191,10 +191,10 @@ index 4d2348df25410a0b5364eec066880326d6667dad..286aad3205ef8a9e21a47ef07893844f
this.maxCount = i * i; this.maxCount = i * i;
} }
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 537e63ff97afc2ae73e25d3699d249a66f13ba16..e0f38ef295e1958b45fc05395cd4c57194928338 100644 index 00267800750ad2a4817b39c9c19a9336aff2299d..d9d327326f5fbf861f7b8ab6120ca2f2e8c8b360 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1350,15 +1350,21 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1360,15 +1360,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setKeepSpawnInMemory(boolean keepLoaded) { public void setKeepSpawnInMemory(boolean keepLoaded) {

View File

@ -33,7 +33,7 @@ this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored. to a jar with this fix, the data will be restored.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97a55a3358 100644 index 9e65b56fd2d5af6be305efa08e7c569e6598343a..bbf84e05d8c2ac5ad8e3837756421b6bda65f91c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -18,8 +18,12 @@ import java.nio.file.LinkOption; @@ -18,8 +18,12 @@ import java.nio.file.LinkOption;
@ -49,15 +49,15 @@ index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97
import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ChunkPos;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -45,6 +49,7 @@ public class RegionFile implements AutoCloseable { @@ -44,6 +48,7 @@ public class RegionFile implements AutoCloseable {
private final IntBuffer timestamps;
@VisibleForTesting @VisibleForTesting
protected final RegionBitmap usedSectors; protected final RegionBitmap usedSectors;
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
+ public final Path regionFile; // Paper + public final Path regionFile; // Paper
public RegionFile(Path file, Path directory, boolean dsync) throws IOException { public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
@@ -52,6 +57,8 @@ public class RegionFile implements AutoCloseable { @@ -51,6 +56,8 @@ public class RegionFile implements AutoCloseable {
public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException { public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {
this.header = ByteBuffer.allocateDirect(8192); this.header = ByteBuffer.allocateDirect(8192);
@ -66,7 +66,7 @@ index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97
this.usedSectors = new RegionBitmap(); this.usedSectors = new RegionBitmap();
this.version = outputChunkStreamVersion; this.version = outputChunkStreamVersion;
if (!Files.isDirectory(directory, new LinkOption[0])) { if (!Files.isDirectory(directory, new LinkOption[0])) {
@@ -430,6 +437,74 @@ public class RegionFile implements AutoCloseable { @@ -420,6 +427,74 @@ public class RegionFile implements AutoCloseable {
} }
@ -142,21 +142,10 @@ index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97
private final ChunkPos pos; private final ChunkPos pos;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 4c1b1ac36ef09a9cc8da6e8ee71f82d4a67478df..96f129cb13642dc9667464b58c025fa0ed700cfd 100644 index 81710e2853a75a47edd0abf3f5b30f8558b5abcd..e7aa20ec84fcbe74ca2a1a11697e083d713d6a1a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -11,8 +11,10 @@ import java.nio.file.Path; @@ -53,6 +53,71 @@ public final class RegionFileStorage implements AutoCloseable {
import javax.annotation.Nullable;
import net.minecraft.FileUtil;
import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.StreamTagVisitor;
+import net.minecraft.nbt.Tag;
import net.minecraft.util.ExceptionCollector;
import net.minecraft.world.level.ChunkPos;
@@ -120,6 +122,71 @@ public class RegionFileStorage implements AutoCloseable {
} }
} }
@ -203,8 +192,8 @@ index 4c1b1ac36ef09a9cc8da6e8ee71f82d4a67478df..96f129cb13642dc9667464b58c025fa0
+ } + }
+ +
+ private static void mergeChunkList(CompoundTag level, CompoundTag oversizedLevel, String key, String oversizedKey) { + private static void mergeChunkList(CompoundTag level, CompoundTag oversizedLevel, String key, String oversizedKey) {
+ ListTag levelList = level.getList(key, 10); + net.minecraft.nbt.ListTag levelList = level.getList(key, 10);
+ ListTag oversizedList = oversizedLevel.getList(oversizedKey, 10); + net.minecraft.nbt.ListTag oversizedList = oversizedLevel.getList(oversizedKey, 10);
+ +
+ if (!oversizedList.isEmpty()) { + if (!oversizedList.isEmpty()) {
+ levelList.addAll(oversizedList); + levelList.addAll(oversizedList);
@ -212,7 +201,7 @@ index 4c1b1ac36ef09a9cc8da6e8ee71f82d4a67478df..96f129cb13642dc9667464b58c025fa0
+ } + }
+ } + }
+ +
+ private static int getNBTSize(Tag nbtBase) { + private static int getNBTSize(net.minecraft.nbt.Tag nbtBase) {
+ DataOutputStream test = new DataOutputStream(new org.apache.commons.io.output.NullOutputStream()); + DataOutputStream test = new DataOutputStream(new org.apache.commons.io.output.NullOutputStream());
+ try { + try {
+ nbtBase.write(test); + nbtBase.write(test);
@ -228,8 +217,8 @@ index 4c1b1ac36ef09a9cc8da6e8ee71f82d4a67478df..96f129cb13642dc9667464b58c025fa0
@Nullable @Nullable
public CompoundTag read(ChunkPos pos) throws IOException { public CompoundTag read(ChunkPos pos) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@@ -131,6 +198,12 @@ public class RegionFileStorage implements AutoCloseable { @@ -63,6 +128,12 @@ public final class RegionFileStorage implements AutoCloseable {
try { // Paper // CraftBukkit end
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos); DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
+ // Paper start + // Paper start
@ -241,7 +230,7 @@ index 4c1b1ac36ef09a9cc8da6e8ee71f82d4a67478df..96f129cb13642dc9667464b58c025fa0
CompoundTag nbttagcompound; CompoundTag nbttagcompound;
label43: label43:
{ {
@@ -217,6 +290,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -141,6 +212,7 @@ public final class RegionFileStorage implements AutoCloseable {
try { try {
NbtIo.write(nbt, (DataOutput) dataoutputstream); NbtIo.write(nbt, (DataOutput) dataoutputstream);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4926f9f5eaf13b339ce2c2385faf9f4afba3d029..535880a9dc3ccbf8d6f1b185a695011a347bdd88 100644 index 223e43758a009a9f5d97e9e89745bb12f2d72d2f..da2c850b1625758c0bb387930788b6e9f03555d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2746,5 +2746,10 @@ public final class CraftServer implements Server { @@ -2749,5 +2749,10 @@ public final class CraftServer implements Server {
profile.getProperties().putAll(((CraftPlayer)player).getHandle().getGameProfile().getProperties()); profile.getProperties().putAll(((CraftPlayer)player).getHandle().getGameProfile().getProperties());
return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile); return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile);
} }

View File

@ -8,11 +8,11 @@ This patch also adds a chunk status cache on region files (note that
its only purpose is to cache the status on DISK) its only purpose is to cache the status on DISK)
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index af92411006c3d281815b3f4c3de5f0280d3a5901..50a201c08f143117a050305b0dde6873a04efb8b 100644 index 62c36060989acb54eb12a145909a68193c5e3035..a0fba2202b2060694485989094f7e6e4ab94caaa 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -687,9 +687,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1172,9 +1172,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end }
private CompletableFuture<Optional<CompoundTag>> readChunk(ChunkPos chunkPos) { private CompletableFuture<Optional<CompoundTag>> readChunk(ChunkPos chunkPos) {
- return this.read(chunkPos).thenApplyAsync((optional) -> { - return this.read(chunkPos).thenApplyAsync((optional) -> {
@ -28,7 +28,7 @@ index af92411006c3d281815b3f4c3de5f0280d3a5901..50a201c08f143117a050305b0dde6873
} }
// CraftBukkit start // CraftBukkit start
@@ -698,6 +702,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1183,6 +1187,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// CraftBukkit end // CraftBukkit end
} }
@ -93,11 +93,11 @@ index af92411006c3d281815b3f4c3de5f0280d3a5901..50a201c08f143117a050305b0dde6873
// Spigot start // Spigot start
return this.anyPlayerCloseEnoughForSpawning(pos, false); return this.anyPlayerCloseEnoughForSpawning(pos, false);
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fecbad81d77 100644 index bbf84e05d8c2ac5ad8e3837756421b6bda65f91c..13ab2d2d8d0d3ab0facbae8285b09267765cc97d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -51,6 +51,30 @@ public class RegionFile implements AutoCloseable { @@ -50,6 +50,30 @@ public class RegionFile implements AutoCloseable {
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper protected final RegionBitmap usedSectors;
public final Path regionFile; // Paper public final Path regionFile; // Paper
+ // Paper start - Cache chunk status + // Paper start - Cache chunk status
@ -127,7 +127,7 @@ index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fec
public RegionFile(Path file, Path directory, boolean dsync) throws IOException { public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
} }
@@ -398,6 +422,7 @@ public class RegionFile implements AutoCloseable { @@ -397,11 +421,13 @@ public class RegionFile implements AutoCloseable {
return this.getOffset(pos) != 0; return this.getOffset(pos) != 0;
} }
@ -135,19 +135,17 @@ index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fec
private static int getOffsetIndex(ChunkPos pos) { private static int getOffsetIndex(ChunkPos pos) {
return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32; return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32;
} }
@@ -408,6 +433,7 @@ public class RegionFile implements AutoCloseable {
synchronized (this) { public void close() throws IOException {
try {
// Paper end
+ this.closed = true; // Paper + this.closed = true; // Paper
try { try {
this.padToFullSector(); this.padToFullSector();
} finally { } finally {
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 96f129cb13642dc9667464b58c025fa0ed700cfd..29da08c58200c24fd03003937d30eb41234cabc9 100644 index e7aa20ec84fcbe74ca2a1a11697e083d713d6a1a..390569f89b21c375357fb71d7b7730f0ea789545 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -290,6 +290,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -212,6 +212,7 @@ public final class RegionFileStorage implements AutoCloseable {
try { try {
NbtIo.write(nbt, (DataOutput) dataoutputstream); NbtIo.write(nbt, (DataOutput) dataoutputstream);
@ -156,7 +154,7 @@ index 96f129cb13642dc9667464b58c025fa0ed700cfd..29da08c58200c24fd03003937d30eb41
} catch (Throwable throwable) { } catch (Throwable throwable) {
if (dataoutputstream != null) { if (dataoutputstream != null) {
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 e0f38ef295e1958b45fc05395cd4c57194928338..f259f6609cd87a210451ddf4ea00a72718d1efd0 100644 index d9d327326f5fbf861f7b8ab6120ca2f2e8c8b360..b266cd21fec4c48d2fc4676eb30b1bfdaa4acd98 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -307,9 +307,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -307,9 +307,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -185,7 +183,7 @@ index e0f38ef295e1958b45fc05395cd4c57194928338..f259f6609cd87a210451ddf4ea00a727
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} }
@@ -423,20 +437,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -420,20 +434,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean loadChunk(int x, int z, boolean generate) { public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot

View File

@ -17,7 +17,7 @@ This should fully solve all of the issues around it so that only natural
influences natural spawns. influences natural spawns.
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 2503d4691e47083a9d99a38c4ed3f50a2374821a..23d53f3fd524cc4d827dc95ab95367702a110a05 100644 index 9ed7abddf30d298a5abb04974efd1b470d015b09..fe38079d69f3e9987ad5ab077ae09d05017a681a 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -88,6 +88,13 @@ public final class NaturalSpawner { @@ -88,6 +88,13 @@ public final class NaturalSpawner {

View File

@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it
was expired at that point, then it would be null. was expired at that point, then it would be null.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 94a0d17a0339249c1c97e36d6e13b5958cfa2e49..2848e657209a699b12fc0e1fd2bde54d661f07f0 100644 index 3c4224472ce59d7a2c1748d510e4fc8f58a7d5e1..b4ded40387006821433db1de85ed1c2347757155 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -642,8 +642,10 @@ public abstract class PlayerList { @@ -629,8 +629,10 @@ public abstract class PlayerList {
Player player = entity.getBukkitEntity(); Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress()); PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent consuming the wrong itemstack
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 965c5724eb4927f017123c791c4a721c59b6db15..53abf88143206eee03f372cf6471fbfbe519496d 100644 index 0f7f90a6b358402c7a05217f59768448eabfce53..ac59a1e5ae4fe84af44220d721b60f2e157e0f1f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3651,9 +3651,14 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3710,9 +3710,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public void startUsingItem(InteractionHand hand) { public void startUsingItem(InteractionHand hand) {
@ -24,7 +24,7 @@ index 965c5724eb4927f017123c791c4a721c59b6db15..53abf88143206eee03f372cf6471fbfb
this.useItem = itemstack; this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration(); this.useItemRemaining = itemstack.getUseDuration();
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
@@ -3733,6 +3738,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3792,6 +3797,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.releaseUsingItem(); this.releaseUsingItem();
} else { } else {
if (!this.useItem.isEmpty() && this.isUsingItem()) { if (!this.useItem.isEmpty() && this.isUsingItem()) {
@ -32,7 +32,7 @@ index 965c5724eb4927f017123c791c4a721c59b6db15..53abf88143206eee03f372cf6471fbfb
this.triggerItemUseEffects(this.useItem, 16); this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent // CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack; ItemStack itemstack;
@@ -3767,8 +3773,8 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3826,8 +3832,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
this.stopUsingItem(); this.stopUsingItem();

View File

@ -126,7 +126,7 @@ index c887d34171f89c731d76c4ca92c70be2b1edc1e6..df6752b5c77bc88a4fcf1ffe918b24d4
}); });
// Paper end // Paper end
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index 902156477bdfc9917105f1229f760c26e5af302a..58609a0911c4e32b6f80f050cd3d23f70ad75b1b 100644 index 54308f1decc3982f30bf8b7a8a9d8865bfdbb9fd..0fca35ac82a1854260980b7c2664be82033e3bad 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -207,7 +207,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @@ -207,7 +207,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
index 9012a6347b2f061e88c42d3c237c4b465883e941..6b2b34cb129f807af8042e26a5e180d18e195459 100644 index 964fc8615d071d33c821f0c54ac1ebd4884df0cd..dcfc668503c50927b4a4dbb3988d531215d513f8 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
@@ -43,7 +43,8 @@ public class SleepInBed extends Behavior<LivingEntity> { @@ -43,7 +43,8 @@ public class SleepInBed extends Behavior<LivingEntity> {

View File

@ -33,10 +33,10 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love. It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java diff --git a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
index 8f7bf1f0400aeab8b7801d113d244d0716c5eb84..fccb8d7a99bef076838ebefa233f2f00a1364c30 100644 index 95eac2e12a16938d81ab512b00e90c5234b42834..9aea7de906103e4a8dcbcac397cc05ce1abb4aa2 100644
--- a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java --- a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
+++ b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java +++ b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
@@ -74,7 +74,17 @@ public final class ChunkSystem { @@ -224,7 +224,17 @@ public final class ChunkSystem {
} }
public static void onEntityPreAdd(final ServerLevel level, final Entity entity) { public static void onEntityPreAdd(final ServerLevel level, final Entity entity) {
@ -56,10 +56,10 @@ index 8f7bf1f0400aeab8b7801d113d244d0716c5eb84..fccb8d7a99bef076838ebefa233f2f00
public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) { public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 50a201c08f143117a050305b0dde6873a04efb8b..562e45954cc72a253f20e9a9fddf0f179baf3e7b 100644 index a0fba2202b2060694485989094f7e6e4ab94caaa..66046c763872a031c65db17502b33199a40fd093 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -535,6 +535,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -870,6 +870,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.discard(); entity.discard();
needsRemoval = true; needsRemoval = true;
} }
@ -67,8 +67,8 @@ index 50a201c08f143117a050305b0dde6873a04efb8b..562e45954cc72a253f20e9a9fddf0f17
return !needsRemoval; return !needsRemoval;
})); }));
// CraftBukkit end // CraftBukkit end
@@ -546,6 +547,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -920,6 +921,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
throw new UnsupportedOperationException(); // Paper - rewrite chunk system });
} }
+ // Paper start + // Paper start
@ -115,5 +115,5 @@ index 50a201c08f143117a050305b0dde6873a04efb8b..562e45954cc72a253f20e9a9fddf0f17
+ } + }
+ // Paper end + // Paper end
public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) { public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) {
throw new UnsupportedOperationException(); // Paper - rewrite chunk system CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(holder, 1, (i) -> {
} return ChunkStatus.FULL;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 3ebb5cd3a0068cf6716ebe6fa6f4f4f4a1d58d08..4aea5b2e36f5cd6f9b076f9a225a391211ec0c25 100644 index e66d24174d5834cb9526fa4a238d0765bef827b2..394f2b87010454ff2e4898f3ee5085c68d91952a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -967,7 +967,7 @@ public class ServerPlayer extends Player { @@ -926,7 +926,7 @@ public class ServerPlayer extends Player {
this.tellNeutralMobsThatIDied(); this.tellNeutralMobsThatIDied();
} }
// SPIGOT-5478 must be called manually now // SPIGOT-5478 must be called manually now

View File

@ -6,12 +6,12 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players Use the PlayerList map instead of iterating over all players
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 773fea9c2c4bef931439b5663471c010d9a1297c..0efc377743e93a0120843cab192753d037e88a73 100644 index 74bddd7f37af06355549128bb0bfc1d7eedd2bb8..0b928a1cf86de9c83fd50472226be48443ed65a6 100644
--- 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
@@ -550,6 +550,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -326,6 +326,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
} }
// Paper end
+ // Paper start - optimise getPlayerByUUID + // Paper start - optimise getPlayerByUUID
+ @Nullable + @Nullable

View File

@ -28,10 +28,10 @@ index fda34d93a5b75919c840d3bc0efa0651e5eb4843..cecd7bd4a6dd66cfb2d632a232ff469e
float f1 = 0.98F; float f1 = 0.98F;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 1d9ce6dae17ff572d4528971c69c63d0f85b313c..305d9772f2af22e8bdf73235cdb15ea01ac2c3b3 100644 index d9149580408094784794bc0575a00bebe2e7b4d4..5d470b424d52ae402ec0e950263ad54cf6f7e3ef 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -257,7 +257,7 @@ public class ActivationRange @@ -251,7 +251,7 @@ public class ActivationRange
isActive = true; isActive = true;
} }
// Add a little performance juice to active entities. Skip 1/4 if not immune. // Add a little performance juice to active entities. Skip 1/4 if not immune.

View File

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 10 May 2019 18:38:19 +0100
Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 593f017a43153c081f007073926fa4f520bded00..732238a60dacd83b6572f6f79763f112e5fe9611 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -517,7 +517,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Objects.requireNonNull(this.connection);
// CraftBukkit - Don't wait
- minecraftserver.wrapRunnable(networkmanager::handleDisconnection);
+ minecraftserver.scheduleOnMain(networkmanager::handleDisconnection); // Paper
}
private <T, R> CompletableFuture<R> filterTextPacket(T text, BiFunction<TextFilter, T, CompletableFuture<R>> filterer) {