some more patches

This commit is contained in:
Jason Penilla 2023-12-05 15:21:44 -07:00
parent f6bef3efe8
commit 9811c737bb
65 changed files with 53 additions and 52 deletions

View file

@ -53,9 +53,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot()));
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} else {
speed = this.player.getAbilities().walkingSpeed * 10f;
}
} else {
speed = this.player.getAbilities().walkingSpeed * 10f;
}
+ // Paper start - Prevent moving into unloaded chunks
+ if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) {
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet());
@ -63,5 +63,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;

View file

@ -26,13 +26,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- ServerChunkCache chunkproviderserver = worldserver.getChunkSource();
+ //ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper - move up
this.nextTickTime = Util.getMillis();
this.nextTickTimeNanos = Util.getNanos();
- // CraftBukkit start
- if (worldserver.getWorld().getKeepSpawnInMemory()) {
- chunkproviderserver.addRegionTicket(TicketType.START, new ChunkPos(blockposition), 11, Unit.INSTANCE);
-
- while (chunkproviderserver.getTickingGenerated() != 441) {
- // this.nextTickTime = SystemUtils.getMillis() + 10L;
- // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
- this.executeModerately();
- }
- }
@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ worldserver.addTicketsForSpawn(radiusBlocks, blockposition);
+ // Paper end
// this.nextTickTime = SystemUtils.getMillis() + 10L;
// this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
this.executeModerately();
// Iterator iterator = this.levels.values().iterator();
+ }
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (true) {
ServerLevel worldserver1 = worldserver;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// this.nextTickTime = SystemUtils.getMillis() + 10L;
// this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
this.executeModerately();
// CraftBukkit end
- worldloadlistener.stop();

View file

@ -62,7 +62,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
}
// Paper end
@ -70,9 +70,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
}
+ if (spawnReason != null) {
+ nbt.putString("Paper.SpawnReason", spawnReason.name());
@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Save entity's from mob spawner status
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status

View file

@ -66,12 +66,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.world.phys.Vec3;
import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
-public class CommandSourceStack implements SharedSuggestionProvider {
+public class CommandSourceStack implements SharedSuggestionProvider, com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource { // Paper
-public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider {
+public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider, com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource { // Paper
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
@@ -0,0 +0,0 @@ public class CommandSourceStack implements SharedSuggestionProvider {
@@ -0,0 +0,0 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
return this.textName;
}

View file

@ -40,13 +40,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/Util.java
@@ -0,0 +0,0 @@ public class Util {
private static final int DEFAULT_MAX_THREADS = 255;
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1);
- private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
+ private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
@@ -0,0 +0,0 @@ public class Util {
return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now());
}
@ -62,9 +62,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (i <= 0) {
executorService = MoreExecutors.newDirectExecutorService();
} else {
- executorService = new ForkJoinPool(i, (forkJoinPool) -> {
- ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(forkJoinPool) {
+ executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<Runnable>(), target -> new io.papermc.paper.util.ServerWorkerThread(target, s, priorityModifier));
- AtomicInteger atomicInteger = new AtomicInteger(1);
- executorService = new ForkJoinPool(i, (pool) -> {
- ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(pool) {
+ executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<>(), target -> new io.papermc.paper.util.ServerWorkerThread(target, s, priorityModifier));
+ }
+ /*
@Override

View file

@ -342,16 +342,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-public class ShapedRecipe implements CraftingRecipe {
+public class ShapedRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingContainer> implements CraftingRecipe { // Paper - improve exact recipe choices
final int width;
final int height;
final ShapedRecipePattern pattern;
final ItemStack result;
@@ -0,0 +0,0 @@ public class ShapedRecipe implements CraftingRecipe {
this.recipeItems = ingredients;
this.pattern = raw;
this.result = result;
this.showNotification = showNotification;
+ this.checkExactIngredients(); // Paper - improve exact recipe choices
}
public ShapedRecipe(String group, CraftingBookCategory category, int width, int height, NonNullList<Ingredient> ingredients, ItemStack result) {
public ShapedRecipe(String group, CraftingBookCategory category, ShapedRecipePattern raw, ItemStack result) {
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java

View file

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private final MessageSignatureCache messageSignatureCache;
private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault();
private final FutureChain chatMessageChain;
private boolean waitingForSwitchToConfig;
+ private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper

View file

@ -15,21 +15,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -0,0 +0,0 @@ public abstract class Projectile extends Entity implements TraceableEntity {
return this.cachedOwner;
} else if (this.ownerUUID != null && this.level() instanceof ServerLevel) {
this.cachedOwner = ((ServerLevel) this.level()).getEntity(this.ownerUUID);
+ // Paper start - check all worlds
+ if (this.cachedOwner == null) {
+ for (final ServerLevel level : this.level().getServer().getAllLevels()) {
+ if (level == this.level()) continue;
+ final Entity entity = level.getEntity(this.ownerUUID);
+ if (entity != null) {
+ this.cachedOwner = entity;
+ break;
ServerLevel worldserver = (ServerLevel) world;
this.cachedOwner = worldserver.getEntity(this.ownerUUID);
+ // Paper start - check all worlds
+ if (this.cachedOwner == null) {
+ for (final ServerLevel level : this.level().getServer().getAllLevels()) {
+ if (level == this.level()) continue;
+ final Entity entity = level.getEntity(this.ownerUUID);
+ if (entity != null) {
+ this.cachedOwner = entity;
+ break;
+ }
+ }
+ }
+ }
+ }
+ // Paper end
return this.cachedOwner;
} else {
return null;
+ // Paper end
return this.cachedOwner;
}
}

View file

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
++this.tickCount;
this.tickChildren(shouldKeepTicking);
this.tickRateManager.tick();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.runAllTasks();
}
@ -27,5 +27,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
+ // Paper end
this.profiler.push("tallying");
long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
long j = Util.getNanos() - i;
int k = this.tickCount % 100;

View file

@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -0,0 +0,0 @@ public abstract class AbstractMinecart extends Entity {
@@ -0,0 +0,0 @@ public abstract class AbstractMinecart extends VehicleEntity {
private double derailedX = 0.5;
private double derailedY = 0.5;
private double derailedZ = 0.5;

View file

@ -23,7 +23,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public void removeVehicle() {
@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
}
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
VehicleExitEvent event = new VehicleExitEvent(
(Vehicle) this.getBukkitEntity(),
@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
);
// Suppress during worldgen
if (this.valid) {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// CraftBukkit end
// Spigot start