Commit Graph

354 Commits

Author SHA1 Message Date
Jason
14be4180f6
Use updatingChunks for flush saving (#6533) 2021-08-31 17:23:22 -07:00
Nassim Jahnke
2cd4bcfba1
Fix distance map contains (#6530) 2021-08-31 12:47:00 +00:00
Spottedleaf
7d10cdea03
Merge tuinity (#6413)
This PR contains all of Tuinity's patches. Very notable ones are:

- Highly optimised collisions
- Optimised entity lookups by bounding box (Mojang made regressions in 1.17, this brings it back to 1.16)
- Starlight https://github.com/PaperMC/Starlight
- Rewritten dataconverter system https://github.com/PaperMC/DataConverter
- Random block ticking optimisation (wrongly dropped from Paper 1.17)
- Chunk ticking optimisations
- Anything else I've forgotten in the 60 or so patches

If you are a previous Tuinity user, your config will not migrate. You must do it yourself. The config options have simply been moved into paper.yml, so it will be an easy migration. However, please note that the chunk loading options in tuinity.yml are NOT compatible with the options in paper.yml. 

* Port tuinity, initial patchset

* Update gradle to 7.2

jmp said it fixes rebuildpatches not working for me. it fucking better

* Completely clean apply

* Remove tuinity config, add per player api patch

* Remove paper reobf mappings patch

* Properly update gradlew

* Force clean rebuild

* Mark fixups

Comments and ATs still need to be done

* grep -r "Tuinity"

* Fixup

* Ensure gameprofile lastaccess is written only under the state lock

* update URL for dataconverter

* Only clean rebuild tuinity patches

might fix merge conflicts

* Use UTF-8 for gradlew

* Clean rb patches again

* Convert block ids used as item ids

Neither the converters of pre 1.13 nor DFU handled these cases,
as by the time they were written the game at the time didn't
consider these ids valid - they would be air. Because of this,
some worlds have logspam since only DataConverter (not DFU or
legacy converters) will warn when an invalid id has been
seen.

While quite a few do need to now be considered as air, quite a lot
do not. So it makes sense to add conversion for these items, instead
of simply suppressing or ignoring the logs. I've now added id -> string conversion
for all block ids that could be used as items that existed in the game
before 1.7.10 (I have no interest in tracking down the
exact version block ids stopped working) that were on
https://minecraft-ids.grahamedgecombe.com/

Items that did not directly convert to new items will
be instead converted to air: stems, wheat crops, piston head,
tripwire wire block

* Fix LightPopulated parsing in V1466

The DFU code was checking if the number existed, not if it
didn't exist. I misread the original code.

* Always parse protochunk light sources unless it is marked as non-lit

Chunks not marked as lit will always go through the light engine,
so they should always have their block sources parsed.

* Update custom names to JSON for players

Missed this fix from CB, as it was inside
the DataFixers class.

I decided to double check all of the CB changes again:

DataFixers.java was the only area I missed, as I had inspected all
datafixer diffs and implemented them all into DataConverter. I also
checked Bootstrap.java again, and re-evaluated their changes. I had
previously done this, but determined that they were all bad.

The changes to make standing_sign block map to oak_sign block in
V1450 is bad, because that's not the item id V1450 accepts. Only
in 1.14 did oak_sign even exist, and as expected there is a converter
to rename all existing sign items/blocks.

The fix to register the portal block under id 1440 is useless, as
the flattenning logic will default to the lowest registered id - which
is the exact blockstate that CB registers into 1440. So it just
doesn't do anything.

The extra item ids in the id -> string converter are already added,
but I found this from EMC originally.

The change for the spawn egg id 23 -> Arrow is just wrong,
that id DOES correspond to TippedArrow, NOT Arrow. As
expected, the spawn egg already has a dedicated mapping for
Arrow, which is id 10 - which was Arrow's entity id.

I also ported a fix for the cooked_fished id update. This doesn't
really matter since there is already a dataconverter to fix this,
but the game didn't accept cooked_fished at the time. So I see
no harm.

* Review all converters and walkers

- Refactor V99 to have helper methods for defining entity/tile
  entity types
- Automatically namespace all ids that should be namespaced.
  While vanilla never saved non-namespaced data for things that
  are namespaced, plugins/users might have.
- Synchronised the identity ensure map in HelperBlockFlatteningV1450
- Code style consistency
- Add missing log warning in V102 for ITEM_NAME type conversion
- Use getBoolean instead of getByte
- Use ConverterAbstractEntityRename for V143 TippedArrow -> Arrow
  rename, as it will affect ENTITY_NAME type
- Always set isVillager to false in V502 for Zombie
- Register V808's converter under subversion 1 like DFU
- Register a breakpoint for V1.17.1. In the future, all final
  versions of major releases will have a breakpoint so that
  the work required to determine if a converter needs a breakpoint
  is minimal
- Validate that a dataconverter is only registered for a version
  that is registered
- ConverterFlattenTileEntity is actually ConverterFlattenEntity
  It even registered the converters under TILE_ENTITY, instead of
  ENTITY.
- Fix id comparison in V1492 STRUCTURE_FEATURE renamer
- Use ConverterAbstractStatsRename for V1510 stats renamer
  At the time I had written that class, the abstract renamer didn't
  exist.
- Ensure OwnerUUID is at least set to empty string in
  V1904 if the ocelot is converted to a cat (this is
  likely so that it retains a collar)
- Use generic read/write for Records in V1946
  Records is actually a list, not a map. So reading map was
  invalid.

* Always set light to zero when propagating decrease

This fixes an almost infinite loop where light values
would be spam queued on a very small subset on blocks.

This also likely fixes the memory issues people were
seeing.

* re-organize patches

* Apply and fix conflicts

* Revert some patches

getChunkAt retains chunks so that plugins don't spam loads
revert mc-4 fix will remain unless issues pop up

* Shuffle iterated chunks if per player is not enabled

Can help with some mob spawning stacking up at locations

* Make per player default, migrate all configs

* Adjust comments in fixups

* Rework config for player chunk loader

Old config is not compatible. Move all configs to be
under `settings` in paper.yml

The player chunk loader has been modified to
less aggressively load chunks, but to send
chunks at higher rates compared to tuinity. There are
new config entries to tune this behavior.

* Add back old constructor to CompressionEncoder/Decoder (fixes
 Tuinity #358)

* Raise chunk loading default limits

* Reduce worldgen thread workers for lower core count cpus

* Raise limits for chunk loading config

Also place it under `chunk-loading`

* Disable max chunk send rate by default

* Fix conflicts and rebuild patches

* Drop default send rate again

Appears to be still causing problems for no known reason

* Raise chunk send limits to 100 per player

While a low limit fixes ping issues for some people, most people
do not suffer from this issue and thus should not suffer from
an extremely slow load-in rate.

* Rebase part 1

Autosquash the fixups

* Move not implemented up

* Fixup mc-dev fixes

Missed this one

* Rebase per player viewdistance api into the original api patch

* Remove old light engine patch part 1

The prioritisation must be kept from it, so that part
has been rebased into the priority patch.
Part 2 will deal with rebasing all of the patches _after_

* Rebase remaining patches for old light patch removal

* Remove other mid tick patch

* Remove Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch

Replaced by `Do not copy visible chunks`

* Revert AT for Vec3i setX/Y/Z

The class is immutable. set should not be exposed

* Remove old IntegerUtil class

* Replace old CraftChunk#getEntities patch

* Remove import for SWMRNibbleArray in ChunkAccess

* Finished merge checklist

* Remove ensureTickThread impl in urgency patch

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2021-08-31 04:02:11 -07:00
Jason
6e9f38ea91
[ci skip] Cleanup Timings v2 diff (#6523) 2021-08-30 00:02:24 -07:00
Jason
cf27619809
Log error for invalid entity-per-chunk-save-limit configs (#6522) 2021-08-29 21:19:43 -07:00
Nassim Jahnke
be269d1cf0
Move ProtoWorld methods to LimitedRegion (#6486) 2021-08-28 13:43:26 +00:00
Jason
411a5eed18
Fix and optimize legacy world conversion (#6473)
CraftBukkit breaks legacy world conversion in three ways:
- Writes userdata to the path of the userdata folder rather than to
  the correct file inside the aforementioned folder. This causes the
  userdata folder to fail to be created as a file already exists at
  its path.
- Makes changes to how multiworld works, without modifying
  McRegionUpgrader to be aware of these changes.
- Calls methods on Bukkit before the server is initialized.

This patch fixes all of these issues, and also threads the
McRegionUpgrader to improve performance.
2021-08-27 22:07:12 -07:00
Spottedleaf
1c4f87a258
Ensure priority updates are determined by current level, not deferred level (#6507)
* Ensure priority updates are determined by current level, not deferred level

Deferral could cause an infinite loop to occur.

Also, re-add the light engine priority logic.

* Rebase

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2021-08-27 19:20:31 -07:00
Owen1212055
159112ef41
Add Missing Entity API: Cat (#5744) 2021-08-27 18:16:41 +00:00
Nassim Jahnke
f44d237de9
Updated Upstream (CraftBukkit) (#6504)
Upstream has released updates that appear 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:
5be41fb8 SPIGOT-6720: Fix bed explosion checks
09b99daf SPIGOT-6722: Close entity manager when unloading world
3a9561bf SPIGOT-6686: Changes in MaximumRepairCost for Anvil Rename cause inconsistency
2021-08-27 11:51:18 +02:00
Jake Potrebic
8b793ed52c
[ci skip] Remove this file that got created somehow (#6489) 2021-08-26 09:49:32 -07:00
Jason
0205b902c2
[ci skip] Cleanup diff in Async command map building (#6492) 2021-08-26 09:41:22 -07:00
Nassim Jahnke
0a6d320410
Sanitize ResourceLocation error logging (#6495) 2021-08-26 10:25:23 +00:00
Spottedleaf
e763a3dc95
Log when the async catcher is tripped (#6493)
The chunk system can swallow the exception given it's all
built with completablefuture, so ensure it is at least printed.

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2021-08-25 20:35:35 -07:00
Spottedleaf
ba4cf68774
Readd chunk priority patch, including many chunk system fixes from tuinity (#6488) 2021-08-26 02:16:27 +00:00
Jason
3773df24ce
Vanilla command permission fixes (fixes #6085) (#6490)
Fixes permission checks for vanilla commands which don't have a
requirement, as well as for namespaced vanilla commands.
2021-08-25 15:20:24 -07:00
Jason
b4ef78556c
Use configured no permission message in PaperCommand (#6484) 2021-08-25 13:34:15 -07:00
Nassim Jahnke
789bc79280
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6457)
Upstream has released updates that appear 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:
c9a46ebf #653: Add World#spawn with randomizeData parameter
e49c2e3a Damageable should extend ItemMeta
01ff04f4 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API
ca5b4b1a SPIGOT-6697: Deprecate generateTree with BlockChangeDelegate as it does not handle tiles

CraftBukkit Changes:
7c8bbcbe SPIGOT-6716: Preserve the order of stored enchantments of enchanted books.
18027d02 #914: Add World#spawn with randomizeData parameter
3cad0316 SPIGOT-6714: Don't fire PlayerBucketEvent when empty
8c6d60cf Fix server crash with BlockPopulator when entities are at a negative chunk border
4f6bcc84 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API
78d5b35b SPIGOT-6697: Restore generateTree with BlockChangeDelegate behaviour
15792f0d Rebuild patch
c949675e SPIGOT-6713: Cancelling EntityTransformEvent Causes Deceased Slimes To Not Despawn
a955f15c Fix issues with new ChunkGenerator API
a0a37f41 SPIGOT-6630: Replacing an enchantment on an item creates a conflict error

Spigot Changes:
b166a49b Rebuild patches
3c1fc60a SPIGOT-6693: Composters only take in one item at custom hopper speeds
2021-08-25 09:59:26 +02:00
Jake Potrebic
61a09c5102
Add BlockBreakBlockEvent (#4989) 2021-08-25 01:42:23 +00:00
Jason
ff3f449b33
Squash "Clear SyncLoadInfo" into "Add debug for sync chunk loads" and add tab completion for the clear argument (#6483) 2021-08-24 16:45:40 -07:00
Jake Potrebic
b74e691256
[ci skip] clean up diff from 1.17 update (#6462) 2021-08-24 23:30:26 +00:00
Pedro
182f56cdd5
Fix bed explosions in custom worlds (#6345) 2021-08-24 20:03:58 +00:00
Jake Potrebic
98fa136099
Fix CB lib relocation (#6454) 2021-08-22 17:22:57 +00:00
Jake Potrebic
b37fbbca3d
Add API to change EnderEye target without other nonsense (#6460) 2021-08-22 15:19:42 +00:00
Jake Potrebic
4b7fa94010
Prevent NPE when removing enchantment with no ItemMeta (#6459) 2021-08-22 15:13:51 +00:00
Jake Potrebic
cf037fbd3e
Better docs for PlayerGameModeChangeEvent (#6461) 2021-08-22 15:10:33 +00:00
Maddy Miller
49c7564283
Fix BlockPistonRetractEvent firing multiple times (#6467) 2021-08-22 23:54:55 +10:00
MiniDigger | Martin
18284cdf66
Fix Mob Goal Leak (#6394) 2021-08-22 14:19:45 +10:00
Octavia Togami
e25557464f
Replace ThreadLocal with ConcurrentHashMap in CommandSourceStack (#6325)
This object is created so often that it likely creates problems with the
ThreadLocalMap because the weak references can't be cleaned up fast
enough. This has manifest as lag seemingly caused by WorldEdit:
https://github.com/EngineHub/WorldEdit/issues/1668
2021-08-22 03:45:40 +00:00
Mariell Hoversholm
2406634ed8
Add timeout & interval to sysout catcher (#6383) 2021-08-21 17:01:42 +02:00
Bjarne Koll
5edda39cc5
Add deepslate as xray engine 2 replacement default (#6362)
Fixes: #6350
2021-08-21 14:34:58 +00:00
Noah van der Aa
0b46fb1e5a
Respect despawn rate in merge check (#6428) 2021-08-21 14:32:07 +00:00
Jake Potrebic
18d1602724
Add API to send game events (#6444) 2021-08-21 14:26:42 +00:00
petersv5
ccbb51078a
Fix entities glitching through blocks pushed by pistons (#6308)
Fixes #5189
2021-08-21 14:15:29 +00:00
Jason
59d449d880
Set AsyncAppender dispatch thread to be a daemon thread (#6424) 2021-08-18 18:47:29 +00:00
Jason
fa184f7429
Setup dev bundle publishing (#6163) 2021-08-17 17:11:04 -05:00
Shane Freeder
f2471d20b4
Do not fire PlayerBucketFillEvent when no fluid (Fixes #4611) 2021-08-17 15:43:01 +01:00
Jake Potrebic
6dfd1d9a71
Fix yaw on player spawn (#6409) 2021-08-16 14:46:25 -07:00
Noah van der Aa
934c694efd
Don't fire entitymovevent for players. (#6402) 2021-08-15 18:37:42 +01:00
Jake Potrebic
72ce684679
Fix possible divide by 0 error with cursor updates (#6398) 2021-08-14 17:44:31 +00:00
Shane Freeder
8d182e8639
Revert "Revert "Remove "Implement-Chunk-Priority-Urgency-System-for-Chunks" (Fixes #5980)""
This reverts commit 622598f1dd.
2021-08-14 15:29:22 +01:00
Shane Freeder
622598f1dd
Revert "Remove "Implement-Chunk-Priority-Urgency-System-for-Chunks" (Fixes #5980)"
This reverts commit aa52bf9e33.
2021-08-14 15:22:21 +01:00
Shane Freeder
aa52bf9e33
Remove "Implement-Chunk-Priority-Urgency-System-for-Chunks" (Fixes #5980)
Mojang made some changes to priorities in 1.17 and it seems that these changes
conflict with the changes made in this patch, which in some cases appears to
cause excessive rescheduling of tasks.

This, however, is not confirmed as such but seems to be the behavior that we're
seeing to cause this issue, if mojang has adopted the changes we suggested,
then a good chunk of this patch may be unneeded, but, this needs a much better
look than I'm currently able to do
2021-08-14 14:55:55 +01:00
Jason
565cd3306c
[ci skip] Add some helper methods to the ObfHelper util class (#6374) 2021-08-14 10:06:17 +00:00
Jason
4dd33cb8b6
[ci skip] Drop "Fix CME on adding a passenger in CreatureSpawnEvent" (#6384)
This is no longer needed as Entity#passengers is an ImmutableList as of 1.17
2021-08-14 03:01:07 -07:00
Jake Potrebic
f12a7f57e1
Clear bucket NBT after dispense (#6391) 2021-08-14 02:51:03 -07:00
Jake Potrebic
c2f47a76ae
Implement Translatable in appropriate places (#6248) 2021-08-13 21:11:12 -07:00
Jason
e9aa9ce66b
Add config migration for named entity death logging option (#6390) 2021-08-13 13:24:25 -07:00
Warrior
591cac3685
Configurable item frame map cursor interval (#6385) 2021-08-13 12:14:44 -07:00
Jake Potrebic
ce43ce8265
Make EntityUnleashEvent cancellable (#4993) 2021-08-13 11:15:43 -07:00