clean up view distance api diff

This commit is contained in:
Jake Potrebic 2022-02-28 19:00:17 -08:00 committed by Jason Penilla
parent fd7432601d
commit 5071d50207
No known key found for this signature in database
GPG Key ID: 0E75A301420E48F8
25 changed files with 131 additions and 115 deletions

View File

@ -18,20 +18,25 @@ index e3e9f082102d16a8e16df3b35772430c6d102243..ba0fc93333fbe3ef1d9677de42f00648
+ public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder + public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder
} }
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 5963fa56e7dcd61336a14fa1035c6c14143989ad..48812a4fe0c12689dd9d7829019cdf70e0bda65b 100644 index 5963fa56e7dcd61336a14fa1035c6c14143989ad..4c2aad1db5a4f82e5fa5c187cb58e8c675b4d697 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
@@ -1831,6 +1831,31 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1832,6 +1832,37 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public int getSimulationDistance() {
return world.spigotConfig.simulationDistance; return world.spigotConfig.simulationDistance;
} }
+ // Spigot end
+ // Paper start - view distance api
+ @Override + @Override
+ public void setViewDistance(int viewDistance) { + public void setViewDistance(int viewDistance) {
+ throw new UnsupportedOperationException(); //TODO + throw new UnsupportedOperationException(); //TODO
+ } + }
+ +
+ @Override + @Override
+ public void setSimulationDistance(int simulationDistance) {
+ throw new UnsupportedOperationException(); //TODO
+ }
+
+ @Override
+ public int getNoTickViewDistance() { + public int getNoTickViewDistance() {
+ throw new UnsupportedOperationException(); //TODO + throw new UnsupportedOperationException(); //TODO
+ } + }
@ -50,14 +55,15 @@ index 5963fa56e7dcd61336a14fa1035c6c14143989ad..48812a4fe0c12689dd9d7829019cdf70
+ public void setSendViewDistance(int viewDistance) { + public void setSendViewDistance(int viewDistance) {
+ throw new UnsupportedOperationException(); //TODO + throw new UnsupportedOperationException(); //TODO
+ } + }
// Spigot end + // Paper end - view distance api
// Spigot start // Spigot start
private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9357440824bf8b125d08c6c785e71c9b1ac95ae4..fe27669d525c84d9f8d828dfcde1c35e3ecb7a49 100644 index 9357440824bf8b125d08c6c785e71c9b1ac95ae4..ea80d73cf2f5703579dba6f331d9a29d310570f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -389,6 +389,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -389,6 +389,46 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message); connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
} }
} }
@ -73,6 +79,16 @@ index 9357440824bf8b125d08c6c785e71c9b1ac95ae4..fe27669d525c84d9f8d828dfcde1c35e
+ } + }
+ +
+ @Override + @Override
+ public int getSimulationDistance() {
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ }
+
+ @Override
+ public void setSimulationDistance(int simulationDistance) {
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ }
+
+ @Override
+ public int getNoTickViewDistance() { + public int getNoTickViewDistance() {
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO + throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ } + }

View File

@ -30,10 +30,10 @@ index c248b66486044150c64eaddbef85fa6644494212..ada624b5f58381122e59568c2087cf38
+ } + }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 523746b698d38494f0fa76b026d50e3d9d411c54..924260ec220f2f1abfb4383a9787ebad3a25bef1 100644 index 81b5c2c0df4944732c99aaee3b325f6c7052ad99..44d732b3f17c4848f5ce99f3120f87dd9fe2b6c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -930,7 +930,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -940,7 +940,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (fromWorld == toWorld) { if (fromWorld == toWorld) {
entity.connection.teleport(to); entity.connection.teleport(to);
} else { } else {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Complete resource pack API
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 28c4e16e202876e58447b1f766619e3cee329aaa..8125b2d736594018e89bb3be32262f5e1e8791d5 100644 index 6f99b1b54fe893240143282563cb59e6c9cd4122..0429a019d8f25dc9df6c3a9d7e28eea739431a71 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
@@ -1653,8 +1653,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1653,8 +1653,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -23,7 +23,7 @@ index 28c4e16e202876e58447b1f766619e3cee329aaa..8125b2d736594018e89bb3be32262f5e
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 924260ec220f2f1abfb4383a9787ebad3a25bef1..a29c20dddb1732a46c05e9ca2386b384b782adab 100644 index 44d732b3f17c4848f5ce99f3120f87dd9fe2b6c0..ccf555c97ee9364c965c5194939602f91d46043f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -139,6 +139,7 @@ import org.bukkit.plugin.Plugin; @@ -139,6 +139,7 @@ import org.bukkit.plugin.Plugin;
@ -45,7 +45,7 @@ index 924260ec220f2f1abfb4383a9787ebad3a25bef1..a29c20dddb1732a46c05e9ca2386b384
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity); super(server, entity);
@@ -2007,6 +2012,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2017,6 +2022,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public boolean getAffectsSpawning() { public boolean getAffectsSpawning() {
return this.getHandle().affectsSpawning; return this.getHandle().affectsSpawning;
} }

View File

@ -44,10 +44,10 @@ index f364978ff256aecb078cca2b6c3fd433d9a4820b..5f7a16651a0ca5497b20d8723e9c1705
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a29c20dddb1732a46c05e9ca2386b384b782adab..816c39c3ce9ec980cda43b05d040b8da85e9c1f3 100644 index ccf555c97ee9364c965c5194939602f91d46043f..af277ce2e2d2baff298dffd4b0f9d2ee146b3c9a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1812,6 +1812,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1822,6 +1822,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setRealHealth(double health) { public void setRealHealth(double health) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Workaround for setting passengers on players
SPIGOT-1915 & GH-114 SPIGOT-1915 & GH-114
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 816c39c3ce9ec980cda43b05d040b8da85e9c1f3..e168bc5a3a3dcab404023ebe16ea90e380d6b38c 100644 index af277ce2e2d2baff298dffd4b0f9d2ee146b3c9a..796060044c0b8e479e93a35de886b31aab24e1b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -940,6 +940,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -950,6 +950,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return true; return true;
} }

View File

@ -10,10 +10,10 @@ of giving the player experience points.
Both an API To standalone mend, and apply mending logic to .giveExp has been added. Both an API To standalone mend, and apply mending logic to .giveExp has been added.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5cd36bb3b83cd553bc16f5f24f7ece07d5003ff9..6eaf970663bf5de9ea30db879e135c5e06238b41 100644 index 8d439a7e901eb18e6e9b606ad71d9fd487743217..3ecdbf91807f915529e608699c80057012d2e8fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1256,7 +1256,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1266,7 +1266,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
@Override @Override

View File

@ -24,7 +24,7 @@ index d3462cdc5eee37cedbff80f35d5b9c51e8dcd1da..5ebc450432805d52457b9f8ff1e2b198
playerName = gameProfile.getName(); playerName = gameProfile.getName();
uniqueId = gameProfile.getId(); uniqueId = gameProfile.getId();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6eaf970663bf5de9ea30db879e135c5e06238b41..0895b09a6fa52697ad36b6de84bc3ba3c6ceef3a 100644 index 3ecdbf91807f915529e608699c80057012d2e8fe..212ad1986c5c2bdcac48cc53463834f6fea32f1e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -72,6 +72,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; @@ -72,6 +72,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
@ -47,7 +47,7 @@ index 6eaf970663bf5de9ea30db879e135c5e06238b41..0895b09a6fa52697ad36b6de84bc3ba3
@Override @Override
public InetSocketAddress getAddress() { public InetSocketAddress getAddress() {
if (this.getHandle().connection == null) return null; if (this.getHandle().connection == null) return null;
@@ -1389,8 +1385,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1399,8 +1395,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.hiddenEntities.put(entity.getUniqueId(), hidingPlugins); this.hiddenEntities.put(entity.getUniqueId(), hidingPlugins);
// Remove this entity from the hidden player's EntityTrackerEntry // Remove this entity from the hidden player's EntityTrackerEntry
@ -64,7 +64,7 @@ index 6eaf970663bf5de9ea30db879e135c5e06238b41..0895b09a6fa52697ad36b6de84bc3ba3
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
if (entry != null) { if (entry != null) {
entry.removePlayer(this.getHandle()); entry.removePlayer(this.getHandle());
@@ -1403,8 +1406,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1413,8 +1416,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, otherPlayer)); this.getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, otherPlayer));
} }
} }
@ -73,7 +73,7 @@ index 6eaf970663bf5de9ea30db879e135c5e06238b41..0895b09a6fa52697ad36b6de84bc3ba3
} }
@Override @Override
@@ -1441,8 +1442,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1451,8 +1452,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
this.hiddenEntities.remove(entity.getUniqueId()); this.hiddenEntities.remove(entity.getUniqueId());
@ -90,7 +90,7 @@ index 6eaf970663bf5de9ea30db879e135c5e06238b41..0895b09a6fa52697ad36b6de84bc3ba3
if (other instanceof ServerPlayer) { if (other instanceof ServerPlayer) {
ServerPlayer otherPlayer = (ServerPlayer) other; ServerPlayer otherPlayer = (ServerPlayer) other;
@@ -1453,9 +1461,51 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1463,9 +1471,51 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) { if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) {
entry.updatePlayer(this.getHandle()); entry.updatePlayer(this.getHandle());
} }

View File

@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk. provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e1d81be0a7ad66fc77c89563fd4e814ce80e24a7..09c9d6bf9000bbdbded2cfa4a949ffca34672481 100644 index 212ad1986c5c2bdcac48cc53463834f6fea32f1e..f5ac3bcc24e9719b02d6b4150daf6e2fed178ead 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -160,6 +160,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -160,6 +160,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -20,7 +20,7 @@ index e1d81be0a7ad66fc77c89563fd4e814ce80e24a7..09c9d6bf9000bbdbded2cfa4a949ffca
// Paper end // Paper end
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
@@ -1705,7 +1706,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1715,7 +1716,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end // Paper end
public void addChannel(String channel) { public void addChannel(String channel) {

View File

@ -75,7 +75,7 @@ index 7f2d96722d3f835980ee841a285a585938acfe1a..005856931c27d4e2dbffec65ae591917
this.doCloseContainer(); this.doCloseContainer();
} }
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 9854706d1645a5c04e7ba636cf6f139b1ac4c453..1be8c731ab7019a2f93d0b32facbe05fb23371d2 100644 index a0d7f02bf8765733521fa144c80cf48c6593f91c..b280cb3250928367efa02cd1d9ce1607e6fb547d 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
@@ -188,6 +188,7 @@ import org.bukkit.event.inventory.ClickType; @@ -188,6 +188,7 @@ import org.bukkit.event.inventory.ClickType;
@ -174,10 +174,10 @@ index c0ed3dd9ebcaf710d202ae8b38007e6a1f20b57e..adfbc156b4c4a8591609f385adaa6b04
@Override @Override
public boolean isBlocking() { public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 09c9d6bf9000bbdbded2cfa4a949ffca34672481..dd33f7fe76686855d52eaf5ba9b9f1ef9d7d1d15 100644 index f5ac3bcc24e9719b02d6b4150daf6e2fed178ead..5897b067797af48a6c643c3a3db7d4b12ec6822f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -959,7 +959,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -969,7 +969,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory // Close any foreign inventory
if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) { if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index dd33f7fe76686855d52eaf5ba9b9f1ef9d7d1d15..83123b1609d7643b818da8adf11edb4f17b30de3 100644 index 5897b067797af48a6c643c3a3db7d4b12ec6822f..f2fcfc12f4efd3317f3d6540f3b73f028b66d5ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2402,6 +2402,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2412,6 +2412,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.adventure$pointers; return this.adventure$pointers;
} }

View File

@ -308,10 +308,10 @@ index 91cf7728aee475cb36f2c02bbfb7e3d2e0d00576..a3a900d10440ed5ebe24370a77ccb6ca
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 83123b1609d7643b818da8adf11edb4f17b30de3..3fc1c400100a87e576052c6d977c8ce1659f7582 100644 index f2fcfc12f4efd3317f3d6540f3b73f028b66d5ee..e6ddc55261c4feccccf476b925e85e67970f4c62 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1965,7 +1965,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1975,7 +1975,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void sendHealthUpdate() { public void sendHealthUpdate() {

View File

@ -106,7 +106,7 @@ index f6665825e62a0cd912e6b06df6d68795596486f0..1f2bc88d4570c6ef00e67a772b745e0b
public Location getBedSpawnLocation() { public Location getBedSpawnLocation() {
CompoundTag data = this.getData(); CompoundTag data = this.getData();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3fc1c400100a87e576052c6d977c8ce1659f7582..a270e5a65d599c3200a4e6d8ca74db991068081e 100644 index e6ddc55261c4feccccf476b925e85e67970f4c62..48dd4649b9ea92bb3fb1fa250d1dc0dd45e32e9a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -161,6 +161,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -161,6 +161,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -117,7 +117,7 @@ index 3fc1c400100a87e576052c6d977c8ce1659f7582..a270e5a65d599c3200a4e6d8ca74db99
// Paper end // Paper end
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
@@ -1577,6 +1578,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1587,6 +1588,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.firstPlayed = firstPlayed; this.firstPlayed = firstPlayed;
} }
@ -136,7 +136,7 @@ index 3fc1c400100a87e576052c6d977c8ce1659f7582..a270e5a65d599c3200a4e6d8ca74db99
public void readExtraData(CompoundTag nbttagcompound) { public void readExtraData(CompoundTag nbttagcompound) {
this.hasPlayedBefore = true; this.hasPlayedBefore = true;
if (nbttagcompound.contains("bukkit")) { if (nbttagcompound.contains("bukkit")) {
@@ -1599,6 +1612,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1609,6 +1622,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setExtraData(CompoundTag nbttagcompound) { public void setExtraData(CompoundTag nbttagcompound) {
@ -145,7 +145,7 @@ index 3fc1c400100a87e576052c6d977c8ce1659f7582..a270e5a65d599c3200a4e6d8ca74db99
if (!nbttagcompound.contains("bukkit")) { if (!nbttagcompound.contains("bukkit")) {
nbttagcompound.put("bukkit", new CompoundTag()); nbttagcompound.put("bukkit", new CompoundTag());
} }
@@ -1613,6 +1628,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1623,6 +1638,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.putLong("firstPlayed", this.getFirstPlayed()); data.putLong("firstPlayed", this.getFirstPlayed());
data.putLong("lastPlayed", System.currentTimeMillis()); data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName()); data.putString("lastKnownName", handle.getScoreboardName());

View File

@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far. be unintentional in the few cases we've seen so far.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a270e5a65d599c3200a4e6d8ca74db991068081e..42062d64b7ea55f5360c435ef1953452d439029b 100644 index 48dd4649b9ea92bb3fb1fa250d1dc0dd45e32e9a..ba9262a610776cfadda6ac0fda007066c2d485b1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2449,6 +2449,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2459,6 +2459,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetCooldown() { public void resetCooldown() {
getHandle().resetAttackStrengthTicker(); getHandle().resetAttackStrengthTicker();
} }

View File

@ -97,10 +97,10 @@ index 9b3f8b6ff7a2522e74bdbc914e35d566ab9c7697..e800229c294a04581c863349119f6727
if (getMainArm() != packet.mainHand()) { if (getMainArm() != packet.mainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index dd77e9215c8e05e220520d5a0e2c3d1da93be054..7c406649f112e1b449d07d180c7f2d63b170f2ed 100644 index ba9262a610776cfadda6ac0fda007066c2d485b1..b2785384d5f6d55a3a03525d7759e1616e2fb1f8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -551,6 +551,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -561,6 +561,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setSendViewDistance(int viewDistance) { public void setSendViewDistance(int viewDistance) {
throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
} }

View File

@ -23,7 +23,7 @@ Chunks in front of the player have higher priority, to help with
fast traveling players keep up with their movement. fast traveling players keep up with their movement.
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
index abf62796cfbfa61392b0776b28eb6bfc284053c1..4c78ad72e7e788fbc0c57834a2c89bfa70e1f872 100644 index 80c785eb503dc36d381f114a4eccffc1a81071f7..311a01d3590dabc7a4e41bb3493cd7ff228a515c 100644
--- a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java --- a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
@@ -106,7 +106,7 @@ public final class ChunkTaskManager { @@ -106,7 +106,7 @@ public final class ChunkTaskManager {
@ -360,7 +360,7 @@ index 05d2790b80a6d2e1dc6b8d2375f783be4eff2343..6ba7e2713452c4c6f48a1a825ef27b50
return this.isEntityTickingReady; return this.isEntityTickingReady;
} }
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 36181d03c44f2ee4a129129b6fe253f25748af2d..679306d4b4607954fe1d68c9bede6e37b408d399 100644 index b1093b728f09a8b1235d27563004de3ff0fbe911..549facfa3e154fa1b1d3eeb4b6127d3bb75b5f8b 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
@@ -131,6 +131,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -131,6 +131,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -529,7 +529,7 @@ index 36181d03c44f2ee4a129129b6fe253f25748af2d..679306d4b4607954fe1d68c9bede6e37
} }
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index d6bb8610de3c2e468c964f131564e54b392534f1..005d75c93387a8c34a9ff7413ba09cb1ae788a74 100644 index 211566dada0f820af331695b4c62035b89f25a53..d2865ce0523b74aaa935db72c6f3478894e13408 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java --- a/src/main/java/net/minecraft/server/level/DistanceManager.java
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
@@ -128,6 +128,7 @@ public abstract class DistanceManager { @@ -128,6 +128,7 @@ public abstract class DistanceManager {
@ -1135,7 +1135,7 @@ index aa9d32a4c86aade43f91c78ae1179119d12e9a88..d5e5e0a80c1a3dd5823e9975062856b6
if (updatingChunk != null) { if (updatingChunk != null) {
return updatingChunk.getEntityTickingChunkFuture(); return updatingChunk.getEntityTickingChunkFuture();
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 85c818c6c4a56065699de9f4675240de54a5a1df..5ec5e5256e81e1cb61897f3c6f63f482a56a92d9 100644 index eac485db587eba68ab0d05ac5bfd07fb20c0e766..2df33172415c8da39b9f299027cd86d2ce7c6890 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
@@ -231,7 +231,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i @@ -231,7 +231,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
@ -1177,7 +1177,7 @@ index bf4e03237225058efc63e23ac3ddb49c339b9f08..937ff5dfb9d2950b80eff57dde272225
org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved()); org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved());
server.getPluginManager().callEvent(unloadEvent); server.getPluginManager().callEvent(unloadEvent);
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 7bb753f498b10be32726771250dca7e15338d8d1..3741dc458bf78be17144528ef041484863ef53ec 100644 index a5c335715a25dc154682e38a49ff308f30b41216..220db41f348437ae2d703ebae883e882804e6797 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
@@ -1992,6 +1992,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1992,6 +1992,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -1194,10 +1194,10 @@ index 7bb753f498b10be32726771250dca7e15338d8d1..3741dc458bf78be17144528ef0414848
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null); net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null);
if (chunk != null) addTicket(x, z); // Paper if (chunk != null) addTicket(x, z); // Paper
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7c406649f112e1b449d07d180c7f2d63b170f2ed..199e0635f4d1ba247624131e8c9fac8b06754c51 100644 index b2785384d5f6d55a3a03525d7759e1616e2fb1f8..1d2d1c69b6f198abb5555c95f8def7f6233943d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -927,6 +927,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -937,6 +937,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead."); throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
} }

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to
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 3741dc458bf78be17144528ef041484863ef53ec..6bd208485b8d7d4fb2eb80811304dfa626c95dfe 100644 index 220db41f348437ae2d703ebae883e882804e6797..84607e4d2b22bc0c5df762fddb556eab7c06de23 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
@@ -2081,6 +2081,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2087,6 +2087,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() ); lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );
lightning.visualOnly = true; lightning.visualOnly = true;
lightning.isSilent = isSilent; lightning.isSilent = isSilent;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
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 67ac85c5d9222f6ccbf5fed0f06c7b62e16c5e7b..b0b715660d17751d4bc6c8d23dc288ca246608ec 100644 index baa80ce55e815b179fcf55b3cda3f59d3efe1354..4b6f6bf8c79f2d496218ab02833c25242beb1067 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
@@ -38,6 +38,7 @@ import net.minecraft.nbt.CompoundTag; @@ -38,6 +38,7 @@ import net.minecraft.nbt.CompoundTag;
@ -64,10 +64,10 @@ index 67ac85c5d9222f6ccbf5fed0f06c7b62e16c5e7b..b0b715660d17751d4bc6c8d23dc288ca
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6ae1b3e95783a0692a72a3754edb1850cd2dc83a..faa942e08d7614755824329b2c8eba7ba7cbcbc5 100644 index 1d2d1c69b6f198abb5555c95f8def7f6233943d7..efb4abdbc914b00ed233bd7bfbee1be3028d0479 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2593,6 +2593,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2603,6 +2603,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end // Paper end
}; };

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index faa942e08d7614755824329b2c8eba7ba7cbcbc5..6a5813e56ba06be7b8dbebd6d23c373bd4b5dfe6 100644 index efb4abdbc914b00ed233bd7bfbee1be3028d0479..4e77e1aefc14d202505637c624b40e27fd9a290a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -569,6 +569,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -579,6 +579,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
throw new RuntimeException("Unknown settings type"); throw new RuntimeException("Unknown settings type");
} }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6a5813e56ba06be7b8dbebd6d23c373bd4b5dfe6..f3665156fcd4058f630ae814de658f5e9d5b4e14 100644 index 4e77e1aefc14d202505637c624b40e27fd9a290a..a0a6b33f533ff48534ee447ef780922ca67a7561 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2164,7 +2164,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2174,7 +2174,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (data != null && !particle.getDataType().isInstance(data)) { if (data != null && !particle.getDataType().isInstance(data)) {
throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass()); throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass());
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add sendOpLevel API
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 f4e74b0bc3d192d7f7c2bc1dbfef92a28863a57c..b7f3be857d9ffb166e99f20753dbc671bb3b5451 100644 index f0e2f637d443db71bd9df26cebb0f02c3e1ae85f..64b8d76642e8bbcdc685ea30d95a83adffca1bbc 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
@@ -1123,6 +1123,11 @@ public abstract class PlayerList { @@ -1123,6 +1123,11 @@ public abstract class PlayerList {
@ -32,10 +32,10 @@ index f4e74b0bc3d192d7f7c2bc1dbfef92a28863a57c..b7f3be857d9ffb166e99f20753dbc671
// Paper start // Paper start
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f3665156fcd4058f630ae814de658f5e9d5b4e14..502af6311d8ca28f0c1af30ebf65d159eb13b505 100644 index a0a6b33f533ff48534ee447ef780922ca67a7561..d185304572b76f4aa427f51e888afd08f72bb30e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -583,6 +583,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -593,6 +593,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
? (org.bukkit.entity.Firework) entity.getBukkitEntity() ? (org.bukkit.entity.Firework) entity.getBukkitEntity()
: null; : null;
} }

View File

@ -126,7 +126,7 @@ index f97d97426144527cff9ebb91b26fe8541a9c6d9b..b6eef41079120fffd63f06f681378b1b
} }
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 1083e5c23065f9bf5e2edd1e16fd80366ab931f8..43f2fc30b4a7d5b05d3c9399eda1d3fc69469e8f 100644 index 6764cfef07169db97662177837aa7815f7346a5d..1dce75b762c2b9134819bcd66d14fc07826dc48f 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
@@ -2506,7 +2506,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2506,7 +2506,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -139,10 +139,10 @@ index 1083e5c23065f9bf5e2edd1e16fd80366ab931f8..43f2fc30b4a7d5b05d3c9399eda1d3fc
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 502af6311d8ca28f0c1af30ebf65d159eb13b505..b542df24792f3fecb7b017db46555d38cacce15d 100644 index d185304572b76f4aa427f51e888afd08f72bb30e..1acc475774dd50fbfbf68fff4675b9e1e31bbf2a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1287,7 +1287,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1297,7 +1297,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new IllegalArgumentException("Mode cannot be null"); throw new IllegalArgumentException("Mode cannot be null");
} }

View File

@ -67,7 +67,7 @@ index ec202a84a37acf2c58492380789a24b31032dc40..55bdc0abb1fe42c02479678c3840d1d4
this.respawnPosition = pos; this.respawnPosition = pos;
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 ebd416bbaea3fe10aa6812599624cebf7a2bd901..0c2d1a8feb15bc2bc6ce2674b24222d5c501cd18 100644 index 88820ba073e89638304b26e52a39a426f76fb2e9..81957d99205fcee40752914180f9f4a1158a613f 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
@@ -895,7 +895,7 @@ public abstract class PlayerList { @@ -895,7 +895,7 @@ public abstract class PlayerList {
@ -93,10 +93,10 @@ index d620f559cdd1bd0e161a99123ef6c6f64e3302df..07e893f1859abe3c2a765694c21309d6
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9dbcd27b5e4a53fdbd73b1558b6e984ffe43bb63..897459cb9c4bbf17378a181450199a90174ac4a2 100644 index 61c1fdbdd3de1862238bc8e78dff90e5faf7786c..2e2d637d2943f22983bde7011f41f41a3500e7b1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1107,9 +1107,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1117,9 +1117,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setBedSpawnLocation(Location location, boolean override) { public void setBedSpawnLocation(Location location, boolean override) {
if (location == null) { if (location == null) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add player health update API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 897459cb9c4bbf17378a181450199a90174ac4a2..7474e607680be7203c87e15550515110d526df68 100644 index 2e2d637d2943f22983bde7011f41f41a3500e7b1..af439e9e9572d5cda81792f89a7bb3eb506a8c72 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2043,9 +2043,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2053,9 +2053,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().maxHealthCache = getMaxHealth(); this.getHandle().maxHealthCache = getMaxHealth();
} }
@ -22,7 +22,7 @@ index 897459cb9c4bbf17378a181450199a90174ac4a2..7474e607680be7203c87e15550515110
if (this.getHandle().queueHealthUpdatePacket) { if (this.getHandle().queueHealthUpdatePacket) {
this.getHandle().queuedHealthUpdatePacket = packet; this.getHandle().queuedHealthUpdatePacket = packet;
} else { } else {
@@ -2053,7 +2055,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2063,7 +2065,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper end // Paper end
} }

View File

@ -25,7 +25,7 @@ index 82ea4fabd5732052a286d50bcff8bbcc2c4aa7d7..652bea6868a03a5315965f79c76172fb
public void write(FriendlyByteBuf buf) { public void write(FriendlyByteBuf buf) {
buf.writeLong(this.sectionPos.asLong()); buf.writeLong(this.sectionPos.asLong());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c5112cf56bba523dd6ff5595e09977125275614c..a00f65bd14d242ead4d6460e0cc912a54ea58e63 100644 index af439e9e9572d5cda81792f89a7bb3eb506a8c72..087a91ff9c564ad8a137f268331b0e198194b19b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -30,6 +30,7 @@ import javax.annotation.Nullable; @@ -30,6 +30,7 @@ import javax.annotation.Nullable;
@ -36,7 +36,7 @@ index c5112cf56bba523dd6ff5595e09977125275614c..a00f65bd14d242ead4d6460e0cc912a5
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.ChatType;
@@ -840,6 +841,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -850,6 +851,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(packet); this.getHandle().connection.send(packet);
} }

View File

@ -2098,10 +2098,10 @@ index a141071966428315484480831a58f02a2b0bc025..d4ce71d98c5071cd3567c772a0853ca8
@Nullable @Nullable
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 2e8e066ca3f57cfb9d11cbc620d038cea9dd2b64..f20a6d82ac983f7c0239fb9daff8f726c4bed0dd 100644 index 7e8be67b85fc28ecf9d27241e1a7157b976885a5..a3ddeb9862bc87294c215dc906cd8cca8f699b62 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
@@ -2218,37 +2218,55 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2218,43 +2218,56 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Spigot start // Spigot start
@Override @Override
public int getViewDistance() { public int getViewDistance() {
@ -2114,7 +2114,8 @@ index 2e8e066ca3f57cfb9d11cbc620d038cea9dd2b64..f20a6d82ac983f7c0239fb9daff8f726
- return world.spigotConfig.simulationDistance; - return world.spigotConfig.simulationDistance;
+ return getHandle().getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(); // Paper - replace old player chunk management + return getHandle().getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(); // Paper - replace old player chunk management
} }
// Spigot end
// Paper start - view distance api
@Override @Override
public void setViewDistance(int viewDistance) { public void setViewDistance(int viewDistance) {
- throw new UnsupportedOperationException(); //TODO - throw new UnsupportedOperationException(); //TODO
@ -2125,11 +2126,12 @@ index 2e8e066ca3f57cfb9d11cbc620d038cea9dd2b64..f20a6d82ac983f7c0239fb9daff8f726
+ net.minecraft.server.level.ChunkMap chunkMap = getHandle().getChunkSource().chunkMap; + net.minecraft.server.level.ChunkMap chunkMap = getHandle().getChunkSource().chunkMap;
+ chunkMap.setViewDistance(viewDistance); + chunkMap.setViewDistance(viewDistance);
+ // Paper end - replace old player chunk management + // Paper end - replace old player chunk management
+ } }
+
+ // Paper start - replace old player chunk management + // Paper start - replace old player chunk management
+ @Override @Override
+ public void setSimulationDistance(int simulationDistance) { public void setSimulationDistance(int simulationDistance) {
- throw new UnsupportedOperationException(); //TODO
+ // Paper start - replace old player chunk management + // Paper start - replace old player chunk management
+ if (simulationDistance < 2 || simulationDistance > 32) { + if (simulationDistance < 2 || simulationDistance > 32) {
+ throw new IllegalArgumentException("Simulation distance " + simulationDistance + " is out of range of [2, 32]"); + throw new IllegalArgumentException("Simulation distance " + simulationDistance + " is out of range of [2, 32]");
@ -2162,40 +2164,61 @@ index 2e8e066ca3f57cfb9d11cbc620d038cea9dd2b64..f20a6d82ac983f7c0239fb9daff8f726
- throw new UnsupportedOperationException(); //TODO - throw new UnsupportedOperationException(); //TODO
+ getHandle().getChunkSource().chunkMap.playerChunkManager.setSendDistance(viewDistance); // Paper - replace old player chunk management + getHandle().getChunkSource().chunkMap.playerChunkManager.setSendDistance(viewDistance); // Paper - replace old player chunk management
} }
// Spigot end // Paper end - view distance api
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a00f65bd14d242ead4d6460e0cc912a54ea58e63..4e20735837d1b854f3a605d2cf2cf1159fc6b3b4 100644 index 087a91ff9c564ad8a137f268331b0e198194b19b..603e9234294c01f1cde4bfc0b0053e69b99861d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -528,35 +528,80 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -528,45 +528,80 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
} }
+ // Paper start - implement view distances + // Paper start - implement view distances
@Override @Override
- public int getViewDistance() { public int getViewDistance() {
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO - throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ public int getSendViewDistance() {
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap; + net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle()); + io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) { + if (data == null) {
+ return chunkMap.playerChunkManager.getTargetSendDistance(); + return chunkMap.playerChunkManager.getTargetNoTickViewDistance();
+ } + }
+ return data.getTargetSendViewDistance(); + return data.getTargetNoTickViewDistance();
} }
@Override @Override
- public void setViewDistance(int viewDistance) { public void setViewDistance(int viewDistance) {
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO - throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ public void setSendViewDistance(int viewDistance) {
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap; + net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle()); + io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) { + if (data == null) {
+ throw new IllegalStateException("Player is not attached to world"); + throw new IllegalStateException("Player is not attached to world");
+ } + }
+ +
+ data.setTargetSendViewDistance(viewDistance); + data.setTargetNoTickViewDistance(viewDistance);
}
@Override
public int getSimulationDistance() {
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) {
+ return chunkMap.playerChunkManager.getTargetTickViewDistance();
+ }
+ return data.getTargetTickViewDistance();
}
@Override
public void setSimulationDistance(int simulationDistance) {
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) {
+ throw new IllegalStateException("Player is not attached to world");
+ }
+
+ data.setTargetTickViewDistance(simulationDistance);
} }
@Override @Override
@ -2211,49 +2234,26 @@ index a00f65bd14d242ead4d6460e0cc912a54ea58e63..4e20735837d1b854f3a605d2cf2cf115
} }
@Override @Override
- public int getSendViewDistance() { public int getSendViewDistance() {
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO - throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ public int getViewDistance() {
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap; + net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle()); + io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) { + if (data == null) {
+ return chunkMap.playerChunkManager.getTargetNoTickViewDistance(); + return chunkMap.playerChunkManager.getTargetSendDistance();
+ } + }
+ return data.getTargetNoTickViewDistance(); + return data.getTargetSendViewDistance();
} }
@Override @Override
- public void setSendViewDistance(int viewDistance) { public void setSendViewDistance(int viewDistance) {
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO - throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ public void setViewDistance(int viewDistance) {
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap; + net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle()); + io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) { + if (data == null) {
+ throw new IllegalStateException("Player is not attached to world"); + throw new IllegalStateException("Player is not attached to world");
+ } + }
+ +
+ data.setTargetNoTickViewDistance(viewDistance); + data.setTargetSendViewDistance(viewDistance);
+ }
+
+ @Override
+ public int getSimulationDistance() {
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) {
+ return chunkMap.playerChunkManager.getTargetTickViewDistance();
+ }
+ return data.getTargetTickViewDistance();
+ }
+
+ @Override
+ public void setSimulationDistance(int simulationDistance) {
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
+ if (data == null) {
+ throw new IllegalStateException("Player is not attached to world");
+ }
+
+ data.setTargetTickViewDistance(simulationDistance);
} }
+ // Paper end - implement view distances + // Paper end - implement view distances