mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-16 18:31:53 +01:00
even even even even even even even more work
This commit is contained in:
parent
4b66e6c02d
commit
4257a725ae
6 changed files with 34 additions and 139 deletions
|
@ -1,102 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: vemacs <d@nkmem.es>
|
||||
Date: Wed, 23 Nov 2016 08:31:45 -0500
|
||||
Subject: [PATCH] Cache user authenticator threads
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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
|
||||
}
|
||||
}
|
||||
|
||||
- player.entitiesToRemove.remove(Integer.valueOf(this.entity.getId()));
|
||||
+ player.removeQueue.remove(Integer.valueOf(this.entity.getId()));
|
||||
// CraftBukkit end
|
||||
|
||||
if (flag1 && this.trackedPlayerMap.putIfAbsent(player, true) == null) { // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -0,0 +0,0 @@ import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import com.mojang.serialization.DataResult;
|
||||
+import java.util.ArrayDeque; // Paper
|
||||
import java.util.Collection;
|
||||
+import java.util.Deque; // Paper
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
public ServerGamePacketListenerImpl connection;
|
||||
public final MinecraftServer server;
|
||||
public final ServerPlayerGameMode gameMode;
|
||||
- public final List<Integer> entitiesToRemove = Lists.newLinkedList();
|
||||
+ public final Deque<Integer> removeQueue = new ArrayDeque<>(); // Paper
|
||||
private final PlayerAdvancements advancements;
|
||||
private final ServerStatsCounter stats;
|
||||
private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE;
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
this.containerMenu = this.inventoryMenu;
|
||||
}
|
||||
|
||||
- while (!this.entitiesToRemove.isEmpty()) {
|
||||
- int i = Math.min(this.entitiesToRemove.size(), Integer.MAX_VALUE);
|
||||
+ while (!this.removeQueue.isEmpty()) {
|
||||
+ int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE);
|
||||
int[] aint = new int[i];
|
||||
- Iterator<Integer> iterator = this.entitiesToRemove.iterator();
|
||||
+ //Iterator<Integer> iterator = this.removeQueue.iterator(); // Paper
|
||||
int j = 0;
|
||||
|
||||
- while (iterator.hasNext() && j < i) {
|
||||
+ // Paper start
|
||||
+ /* while (iterator.hasNext() && j < i) {
|
||||
aint[j++] = (Integer) iterator.next();
|
||||
iterator.remove();
|
||||
+ } */
|
||||
+
|
||||
+ Integer integer;
|
||||
+ while (j < i && (integer = this.removeQueue.poll()) != null) {
|
||||
+ aint[j++] = integer.intValue();
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
this.connection.send(new ClientboundRemoveEntitiesPacket(aint));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
// this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit
|
||||
- this.entitiesToRemove.addAll(oldPlayer.entitiesToRemove);
|
||||
+ // Paper start - Optimize remove queue - vanilla copies player objects, but CB doesn't. This method currently only
|
||||
+ // Applies to the same player, so we need to not duplicate our removal queue. The rest of this method does "resetting"
|
||||
+ // type logic so it does need to be called, maybe? This is silly.
|
||||
+ // this.removeQueue.addAll(entityplayer.removeQueue);
|
||||
+ if (this.removeQueue != oldPlayer.removeQueue) {
|
||||
+ this.removeQueue.addAll(oldPlayer.removeQueue);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.seenCredits = oldPlayer.seenCredits;
|
||||
this.enteredNetherPosition = oldPlayer.enteredNetherPosition;
|
||||
this.setShoulderEntityLeft(oldPlayer.getShoulderEntityLeft());
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
if (entity instanceof Player) {
|
||||
this.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{entity.getId()}));
|
||||
} else {
|
||||
- this.entitiesToRemove.add((Integer) entity.getId()); // CraftBukkit - decompile error
|
||||
+ this.removeQueue.add((Integer) entity.getId()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void cancelRemoveEntity(Entity entity) {
|
||||
- this.entitiesToRemove.remove((Integer) entity.getId()); // CraftBukkit - decompile error
|
||||
+ this.removeQueue.remove((Integer) entity.getId()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,19 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 19 Jul 2018 01:05:00 -0400
|
||||
Subject: [PATCH] Don't change the Entity Random seed for squids
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -0,0 +0,0 @@ public class Squid extends WaterAnimal {
|
||||
|
||||
public Squid(EntityType<? extends Squid> type, Level world) {
|
||||
super(type, world);
|
||||
- this.random.setSeed((long) this.getId());
|
||||
+ //this.random.setSeed((long) this.getId()); // Paper
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alfie Cleveland <alfeh@me.com>
|
||||
Date: Fri, 25 Nov 2016 13:22:40 +0000
|
||||
Subject: [PATCH] Optimise removeQueue
|
||||
Subject: [PATCH] Cache user authenticator threads
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
|
@ -15,7 +15,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - Cache authenticator threads
|
||||
+ private static final AtomicInteger threadId = new AtomicInteger(0);
|
||||
+ private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(
|
||||
+ r -> new Thread(r, "User Authenticator #" + threadId.incrementAndGet())
|
||||
+ r -> {
|
||||
+ Thread ret = new Thread(r, "User Authenticator #" + threadId.incrementAndGet());
|
||||
+
|
||||
+ ret.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+ );
|
||||
+ // Paper end
|
||||
// Spigot start
|
||||
|
@ -33,7 +39,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 " + gameProfile.getName(), ex);
|
||||
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.gameProfile.getName(), ex);
|
||||
}
|
||||
}
|
||||
- }.start();
|
|
@ -8,14 +8,6 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/m
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ package com.destroystokyo.paper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void removeCorruptTEs() {
|
||||
removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
|
||||
|
@ -35,15 +27,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity {
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag tag) {
|
||||
this.blockState = NbtUtils.readBlockState(tag.getCompound("BlockState"));
|
||||
protected void readAdditionalSaveData(CompoundTag nbt) {
|
||||
this.blockState = NbtUtils.readBlockState(nbt.getCompound("BlockState"));
|
||||
+ // Paper start - Block FallingBlocks with Command Blocks
|
||||
+ // Check mappings on update - dc = "repeating_command_block" - dd = "chain_command_block"
|
||||
+ final Block b = this.blockState.getBlock();
|
||||
+ if (this.level.paperConfig.filterNBTFromSpawnEgg && (b == Blocks.COMMAND_BLOCK || b == Blocks.REPEATING_COMMAND_BLOCK || b == Blocks.CHAIN_COMMAND_BLOCK)) {
|
||||
+ if (this.level.paperConfig.filterNBTFromSpawnEgg
|
||||
+ && (b == Blocks.COMMAND_BLOCK
|
||||
+ || b == Blocks.REPEATING_COMMAND_BLOCK
|
||||
+ || b == Blocks.CHAIN_COMMAND_BLOCK
|
||||
+ || b == Blocks.JIGSAW
|
||||
+ || b == Blocks.STRUCTURE_BLOCK
|
||||
+ || b instanceof net.minecraft.world.level.block.GameMasterBlock)) {
|
||||
+ this.blockState = Blocks.STONE.defaultBlockState();
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.time = tag.getInt("Time");
|
||||
if (tag.contains("HurtEntities", 99)) {
|
||||
this.hurtEntities = tag.getBoolean("HurtEntities");
|
||||
this.time = nbt.getInt("Time");
|
||||
if (nbt.contains("HurtEntities", 99)) {
|
||||
this.hurtEntities = nbt.getBoolean("HurtEntities");
|
|
@ -40,3 +40,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.remainingFireTicks = -this.getFireImmuneTicks();
|
||||
this.fluidHeight = new Object2DoubleArrayMap(2);
|
||||
this.firstTick = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -0,0 +0,0 @@ public class Squid extends WaterAnimal {
|
||||
|
||||
public Squid(EntityType<? extends Squid> type, Level world) {
|
||||
super(type, world);
|
||||
- this.random.setSeed((long) this.getId());
|
||||
+ //this.random.setSeed((long) this.getId()); // Paper - we set the random to shared, do not clobber the seed
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue