mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Delete some dupe patches (should be fixed going forward)
This commit is contained in:
parent
6d1a918378
commit
bac47163e8
15 changed files with 0 additions and 650 deletions
|
@ -1,41 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 2 Apr 2016 05:09:16 -0400
|
||||
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
||||
index 77440ac81..8711462e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {
|
||||
|
||||
- private int a;
|
||||
+ private int a; public int getEntityId() { return this.a; } // Paper - add accessor
|
||||
private PacketPlayInUseEntity.EnumEntityUseAction action;
|
||||
private Vec3D c;
|
||||
private EnumHand d;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 2cc277e4f..553011d88 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Paper start - fire event
|
||||
+ else {
|
||||
+ this.server.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent(
|
||||
+ this.getPlayer(),
|
||||
+ packetplayinuseentity.getEntityId(),
|
||||
+ packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.ATTACK,
|
||||
+ packetplayinuseentity.b() == EnumHand.MAIN_HAND ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND
|
||||
+ ));
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
}
|
||||
|
||||
--
|
|
@ -1,34 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 3 Apr 2016 16:28:17 -0400
|
||||
Subject: [PATCH] Configurable Grass Spread Tick Rate
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 17fb883f6..eb09be512 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void useInhabitedTime() {
|
||||
useInhabitedTime = getBoolean("use-chunk-inhabited-timer", true);
|
||||
}
|
||||
+
|
||||
+ public int grassUpdateRate = 1;
|
||||
+ private void grassUpdateRate() {
|
||||
+ grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
|
||||
+ log("Grass Spread Tick Rate: " + grassUpdateRate);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
|
||||
index 6343fb1e0..903e8241b 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow {
|
||||
}
|
||||
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
|
||||
+ if (this instanceof BlockGrass && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + blockposition.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper
|
||||
if (!world.isClientSide) {
|
||||
if (!a((IWorldReader) world, blockposition)) {
|
||||
// CraftBukkit start
|
||||
--
|
|
@ -1,85 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 13 Sep 2014 23:14:43 -0400
|
||||
Subject: [PATCH] Configurable Keep Spawn Loaded range per world
|
||||
|
||||
This lets you disable it for some worlds and lower it for others.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index eb09be512..6ac58e5ec 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
|
||||
log("Grass Spread Tick Rate: " + grassUpdateRate);
|
||||
}
|
||||
+
|
||||
+ public short keepLoadedRange;
|
||||
+ private void keepLoadedRange() {
|
||||
+ keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16);
|
||||
+ log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16));
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1027b0588..b7aa9e869 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
Set set = Sets.newConcurrentHashSet();
|
||||
|
||||
- for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
|
||||
- for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
|
||||
+ // Paper start
|
||||
+ short radius = worldserver.paperConfig.keepLoadedRange;
|
||||
+ for (int i = -radius; i <= radius && this.isRunning(); i += 16) {
|
||||
+ for (int j = -radius; j <= radius && this.isRunning(); j += 16) {
|
||||
+ // Paper end
|
||||
arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index e42a334bc..d15afd595 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
int k = i * 16 + 8 - blockposition.getX();
|
||||
int l = j * 16 + 8 - blockposition.getZ();
|
||||
boolean flag = true;
|
||||
+ short keepLoadedRange = paperConfig.keepLoadedRange; // Paper
|
||||
|
||||
- return k >= -128 && k <= 128 && l >= -128 && l <= 128 && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory'
|
||||
+ return k >= -keepLoadedRange && k <= keepLoadedRange && l >= -keepLoadedRange && l <= keepLoadedRange && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory' // Paper - Re-add range var
|
||||
}
|
||||
|
||||
public void a(Packet<?> packet) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index f98f355dd..2bcd1c3ca 100644
|
||||
--- 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 {
|
||||
System.out.println("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
||||
|
||||
if (internal.getWorld().getKeepSpawnInMemory()) {
|
||||
- short short1 = 196;
|
||||
+ short short1 = internal.paperConfig.keepLoadedRange; // Paper
|
||||
long i = System.currentTimeMillis();
|
||||
for (int j = -short1; j <= short1; j += 16) {
|
||||
for (int k = -short1; k <= short1; k += 16) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 4df849eef..9d88b9ddb 100644
|
||||
--- 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 implements World {
|
||||
int chunkCoordX = chunkcoordinates.getX() >> 4;
|
||||
int chunkCoordZ = chunkcoordinates.getZ() >> 4;
|
||||
// Cycle through the 25x25 Chunks around it to load/unload the chunks.
|
||||
- for (int x = -12; x <= 12; x++) {
|
||||
- for (int z = -12; z <= 12; z++) {
|
||||
+ int radius = world.paperConfig.keepLoadedRange / 16; // Paper
|
||||
+ for (int x = -radius; x <= radius; x++) { // Paper
|
||||
+ for (int z = -radius; z <= radius; z++) { // Paper
|
||||
if (keepLoaded) {
|
||||
loadChunk(chunkCoordX + x, chunkCoordZ + z);
|
||||
} else {
|
||||
--
|
|
@ -1,21 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 31 Mar 2016 19:17:58 -0400
|
||||
Subject: [PATCH] Do not load chunks for light checks
|
||||
|
||||
Should only happen for blocks on the edge that uses neighbors light level
|
||||
(certain blocks). In that case, there will be 3-4 other neighbors to get a light level from.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index e88baae1d..e42a334bc 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
if (blockposition.getY() >= 256) {
|
||||
blockposition = new BlockPosition(blockposition.getX(), 255, blockposition.getZ());
|
||||
}
|
||||
+ if (!this.isLoaded(blockposition)) return 0; // Paper
|
||||
|
||||
return this.getChunkAtWorldCoords(blockposition).a(blockposition, i);
|
||||
}
|
||||
--
|
|
@ -1,32 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 5 Apr 2016 19:42:22 -0400
|
||||
Subject: [PATCH] Don't spam reload spawn chunks in nether/end
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 9fdedc2d7..3bf2cb8d0 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
return this.K;
|
||||
}
|
||||
|
||||
+ public boolean shouldStayLoaded(int i, int j) { return g(i, j); } // Paper - OBFHELPER
|
||||
public boolean g(int i, int j) {
|
||||
BlockPosition blockposition = this.getSpawn();
|
||||
int k = i * 16 + 8 - blockposition.getX();
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java
|
||||
index 6b62235e5..26ef3a41f 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldProvider.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldProvider.java
|
||||
@@ -0,0 +0,0 @@ public abstract class WorldProvider {
|
||||
public void l() {}
|
||||
|
||||
public boolean a(int i, int j) {
|
||||
- return true;
|
||||
+ return !this.b.shouldStayLoaded(i, j); // Paper - Use shouldStayLoaded check for all worlds
|
||||
}
|
||||
|
||||
protected abstract void m();
|
||||
--
|
|
@ -1,37 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 21:22:26 -0400
|
||||
Subject: [PATCH] EntityPathfindEvent
|
||||
|
||||
Fires when an Entity decides to start moving to a location.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 1964684ac..0c5215657 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
||||
public abstract class NavigationAbstract {
|
||||
|
||||
- protected EntityInsentient a;
|
||||
+ protected EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
|
||||
protected World b;
|
||||
@Nullable
|
||||
protected PathEntity c;
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
} else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
|
||||
return this.c;
|
||||
} else {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(getEntity().world, blockposition), null).callEvent()) { return null; } // Paper
|
||||
this.q = blockposition;
|
||||
float f = this.k();
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
|
||||
return this.c;
|
||||
} else {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(entity.world, blockposition), entity.getBukkitEntity()).callEvent()) { return null; } // Paper
|
||||
this.q = blockposition;
|
||||
float f = this.k();
|
||||
|
||||
--
|
|
@ -1,19 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 3 Apr 2016 17:48:50 -0400
|
||||
Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index d15afd595..9fdedc2d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
}
|
||||
|
||||
public void applyPhysics(BlockPosition blockposition, Block block) {
|
||||
+ if (captureBlockStates) { return; } // Paper - Cancel all physics during placement
|
||||
this.a(blockposition.west(), block, blockposition);
|
||||
this.a(blockposition.east(), block, blockposition);
|
||||
this.a(blockposition.down(), block, blockposition);
|
||||
--
|
|
@ -1,19 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 2 Apr 2016 20:37:03 -0400
|
||||
Subject: [PATCH] Fix reducedDebugInfo not initialized on client
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 23cab725d..8e1edde31 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
|
||||
playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
|
||||
playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
|
||||
+ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean("reducedDebugInfo") ? 22 : 23))); // Paper - fix this rule not being initialized on the client
|
||||
this.f(entityplayer);
|
||||
entityplayer.getStatisticManager().c();
|
||||
entityplayer.B().a(entityplayer);
|
||||
--
|
|
@ -1,53 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Wed, 6 Apr 2016 01:04:23 -0500
|
||||
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 6ac58e5ec..ff9929a05 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16);
|
||||
log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16));
|
||||
}
|
||||
+
|
||||
+ public boolean useVanillaScoreboardColoring;
|
||||
+ private void useVanillaScoreboardColoring() {
|
||||
+ useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index c37c46e71..fecf29710 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return this.getFlag(5);
|
||||
}
|
||||
|
||||
+ @Nullable public ScoreboardTeamBase getTeam() { return this.aY(); } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
public ScoreboardTeamBase be() {
|
||||
if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 553011d88..d61ce6461 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
return;
|
||||
}
|
||||
|
||||
- s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
|
||||
+ // Paper Start - (Meh) Support for vanilla world scoreboard name coloring
|
||||
+ String displayName = event.getPlayer().getDisplayName();
|
||||
+ if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) {
|
||||
+ displayName = ScoreboardTeam.getPlayerDisplayName(this.player.getTeam(), player.getDisplayName());
|
||||
+ }
|
||||
+
|
||||
+ s = String.format(event.getFormat(), displayName, event.getMessage());
|
||||
+ // Paper end
|
||||
minecraftServer.console.sendMessage(s);
|
||||
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
|
||||
for (Object recipient : minecraftServer.getPlayerList().players) {
|
||||
--
|
|
@ -1,51 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Antony Riley <antony@cyberiantiger.org>
|
||||
Date: Tue, 29 Mar 2016 06:56:23 +0300
|
||||
Subject: [PATCH] Reduce IO ops opening a new region file.
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
|
||||
index 3f9aa5923..4acb6df5d 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/server/RegionFile.java
|
||||
@@ -0,0 +0,0 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
+import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
+import java.nio.ByteBuffer;
|
||||
+import java.nio.IntBuffer;
|
||||
import java.util.List;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@@ -0,0 +0,0 @@ public class RegionFile {
|
||||
|
||||
int k;
|
||||
|
||||
+ // Paper Start
|
||||
+ ByteBuffer header = ByteBuffer.allocate(8192);
|
||||
+ while (header.hasRemaining()) {
|
||||
+ if (this.c.getChannel().read(header) == -1) throw new EOFException();
|
||||
+ }
|
||||
+ header.clear();
|
||||
+ IntBuffer headerAsInts = header.asIntBuffer();
|
||||
+ // Paper End
|
||||
for (j = 0; j < 1024; ++j) {
|
||||
- k = this.c.readInt();
|
||||
+ k = headerAsInts.get(); // Paper
|
||||
this.d[j] = k;
|
||||
if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) {
|
||||
for (int l = 0; l < (k & 255); ++l) {
|
||||
@@ -0,0 +0,0 @@ public class RegionFile {
|
||||
}
|
||||
|
||||
for (j = 0; j < 1024; ++j) {
|
||||
- k = this.c.readInt();
|
||||
+ k = headerAsInts.get(); // Paper
|
||||
this.e[j] = k;
|
||||
}
|
||||
} catch (IOException ioexception) {
|
||||
--
|
|
@ -1,44 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 5 Apr 2016 21:38:58 -0400
|
||||
Subject: [PATCH] Remove Debug checks from DataBits
|
||||
|
||||
These are super hot and causing noticeable hits
|
||||
|
||||
Before: http://i.imgur.com/nQsMzAE.png
|
||||
After: http://i.imgur.com/nJ46crB.png
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java
|
||||
index d24ec3d53..0fb3162e6 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataBits.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataBits.java
|
||||
@@ -0,0 +0,0 @@ public class DataBits {
|
||||
}
|
||||
|
||||
public DataBits(int i, int j, long[] along) {
|
||||
- Validate.inclusiveBetween(1L, 32L, (long) i);
|
||||
+ //Validate.inclusiveBetween(1L, 32L, (long) i); // Paper
|
||||
this.d = j;
|
||||
this.b = i;
|
||||
this.a = along;
|
||||
@@ -0,0 +0,0 @@ public class DataBits {
|
||||
}
|
||||
|
||||
public void a(int i, int j) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i);
|
||||
- Validate.inclusiveBetween(0L, this.c, (long) j);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper
|
||||
+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper
|
||||
int k = i * this.b;
|
||||
int l = k / 64;
|
||||
int i1 = ((i + 1) * this.b - 1) / 64;
|
||||
@@ -0,0 +0,0 @@ public class DataBits {
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper
|
||||
int j = i * this.b;
|
||||
int k = j / 64;
|
||||
int l = ((i + 1) * this.b - 1) / 64;
|
||||
--
|
|
@ -1,69 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 13 Apr 2016 00:25:28 -0400
|
||||
Subject: [PATCH] Remove unused World Tile Entity List
|
||||
|
||||
Massive hit to performance and it is completely unnecessary.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3bf2cb8d0..3b3cc69de 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
};
|
||||
// Spigot end
|
||||
protected final Set<Entity> g = Sets.newHashSet(); // Paper
|
||||
- public final List<TileEntity> tileEntityList = Lists.newArrayList();
|
||||
+ //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
|
||||
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
|
||||
private final List<TileEntity> c = Lists.newArrayList();
|
||||
private final Set<TileEntity> tileEntityListUnload = Sets.newHashSet(); // Paper
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
timings.tileEntityTick.startTiming(); // Spigot
|
||||
if (!this.tileEntityListUnload.isEmpty()) {
|
||||
this.tileEntityListTick.removeAll(this.tileEntityListUnload);
|
||||
- this.tileEntityList.removeAll(this.tileEntityListUnload);
|
||||
+ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
|
||||
this.tileEntityListUnload.clear();
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
if (tileentity.x()) {
|
||||
tilesThisCycle--;
|
||||
this.tileEntityListTick.remove(tileTickPosition--);
|
||||
- this.tileEntityList.remove(tileentity);
|
||||
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
if (this.isLoaded(tileentity.getPosition())) {
|
||||
this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition());
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
||||
// CraftBukkit start
|
||||
// From above, don't screw this up - SPIGOT-1746
|
||||
- if (!this.tileEntityList.contains(tileentity1)) {
|
||||
+ if (true) { // Paper - remove unused list
|
||||
this.a(tileentity1);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
protected void p_() {}
|
||||
|
||||
public boolean a(TileEntity tileentity) {
|
||||
- boolean flag = this.tileEntityList.add(tileentity);
|
||||
+ boolean flag = true; // Paper - remove unused list
|
||||
|
||||
- if (flag && tileentity instanceof ITickable) {
|
||||
+ if (flag && tileentity instanceof ITickable && !this.tileEntityListTick.contains(tileentity)) { // Paper
|
||||
this.tileEntityListTick.add(tileentity);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
} else {
|
||||
if (tileentity != null) {
|
||||
this.c.remove(tileentity);
|
||||
- this.tileEntityList.remove(tileentity);
|
||||
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
this.tileEntityListTick.remove(tileentity);
|
||||
}
|
||||
|
||||
--
|
|
@ -1,79 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Antony Riley <antony@cyberiantiger.org>
|
||||
Date: Tue, 29 Mar 2016 08:22:55 +0300
|
||||
Subject: [PATCH] Sanitise RegionFileCache and make configurable.
|
||||
|
||||
RegionFileCache prior to this patch would close every single open region
|
||||
file upon reaching a size of 256.
|
||||
This patch modifies that behaviour so it closes the the least recently
|
||||
used RegionFile.
|
||||
The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap).
|
||||
The maximum size of the RegionFileCache is also made configurable.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 2f6e169f5..ec4643384 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
private static void loadPermsBeforePlugins() {
|
||||
loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
|
||||
}
|
||||
+
|
||||
+ public static int regionFileCacheSize = 256;
|
||||
+ private static void regionFileCacheSize() {
|
||||
+ regionFileCacheSize = getInt("settings.region-file-cache-size", 256);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
|
||||
index 384628ccc..b335016fd 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
|
||||
@@ -0,0 +0,0 @@ import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
+import com.destroystokyo.paper.PaperConfig; // Paper
|
||||
+import java.util.LinkedHashMap; // Paper
|
||||
|
||||
public class RegionFileCache {
|
||||
|
||||
- public static final Map<File, RegionFile> a = Maps.newHashMap(); // Spigot - private -> public
|
||||
+ public static final Map<File, RegionFile> a = new LinkedHashMap(PaperConfig.regionFileCacheSize, 0.75f, true); // Spigot - private -> public, Paper - HashMap -> LinkedHashMap
|
||||
|
||||
public static synchronized RegionFile a(File file, int i, int j) {
|
||||
File file1 = new File(file, "region");
|
||||
@@ -0,0 +0,0 @@ public class RegionFileCache {
|
||||
file1.mkdirs();
|
||||
}
|
||||
|
||||
- if (RegionFileCache.a.size() >= 256) {
|
||||
- a();
|
||||
+ if (RegionFileCache.a.size() >= PaperConfig.regionFileCacheSize) { // Paper
|
||||
+ trimCache(); // Paper
|
||||
}
|
||||
|
||||
RegionFile regionfile1 = new RegionFile(file2);
|
||||
@@ -0,0 +0,0 @@ public class RegionFileCache {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper Start
|
||||
+ private static synchronized void trimCache() {
|
||||
+ Iterator<Map.Entry<File, RegionFile>> itr = RegionFileCache.a.entrySet().iterator();
|
||||
+ int count = RegionFileCache.a.size() - PaperConfig.regionFileCacheSize;
|
||||
+ while (count-- >= 0 && itr.hasNext()) {
|
||||
+ try {
|
||||
+ itr.next().getValue().c();
|
||||
+ } catch (IOException ioexception) {
|
||||
+ ioexception.printStackTrace();
|
||||
+ ServerInternalException.reportInternalException(ioexception);
|
||||
+ }
|
||||
+ itr.remove();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper End
|
||||
+
|
||||
public static synchronized void a() {
|
||||
Iterator iterator = RegionFileCache.a.values().iterator();
|
||||
|
||||
--
|
|
@ -1,36 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 30 Mar 2016 02:13:24 -0400
|
||||
Subject: [PATCH] Use Optimized Collections
|
||||
|
||||
Swap out CraftBukkit LongObjectHashMap with Long2ObjectOpenHashMap
|
||||
Swap out Integer key HashMap for a Int2ObjectOpenHashMap For ChunkProviderServer
|
||||
|
||||
Amaranth, the creator of LongObjectHashMap, tested it vs fastutil and determined fastutil to be 3x faster
|
||||
and could not create anything faster than fastutil.
|
||||
|
||||
These collections are super fast as seen
|
||||
http://java-performance.info/hashmap-overview-jdk-fastutil-goldman-sachs-hppc-koloboke-trove-january-2015/
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
index 2b27ae797..7191185ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
@@ -0,0 +0,0 @@ import java.util.Map;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import javax.annotation.Nullable;
|
||||
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
private static final Map<Class<? extends Entity>, Integer> b = Maps.newHashMap();
|
||||
private final Entity c;
|
||||
- private final Map<Integer, DataWatcher.Item<?>> d = Maps.newHashMap();
|
||||
+ private final Map<Integer, DataWatcher.Item<?>> d = new Int2ObjectOpenHashMap<>(); // Paper
|
||||
private final ReadWriteLock e = new ReentrantReadWriteLock();
|
||||
private boolean f = true;
|
||||
private boolean g;
|
||||
--
|
|
@ -1,30 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Sun, 10 Apr 2016 03:23:32 -0500
|
||||
Subject: [PATCH] Workaround for setting passengers on players
|
||||
|
||||
SPIGOT-1915 & GH-114
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index e71fc971d..3871f3100 100644
|
||||
--- 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 true;
|
||||
}
|
||||
|
||||
+ // Paper start - Ugly workaround for SPIGOT-1915 & GH-114
|
||||
+ @Override
|
||||
+ public boolean setPassenger(org.bukkit.entity.Entity passenger) {
|
||||
+ boolean wasSet = super.setPassenger(passenger);
|
||||
+ if (wasSet) {
|
||||
+ this.getHandle().playerConnection.sendPacket(new net.minecraft.server.PacketPlayOutMount(this.getHandle()));
|
||||
+ }
|
||||
+ return wasSet;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void setSneaking(boolean sneak) {
|
||||
getHandle().setSneaking(sneak);
|
||||
--
|
Loading…
Reference in a new issue