Commit Graph
83 Commits
Author SHA1 Message Date
Aikar 5dc69ba6e1 ensure upstream is set correctly on apply patches 2016-03-25 00:11:38 -04:00
Aikar 92f8da4b50 Abort properly on error for build script 2016-03-24 20:39:20 -04:00
Aikar 6f4bf57aa0 remove blockstate cache patch 2016-03-23 21:19:45 -04:00
Aikar 7ab893447a Optimize isValidLocation for inlining - Resolves #123 2016-03-22 23:44:46 -04:00
Aikar 97e083b9b0 Setting the cache is important to access a cache 2016-03-22 23:44:35 -04:00
Aikar 95b9e1e6f2 Optimize Chunk Access
getting a loaded chunk is one of the most hottest pieces of code in the game.
Often, getChunkAt is called for the same chunk multiple times in a row, often
from getType();

Optimize this look up by using a Last Access cache.
2016-03-22 01:46:32 -04:00
Aikar 87ebc85c3c Don't teleport dead entities
Had some issue with this in past, and this is the vanilla logic.
Potentially an old CB change that's no longer needed.
2016-03-22 00:56:09 -04:00
Aikar bd75ff8b5b Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
2016-03-22 00:36:20 -04:00
Aikar d24502015a Make Chunk IO Thread Base count configurable 2016-03-21 23:51:58 -04:00
Aikar 37afe5e662 Fix skull cache case bug
missing cache hits on players with uppercase letters in name
2016-03-21 23:38:24 -04:00
Aikar 8abad348b6 Cache BlockState for Blocks
Improve performance for many plugins that call .getState() multiple
times for things like signs that have to "build" sign data.
2016-03-21 23:38:19 -04:00
Aikar ae95189944 Another attempt at unload queue, including EAR improvements.
should be fully working now as I pretty much fell back to existing
methods so anything touching the unloadQueue set should behave correctly.

And maintained NMS Reflection safe change too
2016-03-21 22:51:14 -04:00
Aikar 4646f9b68f Allow command line arg to allow normal reload 2016-03-21 21:56:52 -04:00
Aikar a3cc380333 Make /reload require typing confirm to actually reload 2016-03-21 21:40:29 -04:00
Aikar 812a2ea08d Fix rebuild patches for real this time. 2016-03-21 21:40:18 -04:00
Daniel Ennis 0e2350efd1 Merge pull request #122 from willies952002/master
Add Bukkit#reloadPermissions()
2016-03-21 21:32:06 -04:00
Aikar 9300f163fd fix rebuild patches and rebuild current patches 2016-03-21 20:46:54 -04:00
Daniel Ennis 4916cd2551 Merge pull request #91 from willies952002/feature/permReload
Allow Reloading of Custom Permissions - resolves #49
2016-03-21 20:24:27 -04:00
Aikar 6acff7d61d Disable Chunk Unload Queue Patch for now 2016-03-20 00:53:34 -04:00
Aikar 0b26bbd451 handle NaN health/absorb values and repair bad data
Undoes damage from Damage API bugs
2016-03-20 00:35:02 -04:00
Aikar db0f31134f Improve chunk unload queue to maintain some previous expectations
While the previous logic was logically correct, some CB API's before
would request a chunk without removing it from the unload queue.

While this is logically wrong, some plugins seem to be causing unload issues.

This change will make anything using that one API that use to not remove from
queue, no longer remove from queue.

Hopefully other activities on the server will touch the chunk if it REALLY is in use.
2016-03-20 00:13:20 -04:00
Aikar 1c20143e3c Optimize Navigation Listener
Replace WeakHashMap with an ArrayList and manually manage object
lifecycle. Gives superior iteration performance at a slight cost
to removal performance and also ensures entities are removed immediately
upon losing their validity within the world.

Additionally, change listener registration to be done upon world add
instead of immediate up creation. This provides benefit of only
registering and ticking real Navigation objects, and not invalid
entities (cancelled entity spawns for example).
2016-03-19 00:32:08 -04:00
Aikar d1c4507c9c Fixes #95 - Vanilla bug with Villages 2016-03-19 15:21:39 -04:00
Aikar 7efe31a331 Fix chunk unload issues - Resolves #97 2016-03-19 11:29:46 -04:00
Aikar bb82a8a401 forgot to rebuild after last light change, another fix 2016-03-19 10:57:22 -04:00
Aikar e59f9ab2e6 fix light level check on monsters 2016-03-19 10:45:28 -04:00
Aikar 16a89b43d7 always clean patches 2016-03-19 00:11:14 -04:00
Aikar d72abafa8f Optimized Light Level Comparisons
Use an optimized method to test if a block position meets a desired light level.

This method benefits from returning as soon as the desired light level matches.

Also Optimize Grass more
2016-03-18 23:55:31 -04:00
Aikar 80dcb6c4a3 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.
2016-03-18 19:25:43 -04:00
Aikar 11a3044c3c 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.
2016-03-18 18:03:44 -04:00
Aikar 57be47c2d1 Add comment to Navigation patch on why its done that way
to avoid accidently changing it in future and breaking things
2016-03-18 17:12:30 -04:00
Aikar af73f87c66 Remove checkIfActive timings
Unneeded and adds extra timings cost to every entity tick
2016-03-18 17:11:53 -04:00
Aikar 3ce3b26186 Configurable Non Player Arrow Despawn Rate
Can set a much shorter despawn rate for arrows that players can not pick up.
2016-03-18 15:13:03 -04:00
Aikar 32a3169a1f Handle Item Meta Inconsistencies
First, Enchantment order would blow away seeing 2 items as the same,
however the Client forces enchantment list in a certain order, as well
as does the /enchant command. Anvils can insert it into forced order,
causing 2 same items to be considered different.

This change makes unhandled NBT Tags and Enchantments use a sorted tree map,
so they will always be in a consistent order.

Additionally, the old enchantment API was never updated when ItemMeta
was added, resulting in 2 different ways to modify an items enchantments.

For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
2016-03-18 14:56:16 -04:00
Aikar 944a964300 Fix Furnace cook time bug
If the server lags out and skips multiple ticks, Furnace cooking behavior would not
cook in the expected amount of time as the cook time was not decremented correctly.

This patch ensures that furnaces cook to the correct wall time expectation.
2016-03-18 14:27:53 -04:00
Aikar 91b4746fe0 Undead horse leashing
default false to match vanilla, but option to allow undead horse types to be leashed.
2016-03-18 14:20:11 -04:00
Aikar 63b6980015 Invalidate Metadata on reload
Metadata is not meant to persist reload as things break badly with non primitive types
This will invalidate metadata on reload so it does not crash everything if a plugin uses it.
2016-03-18 13:50:33 -04:00
Aikar 9da9b3a9d0 reduce sleep rate if file io thread sleep is enabled
so we will still give it time to sleep to avoid the issue, but reduce the
known negative effects of that sleeping.
2016-03-18 13:40:46 -04:00
Aikar 4d317d0ebe Default loading permissions.yml before plugins
Under previous behavior, plugins were not able to check if a player had a permission
if it was defined in permissions.yml. there is no clean way for a plugin to fix that either.

This will change the order so that by default, permissions.yml loads BEFORE plugins instead of after.

This gives plugins expected permission checks.

It also helps improve the expected logic, as servers should set the initial defaults, and then let plugins
modify that. Under the previous logic, plugins were unable (cleanly) override permissions.yml.

A config option has been added for those who depend on the previous behavior, but I don't expect that.
2016-03-18 13:23:48 -04:00
Aikar 3ad0e63a21 set default goals on all pom poms </cheer> 2016-03-18 02:13:51 -04:00
Aikar 379ce4072b remove that comment... 2016-03-18 01:50:06 -04:00
Aikar 223cb8b0e1 skip jar creation on build unless --jar specified 2016-03-18 01:46:32 -04:00
Aikar 0316152120 Chunk Save Reattempt
Sometimes a chunk region file is closed prematurely, resulting in a "Stream Closed" error on chunk saving.
Ultimately there is a race condition that causes it, but re-trying the save will avoid the issue.

Retry the save 5 times to try our best to avoid rollbacks due to chunk save failures.
2016-03-18 01:35:26 -04:00
Aikar 588b01aed3 Add sender name to commands.yml replacement
This allows you to use $sender in commands.yml definitions to make
commands that auto target self.
2016-03-18 00:29:35 -04:00
Aikar d35aeb50ee Add event call helper
This simplifies new event calling by reducing the diff to actually fire the event and check for cancelled state.
2016-03-18 00:24:00 -04:00
Aikar 82452cd373 Re-add chunk save queue improvements 2016-03-12 14:23:17 -06:00
Aikar a1403cb641 Disable Scoreboards for non players by default
Entities collision is checking for scoreboards setting.
This is very heavy to do map lookups for every collision to check
this setting.

So avoid looking up scoreboards and short circuit to the "not on a team"
logic which is most likely to be true.
2016-03-08 23:42:08 -05:00
Aikar 6dd8d79e7f Add makemcdevsrc.sh
This script will build a folder in work/ that includes only
non imported NMS files. This folder can then be added to IDE as a
source to see unimported files without any duplicate class errors
2016-03-08 22:08:16 -05:00
Aikar ed8ebbc98a Improve NavigationListener patches.
reduces diff and cleans up implementation of goals greatly.
2016-03-08 19:31:47 -05:00
Aikar 627ccd793f Optimize NavigationListener Iteration
I don't know what the person who wrote that code was smoking, but I
don't think it was good.

Gets rid of the WeakHashMap that mojang was abusing purely to be lazy
on clean up, and handles registering and deregistering navigation
upon world add/remove operations.
2016-03-07 22:59:12 -05:00
Aikar 7c3ec88eb6 Optimize NavigationListener Iteration
I don't know what the person who wrote that code was smoking, but I
don't think it was good.
2016-03-07 22:59:12 -05:00
Aikar b65586112b Optimize NavigationListener 2016-03-07 20:45:08 -06:00
Aikar cedb1c3686 Chunk save queue improvements 2016-03-04 20:14:27 -06:00
Aikar fbdb33981e Fix ServerListPingEvent flagging as Async 2016-02-24 00:32:44 -06:00
Aikar 3b4630072e More timings for scheduler 2016-02-23 22:35:34 -06:00
Aikar 5fbb42de01 Make Timings use less passes in its benchmark 2016-02-23 21:31:01 -06:00
Aikar 026367d300 Optimize getBlockData 2016-02-13 19:29:59 -06:00
Aikar 720abf5ab8 Optimize Pathfinding 2016-02-13 19:25:23 -06:00
Aikar eda6aa433f Automatically disable plugins that fail to load 2016-02-13 17:28:15 -06:00
Aikar 6584a8a1b1 Remove completely invalid Redstone event for Netherrack 2016-01-29 03:40:00 -06:00
Aikar 0875e3ee25 Entity teleport fix 2016-01-04 00:23:17 -06:00
Aikar 10316338d8 EAR: Fix bug with teleporting entities 2015-12-22 18:22:36 -06:00
Aikar c0fa6b8d12 Don't create a chunk just to unload it 2015-11-15 19:46:34 -06:00
Aikar 68c983d7cd Don't create region files when checking if a chunk exists 2015-11-15 19:44:28 -06:00
Aikar 929a5b40ed Bump thread count for chunk loading 2015-11-15 19:41:12 -06:00
Aikar 314c8f06cc Don't damage ArmorStands that are already dead 2015-11-15 19:40:32 -06:00
Aikar ee9886c278 Update tick limiter removal and TE/E removal optimizations 2015-10-24 02:12:33 -05:00
Aikar eac397cbab Implement EMC's optimized entity and tileentity removal 2015-10-16 22:23:05 -05:00
Aikar 2d37e27b37 Remove an unused list of TileEntities slowing down removal 2015-10-06 23:27:01 -05:00
Aikar 7e89c54e7c Don't sleep between chunk saves
For some unknown reason, Minecraft is sleeping 10ms between every single chunk being saved to disk.
Under high chunk load/unload activity (lots of movement / teleporting), this causes the chunk unload queue
to build up in size.

This has multiple impacts:
1) Performance of the unload queue itself - The save thread is pretty ineffecient for how it accesses it
   By letting the queue get larger, checking and popping work off the queue can get less performant.
2) Performance of chunk loading - As with #1, chunk loads also have to check this queue when loading
   chunk data so that it doesn't load stale data if new data is pending write to disk.
3) Memory Usage - The entire chunk has been serialized to NBT, and now sits in this queue. This leads to
   elevated memory usage, and then the objects used in the serialization sit around longer than needed,
   resulting in promotion to Old Generation instead of dying young.

If there is work to do, then the thread should be doing its work, and only sleep when it is done.
2015-09-09 21:16:42 -04:00
Aikar bbc7b0999f Optimize Chunk Saving Memory Allocation and Compression
Minecraft ineffeciently uses OutputStreams by calling .write(int) on the stream.
For Chunks, this is a DeflaterOutputStream, which allocates a single byte EVERY write.

This is causing the server to allocate tons of new byte[1] objects.
Additionally, this is very ineffecient for the Deflate process.

By Buffering Writes the same way it already is Buffering Reads, we will
write to the stream much more effeciently.

Also a more effecient RegionFile zero'ing for new chunks to speed up
new chunk generation.
2015-09-09 20:48:46 -04:00
Aikar 2b62b33603 Don't allow sendPacket once disconnect has been processed. 2015-07-23 16:23:21 +10:00
Aikar 5e5d11f13b Prevent tile entity and entity based crashes 2014-12-22 15:13:29 -06:00
Aikar 73bc2489c0 Do not allow negative count itemstacks (infinite itemstacks)
Should work around quite a few issues and this
'feature' is relatively worthless anyway
2014-12-19 16:35:01 -06:00
Aikar 9cb520d8f1 Add TNT source location API 2014-11-30 22:58:25 -06:00
Aikar 3a304401b4 Add Async Chunk Load API 2014-11-06 18:31:52 -06:00
Aikar d1cbf1b137 Implement performance improvements from the EMC-CraftBukkit fork
See the individual patch files for more details
2014-10-19 17:58:49 -05:00
Aikar a4e202676e Implement optimized Tile Entity ticking 2014-08-24 21:19:36 -05:00
Aikar eefd5936bb Update with latest TileEntity optimization changes 2014-08-11 21:43:04 -05:00
Aikar f2cea9d8fa Optimize TileEntity Ticking
Re-organizes the servers TileEntity Tick List to be bucketed by type.

This allows the server to skip buckets of Tile Entities that is known to
not have any tick function (half of them), skipping time spent iterating
them and checking if they are valid and in a loaded chunk. In other words,
a lot of "meta" time wasted on tile entities that would never do anything anyways.

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
(Such as chest), to improve performance.
2014-08-11 16:04:54 -05:00
Aikar 5cb541b122 Revert Bukkit damage API changes 2014-07-08 19:31:32 -05:00
Aikar f50d1233d4 Fix damage bug - Fixes BUKKIT-5678 2014-07-07 23:14:51 -05:00
Aikar 5537db04fc Teleport passenger/vehicle with player 2014-06-22 15:28:51 -05:00