diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-04-11 18:11:10 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-04-13 00:30:43 -0500 |
commit | a2d9f33ca38660bb6bd698f598e8a6cfddc4e702 (patch) | |
tree | b4a01d520b89a472663eeb0d260b69d0eb9364d6 /src/main/java/net/minecraft/server/EntitySquid.java | |
parent | 159d614a3a7a56818b561f79ec2c0b1eb00440a0 (diff) | |
download | craftbukkit-a2d9f33ca38660bb6bd698f598e8a6cfddc4e702.tar craftbukkit-a2d9f33ca38660bb6bd698f598e8a6cfddc4e702.tar.gz craftbukkit-a2d9f33ca38660bb6bd698f598e8a6cfddc4e702.tar.lz craftbukkit-a2d9f33ca38660bb6bd698f598e8a6cfddc4e702.tar.xz craftbukkit-a2d9f33ca38660bb6bd698f598e8a6cfddc4e702.zip |
Various minor performance improvements
Add a check to avoid doing movement work if an entity doesn't move. This
usually will not ever happen in the current server but is useful when it
does and will be more useful in the future.
Only process mob on mob (non-player) collisions every other tick. Players
tend to pack a lot of mobs into a small space (sheep farm, mob grinder, etc)
so they do a lot of work processing collisions. To help alleviate some of
this we only run these calculations every other tick. This has no visible
effect on the client but can be a huge win on the server depending on
circumstances.
Use generic entity inWater checking for squids. Squids have their own logic
currently for determining if they are in water. This check is almost
identical to the generic entity checking which is run anyway. To avoid
doing duplicate work we just remove the squid version. This does not
have any noticeable effect on gameplay since the checks are so similar.
Use HashSet for tile entities instead of ArrayList. Using an ArrayList for
storing tile entities in a world means we have very expensive inserts and
removes that aren't at the end of the array due to the array copy this
causes. This is most noticeable during chunk unload when a large number of
tile entities are removed from the world at once. Using a HashSet here uses
a little more memory but is O(1) for all operations so removes this
bottleneck.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntitySquid.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntitySquid.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java index be8a5ed7..c6e8f786 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -63,9 +63,11 @@ public class EntitySquid extends EntityWaterAnimal { // CraftBukkit end } + /* CraftBukkit start - Delegate to Entity to use existing inWater value public boolean G() { return this.world.a(this.boundingBox.grow(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, (Entity) this); } + // CraftBukkit end */ public void c() { super.c(); |