Commit Graph

8 Commits

Author SHA1 Message Date
Aikar
21f9efa2ca
Improve implementation of chunk leak clean to not run as often 2020-05-25 21:42:53 -04:00
Aikar
10502558e9
Workaround for some hacky environments that mess up things
2 people had issues where some plugin is doing some reallly insane NMS hackery
that created invalid worlds, which caused some errors...

Really don't understand what in the world they did, but putting in a dumb guard that
shouldn't even be necessary to just not send the sound effect rather than erroring.
2020-05-23 22:27:37 -04:00
Aikar
36f34f01c0
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:
da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots
3abebc9f #492: Let Tameable extend Animals rather than Entity
941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent
4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME

CraftBukkit Changes:
933e9094 #664: Add methods to get/set ItemStacks in EquipmentSlots
18722312 #662: Expose ItemStack and hand used in PlayerShearEntityEvent
2020-05-06 06:05:22 -04:00
Aikar
f37381ea8a
Optimize Network Manager to not need synchronization
Removes synchronization from sending packets
Makes normal packet sends no longer need to be wrapped and queued like it use to work.
Adds more packet queue immunities on top of keep alive to let the following scenarios go out
without delay:
  - Keep Alive
  - Chat
  - Kick
  - All of the packets during the Player Joined World event

Hoping that latter one helps join timeout issues more too for slow connections.

Removes processing packet queue off of main thread
  - for the few cases where it is allowed, order is not necessary nor
    should it even be happening concurrently in first place (handshaking/login/status)

Ensures packets sent asynchronously are dispatched on main thread

This helps ensure safety for ProtocolLib as packet listeners
are commonly accessing world state. This will allow you to schedule
a packet to be sent async, but itll be dispatched sync for packet
listeners to process.

This should solve some deadlock risks

This may provide a decent performance improvement because thread synchronization incurs a cache reset
so by avoiding ever entering a synchronized block, we get to avoid that, and packet sending is a really
hot activity.
2020-05-06 05:28:47 -04:00
stonar96
8f9df2ed43
Anti Xray cleanup
Undo the accidental renaming of a method in 0aad8bf
Aikar wanted to rename DataPalette#getDataBits(T object) to getOrCreateIdFor
in 0aad8bf but he also accidentally renamed
ChunkPacketInfo#getDataBitsIndex(int chunkSectionIndex) to
getOrCreateIdForIndex.

Remove chunk-edge-mode and chunk loading entirely from Anti-Xray
The chunk-edge-mode is broken since several versions.
Loading chunk neighbors for chunk edge obfuscation isn't needed anymore.
Unlike in previous versions, these are under normal circumstances already loaded
at the time we need them (plugins for example can bypass this).

Use the modified methods and constructors everywhere
Anti-Xray provides support for the default nms methods and constructors,
which where modified by Anti-Xray to avoid breaking stuff (plugins)
which somehow uses these methods.
However, the modified versions of those methods and constructors should be used
where possible.
2020-05-06 04:35:20 -04:00
Aikar
57dd397155
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:
b999860d SPIGOT-2304: Add LootGenerateEvent

CraftBukkit Changes:
77fd87e4 SPIGOT-2304: Implement LootGenerateEvent
a1a705ee SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent
41712edd SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
2020-05-01 18:03:57 -04:00
Aikar
e0ea2e0e14
Entity Activation Range 2.0! Major improvements to restoring behavior
Calling this 2.0 as it's a pretty major improvement with more knobs to twist.

This update fixes many things. The goal here is to restore vanilla behavior to some degree.
Instead of permanent inactive pools of animals, let them show some signs of life some....

Yes this may reduce performance compared to before, but I hope it is minimal. Got to find a balance.
Previous EAR logic really compromised vanilla behavior of mobs. This tries to restore it.

Changes:

1) All monsters are now classed as Monster. Mojang has an interface, we should use it.
   - This now includes Shulker, Slimes, see #2 for Phantom and Ghast
2) Villagers and Flying Monsters now have their own separate activation range configs.
   - Villagers will default to your Animals config
3) Added a bunch of more immunities
   - Brand new entities are immune for a few seconds
   - Entities that recently traveled by portal are immune for few seconds
   - Entities that are leashed to a player are immune
   - Ender Signals are immune
   - Entities that are jumping, climbing, dying (lol) are immune
   - Minecarts are now always immune to the movement restriction
4) Villagers immunity received major overhaul...
   - Now has many immunities for Villager activities to let them
     do their work then go back inactive
   - Such as interacting with doors and workstations should be more normal now
   - Raids will trigger immunities, in that villagers will run and hide when bell rings.
   - Raid should keep the entire village immune during the raid to keep gameplay mechanics
     You can disable raids by game rule if you dont want raids

Then the big one.....

Wake Up Inactive Entities:
One issue plagueing "farms" is that we no longer even let entities move now.
Entities become lifeless.

A new system has been introduced to wake up inactive entities every so often, to let
them stretch their legs, eat some food, play with each other and experience the good entity life.

Animals, Villagers, Monsters (Includes Pillagers), and Flying Monsters will now wake up every
so often after staying inactive for a very long. This grants them a temporary immunity, that
the goal is they will then find "stuff to do" by having a longer activity window.

How many to wake up, how often they wake up, and for how long they wake up are all configurable.

Current EAR Immunities really don't give some entities enough of a window to find work
to then keep them immune for the work to even start. This system should help that.

We will only wake up a few entities per tick on the first wave, restoring 1 per type per world per tick.

So say you have 10 monsters qualify for inactive wake up, all 8 will wake up on the first eligible tick,
and then the 9th will wake up on next tick, 10th on next tick.

If for 5 ticks no more inactive wake up, our buffer will have built back up to 5, and then 5 can go next needed tick.

This basically incrementally wakes them up, preventing too many from waking up in a single tick, to reduce impact to TPS.
2020-04-27 01:22:44 -04:00
Ytnoos
bf698865f7
Revert "Re-track players that dismount from other players" 2020-04-22 03:16:31 -04:00