mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Paper 1.9.4 Update
This commit is contained in:
parent
324bde1f10
commit
34fcd8ccc2
62 changed files with 209 additions and 1262 deletions
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- <artifactId>spigot-api</artifactId>
|
||||
+ <groupId>com.destroystokyo.paper</groupId>
|
||||
+ <artifactId>paper-api</artifactId>
|
||||
<version>1.9.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
- <name>Spigot-API</name>
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Thu, 7 Apr 2016 18:28:06 -0500
|
||||
Subject: [PATCH] 16w14a memory cleanup
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PathfinderAbstract {
|
||||
this.f = MathHelper.d(entityinsentient.width + 1.0F);
|
||||
}
|
||||
|
||||
- public void a() { this.a = (IBlockAccess) null; } // CraftBukkit - don't leak Chunk Cache
|
||||
+ // Paper start - 16w14a backports
|
||||
+ public void a() {
|
||||
+ this.a = (IBlockAccess) null; // CraftBukkit - don't leak Chunk Cache
|
||||
+ this.b = null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
protected PathPoint a(int i, int j, int k) {
|
||||
int l = PathPoint.b(i, j, k);
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderWater.java b/src/main/java/net/minecraft/server/PathfinderWater.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderWater.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderWater.java
|
||||
@@ -0,0 +0,0 @@ public class PathfinderWater extends PathfinderAbstract {
|
||||
|
||||
public PathfinderWater() {}
|
||||
|
||||
+ // Paper start - 16w14a backports
|
||||
+ /*
|
||||
public void a(IBlockAccess iblockaccess, EntityInsentient entityinsentient) {
|
||||
super.a(iblockaccess, entityinsentient);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PathfinderWater extends PathfinderAbstract {
|
||||
public void a() {
|
||||
super.a();
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
|
||||
public PathPoint b() {
|
||||
return this.a(MathHelper.floor(this.b.getBoundingBox().a), MathHelper.floor(this.b.getBoundingBox().b + 0.5D), MathHelper.floor(this.b.getBoundingBox().c));
|
||||
--
|
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
+
|
||||
public Chunk getChunkIfLoaded(int x, int z) {
|
||||
return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(x, z);
|
||||
return ((ChunkProviderServer) this.chunkProvider).getLoadedChunkAt(x, z);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
|
|
@ -33,6 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
+
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
return this.world.getChunkProviderServer().getOrCreateChunkFast(x, z).bukkitChunk;
|
||||
return this.world.getChunkProviderServer().getChunkAt(x, z).bukkitChunk;
|
||||
}
|
||||
--
|
|
@ -22,15 +22,15 @@ diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/mai
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
@@ -0,0 +0,0 @@ import java.util.Random;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class PortalTravelAgent {
|
||||
|
||||
- private final WorldServer world;
|
||||
+ protected final WorldServer world; // Paper - private -> protected
|
||||
private final Random b;
|
||||
private final LongHashMap<PortalTravelAgent.ChunkCoordinatesPortal> c = new LongHashMap();
|
||||
private final List<Long> d = Lists.newArrayList();
|
||||
private final Long2ObjectMap<PortalTravelAgent.ChunkCoordinatesPortal> c = new Long2ObjectOpenHashMap(4096);
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PortalTravelAgent {
|
||||
|
||||
public boolean b(Entity entity, float f) {
|
||||
|
|
|
@ -92,10 +92,10 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
@@ -0,0 +0,0 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
+import com.destroystokyo.paper.exception.ServerInternalException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -282,7 +282,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -0,0 +0,0 @@ public class VillageSiege {
|
||||
entityzombie.clearVillagerType();
|
||||
} catch (Exception exception) {
|
||||
|
|
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return (float) this.getAttributeInstance(GenericAttributes.maxHealth).getValue();
|
||||
}
|
||||
|
||||
+ public final int getStuckArrows() { return this.bX(); } // Paper - deobfuscation helper
|
||||
public final int bX() {
|
||||
+ public final int getStuckArrows() { return this.bY(); } // Paper // OBFHELPER
|
||||
public final int bY() {
|
||||
return ((Integer) this.datawatcher.get(EntityLiving.h)).intValue();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ for (int k = i - viewDistance; k <= i + viewDistance; ++k) {
|
||||
+ for (int l = j - viewDistance; l <= j + viewDistance; ++l) {
|
||||
+ // Paper end
|
||||
PlayerChunk playerchunk = this.b(k, l);
|
||||
PlayerChunk playerchunk = this.getChunk(k, l);
|
||||
|
||||
if (playerchunk != null) {
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
|
||||
|
@ -81,35 +81,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ final int oldViewDistance = player.getViewDistance();
|
||||
+
|
||||
+ int viewDistance = MathHelper.clamp(toSet, 3, 32);
|
||||
+ if (viewDistance != oldViewDistance) {
|
||||
+ int cx = (int) player.locX >> 4;
|
||||
+ int cz = (int) player.locZ >> 4;
|
||||
+
|
||||
+ if (viewDistance - oldViewDistance > 0) {
|
||||
+ for (int x = cx - viewDistance; x <= cx + viewDistance; ++x) {
|
||||
+ for (int z = cz - viewDistance; z <= cz + viewDistance; ++z) {
|
||||
+ PlayerChunk playerchunkmap_playerchunk = this.c(x, z);
|
||||
+
|
||||
+ if (!playerchunkmap_playerchunk.c.contains(player)) {
|
||||
+ playerchunkmap_playerchunk.a(player);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (int x = cx - oldViewDistance; x <= cx + oldViewDistance; ++x) {
|
||||
+ for (int z = cz - oldViewDistance; z <= cz + oldViewDistance; ++z) {
|
||||
+ if (!this.a(x, z, cx, cz, viewDistance)) {
|
||||
+ this.c(x, z).b(player);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ player.setViewDistance(viewDistance);
|
||||
+ if (toSet < 0) {
|
||||
+ viewDistance = -1;
|
||||
+ }
|
||||
+
|
||||
+ if (toSet == -1) {
|
||||
+ player.setViewDistance(-1);
|
||||
+ if (viewDistance != oldViewDistance) {
|
||||
+ removePlayer(player);
|
||||
+ player.setViewDistance(viewDistance);
|
||||
+ addPlayer(player);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
|
|
@ -23,13 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/EntitySlime.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
|
||||
@@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
return super.cF();
|
||||
return super.cG();
|
||||
}
|
||||
|
||||
- if (this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D) {
|
||||
+ boolean isSlimeChunk = world.paperConfig.allChunksAreSlimeChunks || chunk.a(987234911L).nextInt(10) == 0;
|
||||
+ if (this.random.nextInt(10) == 0 && isSlimeChunk && this.locY < 40.0D) {
|
||||
return super.cF();
|
||||
+ boolean isSlimeChunk = world.paperConfig.allChunksAreSlimeChunks || chunk.a(987234911L).nextInt(10) == 0; // Paper
|
||||
+ if (this.random.nextInt(10) == 0 && isSlimeChunk && this.locY < 40.0D) { // Paper
|
||||
return super.cG();
|
||||
}
|
||||
}
|
||||
--
|
|
@ -23,9 +23,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
private boolean bC;
|
||||
private boolean bD;
|
||||
private Entity leashHolder;
|
||||
private NBTTagCompound bE;
|
||||
private NBTTagCompound bF;
|
||||
+ public PathfinderGoalFloat goalFloat; // Paper
|
||||
|
||||
public EntityInsentient(World world) {
|
||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
private static final DataWatcherObject<Boolean> aA = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> aB = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> aC = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
public boolean aa;
|
||||
- public int ab;
|
||||
- public int ac;
|
||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
|
||||
File file = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat");
|
||||
File file = new File(this.playerDir, entityhuman.bd() + ".dat");
|
||||
// Spigot Start
|
||||
boolean usingWrongFile = false;
|
||||
- if ( !file.exists() )
|
||||
|
|
|
@ -44,17 +44,17 @@ diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/mai
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -0,0 +0,0 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -0,0 +0,0 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.annotation.Nullable;
|
||||
+import java.util.concurrent.ConcurrentLinkedQueue; // Paper
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
|
||||
+ private ConcurrentLinkedQueue<QueuedChunk> queue = new ConcurrentLinkedQueue<QueuedChunk>(); // Paper - Chunk queue improvements
|
||||
+ private ConcurrentLinkedQueue<QueuedChunk> queue = new ConcurrentLinkedQueue<>(); // Paper - Chunk queue improvements
|
||||
+ private final Object lock = new Object(); // Paper - Chunk queue improvements
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
private Map<ChunkCoordIntPair, NBTTagCompound> b = new ConcurrentHashMap();
|
||||
|
|
|
@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
public long x() {
|
||||
- return this.v;
|
||||
+ return world.paperConfig.useInhabitedTime ? this.v : 0; // Paper
|
||||
- return this.w;
|
||||
+ return world.paperConfig.useInhabitedTime ? this.w : 0; // Paper
|
||||
}
|
||||
|
||||
public void c(long i) {
|
||||
|
|
|
@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
|
||||
if (block == this.au && i == this.av) {
|
||||
++this.aw;
|
||||
- if (this.aw >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
|
||||
+ if (this.aw >= (fromPlayer != PickupStatus.DISALLOWED ? world.spigotConfig.arrowDespawnRate : world.paperConfig.nonPlayerArrowDespawnRate)) { // Spigot - First int after shooter
|
||||
if (block == this.av && i == this.aw) {
|
||||
++this.ax;
|
||||
- if (this.ax >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
|
||||
+ if (this.ax >= (fromPlayer != PickupStatus.DISALLOWED ? world.spigotConfig.arrowDespawnRate : world.paperConfig.nonPlayerArrowDespawnRate)) { // Spigot - First int after shooter // Paper
|
||||
this.die();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,317 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Iceee <andrew@opticgaming.tv>
|
||||
Date: Wed, 2 Mar 2016 23:00:53 -0600
|
||||
Subject: [PATCH] Configurable TNT cannon fix
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void mobSpawnerTickRate() {
|
||||
mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
|
||||
}
|
||||
+
|
||||
+ public boolean fixCannons;
|
||||
+ private void fixCannons() {
|
||||
+ fixCannons = getBoolean("fix-cannons", false);
|
||||
+ log("Fix TNT cannons: " + fixCannons);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
|
||||
} else {
|
||||
this.b(world, blockposition, iblockdata, 0);
|
||||
world.setAir(blockposition);
|
||||
+ // Paper start - Fix cannons
|
||||
+ if (world.paperConfig.fixCannons) {
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.SOUTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
int i = aenumdirection.length;
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
|
||||
|
||||
public void postBreak(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (this.d) {
|
||||
+ // Paper start - Fix cannons
|
||||
+ if (world.paperConfig.fixCannons) {
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.SOUTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
int i = aenumdirection.length;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
||||
@@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (this.isOn) {
|
||||
+ // Paper start - Fix cannons
|
||||
+ if (world.paperConfig.fixCannons) {
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.SOUTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
int i = aenumdirection.length;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (this.isOn) {
|
||||
+ // Paper start - Fix cannons
|
||||
+ if (world.paperConfig.fixCannons) {
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.SOUTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
int i = aenumdirection.length;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
||||
@@ -0,0 +0,0 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
|
||||
this.B.add(blockposition);
|
||||
+ // Paper start - Fix cannons
|
||||
+ if (world.paperConfig.fixCannons) {
|
||||
+ this.B.add(blockposition.shift(EnumDirection.WEST));
|
||||
+ this.B.add(blockposition.shift(EnumDirection.EAST));
|
||||
+ this.B.add(blockposition.shift(EnumDirection.DOWN));
|
||||
+ this.B.add(blockposition.shift(EnumDirection.UP));
|
||||
+ this.B.add(blockposition.shift(EnumDirection.NORTH));
|
||||
+ this.B.add(blockposition.shift(EnumDirection.SOUTH));
|
||||
+ return iblockdata;
|
||||
+ }
|
||||
+ // Paper end
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
int i1 = aenumdirection.length;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BlockRedstoneWire extends Block {
|
||||
private void b(World world, BlockPosition blockposition) {
|
||||
if (world.getType(blockposition).getBlock() == this) {
|
||||
world.applyPhysics(blockposition, this);
|
||||
+ // Paper start - Fix cannons
|
||||
+ if (world.paperConfig.fixCannons) {
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.SOUTH), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this);
|
||||
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
int i = aenumdirection.length;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
@@ -0,0 +0,0 @@ public class BlockTNT extends Block {
|
||||
|
||||
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
|
||||
if (!world.isClientSide) {
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
|
||||
+ // Paper start - Fix cannons
|
||||
+ double y = blockposition.getY();
|
||||
+ if (!world.paperConfig.fixCannons) y += 0.5;
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
|
||||
+ // Paper end
|
||||
|
||||
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
|
||||
world.addEntity(entitytntprimed);
|
||||
@@ -0,0 +0,0 @@ public class BlockTNT extends Block {
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) {
|
||||
if (!world.isClientSide) {
|
||||
if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) {
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving);
|
||||
+ // Paper start - Fix cannons
|
||||
+ double y = blockposition.getY();
|
||||
+ if (!world.paperConfig.fixCannons) y += 0.5;
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), entityliving);
|
||||
+ // Paper end
|
||||
|
||||
world.addEntity(entitytntprimed);
|
||||
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gk, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -0,0 +0,0 @@ public class DispenserRegistry {
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
- BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D));
|
||||
+ // Paper start - Fix cannons
|
||||
+ double y = blockposition.getY();
|
||||
+ if (!world.paperConfig.fixCannons) y += 0.5;
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, y, (double) blockposition.getZ() + 0.5D));
|
||||
+ // Paper end
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
|
||||
public boolean br() {
|
||||
return true;
|
||||
}
|
||||
+
|
||||
+ // Paper start - Fix cannons
|
||||
+ @Override
|
||||
+ public double f(double d0, double d1, double d2) {
|
||||
+ if (!world.paperConfig.fixCannons) return super.f(d0, d1, d2);
|
||||
+
|
||||
+ double d3 = this.locX - d0;
|
||||
+ double d4 = this.locY + this.getHeadHeight() - d1;
|
||||
+ double d5 = this.locZ - d2;
|
||||
+
|
||||
+ return (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float getHeadHeight() {
|
||||
+ return world.paperConfig.fixCannons ? this.length / 2 : super.getHeadHeight();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
this.source = entityliving;
|
||||
+ if (world.paperConfig.fixCannons) this.motX = this.motZ = 0.0F; // Paper - Fix cannons
|
||||
}
|
||||
|
||||
protected void i() {
|
||||
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
+ // Paper start - Fix cannons
|
||||
+ @Override
|
||||
+ public double f(double d0, double d1, double d2) {
|
||||
+ if (!world.paperConfig.fixCannons) return super.f(d0, d1, d2);
|
||||
+
|
||||
+ double d3 = this.locX - d0;
|
||||
+ double d4 = this.locY + this.getHeadHeight() - d1;
|
||||
+ double d5 = this.locZ - d2;
|
||||
+
|
||||
+ return (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean bd() {
|
||||
+ return !world.paperConfig.fixCannons && super.bd();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
public float getHeadHeight() {
|
||||
- return 0.0F;
|
||||
+ return world.paperConfig.fixCannons ? this.length / 2 : 0.0F;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Author: Jedediah Smith <jedediah@silencegreys.com>
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean aj() {
|
||||
+ if (!world.paperConfig.fixCannons) return super.aj();
|
||||
+
|
||||
+ // Preserve velocity while calling the super method
|
||||
+ double oldMotX = this.motX;
|
||||
+ double oldMotY = this.motY;
|
||||
+ double oldMotZ = this.motZ;
|
||||
+
|
||||
+ super.aj();
|
||||
+
|
||||
+ this.motX = oldMotX;
|
||||
+ this.motY = oldMotY;
|
||||
+ this.motZ = oldMotZ;
|
||||
+
|
||||
+ if (this.inWater) {
|
||||
+ // Send position and velocity updates to nearby players on every tick while the TNT is in water.
|
||||
+ // This does pretty well at keeping their clients in sync with the server.
|
||||
+ EntityTrackerEntry ete = ((WorldServer) this.getWorld()).getTracker().trackedEntities.get(this.getId());
|
||||
+ if (ete != null) {
|
||||
+ PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this);
|
||||
+ PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this);
|
||||
+
|
||||
+ for (EntityPlayer viewer : ete.trackedPlayers) {
|
||||
+ if ((viewer.locX - this.locX) * (viewer.locY - this.locY) * (viewer.locZ - this.locZ) < 16 * 16) {
|
||||
+ viewer.playerConnection.sendPacket(velocityPacket);
|
||||
+ viewer.playerConnection.sendPacket(positionPacket);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return this.inWater;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
public void setFuseTicks(int i) {
|
||||
this.datawatcher.set(EntityTNTPrimed.FUSE_TICKS, Integer.valueOf(i));
|
||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||
@@ -0,0 +0,0 @@ public class Explosion {
|
||||
d14 = entity instanceof EntityHuman && world.paperConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a((EntityLiving) entity, d13); // Paper - Disable explosion knockback
|
||||
}
|
||||
|
||||
+ // Paper start - Fix cannons
|
||||
+ /*
|
||||
entity.motX += d8 * d14;
|
||||
entity.motY += d9 * d14;
|
||||
entity.motZ += d10 * d14;
|
||||
+ */
|
||||
+ // This impulse method sets the dirty flag, so clients will get an immediate velocity update
|
||||
+ entity.g(d8 * d14, d9 * d14, d10 * d14);
|
||||
+ // Paper end
|
||||
+
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
|
||||
--
|
|
@ -29,9 +29,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
- private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, 1);
|
||||
+ private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", world.paperConfig.babyZombieMovementSpeed, 1); // Paper - Remove static - Make baby speed configurable
|
||||
private static final DataWatcherObject<Boolean> bv = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Integer> bw = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b);
|
||||
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> bw = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Integer> bx = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b);
|
||||
private static final DataWatcherObject<Boolean> by = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h);
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
if (this.world != null && !this.world.isClientSide) {
|
||||
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
fixCannons = getBoolean("fix-cannons", false);
|
||||
log("Fix TNT cannons: " + fixCannons);
|
||||
private void mobSpawnerTickRate() {
|
||||
mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
|
||||
}
|
||||
+
|
||||
+ public int containerUpdateTickRate;
|
||||
|
|
|
@ -27,18 +27,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return this.world.pvpMode;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Paper - Give "theEnd2" achievement if the player doesn't already have it
|
||||
+ */
|
||||
+
|
||||
+ // Paper start - Give "theEnd2" achievement if the player doesn't already have it
|
||||
+ private void giveTheEnd2() {
|
||||
+ if (!this.a(AchievementList.D)) {
|
||||
+ this.b(AchievementList.D);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Nullable
|
||||
public Entity c(int i) {
|
||||
//this.cj = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
|
||||
if (this.dimension == 1 && i == 1) {
|
||||
//this.ck = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.world.kill(this);
|
||||
if (!this.viewingCredits) {
|
||||
|
|
|
@ -26,12 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
|
||||
this.aw = MathHelper.nextInt(this.random, 20, 80);
|
||||
this.ax = MathHelper.nextInt(this.random, 20, 80);
|
||||
}
|
||||
} else {
|
||||
- this.av = MathHelper.nextInt(this.random, 100, 900);
|
||||
+ this.av = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper - Configurable fishing time range
|
||||
this.av -= EnchantmentManager.g(this.owner) * 20 * 5;
|
||||
- this.aw = MathHelper.nextInt(this.random, 100, 900);
|
||||
+ this.aw = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper - Configurable fishing time range
|
||||
this.aw -= EnchantmentManager.g(this.owner) * 20 * 5;
|
||||
}
|
||||
}
|
||||
--
|
|
@ -28,10 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class EntitySquid extends EntityWaterAnimal {
|
||||
}
|
||||
|
||||
public boolean cF() {
|
||||
- return this.locY > 45.0D && this.locY < (double) this.world.K() && super.cF();
|
||||
public boolean cG() {
|
||||
- return this.locY > 45.0D && this.locY < (double) this.world.K() && super.cG();
|
||||
+ // Paper - Configurable squid spawn height range
|
||||
+ return this.locY > world.paperConfig.squidMinSpawnHeight && this.locY < world.paperConfig.squidMaxSpawnHeight && super.cF();
|
||||
+ return this.locY > world.paperConfig.squidMinSpawnHeight && this.locY < world.paperConfig.squidMaxSpawnHeight && super.cG();
|
||||
}
|
||||
|
||||
public void b(float f, float f1, float f2) {
|
||||
|
|
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
public void U() {
|
||||
this.world.methodProfiler.a("entityBaseTick");
|
||||
if (this.isPassenger() && this.by().dead) {
|
||||
if (this.isPassenger() && this.bz().dead) {
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
this.fallDistance *= 0.5F;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
ItemStack itemstack = (craftItem.equals(event.getItem())) ? this.bm.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this);
|
||||
ItemStack itemstack = (craftItem.equals(event.getItem())) ? this.bn.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this);
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start - save the default replacement item and change it if necessary
|
||||
|
@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
itemstack = null;
|
||||
}
|
||||
|
||||
this.a(this.ct(), itemstack);
|
||||
this.cz();
|
||||
this.a(this.cu(), itemstack);
|
||||
this.cA();
|
||||
+
|
||||
+ // Paper start - if the replacement is anything but the default, update the client inventory
|
||||
+ if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
|
||||
|
|
|
@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
+ if (!entity.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(entity instanceof EntityHuman)) { continue; } // Paper
|
||||
String s2 = e(minecraftserver, icommandlistener, entity.getUniqueID().toString());
|
||||
String s2 = e(minecraftserver, icommandlistener, entity.bd());
|
||||
|
||||
if (scoreboard.addPlayerToTeam(s2, s)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
|
@ -41,11 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ScoreboardTeamBase aO() {
|
||||
+ if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
|
||||
return this.world.getScoreboard().getPlayerTeam(this.getUniqueID().toString());
|
||||
return this.world.getScoreboard().getPlayerTeam(this.bd());
|
||||
}
|
||||
|
||||
--
|
|
@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback
|
||||
+
|
||||
if (this.getHealth() <= 0.0F) {
|
||||
SoundEffect soundeffect = this.bS();
|
||||
SoundEffect soundeffect = this.bT();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
private boolean unloadChunk0(int x, int z, boolean save, boolean safe) {
|
||||
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z);
|
||||
+ // Paper start - Don't create a chunk just to unload it
|
||||
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z);
|
||||
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getLoadedChunkAt(x, z);
|
||||
+ if (chunk == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
|
|
@ -22,12 +22,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
+ // Paper start - Save the entity's origin location
|
||||
+ if (origin != null) {
|
||||
+ nbttagcompound.set("Paper.Origin", this.a(origin.getX(), origin.getY(), origin.getZ()));
|
||||
+ nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
|
||||
+ }
|
||||
+ // Paper end
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being saved");
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -42,6 +42,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
|
||||
public void at() {}
|
||||
|
||||
+ protected NBTTagList createList(double... adouble) { return a(adouble); } // Paper // OBFHELPER
|
||||
protected NBTTagList a(double... adouble) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
double[] adouble1 = adouble;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
|
|
|
@ -9,15 +9,15 @@ diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/ma
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
public abstract class NavigationAbstract {
|
||||
|
||||
private static int f = 20;
|
||||
- protected EntityInsentient a;
|
||||
+ protected EntityInsentient a;public Entity getEntity() { return a; } // Paper
|
||||
protected World b;
|
||||
@Nullable
|
||||
protected PathEntity c;
|
||||
protected double d;
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
} else if (this.c != null && !this.c.b() && blockposition.equals(this.r)) {
|
||||
return this.c;
|
||||
|
|
|
@ -43,15 +43,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
} else {
|
||||
iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1));
|
||||
@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids {
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
/**
|
||||
* Paper - Get flow speed. Throttle if its water and flowing adjacent to lava
|
||||
*/
|
||||
@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
return super.a(world);
|
||||
}
|
||||
+
|
||||
+ private int getFluidLevel(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
+ return iblockaccess.getType(blockposition).getMaterial() == this.material ? iblockaccess.getType(blockposition).get(BlockFluids.LEVEL) : -1;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Paper - Data check method for fast draining
|
||||
+ */
|
||||
+ public int getData(World world, BlockPosition position) {
|
||||
+ int data = this.c((IBlockAccess) world, position);
|
||||
+ int data = this.getFluidLevel((IBlockAccess) world, position);
|
||||
+ return data < 8 ? data : 0;
|
||||
+ }
|
||||
+
|
||||
|
@ -94,5 +106,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D);
|
||||
- List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1));
|
||||
+ // Paper start - Fix lag from explosions processing dead entities
|
||||
+ List list = this.world.a(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), new com.google.common.base.Predicate<Entity>() {
|
||||
+ List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), new com.google.common.base.Predicate<Entity>() {
|
||||
+ @Override
|
||||
+ public boolean apply(Entity entity) {
|
||||
+ return IEntitySelector.d.apply(entity) && !entity.dead;
|
||||
|
|
|
@ -259,7 +259,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
|
||||
}
|
||||
|
||||
public boolean b(World world, BlockPosition blockposition) {
|
||||
public synchronized boolean b(World world, BlockPosition blockposition) { // CraftBukkit - synchronized
|
||||
+ if (this.g == null) return false; // Paper
|
||||
this.a(world);
|
||||
Iterator iterator = this.c.values().iterator();
|
||||
|
|
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
private static final Logger bQ = LogManager.getLogger();
|
||||
private static final Logger bR = LogManager.getLogger();
|
||||
- public String locale = "en_US"; // Spigot private -> public
|
||||
+ public String locale = null; // Spigot private -> public // Paper - default to null
|
||||
public PlayerConnection playerConnection;
|
||||
|
@ -26,12 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ String oldLocale = this.locale;
|
||||
this.locale = packetplayinsettings.a();
|
||||
+ if (!this.locale.equals(oldLocale)) {
|
||||
+ CraftEventFactory.callEvent(new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale));
|
||||
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.cf = packetplayinsettings.c();
|
||||
this.cg = packetplayinsettings.d();
|
||||
this.getDataWatcher().set(EntityPlayer.bp, Byte.valueOf((byte) packetplayinsettings.e()));
|
||||
this.cg = packetplayinsettings.c();
|
||||
this.ch = packetplayinsettings.d();
|
||||
this.getDataWatcher().set(EntityPlayer.bq, Byte.valueOf((byte) packetplayinsettings.e()));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
|
|
|
@ -88,7 +88,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase {
|
||||
nbttagcompound.setBoolean("trackingPosition", this.track);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
+ public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { a(entityhuman, itemstack); } // Paper // OBFHELPER
|
||||
|
|
|
@ -36,8 +36,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
private int w;
|
||||
private ConcurrentLinkedQueue<BlockPosition> x;
|
||||
private ConcurrentLinkedQueue<BlockPosition> y;
|
||||
public boolean d;
|
||||
protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
|
||||
+ public int lightUpdates; // Paper - Number of queued light updates for this chunk
|
||||
|
||||
|
@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
if (this.h[i + j * 16]) {
|
||||
if (this.i[i + j * 16]) {
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
} else {
|
||||
if (flag) {
|
||||
|
@ -139,13 +139,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
long chunkcoordinates = this.unloadQueue.popFirst();
|
||||
Chunk chunk = this.chunks.get(chunkcoordinates);
|
||||
if (chunk == null) continue;
|
||||
+ if (chunk.hasLightUpdates()) continue; // Paper - Don't unload chunks with pending light updates.
|
||||
Chunk chunk = (Chunk) this.chunks.get(olong);
|
||||
|
||||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (chunk != null && chunk.d) {
|
||||
+ if (chunk.hasLightUpdates()) continue; // Paper - Don't unload chunks with pending light updates.
|
||||
// CraftBukkit start
|
||||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
|
|
|
@ -241,6 +241,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import net.minecraft.server.*;
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+import javax.annotation.Nullable;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import java.util.Random;
|
||||
|
@ -278,7 +279,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return lootable;
|
||||
+ }
|
||||
+
|
||||
+ public boolean shouldReplenish(EntityHuman player) {
|
||||
+ public boolean shouldReplenish(@Nullable EntityHuman player) {
|
||||
+ String tableName = this.lootable.getLootTableName();
|
||||
+
|
||||
+ // No Loot Table associated
|
||||
|
@ -418,10 +419,10 @@ diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/s
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
import java.util.Random;
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
// CraftBukkit start
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
+
|
||||
+import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper
|
||||
+import com.destroystokyo.paper.loottable.CraftLootableInventory; // Paper
|
||||
|
@ -461,7 +462,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
|
||||
}
|
||||
|
||||
public void f(EntityHuman entityhuman) {
|
||||
public void f(@Nullable EntityHuman entityhuman) {
|
||||
- if (this.c != null) {
|
||||
+ if (lootableData.shouldReplenish(entityhuman)) { // Paper
|
||||
LootTable loottable = this.world.ak().a(this.c);
|
||||
|
@ -536,6 +537,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import com.destroystokyo.paper.loottable.LootableInventory; // Paper
|
||||
+
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
-public abstract class TileEntityLootable extends TileEntityContainer implements ILootable {
|
||||
+public abstract class TileEntityLootable extends TileEntityContainer implements ILootable, CraftLootableInventory { // Paper
|
||||
|
@ -546,7 +548,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public TileEntityLootable() {}
|
||||
|
||||
protected boolean c(NBTTagCompound nbttagcompound) {
|
||||
protected boolean d(NBTTagCompound nbttagcompound) {
|
||||
+ lootableData.loadNbt(nbttagcompound); // Paper
|
||||
if (nbttagcompound.hasKeyOfType("LootTable", 8)) {
|
||||
this.m = new MinecraftKey(nbttagcompound.getString("LootTable"));
|
||||
|
@ -554,7 +556,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
|
||||
}
|
||||
|
||||
protected boolean d(NBTTagCompound nbttagcompound) {
|
||||
protected boolean e(NBTTagCompound nbttagcompound) {
|
||||
+ lootableData.saveNbt(nbttagcompound); // Paper
|
||||
if (this.m != null) {
|
||||
nbttagcompound.setString("LootTable", this.m.toString());
|
||||
|
@ -562,7 +564,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
|
||||
}
|
||||
|
||||
protected void d(EntityHuman entityhuman) {
|
||||
protected void d(@Nullable EntityHuman entityhuman) {
|
||||
- if (this.m != null) {
|
||||
+ if (lootableData.shouldReplenish(entityhuman)) { // Paper
|
||||
LootTable loottable = this.world.ak().a(this.m);
|
||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
- public int compareTo(Object object) {
|
||||
+ public int compareTo(BaseBlockPosition object) { // Paper - decompile fix
|
||||
return this.i((BaseBlockPosition) object);
|
||||
return this.l((BaseBlockPosition) object);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
|
||||
|
@ -29,38 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return BiomeBase.REGISTRY_ID.a(biomebase); // Paper - decompile fix
|
||||
}
|
||||
|
||||
public static BiomeBase a(int i) {
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockStateList.java b/src/main/java/net/minecraft/server/BlockStateList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockStateList.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockStateList.java
|
||||
@@ -0,0 +0,0 @@ public class BlockStateList {
|
||||
if (!BlockStateList.a.matcher(s).matches()) {
|
||||
throw new IllegalArgumentException("Block: " + block.getClass() + " has invalidly named property: " + s);
|
||||
} else {
|
||||
- Iterator iterator = iblockstate.c().iterator();
|
||||
+ Iterator<T> iterator = iblockstate.c().iterator(); // Paper - decompile fix
|
||||
|
||||
String s1;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BlockStateList {
|
||||
return s;
|
||||
}
|
||||
|
||||
- Comparable comparable = (Comparable) iterator.next();
|
||||
+ T comparable = iterator.next(); // Paper - decompile fix
|
||||
|
||||
s1 = iblockstate.a(comparable);
|
||||
} while (BlockStateList.a.matcher(s1).matches());
|
||||
@@ -0,0 +0,0 @@ public class BlockStateList {
|
||||
if (!this.b.containsKey(iblockstate)) {
|
||||
throw new IllegalArgumentException("Cannot get property " + iblockstate + " as it does not exist in " + this.a.t());
|
||||
} else {
|
||||
- return (Comparable) iblockstate.b().cast(this.b.get(iblockstate));
|
||||
+ return iblockstate.b().cast(this.b.get(iblockstate)); // Paper - decompile fix
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandAbstract.java b/src/main/java/net/minecraft/server/CommandAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandAbstract.java
|
||||
|
|
|
@ -134,7 +134,7 @@ diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/j
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
@@ -0,0 +0,0 @@ import java.util.concurrent.Callable;
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class NBTTagCompound extends NBTBase {
|
||||
|
||||
|
@ -154,9 +154,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
+ public UUID getUUID(String prefix) { return a(prefix); } // Paper // OBFHELPER
|
||||
@Nullable
|
||||
public UUID a(String s) {
|
||||
return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least"));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 18 Mar 2016 19:15:44 -0400
|
||||
Subject: [PATCH] Optimize BlockStateList/BlockData
|
||||
|
||||
Mojang included some sanity checks on arguments passed to the BlockData.
|
||||
This code results in the Hash look up occuring twice per call, one to test if it exists
|
||||
and another to retrieve the result.
|
||||
|
||||
This code should ideally never be hit, unless mojang released a bad build. We can discover bugs with this as furthur code that never expects a null
|
||||
would then NPE, so it would not result in hidden issues.
|
||||
|
||||
This is super hot code, so removing those checks should give decent gains.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockStateList.java b/src/main/java/net/minecraft/server/BlockStateList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockStateList.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockStateList.java
|
||||
@@ -0,0 +0,0 @@ public class BlockStateList {
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> T get(IBlockState<T> iblockstate) {
|
||||
- if (!this.b.containsKey(iblockstate)) {
|
||||
- throw new IllegalArgumentException("Cannot get property " + iblockstate + " as it does not exist in " + this.a.t());
|
||||
- } else {
|
||||
- return iblockstate.b().cast(this.b.get(iblockstate)); // Paper - decompile fix
|
||||
- }
|
||||
+ return iblockstate.b().cast(this.b.get(iblockstate)); // Paper
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>, V extends T> IBlockData set(IBlockState<T> iblockstate, V v0) {
|
||||
- if (!this.b.containsKey(iblockstate)) {
|
||||
- throw new IllegalArgumentException("Cannot set property " + iblockstate + " as it does not exist in " + this.a.t());
|
||||
- } else if (!iblockstate.c().contains(v0)) {
|
||||
- throw new IllegalArgumentException("Cannot set property " + iblockstate + " to " + v0 + " on block " + Block.REGISTRY.b(this.a) + ", it is not an allowed value");
|
||||
- } else {
|
||||
- return (IBlockData) (this.b.get(iblockstate) == v0 ? this : (IBlockData) this.c.get(iblockstate, v0));
|
||||
- }
|
||||
+ return this.b.get(iblockstate) == v0 ? this : this.c.get(iblockstate, v0); // Paper
|
||||
}
|
||||
|
||||
public ImmutableMap<IBlockState<?>, Comparable<?>> s() {
|
||||
--
|
|
@ -13,13 +13,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
private boolean i;
|
||||
private boolean j;
|
||||
public final World world;
|
||||
public final int[] heightMap;
|
||||
+ public final long chunkKey; // Paper
|
||||
public final int locX;
|
||||
public final int locZ;
|
||||
private boolean l;
|
||||
private boolean m;
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
this.world = world;
|
||||
this.locX = i;
|
||||
|
@ -33,13 +33,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public final ChunkUnloadQueue unloadQueue = new ChunkUnloadQueue(); // CraftBukkit - LongHashSet // Paper -> ChunkUnloadQueue
|
||||
public final ChunkGenerator chunkGenerator; // CraftBukkit - public
|
||||
public final Set<Long> unloadQueue = Sets.newHashSet(); // PAIL: private -> public
|
||||
public final ChunkGenerator chunkGenerator;
|
||||
private final IChunkLoader chunkLoader;
|
||||
- public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>(); // CraftBukkit
|
||||
- public final Long2ObjectMap<Chunk> chunks = new Long2ObjectOpenHashMap(8192);
|
||||
+ // Paper start
|
||||
+ protected Chunk lastChunkByPos = null;
|
||||
+ public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>() {
|
||||
+ public Long2ObjectOpenHashMap<Chunk> chunks = new Long2ObjectOpenHashMap<Chunk>(8192) {
|
||||
+
|
||||
+ @Override
|
||||
+ public Chunk get(long key) {
|
||||
+ if (lastChunkByPos != null && key == lastChunkByPos.chunkKey) {
|
||||
|
@ -57,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ }; // CraftBukkit
|
||||
+ // Paper end
|
||||
// private final LongHashMap<Chunk> chunks = new LongHashMap();
|
||||
// private final List<Chunk> chunkList = Lists.newArrayList();
|
||||
public final WorldServer world;
|
||||
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, ChunkGenerator chunkgenerator) {
|
||||
--
|
|
@ -1,362 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 18 Mar 2016 17:57:25 -0400
|
||||
Subject: [PATCH] Optimize Chunk Unload Queue
|
||||
|
||||
Removing chunks from the unload queue when performing chunk lookups is a costly activity.
|
||||
|
||||
It drastically slows down server performance as many methods call getChunkAt, resulting in a bandaid
|
||||
to skip removing chunks from the unload queue.
|
||||
|
||||
This patch optimizes the unload queue to instead use a boolean on the Chunk object itself to mark
|
||||
if the chunk is active, and then insert into a LinkedList queue.
|
||||
|
||||
The benefits here is that all chunk unload queue actions are now O(1) constant time.
|
||||
|
||||
A LinkedList will never need to resize, and can be removed from in constant time when
|
||||
used in a queue like method.
|
||||
|
||||
We mark the chunk as active in many places that notify it is still being used, so that
|
||||
when the chunk unload queue reaches that chunk, and sees the chunk became active again,
|
||||
it will skip it and move to next.
|
||||
|
||||
Also optimize EAR to use these methods.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
// Keep this synced with entitySlices.add() and entitySlices.remove()
|
||||
private final int[] itemCounts = new int[16];
|
||||
private final int[] inventoryEntityCounts = new int[16];
|
||||
+ public boolean isChunkActive = true;
|
||||
+ public boolean isInUnloadQueue = false;
|
||||
// Paper end
|
||||
|
||||
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
- public final LongHashSet unloadQueue = new LongHashSet(); // CraftBukkit - LongHashSet
|
||||
+ public final ChunkUnloadQueue unloadQueue = new ChunkUnloadQueue(); // CraftBukkit - LongHashSet // Paper -> ChunkUnloadQueue
|
||||
public final ChunkGenerator chunkGenerator; // CraftBukkit - public
|
||||
private final IChunkLoader chunkLoader;
|
||||
public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>(); // CraftBukkit
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
return (chunk == null) ? getChunkAt(x, z) : chunk;
|
||||
}
|
||||
|
||||
- public Chunk getChunkIfLoaded(int x, int z) {
|
||||
- return chunks.get(LongHash.toLong(x, z));
|
||||
+ // Paper start
|
||||
+ public Chunk getLoadedChunkAtWithoutMarkingActive(int i, int j) {
|
||||
+ return chunks.get(LongHash.toLong(i, j));
|
||||
}
|
||||
|
||||
+ // getChunkIfLoaded -> getChunkIfActive
|
||||
+ // this is only used by CraftBukkit now, and plugins shouldnt mark things active
|
||||
+ public Chunk getChunkIfActive(int x, int z) {
|
||||
+ Chunk chunk = chunks.get(LongHash.toLong(x, z));
|
||||
+ return (chunk != null && chunk.isChunkActive) ? chunk : null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Chunk getLoadedChunkAt(int i, int j) {
|
||||
Chunk chunk = chunks.get(LongHash.toLong(i, j)); // CraftBukkit
|
||||
|
||||
- this.unloadQueue.remove(i, j); // CraftBukkit
|
||||
+ //this.unloadQueue.remove(i, j); // CraftBukkit // Paper
|
||||
+ markChunkActive(chunk); // Paper
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
+ markChunkActive(chunk); // Paper
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int i, int j, Runnable runnable, boolean generate) {
|
||||
- unloadQueue.remove(i, j);
|
||||
+ //unloadQueue.remove(i, j); // Paper
|
||||
+
|
||||
Chunk chunk = chunks.get(LongHash.toLong(i, j));
|
||||
ChunkRegionLoader loader = null;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
if (runnable != null) {
|
||||
runnable.run();
|
||||
}
|
||||
+ markChunkActive(chunk); // Paper
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public Chunk originalGetChunkAt(int i, int j) {
|
||||
- this.unloadQueue.remove(i, j);
|
||||
+ //this.unloadQueue.remove(i, j); // Paper
|
||||
Chunk chunk = this.chunks.get(LongHash.toLong(i, j));
|
||||
boolean newChunk = false;
|
||||
// CraftBukkit end
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
chunk.loadNearby(this, this.chunkGenerator);
|
||||
world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
}
|
||||
+ markChunkActive(chunk); // Paper
|
||||
|
||||
return chunk;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
if (!this.world.savingDisabled) {
|
||||
// CraftBukkit start
|
||||
Server server = this.world.getServer();
|
||||
- for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); ++i) {
|
||||
- long chunkcoordinates = this.unloadQueue.popFirst();
|
||||
- Chunk chunk = this.chunks.get(chunkcoordinates);
|
||||
- if (chunk == null) continue;
|
||||
+ // Paper start
|
||||
+ final Iterator<Chunk> iterator = this.unloadQueue.iterator();
|
||||
+ for (int i = 0; i < 100 && iterator.hasNext(); ++i) {
|
||||
+ Chunk chunk = iterator.next();
|
||||
+ iterator.remove();
|
||||
+ long chunkcoordinates = LongHash.toLong(chunk.locX, chunk.locZ);
|
||||
+ chunk.isInUnloadQueue = false;
|
||||
+ if (chunk.isChunkActive) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (chunk.hasLightUpdates()) continue; // Paper - Don't unload chunks with pending light updates.
|
||||
|
||||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborUnloaded(-x, -z);
|
||||
chunk.setNeighborUnloaded(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Paper start
|
||||
+ } else {
|
||||
+ // Unload event is cancelled, make sure this chunk is marked active
|
||||
+ markChunkActive(chunk);
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public boolean e(int i, int j) {
|
||||
return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public static void markChunkActive(Chunk chunk) {
|
||||
+ if (chunk != null) {
|
||||
+ chunk.isChunkActive = true;
|
||||
+ }
|
||||
+ }
|
||||
+ public class ChunkUnloadQueue extends LongHashSet { // Provide compat with NMS plugins
|
||||
+ private java.util.LinkedList<Chunk> unloadQueue = new java.util.LinkedList<Chunk>();
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isEmpty() {
|
||||
+ return unloadQueue.isEmpty();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean contains(long value) {
|
||||
+ throw new UnsupportedOperationException("contains on unload queue");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean add(long value) {
|
||||
+ throw new UnsupportedOperationException("add on unload queue");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean remove(long value) {
|
||||
+ throw new UnsupportedOperationException("remove on unload queue");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int size() {
|
||||
+ return unloadQueue.size();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Iterator iterator() {
|
||||
+ return unloadQueue.iterator();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean contains(int x, int z) {
|
||||
+ final Chunk chunk = chunks.get(LongHash.toLong(x, z));
|
||||
+ return (chunk != null && chunk.isInUnloadQueue);
|
||||
+ }
|
||||
+
|
||||
+ public void remove(int x, int z) {
|
||||
+ final Chunk chunk = chunks.get(LongHash.toLong(x, z));
|
||||
+ if (chunk != null) {
|
||||
+ chunk.isChunkActive = true;
|
||||
+ }
|
||||
+ }
|
||||
+ public boolean add(int x, int z) {
|
||||
+ final Chunk chunk = chunks.get(LongHash.toLong(x, z));
|
||||
+ if (chunk != null) {
|
||||
+ chunk.isChunkActive = false;
|
||||
+ if (!chunk.isInUnloadQueue) {
|
||||
+ chunk.isInUnloadQueue = true;
|
||||
+ return unloadQueue.add(chunk);
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
|
||||
Long coord = it.next();
|
||||
int x = LongHash.msw( coord );
|
||||
int z = LongHash.lsw( coord );
|
||||
- if ( !((ChunkProviderServer)server.chunkProvider).unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) )
|
||||
+ if ( server.isChunkLoaded( x, z, true ) ) // Paper
|
||||
{
|
||||
i += server.getChunkAt( x, z ).entityCount.get( oClass );
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
// Paper end
|
||||
|
||||
public Chunk getChunkIfLoaded(int x, int z) {
|
||||
- return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(x, z);
|
||||
+ return ((ChunkProviderServer) this.chunkProvider).getLoadedChunkAtWithoutMarkingActive(x, z); // Paper - This is added by CB, and will not mark as active. Simply an alias
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public Chunk getChunkIfActive(int x, int z) {
|
||||
+ return ((ChunkProviderServer) this.chunkProvider).getChunkIfActive(x, z);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
|
||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
|
||||
private boolean unloadChunk0(int x, int z, boolean save, boolean safe) {
|
||||
// Paper start - Don't create a chunk just to unload it
|
||||
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z);
|
||||
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfActive(x, z); // Paper
|
||||
if (chunk == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
continue;
|
||||
}
|
||||
|
||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborUnloaded(-xx, -zz);
|
||||
chunk.setNeighborUnloaded(xx, zz);
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
// Use the default variant of loadChunk when generate == true.
|
||||
return world.getChunkProviderServer().getChunkAt(x, z) != null;
|
||||
}
|
||||
+ if (true) { return world.getChunkProviderServer().getOrLoadChunkAt(x, z) != null; } // Paper
|
||||
|
||||
world.getChunkProviderServer().unloadQueue.remove(x, z);
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(LongHash.toLong(x, z));
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
continue;
|
||||
}
|
||||
|
||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
// Already unloading?
|
||||
- if (cps.unloadQueue.contains(chunk.locX, chunk.locZ)) {
|
||||
+ if (chunk.isInUnloadQueue) { // Paper
|
||||
continue;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
@@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = queuedChunk.provider.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
{
|
||||
for ( int j1 = k; j1 <= l; ++j1 )
|
||||
{
|
||||
- if ( world.getWorld().isChunkLoaded( i1, j1 ) )
|
||||
- {
|
||||
- activateChunkEntities( world.getChunkAt( i1, j1 ) );
|
||||
+ Chunk chunk = world.getChunkIfActive(i1, j1); // Paper
|
||||
+ if (chunk != null) { // Paper
|
||||
+ activateChunkEntities( chunk ); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
int x = MathHelper.floor( entity.locX );
|
||||
int z = MathHelper.floor( entity.locZ );
|
||||
// Make sure not on edge of unloaded chunk
|
||||
- Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
|
||||
+ Chunk chunk = isActive ? entity.world.getChunkIfActive( x >> 4, z >> 4 ) : null; // Paper
|
||||
if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
|
||||
{
|
||||
isActive = false;
|
||||
--
|
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private int pathfindFailures = 0;
|
||||
+ // Paper end
|
||||
|
||||
public boolean a(PathEntity pathentity, double d0) {
|
||||
public boolean a(@Nullable PathEntity pathentity, double d0) {
|
||||
if (pathentity == null) {
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
||||
|
||||
public void b() {
|
||||
public void d() {
|
||||
++this.g;
|
||||
+
|
||||
+ // Paper start - Move enderchest open sounds out of the tick loop
|
||||
|
@ -169,7 +169,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
|
||||
}
|
||||
|
||||
public void d() {
|
||||
public void e() {
|
||||
--this.g;
|
||||
+
|
||||
+ // Paper start - Move enderchest close sounds out of the tick loop
|
||||
|
|
|
@ -139,7 +139,7 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ import java.util.concurrent.Callable;
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
||||
// CraftBukkit start
|
||||
import com.google.common.collect.Maps;
|
||||
|
|
|
@ -12,15 +12,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
protected int a;
|
||||
protected int c;
|
||||
protected int d;
|
||||
private final int a;
|
||||
private final int b;
|
||||
private final int c;
|
||||
+ // Paper start
|
||||
+ public boolean isValidLocation() {
|
||||
+ return a >= -30000000 && d >= -30000000 && a < 30000000 && d < 30000000 && c >= 0 && c < 256;
|
||||
+ return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
|
||||
+ }
|
||||
// Paper end
|
||||
+ // Paper end
|
||||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
this.a = i;
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
|
@ -30,30 +32,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
- private boolean isValidLocation(BlockPosition blockposition) {
|
||||
- return blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000 && blockposition.getY() >= 0 && blockposition.getY() < 256;
|
||||
- return !this.E(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000;
|
||||
+ private static boolean isValidLocation(BlockPosition blockposition) { // Paper
|
||||
+ return blockposition.isValidLocation(); // Paper
|
||||
}
|
||||
|
||||
public boolean isEmpty(BlockPosition blockposition) {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public boolean a(BlockPosition blockposition, boolean flag) {
|
||||
- return !this.isValidLocation(blockposition) ? false : this.isChunkLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4, flag);
|
||||
+ return !blockposition.isValidLocation() ? false : this.isChunkLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4, flag); // Paper
|
||||
}
|
||||
|
||||
public boolean areChunksLoaded(BlockPosition blockposition, int i) {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- if (!this.isValidLocation(blockposition)) {
|
||||
+ if (!blockposition.isValidLocation()) { // Paper
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
return false;
|
||||
private boolean E(BlockPosition blockposition) {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
// Paper start - test if meets light level, return faster
|
||||
// logic copied from below
|
||||
|
@ -90,31 +74,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
- if (!this.isValidLocation(blockposition)) {
|
||||
+ if (!blockposition.isValidLocation()) { // Paper
|
||||
return Blocks.AIR.getBlockData();
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
|
||||
|
||||
public TileEntity getTileEntity(BlockPosition blockposition) {
|
||||
- if (!this.isValidLocation(blockposition)) {
|
||||
+ if (!blockposition.isValidLocation()) { // Paper
|
||||
return null;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public boolean d(BlockPosition blockposition, boolean flag) {
|
||||
- if (!this.isValidLocation(blockposition)) {
|
||||
+ if (!blockposition.isValidLocation()) { // Paper
|
||||
return flag;
|
||||
} else {
|
||||
Chunk chunk = this.chunkProvider.getLoadedChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
--
|
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ <groupId>com.destroystokyo.paper</groupId>
|
||||
+ <artifactId>paper</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.9.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
- <name>Spigot</name>
|
||||
- <url>http://www.spigotmc.org</url>
|
||||
+ <name>Paper</name>
|
||||
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -0,0 +0,0 @@
|
||||
<minecraft_version>1_9_R1</minecraft_version>
|
||||
<minecraft_version>1_9_R2</minecraft_version>
|
||||
<buildtag.prefix>git-Bukkit-</buildtag.prefix>
|
||||
<buildtag.suffix></buildtag.suffix>
|
||||
- <maven.compiler.source>1.6</maven.compiler.source>
|
||||
|
|
|
@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/server/Block.java
|
||||
@@ -0,0 +0,0 @@ public class Block {
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity, ItemStack itemstack) {
|
||||
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, @Nullable ItemStack itemstack) {
|
||||
entityhuman.b(StatisticList.a(this));
|
||||
- entityhuman.applyExhaustion(0.025F);
|
||||
+ entityhuman.applyExhaustion(world.paperConfig.blockBreakExhaustion); // Paper - Configurable block break exhaustion
|
||||
|
|
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import java.util.Arrays;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
private final ItemCooldown bU = this.l();
|
||||
private final ItemCooldown bV = this.l();
|
||||
public EntityFishingHook hookedFish;
|
||||
|
||||
+ // Paper start - affectsSpawning API
|
||||
|
@ -55,8 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
||||
@@ -0,0 +0,0 @@ public class EntitySilverfish extends EntityMonster {
|
||||
|
||||
public boolean cF() {
|
||||
if (super.cF()) {
|
||||
public boolean cG() {
|
||||
if (super.cG()) {
|
||||
- EntityHuman entityhuman = this.world.b(this, 5.0D);
|
||||
+ EntityHuman entityhuman = this.world.findNearbyPlayerNotInCreativeMode(this, 5.0D, EntityHuman.affectsSpawningFilter()); // Paper - affectsSpawning filter
|
||||
|
||||
|
@ -123,8 +123,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityHuman findNearbyPlayer(Entity entity, double d0) {
|
||||
- return this.a(entity.locX, entity.locY, entity.locZ, d0, false);
|
||||
+ // Paper start - Add filter parameter
|
||||
|
@ -135,6 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.findNearbyPlayer(entity.locX, entity.locY, entity.locZ, d0, false, filter);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityHuman b(Entity entity, double d0) {
|
||||
- return this.a(entity.locX, entity.locY, entity.locZ, d0, true);
|
||||
+ return this.findNearbyPlayerNotInCreativeMode(entity, d0, Predicates.<EntityHuman>alwaysTrue());
|
||||
|
@ -144,6 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.findNearbyPlayer(entity.locX, entity.locY, entity.locZ, d0, true, filter);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityHuman a(double d0, double d1, double d2, double d3, boolean flag) {
|
||||
+ return findNearbyPlayer(d0, d1, d2, d3, flag, Predicates.<EntityHuman>alwaysTrue());
|
||||
+ }
|
||||
|
|
|
@ -84,6 +84,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ // Paper end
|
||||
|
||||
// Paper start - modify base position variables
|
||||
((BaseBlockPosition) this.b).a = i;
|
||||
this.b.b = i;
|
||||
this.b.c = j;
|
||||
--
|
|
@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - Prevent TileEntity and Entity crashes
|
||||
+ Block block = this.getBlock();
|
||||
+ if (block != null) {
|
||||
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock(), this.u());
|
||||
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block, this.u());
|
||||
+ }
|
||||
+ // Paper end
|
||||
crashreportsystemdetails.a("Actual block type", new Callable() {
|
||||
crashreportsystemdetails.a("Actual block type", new CrashReportCallable() {
|
||||
public String a() throws Exception {
|
||||
int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock());
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
|
|
|
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ */
|
||||
+ // Paper end
|
||||
|
||||
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
if (world.isClientSide) {
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockFurnace.java b/src/main/java/net/minecraft/server/BlockFurnace.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -48,6 +48,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ */
|
||||
+ // Paper end
|
||||
|
||||
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
if (world.isClientSide) {
|
||||
--
|
|
@ -1,221 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Mon, 7 Mar 2016 12:51:01 -0700
|
||||
Subject: [PATCH] Speedup BlockPos by fixing inlining
|
||||
|
||||
Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code.
|
||||
If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types.
|
||||
But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains.
|
||||
|
||||
This scenario also occurs with BlockPos and MutableBlockPos.
|
||||
The variables in BlockPos are final, so MutableBlockPos can't modify them.
|
||||
MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them.
|
||||
|
||||
This approach with utility methods that operate on MutableBlockPos and BlockPos.
|
||||
Specific examples are BlockPosition.up(), and World.isValidLocation().
|
||||
It makes these simple methods much slower than they need to be.
|
||||
|
||||
This should result in an across the board speedup in anything that accesses blocks or does logic with positions.
|
||||
|
||||
This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my mircorbenchmarks.
|
||||
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -0,0 +0,0 @@ import com.google.common.base.Objects;
|
||||
public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
|
||||
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
|
||||
- private final int a;
|
||||
- private final int c;
|
||||
- private final int d;
|
||||
+ // Paper start - make mutable and protected for MutableBlockPos and PooledBlockPos
|
||||
+ protected int a;
|
||||
+ protected int c;
|
||||
+ protected int d;
|
||||
+ // Paper end
|
||||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
this.a = i;
|
||||
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||
}
|
||||
|
||||
- public int getX() {
|
||||
+ // Paper start - Only allow one implementation of these methods (make final)
|
||||
+ public final int getX() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
- public int getY() {
|
||||
+ public final int getY() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
- public int getZ() {
|
||||
+ public final int getZ() {
|
||||
return this.d;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
|
||||
return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
++k;
|
||||
}
|
||||
|
||||
- this.b.c = i;
|
||||
- this.b.d = j;
|
||||
- this.b.e = k;
|
||||
+ // Paper start - modify base position variables
|
||||
+ ((BaseBlockPosition) this.b).a = i;
|
||||
+ ((BaseBlockPosition) this.b).c = j;
|
||||
+ ((BaseBlockPosition) this.b).d = k;
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
|
||||
public static final class PooledBlockPosition extends BlockPosition {
|
||||
|
||||
+ // Paper start - remove variables
|
||||
+ /*
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
+ */
|
||||
+ // Paper end
|
||||
private boolean f;
|
||||
private static final List<BlockPosition.PooledBlockPosition> g = Lists.newArrayList();
|
||||
|
||||
private PooledBlockPosition(int i, int j, int k) {
|
||||
super(0, 0, 0);
|
||||
- this.c = i;
|
||||
- this.d = j;
|
||||
- this.e = k;
|
||||
+ // Paper start - modify base position variables
|
||||
+ ((BaseBlockPosition) this).a = i;
|
||||
+ ((BaseBlockPosition) this).c = j;
|
||||
+ ((BaseBlockPosition) this).d = k;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public static BlockPosition.PooledBlockPosition s() {
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - use superclass methods
|
||||
+ /*
|
||||
public int getX() {
|
||||
return this.c;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
public int getZ() {
|
||||
return this.e;
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
|
||||
public BlockPosition.PooledBlockPosition d(int i, int j, int k) {
|
||||
if (this.f) {
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
this.f = false;
|
||||
}
|
||||
|
||||
- this.c = i;
|
||||
- this.d = j;
|
||||
- this.e = k;
|
||||
+ // Paper start - modify base position variables
|
||||
+ ((BaseBlockPosition) this).a = i;
|
||||
+ ((BaseBlockPosition) this).c = j;
|
||||
+ ((BaseBlockPosition) this).d = k;
|
||||
+ // Paper end
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
}
|
||||
|
||||
public BlockPosition.PooledBlockPosition c(EnumDirection enumdirection) {
|
||||
- return this.d(this.c + enumdirection.getAdjacentX(), this.d + enumdirection.getAdjacentY(), this.e + enumdirection.getAdjacentZ());
|
||||
+ return this.d(this.getX() + enumdirection.getAdjacentX(), this.getY() + enumdirection.getAdjacentY(), this.getZ() + enumdirection.getAdjacentZ()); // Paper - use getters
|
||||
}
|
||||
|
||||
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
|
||||
public static final class MutableBlockPosition extends BlockPosition {
|
||||
|
||||
+ // Paper start - remove variables
|
||||
+ /*
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
+ */
|
||||
+ // Paper end
|
||||
|
||||
public MutableBlockPosition() {
|
||||
this(0, 0, 0);
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
|
||||
public MutableBlockPosition(int i, int j, int k) {
|
||||
super(0, 0, 0);
|
||||
- this.c = i;
|
||||
- this.d = j;
|
||||
- this.e = k;
|
||||
+ // Paper start - modify base position variables
|
||||
+ ((BaseBlockPosition) this).a = i;
|
||||
+ ((BaseBlockPosition) this).c = j;
|
||||
+ ((BaseBlockPosition) this).d = k;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
+ // Paper start - use superclass methods
|
||||
+ /*
|
||||
public int getX() {
|
||||
return this.c;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
public int getZ() {
|
||||
return this.e;
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
|
||||
public BlockPosition.MutableBlockPosition c(int i, int j, int k) {
|
||||
- this.c = i;
|
||||
- this.d = j;
|
||||
- this.e = k;
|
||||
+ // Paper start - modify base position variables
|
||||
+ ((BaseBlockPosition) this).a = i;
|
||||
+ ((BaseBlockPosition) this).c = j;
|
||||
+ ((BaseBlockPosition) this).d = k;
|
||||
+ // Paper end
|
||||
return this;
|
||||
}
|
||||
|
||||
public void c(EnumDirection enumdirection) {
|
||||
- this.c += enumdirection.getAdjacentX();
|
||||
- this.d += enumdirection.getAdjacentY();
|
||||
- this.e += enumdirection.getAdjacentZ();
|
||||
+ // Paper start - modify base position variables
|
||||
+ ((BaseBlockPosition) this).a += enumdirection.getAdjacentX();
|
||||
+ ((BaseBlockPosition) this).c += enumdirection.getAdjacentY();
|
||||
+ ((BaseBlockPosition) this).d += enumdirection.getAdjacentZ();
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void p(int i) {
|
||||
- this.d = i;
|
||||
+ ((BaseBlockPosition) this).c = i; // Paper - modify base variable
|
||||
}
|
||||
|
||||
public BlockPosition h() {
|
||||
--
|
|
@ -367,7 +367,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void m() {
|
||||
- SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
|
||||
super.m();
|
||||
this.cu();
|
||||
this.cv();
|
||||
if (!this.world.isClientSide) {
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
float f = (float) (d0 * d0 + d1 * d1);
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
} else {
|
||||
this.bo = 0;
|
||||
this.bp = 0;
|
||||
}
|
||||
-
|
||||
- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
|
||||
|
@ -393,9 +393,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
this.world.methodProfiler.a("ai");
|
||||
- SpigotTimings.timerEntityAI.startTiming(); // Spigot
|
||||
if (this.cf()) {
|
||||
this.bc = false;
|
||||
this.bd = 0.0F;
|
||||
if (this.cg()) {
|
||||
this.bd = false;
|
||||
this.be = 0.0F;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
this.doTick();
|
||||
this.world.methodProfiler.b();
|
||||
|
@ -405,16 +405,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("jump");
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
this.be *= 0.98F;
|
||||
this.bf *= 0.9F;
|
||||
this.bf *= 0.98F;
|
||||
this.bg *= 0.9F;
|
||||
this.r();
|
||||
- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
|
||||
this.g(this.bd, this.be);
|
||||
this.g(this.be, this.bf);
|
||||
- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("push");
|
||||
- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
|
||||
this.cn();
|
||||
this.co();
|
||||
- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
@ -454,9 +454,9 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
// CraftBukkit end
|
||||
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
+import co.aikar.timings.MinecraftTimings; // Paper
|
||||
|
@ -647,7 +647,7 @@ diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ import java.util.concurrent.Callable;
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
|
|
@ -16,31 +16,23 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
import com.destroystokyo.paper.exception.ServerInternalException;
|
||||
+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
- public final Set<Long> unloadQueue = Sets.newHashSet(); // PAIL: private -> public
|
||||
+ public final it.unimi.dsi.fastutil.longs.LongSet unloadQueue = new it.unimi.dsi.fastutil.longs.LongArraySet(); // PAIL: private -> public // Paper
|
||||
public final ChunkGenerator chunkGenerator;
|
||||
private final IChunkLoader chunkLoader;
|
||||
// Paper start
|
||||
protected Chunk lastChunkByPos = null;
|
||||
- public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>() {
|
||||
+ public Long2ObjectOpenHashMap<Chunk> chunks = new Long2ObjectOpenHashMap<Chunk>() {
|
||||
@Override
|
||||
public Chunk get(long key) {
|
||||
if (lastChunkByPos != null && key == lastChunkByPos.chunkKey) {
|
||||
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
@@ -0,0 +0,0 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -0,0 +0,0 @@ import java.util.Map;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import javax.annotation.Nullable;
|
||||
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
this.width = 0.6F;
|
||||
this.length = 1.8F;
|
||||
this.av = 1;
|
||||
this.aw = 1;
|
||||
- this.random = new Random();
|
||||
+ this.random = SHARED_RANDOM; // Paper
|
||||
this.maxFireTicks = 1;
|
||||
|
|
|
@ -12,19 +12,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
public boolean a(Entity entity, boolean flag) {
|
||||
+ return this.a(entity, flag, false); // Paper
|
||||
+ return this.mountEntity(entity, flag, false); // Paper - forward
|
||||
+ }
|
||||
+
|
||||
+ public boolean a(Entity entity, boolean flag, boolean suppressEvents) { // Paper - Add suppress
|
||||
+ public boolean mountEntity(Entity entity, boolean flag, boolean suppressEvents) { // Paper
|
||||
if (!flag && (!this.n(entity) || !entity.q(this))) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
|
||||
this.as = entity;
|
||||
- this.as.o(this);
|
||||
+ this.as.addRider(this, suppressEvents); // Paper
|
||||
this.at = entity;
|
||||
- this.at.o(this);
|
||||
+ this.at.addRider(this, suppressEvents); // Paper
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ private void addRider(Entity entity, boolean suppressEvents) {
|
||||
+ // Paper end
|
||||
if (entity.by() != this) {
|
||||
if (entity.bz() != this) {
|
||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
|
@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Spigot end
|
||||
+ // =============================================================
|
||||
+ } // Paper - end suppressible block
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) {
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bu() instanceof EntityHuman)) {
|
||||
this.passengers.add(0, entity);
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
|
@ -82,11 +82,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ private void cancelDismount(Entity dismounter) {
|
||||
+ this.passengers.remove(dismounter);
|
||||
+ dismounter.a(this, false, true);
|
||||
+ dismounter.mountEntity(this, false, true);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
protected boolean q(Entity entity) {
|
||||
return this.bu().size() < 1;
|
||||
return this.bv().size() < 1;
|
||||
}
|
||||
--
|
|
@ -5,13 +5,13 @@ Subject: [PATCH] Water mobs should only spawn in the water
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityWaterAnimal.java b/src/main/java/net/minecraft/server/EntityWaterAnimal.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
index 0000000000000000000000000000000000000000..00000000000000000000000000000000000000005 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityWaterAnimal.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityWaterAnimal.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityWaterAnimal extends EntityInsentient implements IAni
|
||||
}
|
||||
|
||||
public boolean cF() {
|
||||
public boolean cG() {
|
||||
- return true;
|
||||
+ // Paper start - Don't let water mobs spawn in non-water blocks
|
||||
+ // Based around EntityAnimal's implementation
|
||||
|
|
|
@ -22,6 +22,8 @@ function import {
|
|||
export MODLOG="$MODLOG Imported $file from mc-dev\n";
|
||||
echo "Copying $base to $target"
|
||||
cp "$base" "$target"
|
||||
else
|
||||
echo "UN-NEEDED IMPORT: $file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -42,7 +44,6 @@ import BlockFluids
|
|||
import BlockFurnace
|
||||
import BlockIceFrost
|
||||
import BlockPosition
|
||||
import BlockStateList
|
||||
import ChunkCache
|
||||
import ChunkProviderFlat
|
||||
import ChunkProviderGenerate
|
||||
|
@ -57,6 +58,7 @@ import EntitySquid
|
|||
import EntityWaterAnimal
|
||||
import FileIOThread
|
||||
import ItemBlock
|
||||
import NavigationAbstract
|
||||
import NBTTagCompound
|
||||
import NBTTagList
|
||||
import PersistentScoreboard
|
||||
|
|
|
@ -33,7 +33,20 @@ function savePatches {
|
|||
echo "Formatting patches for $what..."
|
||||
|
||||
cd "$basedir/${what_name}-Patches/"
|
||||
rm -rf *.patch
|
||||
if [ -d "$basedir/$target/.git/rebase-apply" ]; then
|
||||
# in middle of a rebase, be smarter
|
||||
echo "REBASE DETECTED - PARTIAL SAVE"
|
||||
last=$(cat "$basedir/$target/.git/rebase-apply/last")
|
||||
next=$(cat "$basedir/$target/.git/rebase-apply/next")
|
||||
for i in $(seq -w 1 1 $last)
|
||||
do
|
||||
if [ $i -lt $next ]; then
|
||||
rm 0$i-*
|
||||
fi
|
||||
done
|
||||
else
|
||||
rm -rf *.patch
|
||||
fi
|
||||
|
||||
cd "$basedir/$target"
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 46d0be39f2fae4732ebe544dfada3949a18e2092
|
||||
Subproject commit 9b100f8a6f0d86b5fd5f22f65dd6dd9eba6547d3
|
|
@ -1 +1 @@
|
|||
Subproject commit d19bb5b8c5a47a395e11d2456ec86c9ffee88964
|
||||
Subproject commit b7b8f1e11ae7789a465f0e987be24161a1eba7df
|
|
@ -1 +1 @@
|
|||
Subproject commit ed60c01794282696e4cf1ae0d7c51cb49306bd55
|
||||
Subproject commit 23da8b0ab755e242aad3d587ee21dc886f2ac18f
|
|
@ -1 +1 @@
|
|||
Subproject commit e6f93f4eed1696907104cb95c00a6f6c035c82f2
|
||||
Subproject commit 4af49dc0abc0056b1f66f92a2ee107f9f1749a82
|
Loading…
Reference in a new issue