Update PaperSpigot to Minecraft 1.8.3

This commit is contained in:
Zach Brown
2015-03-07 19:16:09 -06:00
parent 64cd5dcd0c
commit 6538ccd924
44 changed files with 813 additions and 726 deletions

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Nov 2014 04:14:14 -0600
Date: Sun, 8 Mar 2015 01:56:22 -0600
Subject: [PATCH] Optimize TileEntity Ticking
@@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -0,0 +0,0 @@ public abstract class TileEntity {
}
// Spigot end
private int h;
protected Block e;
+ // PaperSpigot start - Optimized TileEntity Tick changes
+ // PaperSpigot start - Optimized TileEntity tick changes
+ private static int tileEntityCounter = 0;
+ public boolean isAdded = false;
+ public int tileId = tileEntityCounter++;
@@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void c() {
- if (this.world.getTime() % 80L == 0L) {
+ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick Handling
+ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - Controlled by improved tick handling
this.m();
}
@@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
++this.n;
float f;
- if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 200 == 0) {
+ if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling
- if (!this.world.isClientSide && this.l != 0 && (this.n + i + j + k) % 200 == 0) {
+ if (!this.world.isClientSide && this.l != 0 && (this.n + i + j + k) % 10 == 0) { // PaperSpigot - Reduced 200 -> 10 due to reduced interval from improved tick handling
this.l = 0;
f = 5.0F;
List list = this.world.a(EntityHuman.class, new AxisAlignedBB((double) ((float) i - f), (double) ((float) j - f), (double) ((float) k - f), (double) ((float) (i + 1) + f), (double) ((float) (j + 1) + f), (double) ((float) (k + 1) + f)));
@@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void c() {
- if (++this.h % 20 * 4 == 0) {
+ if (++this.h % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling
+ if (++this.h % 4 == 0) { // PaperSpigot - Reduced (20 * 4) -> 4 interval due to reduced tick rate from improved tick handling
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
@@ -68,53 +68,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public TileEntityLightDetector() {}
public void c() {
- if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) {
+ if (this.world != null && !this.world.isStatic /*&& this.world.getTime() % 20L == 0L*/) { // PaperSpigot - interval controlled by Improved Tick Handling
- if (this.world != null && !this.world.isClientSide && this.world.getTime() % 20L == 0L) {
+ if (this.world != null && !this.world.isClientSide /*&& this.world.getTime() % 20L == 0L*/) { // PaperSpigot - interval controlled by improved tick handling
this.e = this.w();
if (this.e instanceof BlockDaylightDetector) {
((BlockDaylightDetector) this.e).d(this.world, this.position);
((BlockDaylightDetector) this.e).f(this.world, this.position);
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 @@ package net.minecraft.server;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
+import java.util.*;
import java.util.concurrent.Callable;
// CraftBukkit start
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
// Spigot end
protected final List g = Lists.newArrayList();
public final List h = Lists.newArrayList();
- public final List tileEntityList = Lists.newArrayList();
+ public final Set tileEntityList = new org.github.paperspigot.WorldTileEntityList(this); // PaperSpigot
private final List a = Lists.newArrayList();
private final List b = Lists.newArrayList();
public final List players = Lists.newArrayList();
protected final List<Entity> g = Lists.newArrayList();
public final List<TileEntity> h = Lists.newArrayList();
- public final List<TileEntity> tileEntityList = Lists.newArrayList();
+ public final Set<TileEntity> tileEntityList = new org.github.paperspigot.WorldTileEntityList(this); // PaperSpigot
private final List<TileEntity> b = Lists.newArrayList();
private final List<TileEntity> c = Lists.newArrayList();
public final List<EntityHuman> players = Lists.newArrayList();
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public static boolean haveWeSilencedAPhysicsCrash;
public static String blockLocation;
public List<TileEntity> triggerHoppersList = new ArrayList<TileEntity>(); // Spigot, When altHopperTicking, tile entities being added go through here.
private org.spigotmc.TickLimiter entityLimiter;
- private org.spigotmc.TickLimiter tileLimiter;
- private int tileTickPosition;
+ //private org.spigotmc.TickLimiter tileLimiter; // PaperSpigot - Disable Spigot's TE handling in favor of our own
+ //private int tileTickPosition; // PaperSpigot - Disable Spigot's TE handling in favor of our own
+ // PaperSpigot start - Disable Spigot's TE handling in favor of our own
+ //private org.spigotmc.TickLimiter tileLimiter;
+ //private int tileTickPosition;
+ // PaperSpigot end
public static long chunkToKey(int x, int z)
{
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.getServer().addWorld(this.world); // CraftBukkit
timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
this.keepSpawnInMemory = this.paperSpigotConfig.keepSpawnInMemory; // PaperSpigot
timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
- this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
+ //this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); // PaperSpigot - Disable Spigot's TE handling in favor of our own
@@ -122,12 +109,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public World b() {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
// CraftBukkit end
this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently.
+ // PaperSpigot Start - Return to previous behavior, theoretically tile entity ticks should no longer be long enough for this to be an issue
+ // PaperSpigot start - Return to previous behavior, theoretically tile entity ticks should no longer be long enough for this to be an issue
+ Iterator iterator = this.tileEntityList.iterator();
+
+ while (iterator.hasNext()) {
+ TileEntity tileentity = (TileEntity) iterator.next();
+ /*
@@ -182,9 +169,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Use -1 for no ticking
+ // These TE's have empty tick methods, doing nothing. Never bother ticking them.
+ for (Class<? extends TileEntity> ignored : new Class[]{
+ TileEntityChest.class, // PaperSpigot - Don't tick chests either
+ TileEntityEnderChest.class, // PaperSpigot - Don't tick chests either
+ TileEntityRecordPlayer.class,
+ BlockJukeBox.TileEntityRecordPlayer.class,
+ TileEntityDispenser.class,
+ TileEntityDropper.class,
+ TileEntitySign.class,
@@ -201,11 +186,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // does findPlayer lookup, so this helps performance to slow down
+ put(TileEntityEnchantTable.class, 20);
+
+ // Slow things down that players won't notice due to craftbukkit "wall time" patches.
+ // These need to be investigated further before they can be safely used here
+ //put(TileEntityFurnace.class, 20);
+ //put(TileEntityBrewingStand.class, 10);
+
+ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know
+ // won't do anything anyways
+ put(TileEntityBeacon.class, 80);
@@ -339,6 +319,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+}
\ No newline at end of file
--
1.9.5.msysgit.0
--