Archiviert
13
0

Update with latest TileEntity optimization changes

Dieser Commit ist enthalten in:
Aikar 2014-08-11 21:43:04 -05:00 committet von Zach Brown
Ursprung 0b8246dbb7
Commit 169c67aaa0
3 geänderte Dateien mit 355 neuen und 182 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From d283bfd7d39924f8d6fcca0678422842f298b7dc Mon Sep 17 00:00:00 2001 From 5fad8a996eeca6952e2db084f9ddb41ae4f65fa9 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com> From: Zach Brown <Zbob750@live.com>
Date: Tue, 22 Jul 2014 21:05:53 -0500 Date: Tue, 22 Jul 2014 21:05:53 -0500
Subject: [PATCH] mc-dev imports Subject: [PATCH] mc-dev imports
@ -174,6 +174,27 @@ index 0000000..b205ab7
+ return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D; + return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
new file mode 100644
index 0000000..143cffb
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
@@ -0,0 +1,15 @@
+package net.minecraft.server;
+
+public class TileEntityLightDetector extends TileEntity {
+
+ public TileEntityLightDetector() {}
+
+ public void h() {
+ if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) {
+ this.h = this.q();
+ if (this.h instanceof BlockDaylightDetector) {
+ ((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z);
+ }
+ }
+ }
+}
-- --
1.9.1 1.9.1

Datei anzeigen

@ -1,6 +1,6 @@
From 8f1adb02e9ea4bafa794110eb9980f168d88239d Mon Sep 17 00:00:00 2001 From fa5a4c6926b45e62616bef1069f593d5b88d2166 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 11 Aug 2014 16:03:05 -0500 Date: Mon, 11 Aug 2014 21:46:33 -0500
Subject: [PATCH] Optimize TileEntity ticking Subject: [PATCH] Optimize TileEntity ticking
Re-organizes the servers TileEntity Tick List to be bucketed by type. Re-organizes the servers TileEntity Tick List to be bucketed by type.
@ -14,21 +14,105 @@ This change also adds control into the interval of every TileEntity, giving
the server owner control on how fast a TileEntity ticks, slowing it down if they must the server owner control on how fast a TileEntity ticks, slowing it down if they must
(Such as chest), to improve performance. (Such as chest), to improve performance.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0423ee9..09aa073 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -28,6 +28,7 @@ public class Chunk {
public final int locX;
public final int locZ;
private boolean w;
+ public org.github.paperspigot.ChunkTileEntityList tileEntityTickList; // PaperSpigot
public Map tileEntities;
public List[] entitySlices;
public boolean done;
@@ -76,6 +77,7 @@ public class Chunk {
this.b = new int[256];
this.c = new boolean[256];
this.tileEntities = new HashMap();
+ tileEntityTickList = new org.github.paperspigot.ChunkTileEntityList(world); // PaperSpigot
this.x = 4096;
this.entitySlices = new List[16];
this.world = world;
@@ -813,7 +815,7 @@ public class Chunk {
}
// Spigot End
- this.world.a(tileentity);
+ // this.world.a(tileentity); // Handled by Improved Tick List (Only loaded chunks iterate)
}
for (int i = 0; i < this.entitySlices.length; ++i) {
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 3c5ec6f..9fda298 100644 index 3c5ec6f..50130ca 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java --- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -16,6 +16,8 @@ public class TileEntity { @@ -14,6 +14,7 @@ public class TileEntity {
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
private static final Logger a = LogManager.getLogger(); private static final Logger a = LogManager.getLogger();
+ public boolean isAdded = false; // PaperSpigot - optimize contains checks
private static Map i = new HashMap(); private static Map i = new HashMap();
private static Map j = new HashMap(); private static Map j = new HashMap();
+ public boolean isAdded = false; // PaperSpigot - optimize contains checks
+ public static Map<String, Class> getTileEntityMap() { return i;} // PaperSpigot - reference <String, Class> TE map
protected World world; protected World world;
public int x; diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
public int y; index 09313ea..86142f9 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -45,10 +45,10 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
public TileEntityBeacon() {}
public void h() {
- if (this.world.getTime() % 80L == 0L) {
+ // if (this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick handling
this.y();
this.x();
- }
+ // } // PaperSpigot
}
private void x() {
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index c900caf..e27716b 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -255,7 +255,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
++this.ticks;
float f;
- if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) {
+ if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling
this.o = 0;
f = 5.0F;
List list = this.world.a(EntityHuman.class, AxisAlignedBB.a((double) ((float) this.x - f), (double) ((float) this.y - f), (double) ((float) this.z - f), (double) ((float) (this.x + 1) + f), (double) ((float) (this.y + 1) + f), (double) ((float) (this.z + 1) + f)));
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
index b205ab7..d76a2b2 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -11,7 +11,7 @@ public class TileEntityEnderChest extends TileEntity {
public void h() {
super.h();
- if (++this.k % 20 * 4 == 0) {
+ if (++this.k % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling
this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
}
diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
index 143cffb..de33df0 100644
--- a/src/main/java/net/minecraft/server/TileEntityLightDetector.java
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
@@ -5,7 +5,7 @@ public class TileEntityLightDetector extends TileEntity {
public TileEntityLightDetector() {}
public void h() {
- 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
this.h = this.q();
if (this.h instanceof BlockDaylightDetector) {
((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 33c228b..393988e 100644 index 33c228b..940e1c8 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -58,7 +58,7 @@ public abstract class World implements IBlockAccess { @@ -58,7 +58,7 @@ public abstract class World implements IBlockAccess {
@ -36,195 +120,264 @@ index 33c228b..393988e 100644
// Spigot end // Spigot end
protected List f = new ArrayList(); protected List f = new ArrayList();
- public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet - public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet
+ public Set tileEntityList = new org.github.paperspigot.WorldTileEntityList(this); // PaperSpigot // CraftBukkit - ArrayList -> HashSet + public Set tileEntityList = new org.github.paperspigot.WorldTileEntityList(this); // CraftBukkit - ArrayList -> HashSet // PaperSpigot
private List a = new ArrayList(); private List a = new ArrayList();
private List b = new ArrayList(); private List b = new ArrayList();
public List players = new ArrayList(); public List players = new ArrayList();
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java @@ -1529,13 +1529,13 @@ public abstract class World implements IBlockAccess {
index 16eb1ca..4eeb865 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -1,6 +1,11 @@
package org.github.paperspigot;
+import java.util.HashMap; if (tileentity.r()) {
import java.util.List; iterator.remove();
- if (this.isChunkLoaded(tileentity.x >> 4, tileentity.z >> 4)) {
+ // if (this.isChunkLoaded(tileentity.x >> 4, tileentity.z >> 4)) { // PaperSpigot - will always be loaded
Chunk chunk = this.getChunkAt(tileentity.x >> 4, tileentity.z >> 4);
if (chunk != null) {
chunk.f(tileentity.x & 15, tileentity.y, tileentity.z & 15);
}
- }
+ // } // PaperSpigot
}
}
diff --git a/src/main/java/org/github/paperspigot/ChunkTileEntityList.java b/src/main/java/org/github/paperspigot/ChunkTileEntityList.java
new file mode 100644
index 0000000..e673ba9
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/ChunkTileEntityList.java
@@ -0,0 +1,121 @@
+package org.github.paperspigot;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ListMultimap;
+import net.minecraft.server.*;
+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map; +import java.util.Map;
+ +
+import com.google.common.collect.Maps; +public class ChunkTileEntityList {
+import net.minecraft.server.TileEntity; + final ListMultimap<Class, TileEntity> tickList = ArrayListMultimap.create();
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -170,4 +175,51 @@ public class PaperSpigotWorldConfig
hangingTickFrequency = getInt( "hanging-tick-frequency", 100);
log( "Hanging entities tick frequency: " + hangingTickFrequency);
}
+ +
+ public final Map<Class,Integer> tileEntityTickIntervals = Maps.newHashMap(); + private static final TObjectIntHashMap<Class> tileEntityTickIntervals = new TObjectIntHashMap<Class>() {{
+ private static final Map<String,Integer> defaultTileEntityTickIntervals = new HashMap<String, Integer>() {{
+ // Use 0 for no ticking + // Use 0 for no ticking
+ // does findPlayer lookup, so this helps performance to slow down
+ put("chest", 10);
+ put("enderchest", 10);
+ put("enchanttable", 10);
+
+ // These TE's have empty tick methods, doing nothing. Never bother ticking them. + // These TE's have empty tick methods, doing nothing. Never bother ticking them.
+ put("recordplayer", 0); + for (Class<? extends TileEntity> ignored : new Class[]{
+ put("trap", 0); // Dispenser + TileEntityRecordPlayer.class,
+ put("dropper", 0); + TileEntityDispenser.class,
+ put("sign", 0); + TileEntityDropper.class,
+ put("music", 0); + TileEntitySign.class,
+ put("airportal", 0); // Ender Portal + TileEntityNote.class,
+ put("control", 0); // Command Block + TileEntityEnderPortal.class,
+ put("skull", 0); + TileEntityCommand.class,
+ put("comparator", 0); + TileEntitySkull.class,
+ put("flowerpot", 0); + TileEntityComparator.class,
+ TileEntityFlowerPot.class
+ }) {
+ put(ignored, 0);
+ }
+
+ // does findPlayer lookup, so this helps performance to slow down
+ put(TileEntityChest.class, 20);
+ put(TileEntityEnderChest.class, 20);
+ put(TileEntityEnchantTable.class, 20);
+ +
+ // Slow things down that players won't notice due to craftbukkit "wall time" patches. + // Slow things down that players won't notice due to craftbukkit "wall time" patches.
+ put("furnace", 4); + put(TileEntityFurnace.class, 10);
+ put("cauldron", 4); + put(TileEntityBrewingStand.class, 10);
+ +
+ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know + // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know
+ // won't do anything anyways + // won't do anything anyways
+ put("beacon", 80); + put(TileEntityBeacon.class, 80);
+ put("dldetector", 20); + put(TileEntityLightDetector.class, 20);
+ }}; + }};
+ private void tileEntityTickIntervals() { +
+ final Map<String, Class> tileEntityMap = TileEntity.getTileEntityMap(); + public static Integer getInterval(Class cls) {
+ for (Map.Entry<String, Class> entry : tileEntityMap.entrySet()) { + Integer tickInterval = tileEntityTickIntervals.get(cls);
+ String key = entry.getKey().toLowerCase(); + return tickInterval != null ? tickInterval : 1;
+ Class cls = entry.getValue();
+ Integer def = defaultTileEntityTickIntervals.get(key);
+ if (def == null) {
+ def = 1;
+ }
+ Integer tickInterval = getInt("tile-entity-tick-intervals." + key, def);
+ if (!tickInterval.equals(def)) {
+ log("TileEntity - " + entry.getKey() +" - Tick Interval: " + tickInterval);
+ }
+ tileEntityTickIntervals.put(cls, tickInterval);
+ }
+ } + }
+
}
diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java
new file mode 100644
index 0000000..de78287
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/WorldTileEntityList.java
@@ -0,0 +1,113 @@
+package org.github.paperspigot;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import net.minecraft.server.TileEntity;
+import net.minecraft.server.World;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class WorldTileEntityList extends HashSet {
+ final Map<Class, List<TileEntity>> tickList = Maps.newHashMap();
+ +
+ private final World world; + private final World world;
+ +
+ public WorldTileEntityList(World world) { + public ChunkTileEntityList(World world) {
+ this.world = world; + this.world = world;
+ } + }
+ +
+ @Override + public Iterator iterator() {
+ public boolean add(Object o) { + return new ChunkTileEntityIterator();
+ if (getInterval(o.getClass()) != 0) {
+ add((TileEntity) o);
+ }
+ return true;
+ } + }
+ +
+ public void add(TileEntity entity) { +
+ if (entity.isAdded) { + public boolean add(TileEntity entity) {
+ return;
+ }
+ Class cls = entity.getClass();
+ List<TileEntity> list = tickList.get(cls);
+ if (list == null) {
+ list = Lists.newArrayList();
+ tickList.put(cls, list);
+ }
+ list.add(entity);
+ entity.isAdded = true; + entity.isAdded = true;
+ return tickList.put(entity.getClass(), entity);
+ }
+
+ public boolean remove(TileEntity entity) {
+ entity.isAdded = false;
+ return tickList.remove(entity.getClass(), entity);
+ }
+
+ private class ChunkTileEntityIterator implements Iterator {
+ Iterator<Map.Entry<Class, Collection<TileEntity>>> typeIterator;
+ Map.Entry<Class, Collection<TileEntity>> curType = null;
+ Iterator<TileEntity> listIterator = null;
+
+ {
+ typeIterator = tickList.asMap().entrySet().iterator();
+ nextType();
+ }
+
+ private boolean nextType() {
+ if (typeIterator.hasNext()) {
+ curType = typeIterator.next();
+ final Integer interval = ChunkTileEntityList.getInterval(curType.getKey());
+ if (world.getTime() % interval != 0) {
+ listIterator = curType.getValue().iterator();
+ } else {
+ listIterator = null;
+ }
+ return true;
+ } else {
+ curType = null;
+ listIterator = null;
+ return false;
+ }
+ }
+
+ @Override
+ public boolean hasNext() {
+ do {
+ if (listIterator != null && listIterator.hasNext()) {
+ return true;
+ }
+ } while (nextType());
+ return false;
+ }
+
+ @Override
+ public Object next() {
+ return listIterator.next();
+ }
+
+ @Override
+ public void remove() {
+ listIterator.remove();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java
new file mode 100644
index 0000000..d783741
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/WorldTileEntityList.java
@@ -0,0 +1,106 @@
+package org.github.paperspigot;
+
+import com.google.common.collect.Sets;
+import net.minecraft.server.Chunk;
+import net.minecraft.server.TileEntity;
+import net.minecraft.server.World;
+import net.minecraft.server.WorldServer;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class WorldTileEntityList extends HashSet {
+ final Set<ChunkTileEntityList> tickList = Sets.newHashSet();
+ private final WorldServer world;
+
+ public WorldTileEntityList(World world) {
+ this.world = (WorldServer) world;
+ }
+
+ /**
+ * Adds the TileEntity to the tick list only if it is expected to tick
+ */
+ @Override
+ public boolean add(Object o) {
+ return o instanceof TileEntity && ChunkTileEntityList.getInterval(o.getClass()) > 0 && add((TileEntity) o);
+ }
+
+ private boolean add(TileEntity entity) {
+ if (entity.isAdded) {
+ return false;
+ }
+
+ Chunk chunk = world.getChunkIfLoaded(entity.x >> 4, entity.z >> 4);
+ return chunk != null && chunk.tileEntityTickList.add(entity);
+ } + }
+ +
+ @Override + @Override
+ public boolean remove(Object o) { + public boolean remove(Object o) {
+ final Class cls = o.getClass(); + if (!(o instanceof TileEntity)) {
+ final List<TileEntity> list = tickList.get(cls); + return false;
+ if (list != null) { + }
+ list.remove(o); + TileEntity entity = (TileEntity) o;
+ ((TileEntity) o).isAdded = false; + Chunk chunk = world.getChunkIfLoaded(entity.x >> 4, entity.z >> 4);
+ if (chunk != null) {
+ return chunk.tileEntityTickList.remove(entity);
+ } + }
+ return true; + return true;
+ } + }
+ +
+ @Override + @Override
+ public Iterator iterator() { + public Iterator iterator() {
+ return new Iterator() { + return new WorldTileEntityIterator();
+ Iterator<Map.Entry<Class, List<TileEntity>>> typeIterator;
+ Map.Entry<Class, List<TileEntity>> curType = null;
+ Iterator<TileEntity> listIterator = null;
+ {
+ typeIterator = tickList.entrySet().iterator();
+ nextType();
+ }
+
+ private boolean nextType() {
+ if (typeIterator.hasNext()) {
+ curType = typeIterator.next();
+ final Integer interval = getInterval(curType.getKey());
+ if (world.getTime() % interval != 0) {
+ listIterator = curType.getValue().iterator();
+ } else {
+ listIterator = null;
+ }
+ return true;
+ } else {
+ curType = null;
+ listIterator = null;
+ return false;
+ }
+ }
+
+ @Override
+ public boolean hasNext() {
+ do {
+ if (listIterator != null && listIterator.hasNext()) {
+ return true;
+ }
+ } while (nextType());
+ return false;
+ }
+
+ @Override
+ public Object next() {
+ return listIterator.next();
+ }
+
+ @Override
+ public void remove() {
+ listIterator.remove();
+ }
+ };
+ } + }
+ +
+ @Override + @Override
+ public boolean contains(Object o) { + public boolean contains(Object o) {
+ return ((TileEntity) o).isAdded; + return o instanceof TileEntity && ((TileEntity) o).isAdded;
+ } + }
+ public Integer getInterval(Class cls) { +
+ Integer tickInterval = world.paperSpigotConfig.tileEntityTickIntervals.get(cls); + private class WorldTileEntityIterator implements Iterator {
+ return tickInterval != null ? tickInterval : 1; + Iterator<Chunk> chunkIterator;
+ Iterator<ChunkTileEntityList> chunkTileEntityListIterator;
+
+ {
+ chunkIterator = world.chunkProviderServer.chunks.values().iterator();
+ nextChunk();
+ }
+
+ private boolean nextChunk() {
+ if (chunkIterator.hasNext()) {
+ final Chunk chunk = chunkIterator.next();
+ // Skip chunks queued for unload, and save isLoaded checks
+ if (!world.chunkProviderServer.unloadQueue.contains(chunk.locX, chunk.locZ)) {
+ chunkTileEntityListIterator = chunk.tileEntityTickList.iterator();
+ } else {
+ chunkTileEntityListIterator = null;
+ }
+ return true;
+ } else {
+ chunkTileEntityListIterator = null;
+ return false;
+ }
+ }
+
+ @Override
+ public boolean hasNext() {
+ do {
+ if (chunkTileEntityListIterator != null && chunkTileEntityListIterator.hasNext()) {
+ return true;
+ }
+ } while (nextChunk());
+ return false;
+ }
+
+ @Override
+ public Object next() {
+ return chunkTileEntityListIterator.next();
+ }
+
+ @Override
+ public void remove() {
+ chunkTileEntityListIterator.remove();
+ }
+ } + }
+} +}
\ No newline at end of file \ No newline at end of file

Datei anzeigen

@ -1,4 +1,4 @@
From 60ae5659d6d9a7a11949a3dbe2ec9ea0f8fa05a1 Mon Sep 17 00:00:00 2001 From 280e4f94a1b0fc4a599baaeaa854ee2321990e9f Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com> From: Zach Brown <Zbob750@live.com>
Date: Mon, 11 Aug 2014 19:30:19 -0500 Date: Mon, 11 Aug 2014 19:30:19 -0500
Subject: [PATCH] Move sound handling out of the chest tick loop Subject: [PATCH] Move sound handling out of the chest tick loop
@ -7,7 +7,7 @@ This allows us to disable ticking chests and enderchests without any
noticeable difference to players noticeable difference to players
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index c900caf..d2dfa8a 100644 index e27716b..69ffd30 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java --- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -275,6 +275,9 @@ public class TileEntityChest extends TileEntity implements IInventory { @@ -275,6 +275,9 @@ public class TileEntityChest extends TileEntity implements IInventory {
@ -84,7 +84,7 @@ index c900caf..d2dfa8a 100644
if (this.q() == Blocks.TRAPPED_CHEST) { if (this.q() == Blocks.TRAPPED_CHEST) {
int newPower = Math.max(0, Math.min(15, this.o)); int newPower = Math.max(0, Math.min(15, this.o));
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
index b205ab7..a4df9cb 100644 index d76a2b2..339e133 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -16,6 +16,9 @@ public class TileEntityEnderChest extends TileEntity { @@ -16,6 +16,9 @@ public class TileEntityEnderChest extends TileEntity {
@ -146,29 +146,28 @@ index b205ab7..a4df9cb 100644
} }
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/src/main/java/org/github/paperspigot/ChunkTileEntityList.java b/src/main/java/org/github/paperspigot/ChunkTileEntityList.java
index 4eeb865..d02ce68 100644 index e673ba9..dac6463 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java --- a/src/main/java/org/github/paperspigot/ChunkTileEntityList.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/ChunkTileEntityList.java
@@ -180,8 +180,6 @@ public class PaperSpigotWorldConfig @@ -25,14 +25,14 @@ public class ChunkTileEntityList {
private static final Map<String,Integer> defaultTileEntityTickIntervals = new HashMap<String, Integer>() {{ TileEntityCommand.class,
// Use 0 for no ticking TileEntitySkull.class,
// does findPlayer lookup, so this helps performance to slow down TileEntityComparator.class,
- put("chest", 10); - TileEntityFlowerPot.class
- put("enderchest", 10); + TileEntityFlowerPot.class,
put("enchanttable", 10); + TileEntityChest.class,
+ TileEntityEnderChest.class
}) {
put(ignored, 0);
}
// These TE's have empty tick methods, doing nothing. Never bother ticking them. // does findPlayer lookup, so this helps performance to slow down
@@ -195,6 +193,9 @@ public class PaperSpigotWorldConfig - put(TileEntityChest.class, 20);
put("skull", 0); - put(TileEntityEnderChest.class, 20);
put("comparator", 0); put(TileEntityEnchantTable.class, 20);
put("flowerpot", 0);
+ // PaperSpigot - We moved the chest sound handling out of the tick loop, so it's safe to not tick them
+ put("chest", 0);
+ put("enderchest", 0);
// Slow things down that players won't notice due to craftbukkit "wall time" patches. // Slow things down that players won't notice due to craftbukkit "wall time" patches.
put("furnace", 4);
-- --
1.9.1 1.9.1