Commit Graph

3703 Commits

Author SHA1 Message Date
Matthew Miller
8749e58b72 Don't update snapshot blockstates (#1535)
Following this comment on PaperLib, https://github.com/PaperMC/PaperLib/pull/2#discussion_r222761017

I've made non-snapshot TE's not update when they receive the update call. They still do the rest of the update, just not the applying of the TE data. This is to still allow forced physics updates etc. Also in the case of Jukeboxes, updating the properties
2018-10-05 11:24:01 -04:00
Brokkonaut
0a6d449907 Sometimes World.save() did not save the whole world. (#1538)
flag = true is a force save of the whole world (for example World.save()), this should ignore the current queue size.
2018-10-05 11:23:20 -04:00
Aikar
e2418a9945
[CI-SKIP] Undo an accidental merger of patches
Accidently merged 1 pathfinding patch into a light patch instead
of the other pathfinding page.

Fixed that. Hand editting patch master race
2018-10-04 23:31:01 -04:00
Aikar
459987d69f
More improvements to activation range, improve turtles
improved the water code so that immunity wont trigger if the entity
has the water pathfinder system active, so this improves support
for all entities that know how to behave in water.

Merged 2 EAR patches together, and removed an MCUtil method that
doesnt have a purpose anymore
2018-10-04 23:18:46 -04:00
Aikar
a4df5ddee7
Report errors correctly from FutureTasks
Anything that posts something to main thread was not
correctly reporting their errors to the logger, passing the
ExecutionExcetion instead of the cause. This resolves that,
as well as patches some simple cases of System.nanoTime where mojang
had used a LongSupplier to use a different method on client.
2018-10-04 01:45:11 -04:00
Aikar
d7dd3798ec
Fix lag caused by water mobs across the board - Fixes #1462
This update introduces Entity Activation Range for water mobs.

Activation Range has been one of my biggest performance improvements
I ever added to Minecraft, however "Entity is in Water" is an immunity
case that keeps an entity active.

This update ignores the water check for known water based mobs, allowing
them to actually go inactive.

In addition to that, a new config option was added to spigot.yml to go with
the rest of the entity-activation-range options to let you configure
aquatic mobs like fish, squid and dolphins separately.

This should overall fix all lag caused by water mobs.
2018-10-04 01:21:02 -04:00
Aikar
aad2e08482
[CI-SKIP] Remove Trove and update to fastutul 8 on -api
These deps were marked as provided, not compile, so they were never
exposed to plugins anyways as we THOUGHT we had done, oops.

Well plugins can still add fastutil to their build and use the
deps as provided by minecraft.

This ensures -api side does not use a deprecated API as fastutil 8
removed the deprecated methods.
2018-10-03 21:32:11 -04:00
Zach Brown
ebe072deb6
Revert "Dont strip explicit leading color codes in chat components (#1512)"
This reverts commit 31a99db328.

Fixes GH-1525
Reintroduces GH-1484
2018-10-03 18:15:22 -04:00
Shane Freeder
2dcae290df Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
867794b2 Make setPersistent also control player saving

CraftBukkit Changes:
02518f92 Make setPersistent also control player saving
2018-10-03 20:19:35 +01:00
Shane Freeder
26153def87 Fix FileIOThread concurrency issues (fixes #1505)
FileIOThread was using two volatile counters in order to track if
any pending work was in the queue, this causes potential concurrency
issues when this counter is updated from multiple threads, potentially
causing these counters to desync due to the unsafe volatile update
2018-10-03 19:12:07 +01:00
Aikar
a64b0952cb
Add config options to paper.yml for Async Chunks and Shared Host Overrides
Shared Hosts have been concerned over the increased CPU usage that Async Chunks
has introduced. We understand that shared hosts can't allow 1 client
to abuse the systme resources depriving other servers of cpu time, so we've
added some configs to allow hosts to force some settings.

Hosts, you may set the following SYSTEM ENVIRONMENT VARIABLES (NOT JVM FLAGS)
to change some behavior:

PAPER_ASYNC_CHUNKS_SHARED_HOST_GEN=1   - Enable Single Threaded World Generation (capping CPU Usage
PAPER_ASYNC_CHUNKS_SHARED_HOST_GEN=2   - Disable Async Chunk Generation - Please do not do this!!!
  - Minecraft is moving towards asynchronousm per-world chunk generation itself. You need to prepare
  - for this, so please do not disable async chunk generation.

PAPER_ASYNC_CHUNKS_SHARED_HOST_LOAD=#  - Where # is Maximum number of threads to use on Chunk Loading
  - This is a max, so your end user can reduce it more too. I suggest no lower than 2. Minimum is 1.
  - These are usually much faster request, so outside of loading entire worlds, They usually do not
  - get as much load. Paperby default uses CPU Core count * 1.5, so this may default to a higher value
  - on shared host and you should override it with this value to say 2-4.

These settings will override your clients paper.yml options. Set as a system wide environment
variable to ensure all Paper clients respect your resource usage desires.

Resolves #1520
2018-10-02 23:51:03 -04:00
Zach Brown
10209bfbd8
Do not allow null in CanPlaceDestroy NBT API
Fixes GH-1523
2018-10-02 22:54:38 -04:00
Aikar
38f0f0b71a
Disable use of Locks on main thread for DataPaletteBlock
This should greatly improve performance by using a No Op lock
while on the main thread.

Vanilla always had a write lock on write operations, but we added
a Read Lock during Async Chunks to make concurrent writes non fatal
for Async Chunks.

This means we added on a bunch of over head to all chunk read operations.

This corrects that, as well as disabling the write lock while on main thread.

It is a general rule that you do not touch a chunk async once it is loaded
into the world, as we never had locks on the chunk before 1.13 even.

So once we are on main, we don't expect concurrent access to begin with,
so we don't need the write locks either.
2018-10-02 22:29:31 -04:00
Aikar
e45b853e60
Optimize some light chunk access
light calculations repeatedly looks up the same chunk while going
down on the Y access. Pass the chunk to it to skip many round trips
to the map lookup process.

while the gains arent as big since we have last access cache, it
should hopefully avoid many callstacks of depth and improve inlining,
as well as avoids entering a synchronized code block.

The avoiding of entering synchronized section is the main goal here.
2018-10-02 21:55:30 -04:00
Aikar
49f584a14b
[CI-SKIP] Update test server rebuild logic
Many times I've ran paper test trying to SHUTDOWN
the existing test server, only for it to see that my target folder
is missing (for whatever reason), and it try to build paper to make
the jar exists.

Well, the patch process will wipe out any uncommitted changes, causing
loss of work.

Now we will only build patches if your missing your entire Paper-Server
folder, and only trigger a mvn compile if the jar is missing.
2018-10-02 21:49:42 -04:00
Aikar
97b9ce8476
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-10-02 10:26:35 -04:00
BillyGalbreath
31a99db328 Dont strip explicit leading color codes in chat components (#1512) 2018-10-02 10:21:12 -04:00
Aikar
920bf4680b
[Auto] Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
68588dac SPIGOT-4405: Chunk generation problem
2018-10-02 09:06:52 -04:00
Aikar
083bf7b255
[Auto] Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
c8f68670 Save server version
2018-10-02 06:56:32 -04:00
Shane Freeder
9038677c89
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
c71bb9ca Add PlayerRecipeDiscoverEvent and methods to (un/)discover recipes

CraftBukkit Changes:
7a2f4867 Implement PlayerRecipeDiscoverEvent and methods to (un/)discover recipes
2018-10-02 11:01:56 +01:00
Shane Freeder
eaa2c39183
Configurable connection throttle kick message (Closes #1515) 2018-10-02 10:39:49 +01:00
Shane Freeder
3fc712a78f
Fix custom flying kick message 2018-10-02 10:39:49 +01:00
Shane Freeder
f1a92f03db
Cleanup tab completion
During testing, I could not find any case of TabCompleteEvent firing,
however, upon reinspection of the code, and additional testing, this
appears to work fine without any changes on our part.
2018-10-02 10:37:37 +01:00
Aikar
6371b4581d
Fix Async Chunk Load Callback if chunk was already loaded
Fixes ACL API mainly, but might fix other smaller things too

Also improved the high priority check if the chunk was already marked done
2018-10-01 01:00:09 -04:00
Aikar
48b1b0aac5
Optimize Spare Chunk loads to be removed faster
this has technically been a longer standing problem, but if an async
chunk loads after a chunk has been removed from the chunk map, it would
be treated as any other spare chunk and kept loaded until Chunk GC kicks in.

This fixes that, but also obsoletes ChunkGC in that anytime we load a spare
chunk (a chunk outside of any players view distance), we will immediately
mark it for unload.

This should reduce the amount of spare chunks loaded on a server.
2018-09-30 20:34:05 -04:00
Aikar
6135b37c05
[Auto] Updated Upstream (Bukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
e64f4eb1 Remove some draft API markers
2018-09-29 22:16:44 -04:00
BillyGalbreath
c81736fd60 Fix cancelled lootables (#1510) 2018-09-29 21:57:59 -04:00
Zach Brown
d9363f2979
Fix slime pathfinding when loaded from NBT
GH-1507

The canWander property is initialized to true by default, however when
loaded from NBT, if the key doesn't exist the property will be set to
false. The correct solution is to ensure the key exists before setting
the property.
2018-09-29 16:06:26 -04:00
Zach Brown
cfc7baeefb
Add support for Java 11 to deprecated Timings API
In Java 11 the internal reflection method used to determine the calling
class in the legacy and deprecated Timings API, that no one should be
using anymore, was removed.

This means plugins that try and use it will all fail to enable and we
can't compile the server with JDK 11.

The solution to the removal of this internal reflection class is
to just use reflection to call it if its available and fall back to
the unnamed handler system if it isnt.

Update to the newer API if you use Timings already...
2018-09-29 14:05:24 -04:00
Aikar
9285b9cf1c
Fix village check
obf helper was in an unimported file, so just going to skip helper here
2018-09-29 12:20:29 -04:00
Aikar
c64503c66f
Fix Village Loading Doors fix, add config option, hopefully fix farms
The patch was previously applied wrong, and still caused chunk loads.

Now, we will prevent it again, but also added a config option to
disable this optimization.

However, I also updated it so that doors are not removed if the chunk
the door is in is unloaded, so this should avoid breaking farms.

Fixes #1506
2018-09-29 12:03:11 -04:00
Aikar
08bb5b49d2
Fix Sending Chunks to Client - Fixes #1504
Vanilla has some screwy logic that doesn't send a chunk until
it has been post processed. This is an issue as post processing
doesn't occur until all neighbor chunks have been loaded.

This can reduce view distance while generating terrain, but also
cause bugs where chunks are never sent to the client.

This fix always sends chunks to the client, and simply updates
the client anytime post processing is triggered with the new chunk data.
2018-09-29 01:22:21 -04:00
Aikar
590c2f96eb
Fix bug in async load order priority
accidently had priority inverted!

This will greatly improve visual chunk load speeds
2018-09-28 23:12:16 -04:00
Aikar
0c9bb9b7ae
Don't recheck type after setting a block
The server does a "Did my update succeed" check after setting
a blocks data to a chunk.

However, writes can not fail outside of a hard error or a
a race condition from multiple threads writing, which is
not something that should ever occur on the server.

So this check is pointless, as if it did occur, the server would
be having data corruption issues anyways.

This provides a small boost to all setType calls.
2018-09-28 22:40:04 -04:00
Aikar
f02b4d200e
Fix issues with entity loss due to unloaded chunks
Vanilla has risk of losing entities by causing them to be
removed from all chunks if they try to move into an unloaded chunk.

This pretty much means high chance this entity will be lost in this scenario.

There is another case that adding an entity to the world can fail if
the chunk isn't loaded.

Lots of the server is designed around addEntity never expecting to fail for these reasons,
nor is it really logical.

This change ensures the chunks are always loaded when entities are
added to the world, or a valid entity moves between chunks.

Hopefully will fix issues #1496 and #1434
2018-09-28 22:39:20 -04:00
Aikar
cd6a5f3b51
Remove Water optimization from the Light Optimizations
case was found where it could cause light to become incorrect

But we still get to optimize out any same block updates which reduces light operations
2018-09-28 22:37:43 -04:00
Aikar
c75015c1a4
Remove the "Entity already removed" warning unless debug entities is on 2018-09-28 22:37:33 -04:00
Aikar
de4487435d
Optimize Light Recalculations
The server triggers light recalculations even if the new block
is the same as the old block. At this time, BlockData Properties
do not impact light calculations.

So the only way light should change, is if the block itself
changes from 1 block to another.

Additionally, as of 1.13, water now only blocks 1 light level
instead of 3, meaning that light level decreasing is the same as air.

This means, transitions between water and air also do not need
to recalculate light, which saves a TON of updates caused by
fluids flowing.
2018-09-28 21:30:03 -04:00
BillyGalbreath
3482df728f Fix turtle lag (for real this time) (#1503)
Amends #1502, to further fix #1501
2018-09-28 21:27:40 -04:00
Aikar
b62dfa0bf9
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers

CraftBukkit Changes:
1cf8b5dc SPIGOT-4400: Populators running on existing chunks
116cb9a1 SPIGOT-4399: Add attribute modifier equality test
5ee1c18a SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
2018-09-28 19:31:59 -04:00
BillyGalbreath
afeb77bc88 Fix turtle lag (#1502)
Fix #1501

I just added a condition check to not start a new pathfinder goal if the turtle already has one set.

Needs more testing.

![Timings Comparison](https://i.imgur.com/p9eJQSo.png)
2018-09-28 13:58:06 -04:00
Aikar
515f2e7beb
Ignore Dimension NBT field in Entity data
Minecraft is trying to set Dimension Objects based on a Dimension ID

Dimension ID's for custom worlds are dynamically allocate dand not guaranteed
consistent.

This removes checking the NBT data, as the Entity will always have its
DimensionManager set to the world it is being placed into.

This fixes corrupt entities breaking chunk saving in custom worlds.
2018-09-27 00:11:50 -04:00
Aikar
2365b308c8
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.

This update has been tested to ensure that World Conversion still occurs correctly.

Bukkit Changes:
0812ce2c SPIGOT-4397: isChunkGenerated API

CraftBukkit Changes:
4824655c SPIGOT-4398: Upgrade to ASM 6.2.1 for better Java 11 support
eea43870 MC-134115: Fix issues converting tile entities
1a7f2d10 SPIGOT-4397: isChunkGenerated API
40aed54d SPIGOT-4396: Improve vehicle movement

Spigot Changes:
f6a273b1 Rebuild patches
2018-09-26 22:35:46 -04:00
Daniel Ennis
c5fbde9f17
Async Chunk Loading and Generation (#1397)
This restores Asynchronous Chunk Loading to 1.13, as well as adds Asynchronous Chunk Generation..

This provides a massive boost to server performance and should bring 1.13 back closer to 1.12 performance levels for pre generated worlds.

World Generation will now be faster overall than 1.12 since 1.12 did not have async generation.


**DONATE:**
Lots of effort has went into making this happen. Want to say thanks and donate? 

https://donate.emc.gs/AsyncChunks
2018-09-26 18:21:44 -04:00
Daniel Ennis
b9f408c744
[CI-SKIP] Update Issue template
Added information to not use github attachments.
Added information to not report "DO NOT REPORT THIS TO PAPER" logs, because obviously that wasn't clear enough they shouldn't.
2018-09-26 17:22:20 -04:00
Aikar
5cdfbda4e4
Re-enable light queue toggle, optimize neighbor checks, add max queue time
light queue is actually buggy, so re-enabling the config.

however, if anyone is ok with the buggy behavior, made the max time lost due to
light queue configurable.

We want to get to making the ligth queue default if we can make it work perfectly.

also applying neighbor optimizations to use the faster method for light checks.
2018-09-26 00:57:59 -04:00
BillyGalbreath
e1ba203df8 Honor EntityAgeable#ageLock (#1481)
* test

* Obfuscation helper

* Fix #1459
2018-09-25 10:54:06 -04:00
Brokkonaut
e8e994656b Avoid dimension id collisions (#1487)
getDimensionId() returns the dimension id - 1. So without this patch
we would reuse an existing dimension id, if some other dimension was
unloaded before.

In Spigot this is nearly invisible because DimensionManager has no equals(),
so dimension id collisions just create 2 worlds with the same dimension.

The PaperWorldMap (Added in
https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0376-Optimize-Server-World-Map.patch ) changes this - Now the dimension is overwritten if there is some collision,
what causes players to teleport to incorrect worlds, World checks will no longer work
and many more evil things.
2018-09-25 10:53:52 -04:00
Aikar
5abcf67252
[Auto] Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
020b4952 SPIGOT-4392: Stem updates even if BlockGrowEvent cancelled
2018-09-25 00:36:37 -04:00
Zach Brown
ec1012b5d5
Allow zero revive health when it matches maxHealth
Apparently a zero max health attribute is perfectly fine in vanilla and
our own revive handling code appears to handle the case fine, even when
EntityDeathEvent is cancelled. So we should allow it to avoid issues
when these mobs are killed.
2018-09-24 20:48:21 -04:00