mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Update paperweight to 1.5.9 (#9872)
This commit is contained in:
parent
3a4d982c0f
commit
cd2ebaa455
104 changed files with 255 additions and 289 deletions
|
@ -5,7 +5,7 @@ plugins {
|
|||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("io.papermc.paperweight.core") version "1.5.8"
|
||||
id("io.papermc.paperweight.core") version "1.5.9"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
|
|
@ -126,7 +126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
return console.console;
|
||||
return this.console.console;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
ReloadCommand.reload(console);
|
||||
ReloadCommand.reload(this.console);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
// copy tile entity data:
|
||||
- this.snapshot = this.createSnapshot(tileEntity);
|
||||
- this.load(snapshot);
|
||||
- this.load(this.snapshot);
|
||||
+ if (this.snapshot != null) {
|
||||
+ this.load(this.snapshot);
|
||||
+ }
|
||||
|
|
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public BlockState[] getTileEntities(boolean useSnapshot) {
|
||||
+ // Paper end
|
||||
if (!this.isLoaded()) {
|
||||
this.getWorld().getChunkAt(x, z); // Transient load for this tick
|
||||
this.getWorld().getChunkAt(this.x, this.z); // Transient load for this tick
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
BlockState[] entities = new BlockState[chunk.blockEntities.size()];
|
||||
|
|
|
@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem {
|
||||
|
||||
if (tag.contains(ENTITY_TAG.NBT)) {
|
||||
this.entityTag = tag.getCompound(ENTITY_TAG.NBT).copy();
|
||||
if (tag.contains(CraftMetaArmorStand.ENTITY_TAG.NBT)) {
|
||||
this.entityTag = tag.getCompound(CraftMetaArmorStand.ENTITY_TAG.NBT).copy();
|
||||
+ // Paper start
|
||||
+ if (entityTag.contains(INVISIBLE.NBT)) {
|
||||
+ invisible = entityTag.getBoolean(INVISIBLE.NBT);
|
||||
|
@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ // Paper end
|
||||
if (this.entityTag != null) {
|
||||
tag.put(ENTITY_TAG.NBT, entityTag);
|
||||
tag.put(CraftMetaArmorStand.ENTITY_TAG.NBT, this.entityTag);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem {
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
// Spigot start
|
||||
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( recentTps, 20 );
|
||||
Arrays.fill( this.recentTps, 20 );
|
||||
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
|
||||
lastTick = start - TICK_TIME; // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
|
@ -60,8 +60,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
SpigotConfig.restartScript = SpigotConfig.getString( "settings.restart-script", SpigotConfig.restartScript );
|
||||
SpigotConfig.restartMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.restart", "Server is restarting" ) );
|
||||
SpigotConfig.commands.put( "restart", new RestartCommand( "restart" ) );
|
||||
- WatchdogThread.doStart( timeoutTime, restartOnCrash );
|
||||
+ // WatchdogThread.doStart( timeoutTime, restartOnCrash ); // Paper - moved to after paper config initialization
|
||||
- WatchdogThread.doStart( SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash );
|
||||
+ // WatchdogThread.doStart( SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash ); // Paper - moved to after paper config initialization
|
||||
}
|
||||
|
||||
public static boolean bungee;
|
||||
|
@ -157,4 +157,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ sleep( 1000 ); // Paper - Reduce check time to every second instead of every ten seconds, more consistent and allows for short timeout
|
||||
} catch ( InterruptedException ex )
|
||||
{
|
||||
interrupt();
|
||||
this.interrupt();
|
||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return CraftBlock.at(world, new BlockPos(x, y, z));
|
||||
return CraftBlock.at(this.world, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
+ // Paper start - Implement heightmap api
|
||||
|
|
|
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- this.disconnect("Invalid payload REGISTER!");
|
||||
+ this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
||||
}
|
||||
} else if (identifier.equals(CUSTOM_UNREGISTER)) {
|
||||
} else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
|
@ -392,8 +392,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Spigot Start
|
||||
if ( entity == this.player && !this.player.isSpectator() )
|
||||
{
|
||||
- disconnect( "Cannot interact with self!" );
|
||||
+ disconnect( "Cannot interact with self!" , org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause
|
||||
- this.disconnect( "Cannot interact with self!" );
|
||||
+ this.disconnect( "Cannot interact with self!" , org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
// Spigot End
|
||||
|
|
|
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ TicketType.PLUGIN.timeout = Math.min(20, configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
|
||||
this.minimumAPI = this.configuration.getString("settings.minimum-api");
|
||||
this.printSaveWarning = false;
|
||||
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
||||
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
|
|
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getIndirectSourceEntity().getBukkitEntity()).callEvent())
|
||||
+ continue;
|
||||
+ // Paper end
|
||||
nmsBlock.wasExploded(this.level(), blockposition, explosionSource);
|
||||
nmsBlock.wasExploded(this.level(), blockposition, this.explosionSource);
|
||||
|
||||
this.level().removeBlock(blockposition, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
|
|
|
@ -133,11 +133,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
|
||||
+ // Paper start - Unix domain socket support
|
||||
+ java.net.SocketAddress socketAddress = connection.getRemoteAddress();
|
||||
connection.hostname = split[0];
|
||||
- connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
||||
+ connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
|
||||
+ java.net.SocketAddress socketAddress = this.connection.getRemoteAddress();
|
||||
this.connection.hostname = split[0];
|
||||
- this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
||||
+ this.connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
|
||||
+ // Paper end
|
||||
connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
|
||||
this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
|
||||
} else
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end - launchProjectile consumer
|
||||
Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation");
|
||||
|
||||
net.minecraft.world.level.Level world = ((CraftWorld) getWorld()).getHandle();
|
||||
net.minecraft.world.level.Level world = ((CraftWorld) this.getWorld()).getHandle();
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
if (velocity != null) {
|
||||
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
||||
|
|
|
@ -25,6 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||||
+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
|
||||
connection.hostname = split[0];
|
||||
connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
||||
connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
|
||||
this.connection.hostname = split[0];
|
||||
this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
||||
this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
|
||||
|
|
|
@ -102,8 +102,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public void setStorm(boolean hasStorm) {
|
||||
- world.levelData.setRaining(hasStorm);
|
||||
+ world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper
|
||||
- this.world.levelData.setRaining(hasStorm);
|
||||
+ this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper
|
||||
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
|
||||
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public void setThundering(boolean thundering) {
|
||||
- world.serverLevelData.setThundering(thundering);
|
||||
+ world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper
|
||||
- this.world.serverLevelData.setThundering(thundering);
|
||||
+ this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper
|
||||
this.setThunderDuration(0); // Reset weather duration (legacy behaviour)
|
||||
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world)); // Paper
|
||||
if (world.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||
if (!state.canSurvive(world, pos)) {
|
||||
fireExtinguished(world, pos); // CraftBukkit - invalid place location
|
||||
this.fireExtinguished(world, pos); // CraftBukkit - invalid place location
|
||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||
public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) {
|
||||
super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext);
|
||||
|
|
|
@ -53,5 +53,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||||
connection.hostname = split[0];
|
||||
connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
||||
this.connection.hostname = split[0];
|
||||
this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
|
||||
|
|
|
@ -125,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
);
|
||||
this.setSpecialPrice(specialPrice);
|
||||
@@ -0,0 +0,0 @@ public class CraftMerchantRecipe extends MerchantRecipe {
|
||||
handle.priceMultiplier = priceMultiplier;
|
||||
this.handle.priceMultiplier = priceMultiplier;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -141,7 +141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
+
|
||||
public net.minecraft.world.item.trading.MerchantOffer toMinecraft() {
|
||||
List<ItemStack> ingredients = getIngredients();
|
||||
List<ItemStack> ingredients = this.getIngredients();
|
||||
Preconditions.checkState(!ingredients.isEmpty(), "No offered ingredients");
|
||||
@@ -0,0 +0,0 @@ public class CraftMerchantRecipe extends MerchantRecipe {
|
||||
if (recipe instanceof CraftMerchantRecipe) {
|
||||
|
|
|
@ -57,4 +57,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public boolean generateTree(Location loc, TreeType type) {
|
||||
return generateTree(loc, CraftWorld.rand, type);
|
||||
return this.generateTree(loc, CraftWorld.rand, type);
|
||||
|
|
|
@ -16,5 +16,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command);
|
||||
+ } // Paper
|
||||
|
||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(getCraftPlayer(), command, new LazyPlayerSet(server));
|
||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command, new LazyPlayerSet(this.server));
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
|
|
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftCherryLeaves extends org.bukkit.craftbukkit.block.data.C
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
set(CraftCherryLeaves.WATERLOGGED, waterlogged);
|
||||
this.set(CraftCherryLeaves.WATERLOGGED, waterlogged);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
|
@ -96,7 +96,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftLeaves extends org.bukkit.craftbukkit.block.data.CraftBl
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
set(CraftLeaves.WATERLOGGED, waterlogged);
|
||||
this.set(CraftLeaves.WATERLOGGED, waterlogged);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
|
@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMangroveLeaves.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMangroveLeaves extends org.bukkit.craftbukkit.block.data
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
set(CraftMangroveLeaves.WATERLOGGED, waterlogged);
|
||||
this.set(CraftMangroveLeaves.WATERLOGGED, waterlogged);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
|
|
|
@ -97,8 +97,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
Builder<String, Object> serialize(Builder<String, Object> builder) {
|
||||
super.serialize(builder);
|
||||
if (this.profile != null) {
|
||||
- return builder.put(SKULL_OWNER.BUKKIT, new CraftPlayerProfile(this.profile));
|
||||
+ return builder.put(SKULL_OWNER.BUKKIT, new com.destroystokyo.paper.profile.CraftPlayerProfile(this.profile)); // Paper
|
||||
- return builder.put(CraftMetaSkull.SKULL_OWNER.BUKKIT, new CraftPlayerProfile(this.profile));
|
||||
+ return builder.put(CraftMetaSkull.SKULL_OWNER.BUKKIT, new com.destroystokyo.paper.profile.CraftPlayerProfile(this.profile)); // Paper
|
||||
}
|
||||
NamespacedKey namespacedKeyNB = this.getNoteBlockSound();
|
||||
if (namespacedKeyNB != null) {
|
||||
|
|
|
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public long getGameTime() {
|
||||
return world.levelData.getGameTime();
|
||||
return this.world.levelData.getGameTime();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
|
|
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ // Paper end
|
||||
this.entity.setDeltaMovement(CraftVector.toNMS(velocity));
|
||||
entity.hurtMarked = true;
|
||||
this.entity.hurtMarked = true;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -2500,7 +2500,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
+ } else if (false) { // Paper
|
||||
Player player = this.getCraftPlayer();
|
||||
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(server));
|
||||
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server));
|
||||
String originalFormat = event.getFormat(), originalMessage = event.getMessage();
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
|
@ -2555,8 +2555,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
CraftIconCache icon = server.server.getServerIcon();
|
||||
|
||||
ServerListPingEvent() {
|
||||
- super(connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), server.getMotd(), server.getPlayerList().getMaxPlayers());
|
||||
+ super(connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), server.server.motd(), server.getPlayerList().getMaxPlayers()); // Paper - Adventure
|
||||
- super(ServerStatusPacketListenerImpl.this.connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), server.getMotd(), server.getPlayerList().getMaxPlayers());
|
||||
+ super(ServerStatusPacketListenerImpl.this.connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), server.server.motd(), server.getPlayerList().getMaxPlayers()); // Paper - Adventure
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2979,7 +2979,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog)
|
||||
return Thread.currentThread().equals(this.console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog)
|
||||
}
|
||||
|
||||
+ // Paper start - Adventure
|
||||
|
@ -3337,9 +3337,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- // Lazy initialization:
|
||||
- Component[] messages = this.signText.getMessages(false);
|
||||
- this.lines = new String[messages.length];
|
||||
- System.arraycopy(CraftSign.revertComponents(messages), 0, lines, 0, lines.length);
|
||||
- this.originalLines = new String[lines.length];
|
||||
- System.arraycopy(lines, 0, originalLines, 0, originalLines.length);
|
||||
- System.arraycopy(CraftSign.revertComponents(messages), 0, this.lines, 0, this.lines.length);
|
||||
- this.originalLines = new String[this.lines.length];
|
||||
- System.arraycopy(this.lines, 0, this.originalLines, 0, this.originalLines.length);
|
||||
- }
|
||||
- return this.lines;
|
||||
+ // Paper start
|
||||
|
@ -3372,7 +3372,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public SignText applyLegacyStringToSignSide() {
|
||||
if (this.lines != null) {
|
||||
- for (int i = 0; i < lines.length; i++) {
|
||||
- for (int i = 0; i < this.lines.length; i++) {
|
||||
- String line = (this.lines[i] == null) ? "" : this.lines[i];
|
||||
- if (line.equals(this.originalLines[i])) {
|
||||
+ // Paper start
|
||||
|
@ -3656,7 +3656,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public void setDisplayName(final String name) {
|
||||
+ this.getHandle().adventure$displayName = name != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(name) : net.kyori.adventure.text.Component.text(this.getName()); // Paper
|
||||
this.getHandle().displayName = name == null ? getName() : name;
|
||||
this.getHandle().displayName = name == null ? this.getName() : name;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -3684,7 +3684,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
@Override
|
||||
public String getPlayerListName() {
|
||||
return this.getHandle().listName == null ? getName() : CraftChatMessage.fromComponent(this.getHandle().listName);
|
||||
return this.getHandle().listName == null ? this.getName() : CraftChatMessage.fromComponent(this.getHandle().listName);
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
}
|
||||
|
@ -3696,14 +3696,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public String getPlayerListHeader() {
|
||||
- return (this.playerListHeader == null) ? null : CraftChatMessage.fromComponent(playerListHeader);
|
||||
+ return (this.playerListHeader == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(playerListHeader);
|
||||
- return (this.playerListHeader == null) ? null : CraftChatMessage.fromComponent(this.playerListHeader);
|
||||
+ return (this.playerListHeader == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.playerListHeader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerListFooter() {
|
||||
- return (this.playerListFooter == null) ? null : CraftChatMessage.fromComponent(playerListFooter);
|
||||
+ return (this.playerListFooter == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(playerListFooter); // Paper - Adventure
|
||||
- return (this.playerListFooter == null) ? null : CraftChatMessage.fromComponent(this.playerListFooter);
|
||||
+ return (this.playerListFooter == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.playerListFooter); // Paper - Adventure
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4178,7 +4178,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
return this.title;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
|
@ -4583,7 +4583,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return CraftChatMessage.fromJSONComponent(displayName);
|
||||
return CraftChatMessage.fromJSONComponent(this.displayName);
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return this.lore != null && !this.lore.isEmpty();
|
||||
}
|
||||
|
@ -4740,7 +4740,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class CraftMapRenderer extends MapRenderer {
|
||||
}
|
||||
|
||||
MapDecoration decoration = worldMap.decorations.get(key);
|
||||
MapDecoration decoration = this.worldMap.decorations.get(key);
|
||||
- cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, CraftChatMessage.fromComponent(decoration.name()));
|
||||
+ cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, decoration.name() == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.name())); // Paper
|
||||
}
|
||||
|
@ -4978,14 +4978,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
- HashSet<Player> makeReference() {
|
||||
+ protected HashSet<Player> makeReference() { // Paper - protected
|
||||
Preconditions.checkState(reference == null, "Reference already created!");
|
||||
List<ServerPlayer> players = this.server.getPlayerList().players;
|
||||
Preconditions.checkState(this.reference == null, "Reference already created!");
|
||||
- List<ServerPlayer> players = this.server.getPlayerList().players;
|
||||
+ // Paper start
|
||||
+ return makePlayerSet(this.server);
|
||||
+ }
|
||||
+ public static HashSet<Player> makePlayerSet(final MinecraftServer server) {
|
||||
+ // Paper end
|
||||
+ List<ServerPlayer> players = server.getPlayerList().players;
|
||||
+ // Paper end
|
||||
HashSet<Player> reference = new HashSet<Player>(players.size());
|
||||
for (ServerPlayer player : players) {
|
||||
reference.add(player.getBukkitEntity());
|
||||
|
|
|
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public boolean isSlimeChunk() {
|
||||
// 987234911L is deterimined in EntitySlime when seeing if a slime can spawn in a chunk
|
||||
- return WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0;
|
||||
- return WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), this.worldServer.spigotConfig.slimeSeed).nextInt(10) == 0;
|
||||
+ return this.worldServer.paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftBed extends CraftBlockData implements Bed {
|
||||
public boolean isOccupied() {
|
||||
return get(CraftBed.OCCUPIED);
|
||||
return this.get(CraftBed.OCCUPIED);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftBed extends org.bukkit.craftbukkit.block.data.CraftBlock
|
||||
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
|
||||
return getValues(CraftBed.FACING, org.bukkit.block.BlockFace.class);
|
||||
return this.getValues(CraftBed.FACING, org.bukkit.block.BlockFace.class);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
|
|
|
@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
});
|
||||
// CraftBukkit end
|
||||
timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
+ this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
||||
}
|
||||
|
|
|
@ -1173,8 +1173,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.generator = gen;
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
||||
+ this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void run() {
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex);
|
||||
ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex);
|
||||
}
|
||||
}
|
||||
- }.start();
|
||||
|
|
|
@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Override
|
||||
+ public void setTargetLocation(Location location, boolean update) {
|
||||
+ // Paper end
|
||||
Preconditions.checkArgument(getWorld().equals(location.getWorld()), "Cannot target EnderSignal across worlds");
|
||||
Preconditions.checkArgument(this.getWorld().equals(location.getWorld()), "Cannot target EnderSignal across worlds");
|
||||
- this.getHandle().signalTo(CraftLocation.toBlockPosition(location));
|
||||
+ this.getHandle().signalTo(CraftLocation.toBlockPosition(location), update); // Paper
|
||||
}
|
||||
|
|
|
@ -2633,8 +2633,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
||||
this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
+ // Paper start - optimise collisions
|
||||
+ this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
|
||||
|
|
|
@ -198,13 +198,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public void setKeepSpawnInMemory(boolean keepLoaded) {
|
||||
- world.keepSpawnInMemory = keepLoaded;
|
||||
+ // Paper start - Configurable spawn radius
|
||||
+ if (keepLoaded == world.keepSpawnInMemory) {
|
||||
+ if (keepLoaded == this.world.keepSpawnInMemory) {
|
||||
+ // do nothing, nothing has changed
|
||||
+ return;
|
||||
+ }
|
||||
+ this.world.keepSpawnInMemory = keepLoaded;
|
||||
this.world.keepSpawnInMemory = keepLoaded;
|
||||
// Grab the worlds spawn chunk
|
||||
BlockPos chunkcoordinates = this.world.getSharedSpawnPos();
|
||||
if (keepLoaded) {
|
||||
|
|
|
@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
entity.connection.teleport(to);
|
||||
} else {
|
||||
// The respawn reason should never be used if the passed location is non null.
|
||||
- server.getHandle().respawn(entity, toWorld, true, to, true, null);
|
||||
+ server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper
|
||||
- this.server.getHandle().respawn(entity, toWorld, true, to, true, null);
|
||||
+ this.server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
||||
|
||||
- String attributeName = entry.getString(ATTRIBUTES_IDENTIFIER.NBT);
|
||||
+ String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
||||
- String attributeName = entry.getString(CraftMetaItem.ATTRIBUTES_IDENTIFIER.NBT);
|
||||
+ String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(CraftMetaItem.ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
||||
if (attributeName == null || attributeName.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- this.tileTickPosition++, tilesThisCycle++) {
|
||||
+ for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition);
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
|
||||
// Spigot start
|
||||
|
|
|
@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
this.commandsConfiguration = YamlConfiguration.loadConfiguration(this.getCommandsConfigFile());
|
||||
this.commandsConfiguration.options().copyDefaults(true);
|
||||
- this.commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8)));
|
||||
- this.commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8)));
|
||||
+ // Paper start - don't enforce icanhasbukkit default if alias block exists
|
||||
+ final YamlConfiguration commandsDefaults = YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8));
|
||||
+ final YamlConfiguration commandsDefaults = YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8));
|
||||
+ if (this.commandsConfiguration.contains("aliases")) commandsDefaults.set("aliases", null);
|
||||
+ this.commandsConfiguration.setDefaults(commandsDefaults);
|
||||
+ // Paper stop - dont enforce icanhasbukkit default if alias block exists
|
||||
|
|
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
itemstack.addTagElement("pages", nbttaglist);
|
||||
- CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack); // CraftBukkit
|
||||
+ this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent)
|
||||
- CraftEventFactory.handleEditBookEvent(this.player, slot, handItem, itemstack); // CraftBukkit
|
||||
+ this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(this.player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
|
||||
// Paper start
|
||||
java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, null);
|
||||
java.util.List<Entity> entities = world.getEntities((Entity)null, ActivationRange.maxBB, null);
|
||||
+ boolean tickMarkers = world.paperConfig().entities.markers.tick; // Paper - configurable marker ticking
|
||||
for (int i = 0; i < entities.size(); i++) {
|
||||
Entity entity = entities.get(i);
|
||||
|
|
|
@ -565,7 +565,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
|
||||
// Paper start
|
||||
java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, null);
|
||||
java.util.List<Entity> entities = world.getEntities((Entity)null, ActivationRange.maxBB, null);
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
* @param entity
|
||||
* @return
|
||||
|
|
|
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ worldKey = ResourceKey.create(Registries.DIMENSION, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper
|
||||
}
|
||||
|
||||
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11),
|
||||
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, this.console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11),
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -358,4 +358,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public net.minecraft.world.entity.ExperienceOrb getHandle() {
|
||||
return (net.minecraft.world.entity.ExperienceOrb) entity;
|
||||
return (net.minecraft.world.entity.ExperienceOrb) this.entity;
|
||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
|
||||
@@ -0,0 +0,0 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve
|
||||
setItem(0, stack);
|
||||
this.setItem(0, stack);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -28,4 +28,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public Furnace getHolder() {
|
||||
return (Furnace) inventory.getOwner();
|
||||
return (Furnace) this.inventory.getOwner();
|
||||
|
|
|
@ -30,14 +30,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// return true; // CraftBukkit
|
||||
}
|
||||
// CraftBukkit start
|
||||
+ java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
||||
+ level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
|
||||
+ java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = this.level.captureDrops; // Paper - store current list
|
||||
+ this.level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
|
||||
if (event.isDropItems()) {
|
||||
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
|
||||
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, this.level.captureDrops);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
|
||||
}
|
||||
- level.captureDrops = null;
|
||||
+ //world.captureDrops = null; // Paper - move up
|
||||
- this.level.captureDrops = null;
|
||||
+ //this.level.captureDrops = null; // Paper - move up
|
||||
|
||||
// Drop event experience
|
||||
if (flag && event != null) {
|
||||
|
|
|
@ -234,9 +234,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
- public BanEntry<PlayerProfile> ban(String reason, Date expires, String source, boolean kickPlayer) {
|
||||
- BanEntry<PlayerProfile> banEntry = ((ProfileBanList) server.getBanList(BanList.Type.PROFILE)).addBan(this.getPlayerProfile(), reason, expires, source);
|
||||
- BanEntry<PlayerProfile> banEntry = ((ProfileBanList) this.server.getBanList(BanList.Type.PROFILE)).addBan(this.getPlayerProfile(), reason, expires, source);
|
||||
+ public BanEntry<com.destroystokyo.paper.profile.PlayerProfile> ban(String reason, Date expires, String source, boolean kickPlayer) { // Paper - fix ban list API
|
||||
+ BanEntry<com.destroystokyo.paper.profile.PlayerProfile> banEntry = ((ProfileBanList) server.getBanList(BanList.Type.PROFILE)).addBan(this.getPlayerProfile(), reason, expires, source); // Paper - fix ban list API
|
||||
+ BanEntry<com.destroystokyo.paper.profile.PlayerProfile> banEntry = ((ProfileBanList) this.server.getBanList(BanList.Type.PROFILE)).addBan(this.getPlayerProfile(), reason, expires, source); // Paper - fix ban list API
|
||||
if (kickPlayer) {
|
||||
this.kickPlayer(reason);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
|
||||
LevelLightEngine lightengine = this.worldServer.getLightEngine();
|
||||
DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(x, chunk.getSectionYFromSectionIndex(i), z)); // SPIGOT-7498: Convert section index
|
||||
DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(this.x, chunk.getSectionYFromSectionIndex(i), this.z)); // SPIGOT-7498: Convert section index
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ toRemove.add(null);
|
||||
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition);
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity == null) {
|
||||
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
|
||||
|
@ -38,5 +38,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
+ this.blockEntityTickers.removeAll(toRemove);
|
||||
|
||||
timings.tileEntityTick.stopTiming(); // Spigot
|
||||
this.timings.tileEntityTick.stopTiming(); // Spigot
|
||||
this.tickingBlockEntities = false;
|
||||
|
|
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public SculkCatalystBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.SCULK_CATALYST, pos, state);
|
||||
this.catalystListener = new SculkCatalystBlockEntity.CatalystListener(state, new BlockPositionSource(pos));
|
||||
- catalystListener.level = level; // CraftBukkit
|
||||
- this.catalystListener.level = this.level; // CraftBukkit
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
- world.serverLevelData.setDifficulty(config.difficulty);
|
||||
|
|
|
@ -29,9 +29,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public boolean setSpawnLocation(int x, int y, int z, float angle) {
|
||||
try {
|
||||
- Location previousLocation = this.getSpawnLocation();
|
||||
- world.levelData.setSpawn(new BlockPos(x, y, z), angle);
|
||||
- this.world.levelData.setSpawn(new BlockPos(x, y, z), angle);
|
||||
+ // Location previousLocation = this.getSpawnLocation(); // Paper - moved to nms.ServerLevel
|
||||
+ world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use ServerLevel#setDefaultSpawnPos
|
||||
+ this.world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use ServerLevel#setDefaultSpawnPos
|
||||
|
||||
+ // Paper start - move to nms.ServerLevel
|
||||
// Notify anyone who's listening.
|
||||
|
|
|
@ -367,8 +367,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
worlddata.checkName(name);
|
||||
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified());
|
||||
|
||||
- if (console.options.has("forceUpgrade")) {
|
||||
- net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), console.options.has("eraseCache"), () -> true, iregistry);
|
||||
- if (this.console.options.has("forceUpgrade")) {
|
||||
- net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistry);
|
||||
- }
|
||||
+ // Paper - move down
|
||||
|
||||
|
@ -379,9 +379,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
+ // Paper start - fix and optimise world upgrading
|
||||
+ if (console.options.has("forceUpgrade")) {
|
||||
+ if (this.console.options.has("forceUpgrade")) {
|
||||
+ net.minecraft.server.Main.convertWorldButItWorks(
|
||||
+ actualDimension, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), console.options.has("eraseCache")
|
||||
+ actualDimension, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), this.console.options.has("eraseCache")
|
||||
+ );
|
||||
+ }
|
||||
+ // Paper end - fix and optimise world upgrading
|
||||
|
|
|
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public void checkTreeBlockHack() {
|
||||
+ // Paper end
|
||||
// SPIGOT-5537: Horrible hack to manually add bees given World.captureTreeGeneration does not support tiles
|
||||
if (this.treeBlock && getType() == Material.BEE_NEST) {
|
||||
if (this.treeBlock && this.getType() == Material.BEE_NEST) {
|
||||
WorldGenLevel generatoraccessseed = this.world.getHandle();
|
||||
@@ -0,0 +0,0 @@ public final class CapturedBlockState extends CraftBlockState {
|
||||
// End copied block
|
||||
|
|
|
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
Preconditions.checkArgument(material != null, "Material cannot be null");
|
||||
Preconditions.checkArgument(material.isBlock(), "Material.%s must be a block", material);
|
||||
|
||||
- FallingBlockEntity entity = FallingBlockEntity.fall(world, BlockPos.containing(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState(), SpawnReason.CUSTOM);
|
||||
- FallingBlockEntity entity = FallingBlockEntity.fall(this.world, BlockPos.containing(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState(), SpawnReason.CUSTOM);
|
||||
+ // Paper start - restore API behavior for spawning falling blocks
|
||||
+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).defaultBlockState()); // Paper
|
||||
+ entity.time = 1;
|
||||
|
@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
Preconditions.checkArgument(location != null, "Location cannot be null");
|
||||
Preconditions.checkArgument(data != null, "BlockData cannot be null");
|
||||
|
||||
- FallingBlockEntity entity = FallingBlockEntity.fall(world, BlockPos.containing(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState(), SpawnReason.CUSTOM);
|
||||
- FallingBlockEntity entity = FallingBlockEntity.fall(this.world, BlockPos.containing(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState(), SpawnReason.CUSTOM);
|
||||
+ // Paper start - restore API behavior for spawning falling blocks
|
||||
+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState());
|
||||
+ entity.time = 1;
|
||||
|
|
|
@ -24,13 +24,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
double d3 = player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D;
|
||||
double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D;
|
||||
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
|
||||
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities
|
||||
- org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> {
|
||||
+ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> { // Paper - change raySize from 0.1 to 0.0
|
||||
Entity handle = ((CraftEntity) entity).getHandle();
|
||||
return entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity) && !handle.isSpectator() && handle.isPickable() && !handle.isPassengerOfSameVehicle(player);
|
||||
return entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity) && !handle.isSpectator() && handle.isPickable() && !handle.isPassengerOfSameVehicle(this.player);
|
||||
});
|
||||
if (result == null) {
|
||||
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||
|
|
|
@ -120,8 +120,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
- drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe
|
||||
- this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
+ this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe
|
||||
this.handItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
@ -129,8 +129,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
- drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe
|
||||
- this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
+ this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe
|
||||
this.armorItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public void removeExploredLocation(Location location) {
|
||||
Preconditions.checkArgument(location != null, "location cannot be null");
|
||||
- if (location.getWorld() != getWorld()) {
|
||||
- if (location.getWorld() != this.getWorld()) {
|
||||
- return;
|
||||
- }
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
private static BlockStateFactory<?> getFactory(Material material) {
|
||||
return CraftBlockStates.FACTORIES.getOrDefault(material, DEFAULT_FACTORY);
|
||||
return CraftBlockStates.FACTORIES.getOrDefault(material, CraftBlockStates.DEFAULT_FACTORY);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -28,4 +28,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ Preconditions.checkState(DISABLE_CHANNEL_LIMIT || this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); // Paper - flag to disable channel limit
|
||||
channel = StandardMessenger.validateAndCorrectChannel(channel);
|
||||
if (this.channels.add(channel)) {
|
||||
server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));
|
||||
this.server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));
|
||||
|
|
|
@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
// Spigot start
|
||||
Arrays.fill( recentTps, 20 );
|
||||
Arrays.fill( this.recentTps, 20 );
|
||||
- long curTime, tickSection = Util.getMillis(), tickCount = 1;
|
||||
+ long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
|
||||
+ lastTick = start - TICK_TIME; // Paper
|
||||
|
|
|
@ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (this.handle == null) {
|
||||
return 0;
|
||||
}
|
||||
- return EnchantmentHelper.getItemEnchantmentLevel(CraftEnchantment.getRaw(ench), handle);
|
||||
- return EnchantmentHelper.getItemEnchantmentLevel(CraftEnchantment.getRaw(ench), this.handle);
|
||||
+ // Paper start - replace to allow custom enchantments
|
||||
+ final ListTag enchantments = this.handle.getEnchantmentTags();
|
||||
+ for (int i = 0; i < enchantments.size(); i++) {
|
||||
|
@ -256,7 +256,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ EnchantmentMap enchantments = new EnchantmentMap(); // Paper
|
||||
|
||||
for (int i = 0; i < ench.size(); i++) {
|
||||
String id = ((CompoundTag) ench.get(i)).getString(ENCHANTMENTS_ID.NBT);
|
||||
String id = ((CompoundTag) ench.get(i)).getString(CraftMetaItem.ENCHANTMENTS_ID.NBT);
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public Map<Enchantment, Integer> getEnchants() {
|
||||
- return this.hasEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
||||
- return this.hasEnchants() ? ImmutableMap.copyOf(this.enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
||||
+ return this.hasEnchants() ? ImmutableSortedMap.copyOfSorted(this.enchantments) : ImmutableMap.<Enchantment, Integer>of(); // Paper
|
||||
}
|
||||
|
||||
|
|
|
@ -23,13 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
// Refresh the current entity metadata
|
||||
entity.getEntityData().refresh(player);
|
||||
entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player);
|
||||
// SPIGOT-7136 - Allays
|
||||
- if (entity instanceof Allay) {
|
||||
- send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
- ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
+ if (entity instanceof Allay allay) { // Paper
|
||||
+ send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, allay.stripMeta(allay.getItemBySlot(slot), true))).collect(Collectors.toList()))); // Paper - remove unnecessary item meta
|
||||
player.containerMenu.sendAllDataToRemote();
|
||||
+ ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, allay.stripMeta(allay.getItemBySlot(slot), true))).collect(Collectors.toList()))); // Paper - remove unnecessary item meta
|
||||
ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote();
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
|
|
|
@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
|
||||
{
|
||||
return new MethodVisitor( api, super.visitMethod( access, name, desc, signature, exceptions ) )
|
||||
return new MethodVisitor( this.api, super.visitMethod( access, name, desc, signature, exceptions ) )
|
||||
{
|
||||
+ // Paper start - Plugin rewrites
|
||||
+ @Override
|
||||
|
|
|
@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta {
|
||||
if (tag.contains(TRIM.NBT)) {
|
||||
CompoundTag trimCompound = tag.getCompound(TRIM.NBT);
|
||||
if (tag.contains(CraftMetaArmor.TRIM.NBT)) {
|
||||
CompoundTag trimCompound = tag.getCompound(CraftMetaArmor.TRIM.NBT);
|
||||
|
||||
- if (trimCompound.contains(TRIM_MATERIAL.NBT) && trimCompound.contains(TRIM_PATTERN.NBT)) {
|
||||
+ if (trimCompound.contains(TRIM_MATERIAL.NBT, net.minecraft.nbt.Tag.TAG_STRING) && trimCompound.contains(TRIM_PATTERN.NBT, net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - for now, ignore inline definitions of trim material & pattern
|
||||
TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(TRIM_MATERIAL.NBT)));
|
||||
TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(TRIM_PATTERN.NBT)));
|
||||
- if (trimCompound.contains(CraftMetaArmor.TRIM_MATERIAL.NBT) && trimCompound.contains(CraftMetaArmor.TRIM_PATTERN.NBT)) {
|
||||
+ if (trimCompound.contains(CraftMetaArmor.TRIM_MATERIAL.NBT, net.minecraft.nbt.Tag.TAG_STRING) && trimCompound.contains(CraftMetaArmor.TRIM_PATTERN.NBT, net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - for now, ignore inline definitions of trim material & pattern
|
||||
TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(CraftMetaArmor.TRIM_MATERIAL.NBT)));
|
||||
TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(CraftMetaArmor.TRIM_PATTERN.NBT)));
|
||||
|
||||
|
|
|
@ -59,4 +59,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public AbstractMinecart getHandle() {
|
||||
return (AbstractMinecart) entity;
|
||||
return (AbstractMinecart) this.entity;
|
||||
|
|
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return server.getPlayer(getUniqueId()) != null;
|
||||
return this.server.getPlayer(this.getUniqueId()) != null;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -121,8 +121,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void updateOptions(ClientInformation clientOptions) {
|
||||
+ new com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent(getBukkitEntity(), getClientOptionMap(clientOptions.language(), clientOptions.viewDistance(), com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(clientOptions.chatVisibility().name()), clientOptions.chatColors(), new com.destroystokyo.paper.PaperSkinParts(clientOptions.modelCustomisation()), clientOptions.mainHand() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT, clientOptions.allowsListing(), clientOptions.textFilteringEnabled())).callEvent(); // Paper - settings event
|
||||
// CraftBukkit start
|
||||
if (getMainArm() != clientOptions.mainHand()) {
|
||||
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
||||
if (this.getMainArm() != clientOptions.mainHand()) {
|
||||
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
this.server.server.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.language, clientOptions.language())); // Paper
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.chunkTrackingView = ChunkTrackingView.EMPTY;
|
||||
this.respawnDimension = Level.OVERWORLD;
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
||||
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
||||
this.server.server.getPluginManager().callEvent(event);
|
||||
}
|
||||
- if (!this.language.equals(clientOptions.language())) {
|
||||
|
|
|
@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.getDecoder().decode(internal));
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
if (this.hasDamage()) {
|
||||
itemTag.putInt(DAMAGE.NBT, damage);
|
||||
itemTag.putInt(CraftMetaItem.DAMAGE.NBT, this.damage);
|
||||
}
|
||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
||||
+ if (hasPlaceableKeys()) {
|
||||
|
@ -221,7 +221,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
} catch (CloneNotSupportedException e) {
|
||||
throw new Error(e);
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
builder.put(DAMAGE.BUKKIT, damage);
|
||||
builder.put(CraftMetaItem.DAMAGE.BUKKIT, this.damage);
|
||||
}
|
||||
|
||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
||||
|
|
|
@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class CraftBlock implements Block {
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
|
||||
net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), position, this.world.getBlockEntity(position), null, nmsItem);
|
||||
net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), this.position, this.world.getBlockEntity(this.position), null, nmsItem);
|
||||
+ // Paper start - improve Block#breanNaturally
|
||||
+ if (triggerEffect) {
|
||||
+ if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.BaseFireBlock) {
|
||||
|
@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
// SPIGOT-6778: Directly call setBlock instead of setTypeAndData, so that the tile entiy is not removed and custom remove logic is run.
|
||||
- return this.world.setBlock(position, Blocks.AIR.defaultBlockState(), 3) && result;
|
||||
- return this.world.setBlock(this.position, Blocks.AIR.defaultBlockState(), 3) && result;
|
||||
+ // Paper start - improve breakNaturally
|
||||
+ boolean destroyed = this.world.removeBlock(this.position, false);
|
||||
+ if (destroyed) {
|
||||
|
|
|
@ -354,7 +354,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class ArmorStand extends LivingEntity {
|
||||
}
|
||||
|
||||
drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
- this.brokenByAnything(damageSource);
|
||||
+ return this.brokenByAnything(damageSource); // Paper
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public void kill() {
|
||||
- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event
|
||||
- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, this.drops); // CraftBukkit - call event
|
||||
+ // Paper start
|
||||
+ kill(true);
|
||||
+ }
|
||||
|
@ -385,7 +385,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public void kill(boolean callEvent) {
|
||||
+ if (callEvent) {
|
||||
+ // Paper end
|
||||
+ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event // Paper - make cancellable
|
||||
+ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, this.drops); // CraftBukkit - call event // Paper - make cancellable
|
||||
+ if (event.isCancelled()) return; // Paper - make cancellable
|
||||
+ } // Paper
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
|
|
|
@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ org.spigotmc.WatchdogThread.tick(); // Paper
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( recentTps, 20 );
|
||||
Arrays.fill( this.recentTps, 20 );
|
||||
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
|
||||
|
|
|
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.mainScoreboard = new CraftScoreboard(scoreboardServer);
|
||||
+ mainScoreboard.registeredGlobally = true; // Paper
|
||||
this.server = minecraftserver;
|
||||
this.scoreboards.add(mainScoreboard);
|
||||
this.scoreboards.add(this.mainScoreboard);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class CraftScoreboardManager implements ScoreboardManager {
|
||||
public CraftScoreboard getNewScoreboard() {
|
||||
|
|
|
@ -719,7 +719,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- private void setLootTable(LootTable table, long seed) {
|
||||
+ public void setLootTable(LootTable table, long seed) { // Paper - make public since it overrides a public method
|
||||
ResourceLocation key = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
|
||||
getSnapshot().setLootTable(key, seed);
|
||||
this.getSnapshot().setLootTable(key, seed);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
|
|
@ -6995,7 +6995,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return convertable.dimensionType;
|
||||
return this.convertable.dimensionType;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -8352,4 +8352,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
try
|
||||
{
|
||||
SpigotConfig.config.save( CONFIG_FILE );
|
||||
SpigotConfig.config.save( SpigotConfig.CONFIG_FILE );
|
||||
|
|
|
@ -11,17 +11,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
||||
super(tag);
|
||||
|
||||
if (tag.contains(BOOK_TITLE.NBT)) {
|
||||
- this.title = limit( tag.getString(BOOK_TITLE.NBT), 8192 ); // Spigot
|
||||
+ this.title = limit( tag.getString(BOOK_TITLE.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.title); // Spigot // Paper - make configurable
|
||||
if (tag.contains(CraftMetaBook.BOOK_TITLE.NBT)) {
|
||||
- this.title = limit( tag.getString(CraftMetaBook.BOOK_TITLE.NBT), 8192 ); // Spigot
|
||||
+ this.title = limit( tag.getString(CraftMetaBook.BOOK_TITLE.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.title); // Spigot // Paper - make configurable
|
||||
}
|
||||
|
||||
if (tag.contains(BOOK_AUTHOR.NBT)) {
|
||||
- this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 8192 ); // Spigot
|
||||
+ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.author ); // Spigot // Paper - make configurable
|
||||
if (tag.contains(CraftMetaBook.BOOK_AUTHOR.NBT)) {
|
||||
- this.author = limit( tag.getString(CraftMetaBook.BOOK_AUTHOR.NBT), 8192 ); // Spigot
|
||||
+ this.author = limit( tag.getString(CraftMetaBook.BOOK_AUTHOR.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.author ); // Spigot // Paper - make configurable
|
||||
}
|
||||
|
||||
if (tag.contains(RESOLVED.NBT)) {
|
||||
if (tag.contains(CraftMetaBook.RESOLVED.NBT)) {
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
||||
} else {
|
||||
page = this.validatePage(page);
|
||||
|
@ -36,16 +36,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
CompoundTag display = tag.getCompound(DISPLAY.NBT);
|
||||
CompoundTag display = tag.getCompound(CraftMetaItem.DISPLAY.NBT);
|
||||
|
||||
if (display.contains(NAME.NBT)) {
|
||||
- this.displayName = limit( display.getString(NAME.NBT), 8192 ); // Spigot
|
||||
+ this.displayName = limit( display.getString(NAME.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.displayName ); // Spigot // Paper - make configurable
|
||||
if (display.contains(CraftMetaItem.NAME.NBT)) {
|
||||
- this.displayName = limit( display.getString(CraftMetaItem.NAME.NBT), 8192 ); // Spigot
|
||||
+ this.displayName = limit( display.getString(CraftMetaItem.NAME.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.displayName ); // Spigot // Paper - make configurable
|
||||
}
|
||||
|
||||
if (display.contains(LOCNAME.NBT)) {
|
||||
if (display.contains(CraftMetaItem.LOCNAME.NBT)) {
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
ListTag list = display.getList(LORE.NBT, CraftMagicNumbers.NBT.TAG_STRING);
|
||||
ListTag list = display.getList(CraftMetaItem.LORE.NBT, CraftMagicNumbers.NBT.TAG_STRING);
|
||||
this.lore = new ArrayList<String>(list.size());
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
- String line = limit( list.getString(index), 8192 ); // Spigot
|
||||
|
|
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||
@@ -0,0 +0,0 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
||||
update(); // SPIGOT-6579
|
||||
this.update(); // SPIGOT-6579
|
||||
}
|
||||
|
||||
+ // Paper start - set direction without normalizing
|
||||
|
@ -27,4 +27,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public AbstractHurtingProjectile getHandle() {
|
||||
return (AbstractHurtingProjectile) entity;
|
||||
return (AbstractHurtingProjectile) this.entity;
|
||||
|
|
|
@ -633,7 +633,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public EnderMan getHandle() {
|
||||
return (EnderMan) entity;
|
||||
return (EnderMan) this.entity;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
|
||||
|
@ -793,7 +793,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements
|
||||
public void setEnabled(boolean enabled) {
|
||||
((MinecartHopper) getHandle()).setEnabled(enabled);
|
||||
((MinecartHopper) this.getHandle()).setEnabled(enabled);
|
||||
}
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
|
|
|
@ -188,7 +188,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void setTarget(LivingEntity target) {
|
||||
Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||
return (net.minecraft.world.entity.Mob) entity;
|
||||
return (net.minecraft.world.entity.Mob) this.entity;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -57,13 +57,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
|
||||
@@ -0,0 +0,0 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
|
||||
if (getTileEntity().opened && getWorldHandle() instanceof net.minecraft.world.level.Level) {
|
||||
net.minecraft.world.level.Level world = getTileEntity().getLevel();
|
||||
world.blockEvent(getPosition(), getTileEntity().getBlockState().getBlock(), 1, 0);
|
||||
- world.playSound(null, getPosition(), SoundEvents.SHULKER_BOX_OPEN, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
+ world.playSound(null, getPosition(), SoundEvents.SHULKER_BOX_CLOSE, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Paper - More Lidded Block API (Wrong sound)
|
||||
if (this.getTileEntity().opened && this.getWorldHandle() instanceof net.minecraft.world.level.Level) {
|
||||
net.minecraft.world.level.Level world = this.getTileEntity().getLevel();
|
||||
world.blockEvent(this.getPosition(), this.getTileEntity().getBlockState().getBlock(), 1, 0);
|
||||
- world.playSound(null, this.getPosition(), SoundEvents.SHULKER_BOX_OPEN, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
+ world.playSound(null, this.getPosition(), SoundEvents.SHULKER_BOX_CLOSE, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Paper - More Lidded Block API (Wrong sound)
|
||||
}
|
||||
getTileEntity().opened = false;
|
||||
this.getTileEntity().opened = false;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
|
||||
public CraftShulkerBox copy() {
|
||||
|
|
|
@ -469,7 +469,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
@Override
|
||||
public net.minecraft.world.entity.projectile.ThrownPotion getHandle() {
|
||||
return (net.minecraft.world.entity.projectile.ThrownPotion) entity;
|
||||
return (net.minecraft.world.entity.projectile.ThrownPotion) this.entity;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
||||
|
|
|
@ -211,4 +211,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ entity.connection.internalTeleport(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), relativeArguments); // Paper - Teleport API
|
||||
} else {
|
||||
// The respawn reason should never be used if the passed location is non null.
|
||||
server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper
|
||||
this.server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper
|
||||
|
|
|
@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
scoreboard.board.addPlayerToTeam(entry, team);
|
||||
scoreboard.board.addPlayerToTeam(entry, this.team);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ final String nameBefore = thread.getName();
|
||||
+ thread.setName(nameBefore + " - " + this.getOwner().getName());
|
||||
+ try { synchronized (this.workers) { // Paper end - name threads according to running plugin
|
||||
if (getPeriod() == CraftTask.CANCEL) {
|
||||
if (this.getPeriod() == CraftTask.CANCEL) {
|
||||
// Never continue running after cancelled.
|
||||
// Checking this with the lock is important!
|
||||
@@ -0,0 +0,0 @@ class CraftAsyncTask extends CraftTask {
|
||||
|
|
|
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public Material getType() {
|
||||
- return CraftMagicNumbers.getMaterial(this.world.getBlockState(position).getBlock());
|
||||
- return CraftMagicNumbers.getMaterial(this.world.getBlockState(this.position).getBlock());
|
||||
+ return this.world.getBlockState(this.position).getBukkitMaterial(); // Paper - optimise getType calls
|
||||
}
|
||||
|
||||
|
|
|
@ -112,8 +112,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void addToCraftingManager() {
|
||||
ItemStack result = this.getResult();
|
||||
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result))));
|
||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt()))); // Paper
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result))));
|
||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt()))); // Paper
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
|
||||
|
@ -141,7 +141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public void addToCraftingManager() {
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true))));
|
||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), this.willCopyNbt()))); // Paper
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true))));
|
||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), this.willCopyNbt()))); // Paper
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7013,7 +7013,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void loadPlugins() {
|
||||
- this.pluginManager.registerInterface(JavaPluginLoader.class);
|
||||
-
|
||||
- File pluginFolder = (File) console.options.valueOf("plugins");
|
||||
- File pluginFolder = (File) this.console.options.valueOf("plugins");
|
||||
-
|
||||
- if (pluginFolder.exists()) {
|
||||
- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder);
|
||||
|
|
|
@ -4836,7 +4836,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings"));
|
||||
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
|
||||
org.spigotmc.SpigotConfig.registerCommands();
|
||||
// Spigot end
|
||||
+ // Paper start
|
||||
|
@ -4906,7 +4906,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
+ this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
world.serverLevelData.setDifficulty(config.difficulty);
|
||||
|
|
|
@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return server.getPlayer(getUniqueId()) != null;
|
||||
return this.server.getPlayer(this.getUniqueId()) != null;
|
||||
}
|
||||
|
||||
- @Override
|
||||
|
@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
}
|
||||
-
|
||||
- server.getPluginManager().callEvent(new PlayerHideEntityEvent(this, entity));
|
||||
- this.server.getPluginManager().callEvent(new PlayerHideEntityEvent(this, entity));
|
||||
}
|
||||
|
||||
void resetAndHideEntity(org.bukkit.entity.Entity entity) {
|
||||
|
@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
|
||||
this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
|
||||
}
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
|
|
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
|
||||
chunkRange = (chunkRange > this.level.spigotConfig.viewDistance) ? (byte) this.level.spigotConfig.viewDistance : chunkRange;
|
||||
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
|
||||
|
||||
- double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D;
|
||||
|
|
|
@ -89,9 +89,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
||||
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
|
||||
- send(new ClientboundAddEntityPacket(entity));
|
||||
- ServerGamePacketListenerImpl.this.send(new ClientboundAddEntityPacket(entity));
|
||||
+ entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it.
|
||||
player.containerMenu.sendAllDataToRemote();
|
||||
ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
|
|
|
@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
||||
+ this.addLevel(world); // Paper - move up
|
||||
this.initWorld(world, worlddata, worldData, worldoptions);
|
||||
this.initWorld(world, worlddata, this.worldData, worldoptions);
|
||||
|
||||
- this.addLevel(world);
|
||||
+ // Paper - move up
|
||||
|
|
|
@ -88,36 +88,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
private LootContextParamSet paramSet;
|
||||
private Optional<ResourceLocation> randomSequence;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftParticle.java b/src/main/java/org/bukkit/craftbukkit/CraftParticle.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftParticle.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftParticle.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftParticle<D> implements Keyed {
|
||||
private static final BiFunction<NamespacedKey, net.minecraft.core.particles.ParticleType<?>, CraftParticle<?>> VOID_FUNCTION = (name, particle) -> new CraftParticle<>(name, particle, Void.class) {
|
||||
@Override
|
||||
public ParticleOptions createParticleParam(Void data) {
|
||||
- return (SimpleParticleType) CraftParticle.this.getHandle();
|
||||
+ return (SimpleParticleType) this.getHandle(); // Paper - fix?
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftParticle<D> implements Keyed {
|
||||
BiFunction<NamespacedKey, net.minecraft.core.particles.ParticleType<?>, CraftParticle<?>> itemStackFunction = (name, particle) -> new CraftParticle<>(name, particle, ItemStack.class) {
|
||||
@Override
|
||||
public ParticleOptions createParticleParam(ItemStack data) {
|
||||
- return new ItemParticleOption((net.minecraft.core.particles.ParticleType<ItemParticleOption>) CraftParticle.this.getHandle(), CraftItemStack.asNMSCopy(data));
|
||||
+ return new ItemParticleOption((net.minecraft.core.particles.ParticleType<ItemParticleOption>) this.getHandle(), CraftItemStack.asNMSCopy(data)); // Paper - fix?
|
||||
}
|
||||
};
|
||||
|
||||
BiFunction<NamespacedKey, net.minecraft.core.particles.ParticleType<?>, CraftParticle<?>> blockDataFunction = (name, particle) -> new CraftParticle<>(name, particle, BlockData.class) {
|
||||
@Override
|
||||
public ParticleOptions createParticleParam(BlockData data) {
|
||||
- return new BlockParticleOption((net.minecraft.core.particles.ParticleType<BlockParticleOption>) CraftParticle.this.getHandle(), ((CraftBlockData) data).getState());
|
||||
+ return new BlockParticleOption((net.minecraft.core.particles.ParticleType<BlockParticleOption>) this.getHandle(), ((CraftBlockData) data).getState()); // Paper - fix?
|
||||
}
|
||||
};
|
||||
|
||||
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/test/java/org/bukkit/DyeColorsTest.java
|
||||
|
|
|
@ -183,12 +183,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper end
|
||||
|
||||
@@ -0,0 +0,0 @@ public class CraftContainer extends AbstractContainerMenu {
|
||||
this.lastSlots = delegate.lastSlots;
|
||||
this.slots = delegate.slots;
|
||||
this.remoteSlots = delegate.remoteSlots;
|
||||
this.lastSlots = this.delegate.lastSlots;
|
||||
this.slots = this.delegate.slots;
|
||||
this.remoteSlots = this.delegate.remoteSlots;
|
||||
+ // Paper start - copy data slots for InventoryView#set/getProperty
|
||||
+ this.dataSlots = delegate.dataSlots;
|
||||
+ this.remoteDataSlots = delegate.remoteDataSlots;
|
||||
+ this.dataSlots = this.delegate.dataSlots;
|
||||
+ this.remoteDataSlots = this.delegate.remoteDataSlots;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
|
|
|
@ -16767,7 +16767,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
try {
|
||||
if (!this.initServer()) {
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
Arrays.fill( recentTps, 20 );
|
||||
Arrays.fill( this.recentTps, 20 );
|
||||
long curTime, tickSection = Util.getMillis(), tickCount = 1;
|
||||
while (this.running) {
|
||||
+ // Paper start - rewrite chunk system
|
||||
|
@ -19524,7 +19524,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- return super.pollTask();
|
||||
}
|
||||
- } finally {
|
||||
- chunkMap.callbackExecutor.run();
|
||||
- ServerChunkCache.this.chunkMap.callbackExecutor.run();
|
||||
- }
|
||||
- // CraftBukkit end
|
||||
+ return super.pollTask() | ServerChunkCache.this.level.chunkTaskScheduler.executeMainThreadTask(); // Paper - rewrite chunk system
|
||||
|
@ -22593,17 +22593,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public boolean isEntitiesLoaded() {
|
||||
- return this.getCraftWorld().getHandle().entityManager.areEntitiesLoaded(ChunkPos.asLong(x, z));
|
||||
- return this.getCraftWorld().getHandle().entityManager.areEntitiesLoaded(ChunkPos.asLong(this.x, this.z));
|
||||
+ return this.getCraftWorld().getHandle().areEntitiesLoaded(io.papermc.paper.util.CoordinateUtils.getChunkKey(this.x, this.z)); // Paper - rewrite chunk system
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
this.getWorld().getChunkAt(x, z); // Transient load for this tick
|
||||
this.getWorld().getChunkAt(this.x, this.z); // Transient load for this tick
|
||||
}
|
||||
|
||||
- PersistentEntitySectionManager<net.minecraft.world.entity.Entity> entityManager = this.getCraftWorld().getHandle().entityManager;
|
||||
- long pair = ChunkPos.asLong(x, z);
|
||||
- long pair = ChunkPos.asLong(this.x, this.z);
|
||||
-
|
||||
- if (entityManager.areEntitiesLoaded(pair)) {
|
||||
- return entityManager.getEntities(new ChunkPos(this.x, this.z)).stream()
|
||||
|
@ -22647,7 +22647,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- return entityManager.getEntities(new ChunkPos(this.x, this.z)).stream()
|
||||
- .map(net.minecraft.world.entity.Entity::getBukkitEntity)
|
||||
- .filter(Objects::nonNull).toArray(Entity[]::new);
|
||||
+ return getCraftWorld().getHandle().getChunkEntities(this.x, this.z); // Paper - rewrite chunk system
|
||||
+ return this.getCraftWorld().getHandle().getChunkEntities(this.x, this.z); // Paper - rewrite chunk system
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22677,7 +22677,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public boolean isPrimaryThread() {
|
||||
- return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog)
|
||||
- return Thread.currentThread().equals(this.console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog)
|
||||
+ return io.papermc.paper.util.TickThread.isTickThread(); // Paper - rewrite chunk system
|
||||
}
|
||||
|
||||
|
@ -22749,13 +22749,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Spigot start
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
- return world.spigotConfig.viewDistance;
|
||||
- return this.world.spigotConfig.viewDistance;
|
||||
+ return this.getHandle().playerChunkLoader.getAPIViewDistance(); // Paper - replace player chunk loader
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSimulationDistance() {
|
||||
- return world.spigotConfig.simulationDistance;
|
||||
- return this.world.spigotConfig.simulationDistance;
|
||||
+ return this.getHandle().playerChunkLoader.getAPITickDistance(); // Paper - replace player chunk loader
|
||||
}
|
||||
// Spigot end
|
||||
|
@ -22947,9 +22947,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ActivationType.ANIMAL.boundingBox = player.getBoundingBox().inflate( animalActivationRange, 256, animalActivationRange );
|
||||
ActivationType.MONSTER.boundingBox = player.getBoundingBox().inflate( monsterActivationRange, 256, monsterActivationRange );
|
||||
|
||||
- world.getEntities().get(maxBB, ActivationRange::activateEntity);
|
||||
- world.getEntities().get(ActivationRange.maxBB, ActivationRange::activateEntity);
|
||||
+ // Paper start
|
||||
+ java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, null);
|
||||
+ java.util.List<Entity> entities = world.getEntities((Entity)null, ActivationRange.maxBB, null);
|
||||
+ for (int i = 0; i < entities.size(); i++) {
|
||||
+ Entity entity = entities.get(i);
|
||||
+ ActivationRange.activateEntity(entity);
|
||||
|
|
|
@ -27,4 +27,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (System.getProperty("jdk.nio.maxCachedBufferSize") == null) System.setProperty("jdk.nio.maxCachedBufferSize", "262144"); // Paper - cap per-thread NIO cache size
|
||||
OptionParser parser = new OptionParser() {
|
||||
{
|
||||
acceptsAll(Main.asList("?", "help"), "Show the help");
|
||||
this.acceptsAll(Main.asList("?", "help"), "Show the help");
|
||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return CraftChatMessage.fromJSONComponent(displayName);
|
||||
return CraftChatMessage.fromJSONComponent(this.displayName);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
|
|
@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta {
|
||||
CompoundTag trimCompound = tag.getCompound(TRIM.NBT);
|
||||
CompoundTag trimCompound = tag.getCompound(CraftMetaArmor.TRIM.NBT);
|
||||
|
||||
if (trimCompound.contains(TRIM_MATERIAL.NBT, net.minecraft.nbt.Tag.TAG_STRING) && trimCompound.contains(TRIM_PATTERN.NBT, net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - for now, ignore inline definitions of trim material & pattern
|
||||
- TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(TRIM_MATERIAL.NBT)));
|
||||
- TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(TRIM_PATTERN.NBT)));
|
||||
if (trimCompound.contains(CraftMetaArmor.TRIM_MATERIAL.NBT, net.minecraft.nbt.Tag.TAG_STRING) && trimCompound.contains(CraftMetaArmor.TRIM_PATTERN.NBT, net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - for now, ignore inline definitions of trim material & pattern
|
||||
- TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(CraftMetaArmor.TRIM_MATERIAL.NBT)));
|
||||
- TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(CraftMetaArmor.TRIM_PATTERN.NBT)));
|
||||
+ // Paper start
|
||||
+ TrimMaterial trimMaterial = getRegistry(Registry.TRIM_MATERIAL, trimCompound.getString(TRIM_MATERIAL.NBT));
|
||||
+ TrimPattern trimPattern = getRegistry(Registry.TRIM_PATTERN, trimCompound.getString(TRIM_PATTERN.NBT));
|
||||
|
@ -75,12 +75,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
super(tag);
|
||||
|
||||
+ try { // Paper - Ignore invalid game profiles
|
||||
if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||
this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT)));
|
||||
} else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(SKULL_OWNER.NBT).isEmpty()) {
|
||||
this.setProfile(new GameProfile(Util.NIL_UUID, tag.getString(SKULL_OWNER.NBT)));
|
||||
if (tag.contains(CraftMetaSkull.SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||
this.setProfile(NbtUtils.readGameProfile(tag.getCompound(CraftMetaSkull.SKULL_OWNER.NBT)));
|
||||
} else if (tag.contains(CraftMetaSkull.SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(CraftMetaSkull.SKULL_OWNER.NBT).isEmpty()) {
|
||||
this.setProfile(new GameProfile(Util.NIL_UUID, tag.getString(CraftMetaSkull.SKULL_OWNER.NBT)));
|
||||
}
|
||||
+ } catch (Exception ignored) {} // Paper
|
||||
|
||||
if (tag.contains(BLOCK_ENTITY_TAG.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||
CompoundTag nbtTagCompound = tag.getCompound(BLOCK_ENTITY_TAG.NBT).copy();
|
||||
if (tag.contains(CraftMetaSkull.BLOCK_ENTITY_TAG.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||
CompoundTag nbtTagCompound = tag.getCompound(CraftMetaSkull.BLOCK_ENTITY_TAG.NBT).copy();
|
||||
|
|
|
@ -970,9 +970,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
- ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper);
|
||||
- server.dispatchServerCommand(event.getSender(), serverCommand);
|
||||
+
|
||||
+ // Paper start
|
||||
+ command.set(event.getCommand());
|
||||
+ if (event.getCommand().toLowerCase().startsWith("timings") && event.getCommand().toLowerCase().matches("timings (report|paste|get|merged|seperate)")) {
|
||||
|
@ -987,8 +984,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ co.aikar.timings.Timings.generateReport(new co.aikar.timings.TimingsReportListener(sender, waitable));
|
||||
+ } else {
|
||||
+ // Paper end
|
||||
+ ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper);
|
||||
+ server.dispatchServerCommand(event.getSender(), serverCommand);
|
||||
ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper);
|
||||
this.server.dispatchServerCommand(event.getSender(), serverCommand);
|
||||
+ } // Paper
|
||||
});
|
||||
+ // Paper start
|
||||
|
@ -1074,7 +1071,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
gameprofilerfiller.incrementCounter("getChunkCacheMiss");
|
||||
- level.timings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||
- this.level.timings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create);
|
||||
ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
|
||||
|
||||
|
@ -1082,7 +1079,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (!completablefuture.isDone()) { // Paper
|
||||
+ this.level.timings.syncChunkLoad.startTiming(); // Paper
|
||||
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
||||
- level.timings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
- this.level.timings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
+ this.level.timings.syncChunkLoad.stopTiming(); // Paper
|
||||
+ } // Paper
|
||||
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
||||
|
@ -1109,7 +1106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
this.level.timings.doChunkUnload.startTiming(); // Spigot
|
||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
||||
|
@ -1183,8 +1180,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.updateSkyBrightness();
|
||||
this.tickTime();
|
||||
gameprofilerfiller.popPush("tickPending");
|
||||
- timings.doTickPending.startTiming(); // Spigot
|
||||
+ timings.scheduledBlocks.startTiming(); // Paper
|
||||
- this.timings.doTickPending.startTiming(); // Spigot
|
||||
+ this.timings.scheduledBlocks.startTiming(); // Paper
|
||||
if (!this.isDebug()) {
|
||||
j = this.getGameTime();
|
||||
gameprofilerfiller.push("blockTicks");
|
||||
|
@ -1192,8 +1189,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.fluidTicks.tick(j, 65536, this::tickFluid);
|
||||
gameprofilerfiller.pop();
|
||||
}
|
||||
- timings.doTickPending.stopTiming(); // Spigot
|
||||
+ timings.scheduledBlocks.stopTiming(); // Paper
|
||||
- this.timings.doTickPending.stopTiming(); // Spigot
|
||||
+ this.timings.scheduledBlocks.stopTiming(); // Paper
|
||||
|
||||
gameprofilerfiller.popPush("raid");
|
||||
+ this.timings.raids.startTiming(); // Paper - timings
|
||||
|
@ -1204,7 +1201,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.getChunkSource().tick(shouldKeepTicking, true);
|
||||
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
|
||||
gameprofilerfiller.popPush("blockEvents");
|
||||
timings.doSounds.startTiming(); // Spigot
|
||||
this.timings.doSounds.startTiming(); // Spigot
|
||||
this.runBlockEvents();
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
|
@ -1258,7 +1255,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
if (!savingDisabled) {
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit
|
||||
+ try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
|
||||
if (progressListener != null) {
|
||||
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
|
||||
|
@ -1530,17 +1527,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
});
|
||||
// CraftBukkit end
|
||||
- this.timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
|
||||
+ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
+ this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
timings.tileEntityTick.stopTiming(); // Spigot
|
||||
this.timings.tileEntityTick.stopTiming(); // Spigot
|
||||
this.tickingBlockEntities = false;
|
||||
+ co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper
|
||||
gameprofilerfiller.pop();
|
||||
spigotConfig.currentPrimedTnt = 0; // Spigot
|
||||
this.spigotConfig.currentPrimedTnt = 0; // Spigot
|
||||
}
|
||||
|
||||
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
|
||||
|
@ -2115,7 +2112,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
final int animalActivationRange = world.spigotConfig.animalActivationRange;
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
|
||||
world.getEntities().get(maxBB, ActivationRange::activateEntity);
|
||||
world.getEntities().get(ActivationRange.maxBB, ActivationRange::activateEntity);
|
||||
}
|
||||
- SpigotTimings.entityActivationCheckTimer.stopTiming();
|
||||
+ MinecraftTimings.entityActivationCheckTimer.stopTiming();
|
||||
|
|
|
@ -321,7 +321,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - Use TerminalConsoleAppender
|
||||
+ new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start();
|
||||
+ /*
|
||||
jline.console.ConsoleReader bufferedreader = reader;
|
||||
jline.console.ConsoleReader bufferedreader = DedicatedServer.this.reader;
|
||||
|
||||
// MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
@ -407,7 +407,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - JLine update
|
||||
+ /*
|
||||
public ConsoleReader getReader() {
|
||||
return console.reader;
|
||||
return this.console.reader;
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
|
@ -533,12 +533,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
protected List<String> evaluate() {
|
||||
- List<String> offers = ConsoleCommandCompleter.this.server.getCommandMap().tabComplete(ConsoleCommandCompleter.this.server.getConsoleSender(), buffer);
|
||||
+ List<String> offers = server.getCommandMap().tabComplete(server.getConsoleSender(), buffer); // Paper - fix remap
|
||||
+ List<String> offers = server.getCommandMap().tabComplete(server.getConsoleSender(), buffer); // Paper - Remove "this."
|
||||
|
||||
- TabCompleteEvent tabEvent = new TabCompleteEvent(ConsoleCommandCompleter.this.server.getConsoleSender(), buffer, (offers == null) ? Collections.EMPTY_LIST : offers);
|
||||
- ConsoleCommandCompleter.this.server.getPluginManager().callEvent(tabEvent);
|
||||
+ TabCompleteEvent tabEvent = new TabCompleteEvent(server.getConsoleSender(), buffer, (offers == null) ? Collections.EMPTY_LIST : offers); // Paper - fix remap
|
||||
+ server.getPluginManager().callEvent(tabEvent); // Paper - fix remap
|
||||
+ TabCompleteEvent tabEvent = new TabCompleteEvent(server.getConsoleSender(), buffer, (offers == null) ? Collections.EMPTY_LIST : offers); // Paper - Remove "this."
|
||||
+ server.getPluginManager().callEvent(tabEvent); // Paper - Remove "this."
|
||||
|
||||
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.server.close();
|
||||
} finally {
|
||||
try {
|
||||
- server.reader.getTerminal().restore();
|
||||
- this.server.reader.getTerminal().restore();
|
||||
+ net.minecrell.terminalconsole.TerminalConsoleAppender.close(); // Paper - Use TerminalConsoleAppender
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue