More 1.14 updates (#1995)

This commit is contained in:
Spottedleaf 2019-04-26 20:05:36 -07:00 committed by Zach
parent 818e88dbc5
commit 36873bf2d6
43 changed files with 789 additions and 797 deletions

View File

@ -1,4 +1,4 @@
From 4a49b7191988e3bc5f52e7ed14194198b26c4c3c Mon Sep 17 00:00:00 2001
From 3d0ef86c30ca141473b5286f5cb72d1a75413804 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
new file mode 100644
index 0000000000..f699ce18ca
index 000000000..f699ce18c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
@@ -0,0 +1,38 @@
@ -49,7 +49,7 @@ index 0000000000..f699ce18ca
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 1cf5e388e4..c4103680d4 100644
index 1cf5e388e..c4103680d 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@
@ -80,7 +80,7 @@ index 1cf5e388e4..c4103680d4 100644
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 4f0fbe4a0d..2dd1c28fab 100644
index 4f0fbe4a0..2dd1c28fa 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -14,6 +14,9 @@ import java.util.concurrent.Executor;
@ -94,7 +94,7 @@ index 4f0fbe4a0d..2dd1c28fab 100644
public class ChunkProviderServer extends IChunkProvider {
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index 1dd793d2fb..61ea2818b1 100644
index 1dd793d2f..61ea2818b 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -1,5 +1,6 @@
@ -121,7 +121,7 @@ index 1dd793d2fb..61ea2818b1 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 528d0f0cd2..be903252be 100644
index 528d0f0cd..be903252b 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -621,6 +621,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -141,7 +141,7 @@ index 528d0f0cd2..be903252be 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index d4a9af975d..88b5aa3a51 100644
index d4a9af975..88b5aa3a5 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -1,5 +1,6 @@
@ -168,7 +168,7 @@ index d4a9af975d..88b5aa3a51 100644
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 9d4febfbb6..7e58e4714a 100644
index 9d4febfbb..7e58e4714 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager;
@ -196,7 +196,7 @@ index 9d4febfbb6..7e58e4714a 100644
}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index d004494aea..d3ed749e1c 100644
index d004494ae..d3ed749e1 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -1,5 +1,7 @@
@ -216,23 +216,20 @@ index d004494aea..d3ed749e1c 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 25e5216e25..55e8c7c7d4 100644
index 25e5216e2..01f510588 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2,6 +2,12 @@ package net.minecraft.server;
@@ -2,6 +2,9 @@ package net.minecraft.server;
import co.aikar.timings.Timing;
import co.aikar.timings.Timings;
+<<<<<<< HEAD
+=======
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerInternalException;
+import com.google.common.base.MoreObjects;
+>>>>>>> Add exception reporting event
import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.Collection;
@@ -675,8 +681,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
@@ -675,8 +678,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
gameprofilerfiller.exit();
} catch (Throwable throwable) {
// Paper start - Prevent tile entity and entity crashes
@ -245,7 +242,7 @@ index 25e5216e25..55e8c7c7d4 100644
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
continue;
@@ -750,8 +759,10 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
@@ -750,8 +756,10 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
consumer.accept(entity);
} catch (Throwable throwable) {
// Paper start - Prevent tile entity and entity crashes
@ -258,7 +255,7 @@ index 25e5216e25..55e8c7c7d4 100644
return;
// Paper end
diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java
index 3c5b3fe101..47a4ea9985 100644
index 3c5b3fe10..47a4ea998 100644
--- a/src/main/java/net/minecraft/server/WorldPersistentData.java
+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java
@@ -113,6 +113,7 @@ public class WorldPersistentData {
@ -270,7 +267,7 @@ index 3c5b3fe101..47a4ea9985 100644
} finally {
if (pushbackinputstream != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index d99634062b..86a5ee8aac 100644
index d99634062..86a5ee8aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -16,6 +16,9 @@ import java.util.concurrent.atomic.AtomicInteger;

View File

@ -1,4 +1,4 @@
From 87bc4fe3532a93119223040e6cc70d3fc4f93303 Mon Sep 17 00:00:00 2001
From ad235c2c832bb36e4bb444861075244c89c22da4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 20:16:03 -0400
Subject: [PATCH] Add World Util Methods
@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index c4103680d4..9433d04f43 100644
index c4103680d..9433d04f4 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -388,6 +388,7 @@ public class Chunk implements IChunkAccess {
@ -18,7 +18,7 @@ index c4103680d4..9433d04f43 100644
return this.a(blockposition, i, this.world.getWorldProvider().g());
}
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
index bac6c9d65b..0930552b1f 100644
index bac6c9d65..0930552b1 100644
--- a/src/main/java/net/minecraft/server/IWorldReader.java
+++ b/src/main/java/net/minecraft/server/IWorldReader.java
@@ -36,6 +36,22 @@ public interface IWorldReader extends IIBlockAccess {
@ -45,10 +45,10 @@ index bac6c9d65b..0930552b1f 100644
@Nullable
IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 55e8c7c7d4..e8831e2a40 100644
index 01f510588..cdc5d7009 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -49,7 +49,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
@@ -46,7 +46,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper
private final long b = 16777215L;
private final Thread c;
@ -57,7 +57,7 @@ index 55e8c7c7d4..e8831e2a40 100644
protected int j = (new Random()).nextInt();
protected final int k = 1013904223;
protected float l;
@@ -211,6 +211,83 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
@@ -208,6 +208,83 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
return i < 0 || i >= 256;
}

View File

@ -0,0 +1,121 @@
From 48a682eac7e1502586e5edae0c1233ae181823df Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 02:07:55 -0600
Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling
Hot methods, so reduce # of instructions for the method.
Move is valid location test to the BlockPosition class so that it can access local variables.
Replace all calls to the new place to the unnecessary forward.
Optimize getType and getBlockData to manually inline and optimize the calls
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index 2852a17f2..7cb46d7a9 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -10,6 +10,14 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
private final int a;
private final int b;
private final int c;
+ // Paper start
+ public boolean isValidLocation() {
+ return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
+ }
+ public boolean isInvalidYLocation() {
+ return b < 0 || b >= 256;
+ }
+ // Paper end
public BaseBlockPosition(int i, int j, int k) {
this.a = i;
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index c927d524a..64700b97c 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -339,6 +339,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
protected int b;
protected int c;
protected int d;
+ // Paper start
+ @Override
+ public boolean isValidLocation() {
+ return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256;
+ }
+ @Override
+ public boolean isInvalidYLocation() {
+ return c < 0 || c >= 256;
+ }
+ // Paper end
public MutableBlockPosition() {
this(0, 0, 0);
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 9433d04f4..98ec98e02 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -232,12 +232,24 @@ public class Chunk implements IChunkAccess {
return this.sections;
}
- @Override
- public IBlockData getType(BlockPosition blockposition) {
- int i = blockposition.getX();
- int j = blockposition.getY();
- int k = blockposition.getZ();
+ // Paper start - Optimize getBlockData to reduce instructions
+ public final IBlockData getBlockData(BlockPosition pos) { return getBlockData(pos.getX(), pos.getY(), pos.getZ()); } // Paper
+ public final IBlockData getType(BlockPosition blockposition) {
+ return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ }
+ public final IBlockData getBlockData(final int x, final int y, final int z) {
+ // Method body / logic copied from below
+ final int i = y >> 4;
+ if (y >= 0 && i < this.sections.length && this.sections[i] != null) {
+ // Inlined ChunkSection.getType() and DataPaletteBlock.a(int,int,int)
+ return this.sections[i].blockIds.a((y & 15) << 8 | (z & 15) << 4 | x & 15);
+ }
+ return Blocks.AIR.getBlockData();
+ }
+
+ public IBlockData getBlockData_unused(int i, int j, int k) {
+ // Paper end
if (this.world.P() == WorldType.DEBUG_ALL_BLOCK_STATES) {
IBlockData iblockdata = null;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index c973ab607..0d7eab0e0 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -9,7 +9,7 @@ public class ChunkSection {
private short nonEmptyBlockCount;
private short tickingBlockCount;
private short e;
- private final DataPaletteBlock<IBlockData> blockIds;
+ final DataPaletteBlock<IBlockData> blockIds; // Paper - package
public ChunkSection(int i) {
this(i, (short) 0, (short) 0, (short) 0);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index cdc5d7009..78d1a5c71 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -197,11 +197,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
}
public static boolean isValidLocation(BlockPosition blockposition) {
- return !isInsideWorld(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000;
+ return blockposition.isValidLocation(); // Paper
}
public static boolean isInsideWorld(BlockPosition blockposition) {
- return b(blockposition.getY());
+ return blockposition.isInvalidYLocation(); // Paper
}
public static boolean b(int i) {
--
2.21.0

View File

@ -1,14 +1,14 @@
From b0f6b1e28395bcdd423bd2754a630bd1e23ddb29 Mon Sep 17 00:00:00 2001
From 95cb3da5a69aa89cc552cf83a94d4eeff8cb2625 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sun, 20 Mar 2016 06:45:01 -0400
Subject: [PATCH] Access items by EquipmentSlot
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
index 2273f213cb..60446f2478 100644
index d5b90069c..c7db9bd39 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
@@ -250,4 +250,54 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
@@ -249,4 +249,54 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
public void setBootsDropChance(float chance) {
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
}

View File

@ -1,4 +1,4 @@
From 4f6a8c94bfaf64e35e966ccd46185741f79b021d Mon Sep 17 00:00:00 2001
From 106afc897f40321e0f4cad5985e0d38dc225d40e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 19:55:45 -0400
Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
@ -6,10 +6,10 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this
diff --git a/src/main/java/net/minecraft/server/BlockPlant.java b/src/main/java/net/minecraft/server/BlockPlant.java
index 0e4037ea21..317ae16347 100644
index 9bf42bb5e..0526af776 100644
--- a/src/main/java/net/minecraft/server/BlockPlant.java
+++ b/src/main/java/net/minecraft/server/BlockPlant.java
@@ -15,7 +15,7 @@ public class BlockPlant extends Block {
@@ -16,7 +16,7 @@ public class BlockPlant extends Block {
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
// CraftBukkit start
if (!iblockdata.canPlace(generatoraccess, blockposition)) {
@ -19,11 +19,11 @@ index 0e4037ea21..317ae16347 100644
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTallPlant.java b/src/main/java/net/minecraft/server/BlockTallPlant.java
index 77782bf1c1..39d449c28e 100644
index 469a3be05..f2c429f22 100644
--- a/src/main/java/net/minecraft/server/BlockTallPlant.java
+++ b/src/main/java/net/minecraft/server/BlockTallPlant.java
@@ -49,7 +49,7 @@ public class BlockTallPlant extends BlockPlant {
@@ -55,7 +55,7 @@ public class BlockTallPlant extends BlockPlant {
@Override
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
// CraftBukkit start
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
@ -32,10 +32,10 @@ index 77782bf1c1..39d449c28e 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f488c37f73..ee45d3705b 100644
index 4e97e74a2..c5359ae24 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1001,6 +1001,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@@ -1087,6 +1087,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit - dropTickTime
for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
WorldServer worldserver = (WorldServer) iterator.next();
@ -44,10 +44,10 @@ index f488c37f73..ee45d3705b 100644
if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
this.methodProfiler.a(() -> {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f4e91db7c6..f94633cbe2 100644
index 78d1a5c71..7d6893cee 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -486,7 +486,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -435,7 +435,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
// CraftBukkit start
iblockdata1.b(this, blockposition, j); // Don't call an event for the old block to limit event spam
CraftWorld world = ((WorldServer) this).getWorld();
@ -56,7 +56,7 @@ index f4e91db7c6..f94633cbe2 100644
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
this.getServer().getPluginManager().callEvent(event);
@@ -620,7 +620,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -546,7 +546,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
try {
// CraftBukkit start
CraftWorld world = ((WorldServer) this).getWorld();
@ -66,17 +66,17 @@ index f4e91db7c6..f94633cbe2 100644
this.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index aaeb888a8c..639068d2dc 100644
index 9a4a55846..3bd624569 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -33,6 +33,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
public class WorldServer extends World implements IAsyncTaskHandler {
private static final Logger a = LogManager.getLogger();
@@ -76,6 +76,7 @@ public class WorldServer extends World {
// CraftBukkit start
public final DimensionManager dimension;
private int tickPosition;
+ boolean hasPhysicsEvent = true; // Paper
private final MinecraftServer server;
public EntityTracker tracker;
private final PlayerChunkMap manager;
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
--
2.21.0

View File

@ -0,0 +1,29 @@
From 30a0f8ece5268608ed4328b4c2f6aeb9066b6689 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:32:58 -0400
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 3bd624569..ab2ca1c32 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1102,6 +1102,7 @@ public class WorldServer extends World {
this.I.add(((EntityInsentient) entity).getNavigation());
}
entity.valid = true; // CraftBukkit
+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
}
@@ -1111,6 +1112,7 @@ public class WorldServer extends World {
if (this.tickingEntities) {
throw new IllegalStateException("Removing entity while ticking!");
} else {
+ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
this.removeEntityFromChunk(entity);
this.entitiesById.remove(entity.getId());
this.unregisterEntity(entity);
--
2.21.0

View File

@ -1,4 +1,4 @@
From 30cce2c18fb76855ddad062f12072ce436e8ecc2 Mon Sep 17 00:00:00 2001
From 415febb133d2a64f91317c9b2757f323e7307dbf Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:46:14 -0400
Subject: [PATCH] Configurable Chunk Inhabited Time
@ -11,10 +11,10 @@ For people who want all chunks to be treated equally, you can chose a fixed valu
This allows to fine-tune vanilla gameplay.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index be380ac75e..69ac43d9a9 100644
index 2a71381da..e43866991 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -237,4 +237,19 @@ public class PaperWorldConfig {
@@ -229,4 +229,19 @@ public class PaperWorldConfig {
skeleHorseSpawnChance = 0.01D; // Vanilla value
}
}
@ -35,18 +35,18 @@ index be380ac75e..69ac43d9a9 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index b76c1579ea..c74176daa5 100644
index 98ec98e02..a413dc73b 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1289,7 +1289,7 @@ public class Chunk implements IChunkAccess {
@@ -826,7 +826,7 @@ public class Chunk implements IChunkAccess {
@Override
public long q() {
- return this.t;
+ return world.paperConfig.fixedInhabitedTime < 0 ? this.t : world.paperConfig.fixedInhabitedTime; // Paper
}
public long m() {
- return this.z;
+ return world.paperConfig.fixedInhabitedTime < 0 ? this.z : world.paperConfig.fixedInhabitedTime; // Paper
}
public void b(long i) {
@Override
--
2.21.0

View File

@ -0,0 +1,83 @@
From ef812432ec5d1a861add26683b2236d6e3cbcb25 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 2ced8dedd..6ce35018a 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -4,7 +4,7 @@ import javax.annotation.Nullable;
public abstract class NavigationAbstract {
- protected final EntityInsentient a;
+ protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
protected final World b;
@Nullable
protected PathEntity c;
@@ -71,13 +71,16 @@ public abstract class NavigationAbstract {
return this.b(new BlockPosition(d0, d1, d2));
}
+ // Paper start - Add target entity parameter for path find event
+ @Nullable public PathEntity b(BlockPosition blockposition) { return this.b(blockposition, null); }
@Nullable
- public PathEntity b(BlockPosition blockposition) {
+ public PathEntity b(BlockPosition blockposition, Entity target) {
+ // Paper end
float f = (float) blockposition.getX() + 0.5F;
float f1 = (float) blockposition.getY() + 0.5F;
float f2 = (float) blockposition.getZ() + 0.5F;
- return this.a(blockposition, (double) f, (double) f1, (double) f2, 8, false);
+ return this.a(blockposition, target, (double) f, (double) f1, (double) f2, 8, false); // Paper - Path find event
}
@Nullable
@@ -87,16 +90,25 @@ public abstract class NavigationAbstract {
double d1 = entity.getBoundingBox().minY;
double d2 = entity.locZ;
- return this.a(blockposition, d0, d1, d2, 16, true);
+ return this.a(blockposition, entity, d0, d1, d2, 16, true); // Paper - Path find event
}
+ // Paper start - Add target entity parameter for path find event
+ @Nullable protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) { return this.a(blockposition, null, d0, d1, d2, i, flag); }
@Nullable
- protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) {
+ protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
+ // Paper end
if (!this.a()) {
return null;
} else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
return this.c;
} else {
+ // Paper start - Pathfind event
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
+ MCUtil.toLocation(getEntity().world, blockposition), target == null ? null : target.getBukkitEntity()).callEvent()) {
+ return null;
+ }
+ // Paper end
this.q = blockposition;
float f = this.i();
diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java
index 9dfca6067..551ff417b 100644
--- a/src/main/java/net/minecraft/server/NavigationFlying.java
+++ b/src/main/java/net/minecraft/server/NavigationFlying.java
@@ -25,7 +25,7 @@ public class NavigationFlying extends NavigationAbstract {
@Override
public PathEntity a(Entity entity) {
- return this.b(new BlockPosition(entity));
+ return this.b(new BlockPosition(entity), entity); // Paper - Pathfind event
}
@Override
--
2.21.0

View File

@ -0,0 +1,52 @@
From 1f55c86840384d32f33f077d9af9ec28ebbc05e0 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 b062a31c4..4e6288e8b 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -26,7 +26,7 @@ public class RegionFile implements AutoCloseable {
private final File file;
// Spigot end
private static final byte[] a = new byte[4096];
- private final RandomAccessFile b;
+ private final RandomAccessFile b; private RandomAccessFile getDataFile() { return this.b; } // Paper - OBFHELPER
private final int[] c = new int[1024];
private final int[] d = new int[1024];
private final List<Boolean> e;
@@ -59,10 +59,19 @@ public class RegionFile implements AutoCloseable {
this.e.set(1, false);
this.b.seek(0L);
+ // Paper Start
+ java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192);
+ while (header.hasRemaining()) {
+ if (this.getDataFile().getChannel().read(header) == -1) throw new java.io.EOFException();
+ }
+ header.clear();
+ java.nio.IntBuffer headerAsInts = header.asIntBuffer();
+ // Paper End
+
int k;
for (j = 0; j < 1024; ++j) {
- k = this.b.readInt();
+ k = headerAsInts.get(); // Paper
this.c[j] = k;
// Spigot start
int length = k & 255;
@@ -88,7 +97,7 @@ public class RegionFile implements AutoCloseable {
}
for (j = 0; j < 1024; ++j) {
- k = this.b.readInt();
+ k = headerAsInts.get(); // Paper
this.d[j] = k;
}
--
2.21.0

View File

@ -0,0 +1,50 @@
From 170024a9cd0f01892a20a900fbaa04583ed590d4 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 809b3a1a4..e929ba452 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -215,4 +215,9 @@ 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 75731c919..c8573a8ee 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -8,6 +8,7 @@ import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import javax.annotation.Nullable;
+import com.destroystokyo.paper.PaperConfig; // Paper
public abstract class RegionFileCache implements AutoCloseable {
@@ -25,7 +26,7 @@ public abstract class RegionFileCache implements AutoCloseable {
if (regionfile != null) {
return regionfile;
} else {
- if (this.cache.size() >= 256) {
+ if (this.cache.size() >= PaperConfig.regionFileCacheSize) {
this.cache.removeLast();
}
--
2.21.0

View File

@ -1,4 +1,4 @@
From 600f9aaa6a5333db0318c91f1ad30fc82092ba55 Mon Sep 17 00:00:00 2001
From 7ec6ae32dc53d6401706f46533d05f47cb554b30 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
@ -13,7 +13,7 @@ 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 b8fd774956..51a02edf83 100644
index 79a240cd1..6c259effb 100644
--- a/src/main/java/net/minecraft/server/DataWatcher.java
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
@@ -12,6 +12,7 @@ import java.util.Map;
@ -25,7 +25,7 @@ index b8fd774956..51a02edf83 100644
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -21,7 +22,7 @@ public class DataWatcher {
private static final Logger a = LogManager.getLogger();
private static final Logger LOGGER = 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();

View File

@ -1,24 +1,24 @@
From 096033929413ea354e0b00c6433af4178b66dfdf Mon Sep 17 00:00:00 2001
From 61f8cebe436377f8f237d12f4ac12cec64677d25 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 Pathfinding
diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java
index 49533ac33e..eef3ab73fc 100644
index c76087614..475c93836 100644
--- a/src/main/java/net/minecraft/server/ChunkCache.java
+++ b/src/main/java/net/minecraft/server/ChunkCache.java
@@ -26,7 +26,7 @@ public class ChunkCache implements IIBlockAccess {
@@ -25,7 +25,7 @@ public class ChunkCache implements IIBlockAccess {
for (l = this.a; l <= j; ++l) {
for (i1 = this.b; i1 <= k; ++i1) {
- this.c[l - this.a][i1 - this.b] = world.getChunkAt(l, i1);
+ this.c[l - this.a][i1 - this.b] = world.getChunkIfLoaded(l, i1); // Paper
for (k = this.a; k <= i; ++k) {
for (l = this.b; l <= j; ++l) {
- this.c[k - this.a][l - this.b] = world.getChunkAt(k, l, ChunkStatus.FULL, false);
+ this.c[k - this.a][l - this.b] = world.getChunkIfLoaded(k, l); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 604049b088..716d00afb1 100644
index 6ce35018a..2a391be28 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -22,8 +22,9 @@ public abstract class NavigationAbstract {
@ -35,57 +35,57 @@ index 604049b088..716d00afb1 100644
@@ -32,6 +33,7 @@ public abstract class NavigationAbstract {
this.b = world;
this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
this.r = this.a();
this.r = this.a(MathHelper.floor(this.p.getValue() * 16.0D));
+ setWorld(); // Paper
}
public BlockPosition i() {
@@ -174,6 +176,7 @@ public abstract class NavigationAbstract {
public BlockPosition h() {
@@ -178,6 +180,7 @@ public abstract class NavigationAbstract {
}
public void d() {
public void c() {
+ setWorld(); // Paper
++this.e;
if (this.m) {
this.l();
this.k();
diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
index 3085338f0a..89d51d471a 100644
index 480dee704..3901dd751 100644
--- a/src/main/java/net/minecraft/server/Pathfinder.java
+++ b/src/main/java/net/minecraft/server/Pathfinder.java
@@ -9,7 +9,7 @@ public class Pathfinder {
private final Path a = new Path();
@@ -12,7 +12,7 @@ public class Pathfinder {
private final Set<PathPoint> b = Sets.newHashSet();
private final PathPoint[] c = new PathPoint[32];
- private PathfinderAbstract d;
+ private PathfinderAbstract d; public PathfinderAbstract getPathfinder() { return d; } // Paper - OBFHELPER
private final int d;
- private PathfinderAbstract e;
+ private PathfinderAbstract e; public PathfinderAbstract getPathfinder() { return this.e; } // Paper - OBFHELPER
public Pathfinder(PathfinderAbstract pathfinderabstract) {
this.d = pathfinderabstract;
public Pathfinder(PathfinderAbstract pathfinderabstract, int i) {
this.e = pathfinderabstract;
diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java
index 36d7e1d966..d722c85139 100644
index 7aad55c7d..3cb43808f 100644
--- a/src/main/java/net/minecraft/server/PathfinderAbstract.java
+++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java
@@ -4,6 +4,7 @@ public abstract class PathfinderAbstract {
@@ -7,6 +7,7 @@ public abstract class PathfinderAbstract {
protected IBlockAccess a;
protected EntityInsentient b;
+ public World world; // Paper
protected final IntHashMap<PathPoint> c = new IntHashMap<>();
protected final Int2ObjectMap<PathPoint> c = new Int2ObjectOpenHashMap();
protected int d;
protected int e;
@@ -16,6 +17,7 @@ public abstract class PathfinderAbstract {
@@ -19,6 +20,7 @@ public abstract class PathfinderAbstract {
public void a(IBlockAccess iblockaccess, EntityInsentient entityinsentient) {
this.a = iblockaccess;
+ if (iblockaccess instanceof World) world = (World) iblockaccess; // Paper
this.b = entityinsentient;
this.c.c();
this.d = MathHelper.d(entityinsentient.width + 1.0F);
this.c.clear();
this.d = MathHelper.d(entityinsentient.getWidth() + 1.0F);
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
index eec8916479..e45bdb581e 100644
index f1198272b..1eaed0fd8 100644
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
@@ -327,7 +327,8 @@ public class PathfinderNormal extends PathfinderAbstract {
@@ -343,7 +343,8 @@ public class PathfinderNormal extends PathfinderAbstract {
PathType pathtype = this.b(iblockaccess, i, j, k);
if (pathtype == PathType.OPEN && j >= 1) {
@ -95,12 +95,12 @@ index eec8916479..e45bdb581e 100644
PathType pathtype1 = this.b(iblockaccess, i, j - 1, k);
pathtype = pathtype1 != PathType.WALKABLE && pathtype1 != PathType.OPEN && pathtype1 != PathType.WATER && pathtype1 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
@@ -353,9 +354,10 @@ public class PathfinderNormal extends PathfinderAbstract {
@@ -373,9 +374,10 @@ public class PathfinderNormal extends PathfinderAbstract {
for (int l = -1; l <= 1; ++l) {
for (int i1 = -1; i1 <= 1; ++i1) {
if (l != 0 || i1 != 0) {
- Block block = iblockaccess.getType(blockposition_pooledblockposition.c(l + i, j, i1 + k)).getBlock();
+ Block block = world.getBlockIfLoaded(blockposition_pooledblockposition.c(l + i, j, i1 + k)); // Paper
- Block block = iblockaccess.getType(blockposition_pooledblockposition.d(l + i, j, i1 + k)).getBlock();
+ Block block = world.getBlockIfLoaded(blockposition_pooledblockposition.d(l + i, j, i1 + k)); // Paper
- if (block == Blocks.CACTUS) {
+ if (block == null) pathtype = PathType.BLOCKED; // Paper
@ -108,7 +108,7 @@ index eec8916479..e45bdb581e 100644
pathtype = PathType.DANGER_CACTUS;
} else if (block == Blocks.FIRE) {
pathtype = PathType.DANGER_FIRE;
@@ -387,7 +389,8 @@ public class PathfinderNormal extends PathfinderAbstract {
@@ -409,7 +411,8 @@ public class PathfinderNormal extends PathfinderAbstract {
protected PathType b(IBlockAccess iblockaccess, int i, int j, int k) {
BlockPosition blockposition = new BlockPosition(i, j, k);

View File

@ -1,205 +0,0 @@
From f379dcca9c38349b82a318227aee76c6c3c98869 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 02:07:55 -0600
Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling
Hot methods, so reduce # of instructions for the method.
Move is valid location test to the BlockPosition class so that it can access local variables.
Replace all calls to the new place to the unnecessary forward.
Optimize getType and getBlockData to manually inline and optimize the calls
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index 5843ef65af..4c7793f86d 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -10,6 +10,14 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
private final int a;
private final int b;
private final int c;
+ // Paper start
+ public boolean isValidLocation() {
+ return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
+ }
+ public boolean isInvalidYLocation() {
+ return b < 0 || b >= 256;
+ }
+ // Paper end
public BaseBlockPosition(int i, int j, int k) {
this.a = i;
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 9bb7c9c652..bc364ce371 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -300,6 +300,16 @@ public class BlockPosition extends BaseBlockPosition {
protected int b;
protected int c;
protected int d;
+ // Paper start
+ @Override
+ public boolean isValidLocation() {
+ return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256;
+ }
+ @Override
+ public boolean isInvalidYLocation() {
+ return c < 0 || c >= 256;
+ }
+ // Paper end
public MutableBlockPosition() {
this(0, 0, 0);
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3f9de7e55a..b76c1579ea 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -425,12 +425,24 @@ public class Chunk implements IChunkAccess {
return this.getBlockData(i, j, k).b(this.world, new BlockPosition(i, j, k));
}
- public IBlockData getBlockData(BlockPosition blockposition) { return getType(blockposition); } // Paper
- public IBlockData getType(BlockPosition blockposition) {
+ // Paper start - Optimize getBlockData to reduce instructions
+ public final IBlockData getBlockData(BlockPosition pos) { return getBlockData(pos.getX(), pos.getY(), pos.getZ()); } // Paper
+ public final IBlockData getType(BlockPosition blockposition) {
return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ());
}
- public IBlockData getBlockData(int i, int j, int k) {
+ public final IBlockData getBlockData(final int x, final int y, final int z) {
+ // Method body / logic copied from below
+ final int i = y >> 4;
+ if (y >= 0 && i < this.sections.length && this.sections[i] != null) {
+ // Inlined ChunkSection.getType() and DataPaletteBlock.a(int,int,int)
+ return this.sections[i].blockIds.a((y & 15) << 8 | (z & 15) << 4 | x & 15);
+ }
+ return Blocks.AIR.getBlockData();
+ }
+
+ public IBlockData getBlockData_unused(int i, int j, int k) {
+ // Paper end
if (this.world.S() == WorldType.DEBUG_ALL_BLOCK_STATES) {
IBlockData iblockdata = null;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 3c5f10ad4d..621ed1fc53 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -7,7 +7,7 @@ public class ChunkSection {
private int nonEmptyBlockCount;
private int tickingBlockCount;
private int e;
- private final DataPaletteBlock<IBlockData> blockIds;
+ final DataPaletteBlock<IBlockData> blockIds; // Paper - package
private NibbleArray emittedLight;
private NibbleArray skyLight;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index fd45090685..f4e91db7c6 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -257,11 +257,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public static boolean isValidLocation(BlockPosition blockposition) {
- return !k(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000;
+ return blockposition.isValidLocation(); // Paper
}
public static boolean k(BlockPosition blockposition) {
- return blockposition.getY() < 0 || blockposition.getY() >= 256;
+ return blockposition.isInvalidYLocation(); // Paper
}
public boolean isEmpty(BlockPosition blockposition) {
@@ -278,7 +278,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// test if meets light level, return faster
// logic copied from below
public boolean isLightLevel(BlockPosition blockposition, int level) {
- if (isValidLocation(blockposition)) {
+ if (blockposition.isValidLocation()) {
if (this.getType(blockposition).c(this, blockposition)) {
int sky = getSkylightSubtracted();
if (this.getLightLevel(blockposition.up(), sky) >= level) {
@@ -325,7 +325,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// CraftBukkit end
Chunk chunk = this.getChunkIfLoaded(blockposition);
if (chunk != null) {
- return isValidLocation(blockposition) ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData();
+ return blockposition.isValidLocation() ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); // Paper
}
return null;
}
@@ -380,7 +380,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return true;
}
// CraftBukkit end
- if (k(blockposition)) {
+ if (blockposition.isInvalidYLocation()) { // Paper
return false;
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
return false;
@@ -707,11 +707,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
blockposition = new BlockPosition(blockposition.getX(), 0, blockposition.getZ());
}
- return !isValidLocation(blockposition) ? enumskyblock.c : (!this.isLoaded(blockposition) ? enumskyblock.c : this.getChunkAtWorldCoords(blockposition).getBrightness(enumskyblock, blockposition));
+ return !blockposition.isValidLocation() ? enumskyblock.c : (!this.isLoaded(blockposition) ? enumskyblock.c : this.getChunkAtWorldCoords(blockposition).getBrightness(enumskyblock, blockposition)); // Paper
}
public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) {
- if (isValidLocation(blockposition)) {
+ if (blockposition.isValidLocation()) { // Paper
if (this.isLoaded(blockposition)) {
this.getChunkAtWorldCoords(blockposition).a(enumskyblock, blockposition, i);
this.m(blockposition);
@@ -738,7 +738,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}
// CraftBukkit end
- if (k(blockposition)) {
+ if (blockposition.isInvalidYLocation()) { // Paper
return Blocks.VOID_AIR.getBlockData();
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
@@ -748,7 +748,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public Fluid getFluid(BlockPosition blockposition) {
- if (k(blockposition)) {
+ if (blockposition.isInvalidYLocation()) { // Paper
return FluidTypes.EMPTY.i();
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
@@ -1767,7 +1767,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
@Nullable
public TileEntity getTileEntity(BlockPosition blockposition) {
- if (k(blockposition)) {
+ if (blockposition.isInvalidYLocation()) { // Paper
return null;
} else {
// CraftBukkit start
@@ -1808,7 +1808,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
- if (!k(blockposition)) {
+ if (!blockposition.isInvalidYLocation()) { // Paper
if (tileentity != null && !tileentity.x()) {
// CraftBukkit start
if (captureBlockStates) {
@@ -1869,7 +1869,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public boolean p(BlockPosition blockposition) {
- if (k(blockposition)) {
+ if (blockposition.isInvalidYLocation()) { // Paper
return false;
} else {
Chunk chunk = this.chunkProvider.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, false, false);
--
2.21.0

View File

@ -1,4 +1,4 @@
From c8b443afca617ae27d8b784a48c4817933d7e3e3 Mon Sep 17 00:00:00 2001
From c4b8da3fa91a24ce82ad15739e925dba59472423 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
@ -7,10 +7,10 @@ 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 9371d83f1d..34b5ca3a7e 100644
index 7d6893cee..31e477430 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -663,6 +663,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -586,6 +586,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
if (blockposition.getY() >= 256) {
blockposition = new BlockPosition(blockposition.getX(), 255, blockposition.getZ());
}

View File

@ -1,11 +1,11 @@
From c926ab31b1ebc9dc51496f8a9dcbe76eeff63dce Mon Sep 17 00:00:00 2001
From 042628a3daddaf353397c8378d2ea16071cad063 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 77440ac81f..8711462e16 100644
index 680adbdeb..3f7697b39 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
@@ -5,7 +5,7 @@ import javax.annotation.Nullable;
@ -18,10 +18,10 @@ index 77440ac81f..8711462e16 100644
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 8a403354d9..545899fc29 100644
index e83ebaf4f..7b8caa0b9 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1874,6 +1874,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1923,6 +1923,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
}
}

View File

@ -1,29 +0,0 @@
From e04fc8c3d54d686f2894b0b273b8bdfbf47beaa1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:32:58 -0400
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f94633cbe2..9371d83f1d 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1032,6 +1032,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
entity.valid = true; // CraftBukkit
+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
protected void c(Entity entity) {
@@ -1039,6 +1040,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
((IWorldAccess) this.v.get(i)).b(entity);
}
+ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
entity.valid = false; // CraftBukkit
}
--
2.21.0

View File

@ -1,19 +1,19 @@
From 834922853fbfd37864ba9ceb6898e2628c9ec553 Mon Sep 17 00:00:00 2001
From d372b2f3ee68da28fec46cd5c9d313d6b734e0c7 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 c2061e9596..6e62ea90dd 100644
index f904e1c28..bf6cf1ce5 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -161,6 +161,7 @@ public abstract class PlayerList {
@@ -160,6 +160,7 @@ 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);
this.d(entityplayer);
entityplayer.getStatisticManager().c();
entityplayer.B().a(entityplayer);
--

View File

@ -1,14 +1,14 @@
From d7cd2aa94ac35ab602e58484a14ae747b2a68240 Mon Sep 17 00:00:00 2001
From ecdf0f12e6f006fcf530350c33ab4b516acb1581 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 69ac43d9a9..6b74f810a9 100644
index e43866991..59d11e68c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -252,4 +252,10 @@ public class PaperWorldConfig {
@@ -244,4 +244,10 @@ public class PaperWorldConfig {
}
fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1);
}
@ -20,16 +20,16 @@ index 69ac43d9a9..6b74f810a9 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
index da6182deb1..f1174825c2 100644
index ddca19b46..377a57c89 100644
--- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
+++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
@@ -21,6 +21,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow {
}
@@ -29,6 +29,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow {
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
@Override
public void tick(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)) {
if (!b(iblockdata, (IWorldReader) world, blockposition)) {
// CraftBukkit start
--
2.21.0

View File

@ -1,39 +0,0 @@
From 532ad87eb21f8762a38eb0c56dae2e31f292ed22 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 60b5068e32..604049b088 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -4,7 +4,7 @@ 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;
@@ -78,6 +78,7 @@ 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.j();
@@ -102,6 +103,7 @@ 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.j();
--
2.21.0

View File

@ -1,15 +1,15 @@
From 3a2173955a650e1613573c58df97db088d0326cb Mon Sep 17 00:00:00 2001
From efe578dd1466202efe8ea41534297bd2dafbe01b 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 8a445a1fa3..b595536648 100644
index 31e477430..845cabd29 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -578,6 +578,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
@@ -504,6 +504,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
public void m(BlockPosition blockposition) {}
public void applyPhysics(BlockPosition blockposition, Block block) {
+ if (captureBlockStates) { return; } // Paper - Cancel all physics during placement

View File

@ -1,41 +0,0 @@
From a05120f07988e9b44ec31b64d116eecdf159d664 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 9626396745..e2d4450e90 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -71,9 +71,17 @@ public class RegionFile {
this.c.seek(0L);
int k;
+ // Paper Start
+ java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192);
+ while (header.hasRemaining()) {
+ if (this.c.getChannel().read(header) == -1) throw new java.io.EOFException();
+ }
+ header.clear();
+ java.nio.IntBuffer headerAsInts = header.asIntBuffer();
+ // Paper End
for (j = 0; j < 1024; ++j) {
- k = this.c.readInt();
+ k = headerAsInts.get(); // Paper
this.d[j] = k;
// Spigot start
int length = k & 255;
@@ -99,7 +107,7 @@ public class RegionFile {
}
for (j = 0; j < 1024; ++j) {
- k = this.c.readInt();
+ k = headerAsInts.get(); // Paper
this.e[j] = k;
}
} catch (IOException ioexception) {
--
2.21.0

View File

@ -1,4 +1,4 @@
From 370c0f9263d280138a073b0237be9e2cc72f6fd1 Mon Sep 17 00:00:00 2001
From b4a076f89d83b45dae9ae1ec7919ef774ba884e2 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
@ -9,7 +9,7 @@ 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 9e83610f1a..fe5947b6cc 100644
index 409dc837c..4194acc8b 100644
--- a/src/main/java/net/minecraft/server/DataBits.java
+++ b/src/main/java/net/minecraft/server/DataBits.java
@@ -14,7 +14,7 @@ public class DataBits {
@ -24,23 +24,34 @@ index 9e83610f1a..fe5947b6cc 100644
@@ -27,8 +27,8 @@ public class DataBits {
}
public void a(int i, int j) {
public int 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;
@@ -45,7 +45,7 @@ public class DataBits {
int l = k >> 6;
int i1 = (i + 1) * this.b - 1 >> 6;
@@ -49,8 +49,8 @@ public class DataBits {
}
public void b(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 >> 6;
int i1 = (i + 1) * this.b - 1 >> 6;
@@ -67,7 +67,7 @@ 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;
int k = j >> 6;
int l = (i + 1) * this.b - 1 >> 6;
--
2.21.0

View File

@ -1,4 +1,4 @@
From 261781b7a4ce6899433dca3cbf14ceecf88ff6d6 Mon Sep 17 00:00:00 2001
From 6176b038f0f8fddd52cea7c668e06dc3a7403c4b Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 6 Apr 2016 01:04:23 -0500
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
@ -12,12 +12,12 @@ for this on CB at one point but I can't find it. We may need to do this
ourselves at some point in the future.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 260c55016e..37cc057ab7 100644
index 59d11e68c..1da7ffab5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -264,4 +264,9 @@ public class PaperWorldConfig {
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16);
log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16));
@@ -250,4 +250,9 @@ public class PaperWorldConfig {
grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
log("Grass Spread Tick Rate: " + grassUpdateRate);
}
+
+ public boolean useVanillaScoreboardColoring;
@ -26,10 +26,10 @@ index 260c55016e..37cc057ab7 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 545899fc29..66aa3bde64 100644
index 7b8caa0b9..42eac6b71 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1611,7 +1611,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1657,7 +1657,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
return;
}
@ -48,18 +48,18 @@ index 545899fc29..66aa3bde64 100644
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getPlayerList().players) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 6e62ea90dd..5236948990 100644
index bf6cf1ce5..b3343fca2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -176,7 +176,7 @@ public abstract class PlayerList {
@@ -175,7 +175,7 @@ public abstract class PlayerList {
}
// CraftBukkit start
chatmessage.a(EnumChatFormat.YELLOW);
- this.onPlayerJoin(entityplayer, CraftChatMessage.fromComponent(chatmessage));
+ this.onPlayerJoin(entityplayer, CraftChatMessage.fromComponent(chatmessage, EnumChatFormat.WHITE)); // Paper
// CraftBukkit end
worldserver = server.getWorldServer(entityplayer.dimension); // CraftBukkit - Update in case join event changed it
- String joinMessage = CraftChatMessage.fromComponent(chatmessage);
+ String joinMessage = CraftChatMessage.fromComponent(chatmessage, EnumChatFormat.WHITE);
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.players.add(entityplayer);
--
2.21.0

View File

@ -1,79 +0,0 @@
From a1b78729ad268fc1bb764e0432ff606abb0f7f86 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 e4ba7146d1..06c53af2c5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -228,4 +228,9 @@ 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 5dbd1d517a..964996976a 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -9,10 +9,12 @@ 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> cache = Maps.newHashMap();
+ public static final Map<File, RegionFile> cache = new LinkedHashMap(PaperConfig.regionFileCacheSize, 0.75f, true); // Paper - HashMap -> LinkedHashMap
public static synchronized RegionFile a(File file, int i, int j) {
File file1 = new File(file, "region");
@@ -27,7 +29,7 @@ public class RegionFileCache {
}
if (RegionFileCache.cache.size() >= 256) {
- a();
+ trimCache();
}
RegionFile regionfile1 = new RegionFile(file2);
@@ -60,6 +62,22 @@ public class RegionFileCache {
}
// CraftBukkit end
+ // Paper Start
+ private static synchronized void trimCache() {
+ Iterator<Map.Entry<File, RegionFile>> itr = RegionFileCache.cache.entrySet().iterator();
+ int count = RegionFileCache.cache.size() - PaperConfig.regionFileCacheSize;
+ while (count-- >= 0 && itr.hasNext()) {
+ try {
+ itr.next().getValue().close();
+ } catch (IOException ioexception) {
+ ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception);
+ }
+ itr.remove();
+ }
+ }
+ // Paper End
+
public static synchronized void a() {
Iterator iterator = RegionFileCache.cache.values().iterator();
--
2.21.0

View File

@ -1,4 +1,4 @@
From 0ca415c498a9f0a63caa664b5951e4028326b7f5 Mon Sep 17 00:00:00 2001
From 30b50625c0c4b3e5c9bc22a5ecc7b7ff55f9c26c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 10 Apr 2016 03:23:32 -0500
Subject: [PATCH] Workaround for setting passengers on players
@ -6,10 +6,10 @@ 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 d0f8ad0b69..ff9c2c04f3 100644
index e866480f0..bc1b46484 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -727,6 +727,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -753,6 +753,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return true;
}

View File

@ -1,4 +1,4 @@
From 27fffdd001e9462d4701d1011de790f8b6478872 Mon Sep 17 00:00:00 2001
From dd02890bad92638cecc28b7a2a4c2328901f73f8 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
@ -6,49 +6,22 @@ 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 5fc2da0d92..04ec2a0399 100644
index 845cabd29..5637c3872 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -71,7 +71,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
};
// Spigot end
protected final Set<Entity> g = com.google.common.collect.Sets.newHashSet(); // Paper
@@ -40,7 +40,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
protected static final Logger LOGGER = LogManager.getLogger();
private static final EnumDirection[] a = EnumDirection.values();
- 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 = com.google.common.collect.Sets.newHashSet(); // Paper
@@ -1269,7 +1269,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
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();
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper
@@ -686,9 +686,9 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
}, tileentity::getPosition});
}
@@ -1322,7 +1322,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
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());
}
@@ -1352,7 +1352,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
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
@@ -1372,9 +1372,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
protected void p_() {}
public boolean a(TileEntity tileentity) {
- boolean flag = this.tileEntityList.add(tileentity);
+ boolean flag = true; // Paper - remove unused list
@ -57,10 +30,37 @@ index 5fc2da0d92..04ec2a0399 100644
this.tileEntityListTick.add(tileentity);
}
@@ -1855,7 +1855,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -724,7 +724,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, 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();
}
@@ -780,7 +780,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
// Spigot end
- this.tileEntityList.remove(tileentity);
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition());
}
@@ -810,7 +810,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, 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
@@ -1081,7 +1081,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
} else {
if (tileentity != null) {
this.c.remove(tileentity);
this.tileEntityListPending.remove(tileentity);
- this.tileEntityList.remove(tileentity);
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
this.tileEntityListTick.remove(tileentity);

View File

@ -1,11 +1,11 @@
From 62ab4dea592870baed4e544e72552489e5b715d0 Mon Sep 17 00:00:00 2001
From 47491d3a02dd13f9889039781aabe50b7c0c85b9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 00:30:10 -0400
Subject: [PATCH] Don't tick Skulls - unused code
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 48fbcf863d..79c24cdc4c 100644
index 369fdfe67..e827d7605 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -24,7 +24,7 @@ import com.mojang.authlib.ProfileLookupCallback;
@ -15,8 +15,8 @@ index 48fbcf863d..79c24cdc4c 100644
-public class TileEntitySkull extends TileEntity implements ITickable {
+public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable
private GameProfile a;
private int e;
public GameProfile gameProfile;
private int b;
--
2.21.0

View File

@ -1,14 +1,14 @@
From bb1c1ab4db447251965dbd0e053506855d523a6a Mon Sep 17 00:00:00 2001
From 64e3e00b0d04cf06cb339c4804a6f30d4668d75f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 02:10:49 -0400
Subject: [PATCH] Configurable Player Collision
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 06c53af2c5..b0bfdf9424 100644
index e929ba452..033fcf50e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -233,4 +233,9 @@ public class PaperConfig {
@@ -220,4 +220,9 @@ public class PaperConfig {
private static void regionFileCacheSize() {
regionFileCacheSize = getInt("settings.region-file-cache-size", 256);
}
@ -19,12 +19,12 @@ index 06c53af2c5..b0bfdf9424 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 01c5d3c572..b87520d834 100644
index c5359ae24..43cd6d2c6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -421,6 +421,19 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.a(this.getWorldServer(DimensionManager.OVERWORLD).worldMaps);
// CraftBukkit end
@@ -438,6 +438,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.loadSpawn(worldserver.getChunkProvider().playerChunkMap.worldLoadListener, worldserver);
}
+ // Paper start - Handle collideRule team for player collision toggle
+ final Scoreboard scoreboard = this.getScoreboard();
@ -39,14 +39,15 @@ index 01c5d3c572..b87520d834 100644
+ collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
+ }
+ // Paper end
}
protected void a(File file, WorldData worlddata) {
+
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
index a6aed2531f..575e3762b2 100644
index b0740965a..6b1a914d2 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
@@ -94,7 +94,7 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut
@@ -96,7 +96,7 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut
packetdataserializer.a(this.b);
packetdataserializer.writeByte(this.j);
packetdataserializer.a(this.e);
@ -56,18 +57,18 @@ index a6aed2531f..575e3762b2 100644
packetdataserializer.a(this.c);
packetdataserializer.a(this.d);
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 5236948990..79641a73a8 100644
index b3343fca2..7003c4a93 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -73,6 +73,7 @@ public abstract class PlayerList {
@@ -72,6 +72,7 @@ public abstract class PlayerList {
// CraftBukkit start
private CraftServer cserver;
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
public PlayerList(MinecraftServer minecraftserver) {
this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this);
@@ -230,6 +231,13 @@ public abstract class PlayerList {
public PlayerList(MinecraftServer minecraftserver, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
@@ -284,6 +285,13 @@ public abstract class PlayerList {
}
entityplayer.syncInventory();
@ -79,9 +80,9 @@ index 5236948990..79641a73a8 100644
+ }
+ // Paper end
// CraftBukkit - Moved from above, added world
PlayerList.f.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ);
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ);
}
@@ -423,6 +431,16 @@ public abstract class PlayerList {
@@ -402,6 +410,16 @@ public abstract class PlayerList {
entityplayer.playerTick();// SPIGOT-924
// CraftBukkit end
@ -98,7 +99,7 @@ index 5236948990..79641a73a8 100644
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();
@@ -1309,7 +1327,13 @@ public abstract class PlayerList {
@@ -1024,7 +1042,13 @@ public abstract class PlayerList {
player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
}
// CraftBukkit end

View File

@ -1,4 +1,4 @@
From 0c770889d29575a1aca2bfa1a966aed02ca1c94a Mon Sep 17 00:00:00 2001
From 51375e7d49a68f620fab5f1a66cb5637cb40a9de Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 13 Apr 2016 20:21:38 -0700
Subject: [PATCH] Add handshake event to allow plugins to handle client
@ -6,10 +6,10 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 8f2289f4ea..93ca93b640 100644
index 1ef8e8653..60be2fa99 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -72,8 +72,33 @@ public class HandshakeListener implements PacketHandshakingInListener {
@@ -73,8 +73,33 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.b.close(chatmessage);
} else {
this.b.setPacketListener(new LoginListener(this.a, this.b));

View File

@ -0,0 +1,62 @@
From 762544d6d7a753a902f7fbb433f3cfaaca07f643 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 16 Apr 2016 00:39:33 -0400
Subject: [PATCH] Configurable RCON IP address
For servers with multiple IP's, ability to bind to a specific interface.
diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java
index 4af81c886..fb092a941 100644
--- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java
@@ -53,6 +53,8 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Integer> playerIdleTimeout;
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
+ public final String rconIp; // Paper - Add rcon ip
+
// CraftBukkit start
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
super(properties, optionset);
@@ -98,6 +100,10 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
}, 29999984);
this.playerIdleTimeout = this.b("player-idle-timeout", 0);
this.whiteList = this.b("white-list", false);
+ // Paper start - Configurable rcon ip
+ final String rconIp = this.getSettingIfExists("rcon.ip");
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
+ // Paper end
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index d42e7503a..3434f8bae 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -127,8 +127,8 @@ public abstract class PropertyManager<T extends PropertyManager<T>> {
};
}
- @Nullable
- private String c(String s) {
+ @Nullable String getSettingIfExists(final String path) { return this.c(path); } // Paper - OBFHELPER
+ @Nullable private String c(String s) { // Paper - OBFHELPER
return (String) getOverride(s, this.properties.getProperty(s)); // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java
index e48d6dcd7..2ce490be0 100644
--- a/src/main/java/net/minecraft/server/RemoteControlListener.java
+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java
@@ -25,7 +25,7 @@ public class RemoteControlListener extends RemoteConnectionThread {
this.h = dedicatedserverproperties.rconPort;
this.k = dedicatedserverproperties.rconPassword;
- this.i = iminecraftserver.e_();
+ this.i = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
if (this.i.isEmpty()) {
this.i = "0.0.0.0";
}
--
2.21.0

View File

@ -1,4 +1,4 @@
From b44e245e5b5a0dcedd1d41c27db96130b929ead7 Mon Sep 17 00:00:00 2001
From d26dc9b1fa65c8017685b172d9716a2bde604175 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 17 Apr 2016 17:27:09 -0400
Subject: [PATCH] Prevent Fire from loading chunks
@ -7,26 +7,28 @@ This causes the nether to spam unload/reload chunks, plus overall
bad behavior.
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index e09a586977..3f421d46a0 100644
index 2e46ba44a..73190ccba 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -161,6 +161,7 @@ public class BlockFire extends Block {
@@ -163,6 +163,7 @@ public class BlockFire extends Block {
}
blockposition_mutableblockposition.g(blockposition).d(l, j1, i1);
blockposition_mutableblockposition.g(blockposition).e(l, j1, i1);
+ if (!world.isLoaded(blockposition_mutableblockposition)) continue; // Paper
int l1 = this.a((IWorldReader) world, (BlockPosition) blockposition_mutableblockposition);
if (l1 > 0) {
@@ -206,10 +207,14 @@ public class BlockFire extends Block {
@@ -208,10 +209,16 @@ public class BlockFire extends Block {
}
private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
- int k = this.f(world.getType(blockposition).getBlock());
- int k = this.q(world.getType(blockposition));
+ // Paper start
+ final IBlockData iblockdata = world.getTypeIfLoaded(blockposition);
+ if (iblockdata == null) return;
+ int k = this.f(iblockdata.getBlock());
+ if (iblockdata == null) {
+ return;
+ }
+ int k = this.q(iblockdata);
+ // Paper end
if (random.nextInt(i) < k) {
@ -35,19 +37,21 @@ index e09a586977..3f421d46a0 100644
// CraftBukkit start
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
@@ -266,7 +271,11 @@ public class BlockFire extends Block {
@@ -269,8 +276,12 @@ public class BlockFire extends Block {
for (int k = 0; k < j; ++k) {
EnumDirection enumdirection = aenumdirection[k];
- i = Math.max(this.g(iworldreader.getType(blockposition.shift(enumdirection)).getBlock()), i);
- IBlockData iblockdata = iworldreader.getType(blockposition.shift(enumdirection));
-
+ // Paper start
+ final IBlockData type = ((World)iworldreader).getTypeIfLoaded(blockposition.shift(enumdirection));
+ if (type == null) continue;
+ i = Math.max(this.g(type.getBlock()), i);
+ IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition.shift(enumdirection));
+ if (iblockdata == null) {
+ continue;
+ }
+ // Paper end
i = Math.max(this.r(iblockdata), i);
}
return i;
--
2.21.0

View File

@ -1,23 +1,23 @@
From bf7af916f9eb07cbe2f9a6e1d0c919a06bb99191 Mon Sep 17 00:00:00 2001
From 75eff88fb2e2b9bb608a0e69a7a173085eea922c Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Tue, 19 Apr 2016 14:09:31 -0500
Subject: [PATCH] Implement PlayerLocaleChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 2665faa6c5..7ed9903a8c 100644
index dbb9a9a69..6b6c14567 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -33,7 +33,7 @@ import org.bukkit.inventory.MainHand;
@@ -36,7 +36,7 @@ import org.bukkit.inventory.MainHand;
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger cc = LogManager.getLogger();
private static final Logger LOGGER = LogManager.getLogger();
- public String locale = "en_us"; // CraftBukkit - lowercase
+ public String locale = null; // CraftBukkit - lowercase // Paper - default to null
public PlayerConnection playerConnection;
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
@@ -1266,13 +1266,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1423,13 +1423,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event);
}
@ -36,14 +36,14 @@ index 2665faa6c5..7ed9903a8c 100644
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent();
+ }
+ // Paper end
this.cs = packetplayinsettings.d();
this.ct = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bx, (byte) packetplayinsettings.f());
this.ck = packetplayinsettings.d();
this.cl = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bt, (byte) packetplayinsettings.f());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ff9c2c04f3..59bfcce68d 100644
index bc1b46484..4e12b6406 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1721,8 +1721,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1747,8 +1747,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public String getLocale() {
@ -56,7 +56,7 @@ index ff9c2c04f3..59bfcce68d 100644
}
// Paper start
@@ -1811,7 +1813,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1827,7 +1829,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public String getLocale()
{

View File

@ -1,4 +1,4 @@
From 3910692335aa74b78d0352cbc8736c6b8ebcb80f Mon Sep 17 00:00:00 2001
From c246fe0efb76eae003ec61c0992ff8c4e4f3ae07 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 01:43:11 -0500
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
@ -6,10 +6,10 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
Don't even get me started
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 2454083b2d..e8f2f11c4d 100644
index 5ae701488..780287f91 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -873,10 +873,16 @@ public abstract class EntityLiving extends Entity {
@@ -963,10 +963,16 @@ public abstract class EntityLiving extends Entity {
}
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {
@ -23,15 +23,15 @@ index 2454083b2d..e8f2f11c4d 100644
if (f1 > 0.0F) {
- EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper - Add isFastRegen
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen);
// Suppress during worldgen
if (this.valid) {
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index 03dbd21ee8..aed3606bdc 100644
index da07530d9..d184422fb 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -65,7 +65,7 @@ public class FoodMetaData {
@@ -69,7 +69,7 @@ public class FoodMetaData {
if (this.foodTickTimer >= 10) {
float f = Math.min(this.saturationLevel, 6.0F);

View File

@ -1,14 +1,14 @@
From f72e611c6ce91816e01957a1b15a61e29e76b0a6 Mon Sep 17 00:00:00 2001
From 1b74e3cb58a144c914a29d1158c06596d2ef751a Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Thu, 21 Apr 2016 23:51:55 -0700
Subject: [PATCH] Add ability to configure frosted_ice properties
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 37cc057ab7..52a6ff8554 100644
index 1da7ffab5..377f4983b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -269,4 +269,14 @@ public class PaperWorldConfig {
@@ -255,4 +255,14 @@ public class PaperWorldConfig {
private void useVanillaScoreboardColoring() {
useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
}
@ -24,27 +24,27 @@ index 37cc057ab7..52a6ff8554 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java
index f99046b9b6..2c881be1ed 100644
index 1a0c2eeaa..39c3bbc9c 100644
--- a/src/main/java/net/minecraft/server/BlockIceFrost.java
+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java
@@ -12,6 +12,7 @@ public class BlockIceFrost extends BlockIce {
}
@@ -13,6 +13,7 @@ public class BlockIceFrost extends BlockIce {
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
+ if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b(world, blockposition) && this.c(iblockdata, world, blockposition)) {
if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) world, blockposition) && this.e(iblockdata, world, blockposition)) {
BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.r();
Throwable throwable = null;
@@ -27,7 +28,7 @@ public class BlockIceFrost extends BlockIce {
@@ -28,7 +29,7 @@ public class BlockIceFrost extends BlockIce {
IBlockData iblockdata1 = world.getType(blockposition_pooledblockposition);
if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition_pooledblockposition)) {
if (iblockdata1.getBlock() == this && !this.e(iblockdata1, world, blockposition_pooledblockposition)) {
- world.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, 20, 40));
+ world.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
}
}
} catch (Throwable throwable1) {
@@ -49,7 +50,7 @@ public class BlockIceFrost extends BlockIce {
@@ -50,7 +51,7 @@ public class BlockIceFrost extends BlockIce {
}
} else {

View File

@ -1,4 +1,4 @@
From 29606f9f5c0510848c92ee9e704c086315c30074 Mon Sep 17 00:00:00 2001
From d8085c16c673d63ddda105426826b113e4c1aee5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 Apr 2016 00:57:27 -0400
Subject: [PATCH] remove null possibility for getServer singleton
@ -6,32 +6,31 @@ Subject: [PATCH] remove null possibility for getServer singleton
to stop IDE complaining about potential NPE
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b87520d834..78b60d0e35 100644
index 43cd6d2c6..cddb4311a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -68,6 +68,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
@@ -61,6 +61,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable {
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable {
+ private static MinecraftServer SERVER; // Paper
public static final Logger LOGGER = LogManager.getLogger();
public static final File a = new File("usercache.json");
public Convertable convertable;
@@ -157,6 +158,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// Spigot end
public static final File b = new File("usercache.json");
public static final WorldSettings c = (new WorldSettings((long) "North Carolina".hashCode(), EnumGamemode.SURVIVAL, true, false, WorldType.NORMAL)).a();
@@ -166,6 +167,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) {
super("Server");
+ SERVER = this; // Paper - better singleton
+ this.commandDispatcher = commanddispatcher; // CraftBukkit
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
this.ag = new CraftingManager();
@@ -1825,7 +1828,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// CraftBukkit start
this.ai = new CraftingManager();
@@ -1893,7 +1895,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Deprecated
public static MinecraftServer getServer() {
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
+ return SERVER;
+ return SERVER; // Paper
}
// CraftBukkit end
}

View File

@ -1,4 +1,4 @@
From 46f6453e45b047a008d8cd5dd02ca0fcb1ba360d Mon Sep 17 00:00:00 2001
From f77a0b7daecc921d3c29fe4375224fe88728548b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 29 Apr 2016 20:02:00 -0400
Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes
@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index e97bb2305c..5e5a747e9f 100644
index d0713bfcd..8a6f8e875 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -615,6 +615,12 @@ public abstract class EntityHuman extends EntityLiving {
@@ -590,6 +590,12 @@ public abstract class EntityHuman extends EntityLiving {
return null;
}
// CraftBukkit end
@ -25,35 +25,23 @@ index e97bb2305c..5e5a747e9f 100644
+ WorldMap worldmap = ItemWorldMap.getSavedMap(itemstack, this.world);
+ worldmap.updateSeenPlayers(this, itemstack);
+ }
+ // Paper stop
+ // Paper end
ItemStack itemstack1 = this.a(entityitem);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 04ec2a0399..32ee298648 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1072,6 +1072,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
{
if ( iter.next().trackee == entity )
{
+ map.decorations.remove(entity.getDisplayName().getString()); // Paper
iter.remove();
}
return entityitem;
}
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index 5c09085a6b..a819d60375 100644
index e080a77c7..98e4ad4ac 100644
--- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -30,6 +30,7 @@ public class WorldMap extends PersistentBase {
private final Map<String, MapIconBanner> k = Maps.newHashMap();
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
private final Map<String, WorldMapFrame> l = Maps.newHashMap();
@@ -31,6 +31,7 @@ public class WorldMap extends PersistentBase {
private final Map<String, MapIconBanner> l = Maps.newHashMap();
public final Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
private final Map<String, WorldMapFrame> m = Maps.newHashMap();
+ private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper
// CraftBukkit start
public final CraftMapView mapView;
@@ -42,6 +43,7 @@ public class WorldMap extends PersistentBase {
@@ -43,6 +44,7 @@ public class WorldMap extends PersistentBase {
// CraftBukkit start
mapView = new CraftMapView(this);
server = (CraftServer) org.bukkit.Bukkit.getServer();
@ -61,23 +49,23 @@ index 5c09085a6b..a819d60375 100644
// CraftBukkit end
}
@@ -107,6 +109,7 @@ public class WorldMap extends PersistentBase {
this.k.put(mapiconbanner.f(), mapiconbanner);
@@ -110,6 +112,7 @@ public class WorldMap extends PersistentBase {
this.l.put(mapiconbanner.f(), mapiconbanner);
this.a(mapiconbanner.c(), (GeneratorAccess) null, mapiconbanner.f(), (double) mapiconbanner.a().getX(), (double) mapiconbanner.a().getZ(), 180.0D, mapiconbanner.d());
}
+ vanillaRender.buffer = colors; // Paper
NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10);
@@ -169,6 +172,7 @@ public class WorldMap extends PersistentBase {
return nbttagcompound;
@@ -184,6 +187,7 @@ public class WorldMap extends PersistentBase {
this.b();
}
+ public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { a(entityhuman, itemstack); } // Paper - OBFHELPER
+ public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { this.a(entityhuman, itemstack); } // Paper - OBFHELPER
public void a(EntityHuman entityhuman, ItemStack itemstack) {
if (!this.humans.containsKey(entityhuman)) {
WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman);
@@ -404,6 +408,21 @@ public class WorldMap extends PersistentBase {
@@ -419,6 +423,21 @@ public class WorldMap extends PersistentBase {
public class WorldMapHumanTracker {
@ -95,11 +83,11 @@ index 5c09085a6b..a819d60375 100644
+ private boolean shouldUseVanillaMap() {
+ return mapView.getRenderers().size() == 1 && mapView.getRenderers().get(0).getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class;
+ }
+ // Paper stop
+ // Paper end
public final EntityHuman trackee;
private boolean d = true;
private int e;
@@ -420,9 +439,12 @@ public class WorldMap extends PersistentBase {
@@ -435,9 +454,12 @@ public class WorldMap extends PersistentBase {
@Nullable
public Packet<?> a(ItemStack itemstack) {
// CraftBukkit start
@ -113,8 +101,20 @@ index 5c09085a6b..a819d60375 100644
for ( org.bukkit.map.MapCursor cursor : render.cursors) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ab2ca1c32..1e718e4db 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1045,6 +1045,7 @@ public class WorldServer extends World {
{
if ( iter.next().trackee == entity )
{
+ map.decorations.remove(entity.getDisplayName().getString()); // Paper
iter.remove();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
index 256a131781..5768cd512e 100644
index 256a13178..5768cd512 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
@@ -5,7 +5,7 @@ import org.bukkit.map.MapCursor;

View File

@ -1,4 +1,4 @@
From b5c5fe130ae42288c1b008a77039502bcd3b441c Mon Sep 17 00:00:00 2001
From 472adc5afb5e00d4237f753c14899bd06f52071f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 1 May 2016 21:19:14 -0400
Subject: [PATCH] LootTable API & Replenishable Lootables Feature
@ -11,10 +11,10 @@ This feature is good for long term worlds so that newer players
do not suffer with "Every chest has been looted"
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 52a6ff8554..720b87a5ec 100644
index 377f4983b..805aa5699 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -279,4 +279,26 @@ public class PaperWorldConfig {
@@ -265,4 +265,26 @@ public class PaperWorldConfig {
this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax);
log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax);
}
@ -43,7 +43,7 @@ index 52a6ff8554..720b87a5ec 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java
new file mode 100644
index 0000000000..d6fce3112e
index 000000000..d6fce3112
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java
@@ -0,0 +1,33 @@
@ -82,7 +82,7 @@ index 0000000000..d6fce3112e
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java
new file mode 100644
index 0000000000..5e637782d5
index 000000000..5e637782d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java
@@ -0,0 +1,28 @@
@ -116,7 +116,7 @@ index 0000000000..5e637782d5
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java
new file mode 100644
index 0000000000..856843fc91
index 000000000..856843fc9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java
@@ -0,0 +1,71 @@
@ -193,7 +193,7 @@ index 0000000000..856843fc91
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
new file mode 100644
index 0000000000..b5401eaf97
index 000000000..b5401eaf9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
@@ -0,0 +1,179 @@
@ -378,7 +378,7 @@ index 0000000000..b5401eaf97
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
new file mode 100644
index 0000000000..f9fbc221bd
index 000000000..f9fbc221b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
@@ -0,0 +1,64 @@
@ -448,7 +448,7 @@ index 0000000000..f9fbc221bd
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
new file mode 100644
index 0000000000..d50410532c
index 000000000..d50410532
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
@@ -0,0 +1,67 @@
@ -520,10 +520,10 @@ index 0000000000..d50410532c
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index dba97f2305..c9b37727ff 100644
index 5744760ac..3dcd93e5e 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -67,6 +67,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -69,6 +69,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@ -532,29 +532,29 @@ index dba97f2305..c9b37727ff 100644
public CraftEntity getBukkitEntity() {
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index 520cca48cc..e228fc8538 100644
index 66826da45..b84a70edb 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -15,10 +15,11 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
private NonNullList<ItemStack> items;
private boolean b;
- private MinecraftKey c;
+ private MinecraftKey c; public MinecraftKey getLootTableKey() { return c; } public void setLootTable(MinecraftKey key) { c = key; } // Paper - OBFHELPER
private boolean c;
@Nullable
- public MinecraftKey lootTable;
+ public MinecraftKey lootTable; public MinecraftKey getLootTableKey() { return this.lootTable; } public void setLootTable(final MinecraftKey key) { this.lootTable = key; } // Paper - OBFHELPER
public long lootTableSeed;
// CraftBukkit start
+ { lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperMinecartLootableInventory(this)); } // Paper
+ { this.lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperMinecartLootableInventory(this)); } // Paper
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
private int maxStack = MAX_STACK;
@@ -168,12 +169,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@@ -169,12 +170,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@Override
protected void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
+ lootableData.saveNbt(nbttagcompound); // Paper
if (this.c != null) {
nbttagcompound.setString("LootTable", this.c.toString());
+ this.lootableData.saveNbt(nbttagcompound); // Paper
if (this.lootTable != null) {
nbttagcompound.setString("LootTable", this.lootTable.toString());
if (this.lootTableSeed != 0L) {
nbttagcompound.setLong("LootTableSeed", this.lootTableSeed);
}
@ -563,58 +563,57 @@ index 520cca48cc..e228fc8538 100644
ContainerUtil.a(nbttagcompound, this.items);
}
@@ -181,11 +183,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@@ -183,11 +185,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@Override
protected void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
+ lootableData.loadNbt(nbttagcompound); // Paper
+ this.lootableData.loadNbt(nbttagcompound); // Paper
this.items = NonNullList.a(this.getSize(), ItemStack.a);
if (nbttagcompound.hasKeyOfType("LootTable", 8)) {
this.c = new MinecraftKey(nbttagcompound.getString("LootTable"));
this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable"));
this.lootTableSeed = nbttagcompound.getLong("LootTableSeed");
- } else {
+ } if (true) { // Paper - always load the items, table may still remain
ContainerUtil.b(nbttagcompound, this.items);
}
@@ -234,10 +237,10 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@@ -213,10 +216,10 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
}
public void f(@Nullable EntityHuman entityhuman) {
- if (this.c != null && this.world.getMinecraftServer() != null) {
+ if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.c);
public void d(@Nullable EntityHuman entityhuman) {
- if (this.lootTable != null && this.world.getMinecraftServer() != null) {
+ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable);
- this.c = null;
+ lootableData.processRefill(entityhuman); // Paper
Random random;
- this.lootTable = null;
+ this.lootableData.processRefill(entityhuman); // Paper
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this)).a(this.lootTableSeed);
if (this.lootTableSeed == 0L) {
if (entityhuman != null) {
diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java
index 961d9a5f99..60f0b5046a 100644
index 56c7f9b4e..a12d49fc4 100644
--- a/src/main/java/net/minecraft/server/TileEntityLootable.java
+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java
@@ -5,9 +5,10 @@ import javax.annotation.Nullable;
@@ -6,8 +6,9 @@ import javax.annotation.Nullable;
public abstract class TileEntityLootable extends TileEntityContainer {
public abstract class TileEntityLootable extends TileEntityContainer implements ILootable {
- protected MinecraftKey g;
- protected long h;
+ protected MinecraftKey g; public MinecraftKey getLootTableKey() { return g; } public void setLootTable(MinecraftKey key) { g = key; } // Paper - OBFHELPER
+ protected long h; public long getSeed() { return h; } public void setSeed(long seed) { h = seed; } // Paper - OBFHELPER
protected IChatBaseComponent i;
@Nullable
- public MinecraftKey lootTable;
- public long lootTableSeed;
+ public MinecraftKey lootTable; public MinecraftKey getLootTableKey() { return this.lootTable; } public void setLootTable(final MinecraftKey key) { this.lootTable = key; } // Paper - OBFHELPER
+ public long lootTableSeed; public long getSeed() { return this.lootTableSeed; } public void setSeed(final long seed) { this.lootTableSeed = seed; } // Paper - OBFHELPER
+ public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper
protected TileEntityLootable(TileEntityTypes<?> tileentitytypes) {
super(tileentitytypes);
@@ -23,16 +24,18 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
@@ -23,16 +24,18 @@ public abstract class TileEntityLootable extends TileEntityContainer {
}
protected boolean d(NBTTagCompound nbttagcompound) {
+ lootableData.loadNbt(nbttagcompound); // Paper
+ this.lootableData.loadNbt(nbttagcompound); // Paper
if (nbttagcompound.hasKeyOfType("LootTable", 8)) {
this.g = new MinecraftKey(nbttagcompound.getString("LootTable"));
this.h = nbttagcompound.getLong("LootTableSeed");
this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable"));
this.lootTableSeed = nbttagcompound.getLong("LootTableSeed");
- return true;
+ return false; // Paper - always load the items, table may still remain
} else {
@ -623,12 +622,12 @@ index 961d9a5f99..60f0b5046a 100644
}
protected boolean e(NBTTagCompound nbttagcompound) {
+ lootableData.saveNbt(nbttagcompound); // Paper
if (this.g == null) {
+ this.lootableData.saveNbt(nbttagcompound); // Paper
if (this.lootTable == null) {
return false;
} else {
@@ -41,15 +44,15 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
nbttagcompound.setLong("LootTableSeed", this.h);
@@ -41,15 +44,15 @@ public abstract class TileEntityLootable extends TileEntityContainer {
nbttagcompound.setLong("LootTableSeed", this.lootTableSeed);
}
- return true;
@ -637,17 +636,17 @@ index 961d9a5f99..60f0b5046a 100644
}
public void d(@Nullable EntityHuman entityhuman) {
- if (this.g != null && this.world.getMinecraftServer() != null) {
+ if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.g);
- if (this.lootTable != null && this.world.getMinecraftServer() != null) {
+ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable);
- this.g = null;
+ lootableData.processRefill(entityhuman); // Paper
Random random;
- this.lootTable = null;
+ this.lootableData.processRefill(entityhuman); // Paper
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this.position)).a(this.lootTableSeed);
if (this.h == 0L) {
if (entityhuman != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 8617fac6b0..4f4121adca 100644
index 8617fac6b..4f4121adc 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -61,7 +61,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
@ -660,10 +659,10 @@ index 8617fac6b0..4f4121adca 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index fa03d17a4c..14b5be75f3 100644
index 0e8f1a89f..18c80b35b 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -13,8 +13,9 @@ import org.bukkit.craftbukkit.CraftWorld;
@@ -12,8 +12,9 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest;
import org.bukkit.inventory.Inventory;
@ -675,7 +674,7 @@ index fa03d17a4c..14b5be75f3 100644
public CraftChest(final Block block) {
super(block, TileEntityChest.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
index 7ef68bb626..daf183fb10 100644
index e1ad26a24..678aa09d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
@@ -1,5 +1,6 @@
@ -685,7 +684,7 @@ index 7ef68bb626..daf183fb10 100644
import net.minecraft.server.MinecraftKey;
import net.minecraft.server.TileEntityLootable;
import org.bukkit.Bukkit;
@@ -11,7 +12,7 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -10,7 +11,7 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.loot.LootTable;
import org.bukkit.loot.Lootable;
@ -694,7 +693,7 @@ index 7ef68bb626..daf183fb10 100644
public CraftLootable(Block block, Class<T> tileEntityClass) {
super(block, tileEntityClass);
@@ -69,7 +70,7 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
@@ -54,7 +55,7 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
setLootTable(getLootTable(), seed);
}
@ -704,7 +703,7 @@ index 7ef68bb626..daf183fb10 100644
getSnapshot().setLootTable(key, seed);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
index 1b5b266c05..e0b99207b2 100644
index 9225082bd..3f82a7957 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
@@ -1,5 +1,6 @@
@ -712,9 +711,9 @@ index 1b5b266c05..e0b99207b2 100644
+import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper
import net.minecraft.server.EntityMinecartChest;
import org.bukkit.craftbukkit.CraftServer;
@@ -9,7 +10,7 @@ import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.craftbukkit.inventory.CraftInventory;
@@ -8,7 +9,7 @@ import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.inventory.Inventory;
@SuppressWarnings("deprecation")
@ -724,7 +723,7 @@ index 1b5b266c05..e0b99207b2 100644
public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
index 87303ecd13..6790fa2fee 100644
index 2d776b520..fcc978784 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
@@ -47,7 +47,7 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
@ -734,10 +733,10 @@ index 87303ecd13..6790fa2fee 100644
- private void setLootTable(LootTable table, long seed) {
+ public void setLootTable(LootTable table, long seed) { // Paper
MinecraftKey newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
getHandle().a(newKey, seed);
getHandle().setLootTable(newKey, seed);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
index f29365c948..1937f7b9a2 100644
index 44b3418b1..d56cbeac4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
@@ -1,5 +1,6 @@
@ -745,9 +744,9 @@ index f29365c948..1937f7b9a2 100644
+import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper
import net.minecraft.server.EntityMinecartHopper;
import org.bukkit.craftbukkit.CraftServer;
@@ -8,7 +9,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.craftbukkit.inventory.CraftInventory;
@@ -7,7 +8,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.inventory.Inventory;

View File

@ -1,14 +1,14 @@
From c3a16fc0fb33437dd1096f445f7b2c2e15c78c16 Mon Sep 17 00:00:00 2001
From dd5edda1525f452645902b8344a46fc617bfe8ed Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 May 2016 23:33:08 -0400
Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index b0bfdf9424..c6d2c30339 100644
index 033fcf50e..a89a9bfcb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -238,4 +238,9 @@ public class PaperConfig {
@@ -225,4 +225,9 @@ public class PaperConfig {
private static void enablePlayerCollisions() {
enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true);
}
@ -19,10 +19,10 @@ index b0bfdf9424..c6d2c30339 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java
index 1a9391a382..3a9dfb9798 100644
index fab5962e2..de7ac6c20 100644
--- a/src/main/java/net/minecraft/server/PersistentScoreboard.java
+++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java
@@ -177,6 +177,7 @@ public class PersistentScoreboard extends PersistentBase {
@@ -174,6 +174,7 @@ public class PersistentScoreboard extends PersistentBase {
while (iterator.hasNext()) {
ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next();

View File

@ -1,11 +1,11 @@
From c9943e056e9e489ad5907e5b2d7e99b1602550f7 Mon Sep 17 00:00:00 2001
From 1903e90b74e09bde64878c01584df9d90cfa8815 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 12 May 2016 23:02:58 -0500
Subject: [PATCH] System property for disabling watchdoge
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index c080a61185..0117c3d3de 100644
index 56f5f54bd..9532aada8 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -57,7 +57,7 @@ public class WatchdogThread extends Thread

View File

@ -1,23 +0,0 @@
From faa24a31538552e4bf1ee189e86a98c49798bb93 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 16 Apr 2016 00:39:33 -0400
Subject: [PATCH] Configurable RCON IP address
For servers with multiple IP's, ability to bind to a specific interface.
diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java
index 81a6a8fc9e..7b82c4dea2 100644
--- a/src/main/java/net/minecraft/server/RemoteControlListener.java
+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java
@@ -24,7 +24,7 @@ public class RemoteControlListener extends RemoteConnectionThread {
super(iminecraftserver, "RCON Listener");
this.h = iminecraftserver.a("rcon.port", 0);
this.l = iminecraftserver.a("rcon.password", "");
- this.j = iminecraftserver.e();
+ this.j = iminecraftserver.a("rcon.ip", ((DedicatedServer) iminecraftserver).getServerIp()); // Paper
this.i = iminecraftserver.e_();
if (0 == this.h) {
this.h = this.i + 10;
--
2.21.0