Commit Graph

4344 Commits

Author SHA1 Message Date
Spottedleaf
7fb12d787e Improve MT-Safety of UserCache (#2080)
We were missing a synchronize on a get if cached method, however
it appears that using a ConcurrentHashMap is a better solution
so readers can avoid locking if they just want a cached value.

Existing synchronization for writers remains untouched, the
ConcurrentHashMap is just so readers can safely read without
synchronization
2019-05-27 01:17:50 -05:00
Spottedleaf
5dc46cd3b2 Move getTypeIfLoaded and friends to IBlockAccess (#2077) 2019-05-27 01:14:14 -05:00
Spottedleaf
90141ff411 Handle gen flag for placeholder getChunkAtAsync (#2079)
Also fix a loadChunk call in heightmap api
2019-05-27 00:17:12 -05:00
Zach Brown
7fe6e643d1
Check property exists before playing chest close sound
There is an artificial delay added to chest close sounds (of 10 ticks)
to make them "feel" more true to vanilla. The problem is that because of
this delay it is possible for the block to be removed by the time the
sound plays.

With 1.14 in the state it is the timing necessary to encounter this
issue has increased.

The correct fix is to just return early if the property checked for in
the TileEntityChest sound method does not exist for the block at the
current location.

Fixes GH-2074
2019-05-26 23:42:39 -05:00
Shane Freeder
e9c7232267
Merge branch 'master' into ver/1.14 2019-05-27 01:16:47 +01:00
Spottedleaf
07762fc610 Revert Don-t-recheck-type-after-setting-a-block.patch 2019-05-26 10:40:12 -07:00
Shane Freeder
d627cfa110
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:
17da3420 Fix reading custom persistent entity data
83783357 SPIGOT-4980: Shields will not be put on cooldown when hit with an axe
8d0f3722 SPIGOT-4752: Fixed inconsistency between isChunkLoaded and chunk load/unload events
3f9f31c3 SPIGOT-4982: Armor disappearing while breaking the armor stand
2019-05-26 02:56:30 +01:00
Shane Freeder
c2aec55dce
remove old patch from removed 2019-05-24 11:21:50 +01:00
Shane Freeder
ddab5b61a8
Fix some concurrency issues around world generation (Fixes #2052, #2037) 2019-05-24 11:16:03 +01:00
Shane Freeder
b3aa7dadcd
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:
c45c0a98 SPIGOT-4972: Cannot add contextual data to loot table API
2019-05-24 04:49:27 +01:00
Spottedleaf
c47f54dc88 Add configurable spawn loaded range back (#2051) 2019-05-24 04:12:57 +01:00
Spottedleaf
27731ddb32 Fix /tps (#2066) 2019-05-22 19:57:27 +01:00
Shane Freeder
1956e5a5f4
Actually fix compilation 2019-05-22 05:21:49 +01:00
Shane Freeder
d9ad4e8bd8
Fix compilation 2019-05-22 05:14:56 +01:00
Shane Freeder
08aaab0105
Remove TPS catchup improvements
These changes are incompatbile as-is with 1.14 due to the Thread.sleep
call, this should ideally be brought back in the future
2019-05-22 04:59:14 +01:00
Shane Freeder
c500f6a7fb
Updated Upstream (Bukkit/CraftBukkit/Spigot)
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:
142bdd6a SPIGOT-4966: Provide access to Entity in PortalCreateEvent
36ae34f0 Fix some javadoc warnings
2c68d3b9 Explicitly deprecate all MaterialData subclasses
b97d9bb7 Fix duplicate lowercasing in NamespacedKey
531c4dd3 SPIGOT-4961: Cannot open various inventories
2327df08 SPIGOT-4958: API to set map trackingPosition
2ae6a5a8 SPIGOT-4833: Allow access to LivingEntity memories

CraftBukkit Changes:
342194e3 SPIGOT-4970: PlayerTeleportEvent event.setTo() has no effect on portal teleports
6984fc4f SPIGOT-4968: Jukebox.setPlaying(null) causes error
0e4ca96e SPIGOT-4966: Provide access to Entity in PortalCreateEvent
49e15b4d SPIGOT-4964: EntityPickupItemEvent for pandas
de9b85b8 SPIGOT-4925: Uppercase world names no longer supported
c5e09cea SPIGOT-4961: Cannot open various inventories
b114affb SPIGOT-4958: API to set map trackingPosition
401432b9 SPIGOT-4962: Bubble column blocks not classified as liquid
f498aabe SPIGOT-4898: Call EntityChangeBlockEvent / EntityPickupItemEvent for foxes
eb99127a SPIGOT-4833: Allow access to LivingEntity memories

Spigot Changes:
03bd4b03 Remove // Spigot comment from javadoc
54b58fa6 Fix some javadoc warnings
2019-05-22 04:38:43 +01:00
Shane Freeder
4800d2da2a
improve CraftWorld#isChunkLoaded to use the chunk status
vs just checking that it exists as an updating chunk, as this appears to
be a "the chunk should be loaded, but might not be"
2019-05-21 21:32:47 +01:00
Shane Freeder
034fefceb7
stop CraftWorld#isChunkLoaded from loading chunks 2019-05-21 02:37:47 +01:00
Spottedleaf
d189ac1db3 Fix RegionFileCache#hasRegionFile (#2062)
also remove the pointless synchronization on
RegionFileCache#getRegionFileName
2019-05-20 03:26:17 +01:00
Shane Freeder
6b05c3f8d6
try-with-resources on populate timer (Fixes #2061)
Lets also ignore the fixup patch, that never existed, right? Right.
2019-05-20 02:32:41 +01:00
Shane Freeder
e16dd85327
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:
d06991d9 SPIGOT-4953: Crafting table inventory returns player location, not block location
2019-05-20 00:56:19 +01:00
Shane Freeder
25621957f1
Don't run death logic on dupe entity removals 2019-05-19 20:48:54 +01:00
Shane Freeder
060bc7bbee
Updated Upstream (Bukkit/CraftBukkit/Spigot)
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:
4543fb40 SPIGOT-4943: Zombie villager conversion player API.

CraftBukkit Changes:
585b2ebd Tweak thresholds for can't keep up message
91ada5c2 SPIGOT-4956: EntityTameEvent not triggered when taming a Cat
9bda4134 SPIGOT-4943: Zombie villager conversion player API.
5a027071 SPIGOT-4947: Allow setting the content on a lectern
09d00e9f SPIGOT-4938: Call EntityPickupItemEvent for dolphins
a278e445 SPIGOT-4948: Lectern.getInventory should return a LecternInventory

Spigot Changes:
4f661b22 Rebuild patches
2019-05-19 04:16:22 +01:00
Shane Freeder
da3b503596
Restore some entity duplication fix patches 2019-05-18 06:01:44 +01:00
Spottedleaf
2e18e54a83 Fix MinecraftServer#isMainThread (#2046)
See patch notes
2019-05-16 17:27:36 -05:00
Zach Brown
37431d2867
Update upstream CB
--- work/CraftBukkit
Submodule work/CraftBukkit f6909573..02b466cc:
  > SPIGOT-4940: Fletcher villager gifts sometimes crash server
2019-05-16 17:04:14 -05:00
Zach Brown
24a5bfb9cb
Fix logic issue with no save proto chunks patch
Should be returning true as a no-op "yes it was saved" rather than false
as a "there was an issue saving"
2019-05-16 16:53:17 -05:00
Shane Freeder
17fe7a1b43
Remove leftover line from spigots tick limiters
Looking over the code, this appears to be one "high risk but hopefully
unlikely that plugins are causing this to break", this line is however
redundant leftovers from spigots tick limiter patch, which should be
doing nothing as-is.
2019-05-15 22:53:13 +01:00
Shane Freeder
2f4fe0962b
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:
f6909573 SPIGOT-4935: Lore deserializes incorrectly from previous versions
dd99c5bb SPIGOT-4929: Beacon inventory getType() returns CHEST
2019-05-15 19:12:22 +01:00
kashike
3a425b3a72
Merge pull request #2029 from Spottedleaf/optimize-datawatcher
Optimize DataWatcher
2019-05-15 01:13:05 -07:00
Spottedleaf
89a1469d3f Resolve memory leak involving TileEntities
Their chunk is set to null before removal, so we kept them around.
2019-05-14 17:19:58 -05:00
Spottedleaf
1672ac6fc1 Fix CraftServer#isPrimaryThread
md_5 changed it so he could shut down the server asynchronously
from watchdog, although we have patches that prevent that type
of behavior for this exact reason.
2019-05-13 23:19:48 -05:00
Zach Brown
6c2a2f2dd2
Re-add dropped keep alive disconnect
Should fix the terminal spam
2019-05-13 23:17:05 -05:00
Spottedleaf
05d074d557 Optimize DataWatcher
The lock in DataWatcher is used to prevent concurrent modifications
to the 'd' field (entries in MCP). However any modifications to
this map only occur on initialization of an Entity in its
constructor. This modification is write-locked.

Every other access is through a readlock, which allows
the threads to pass if there is no thread holding the
writelock.

Since the writelock is only obtained in the constructor
of the Entity, the further readlocks are actually
useless (which get obtained on set, get, etc calls).

The entries field ('d' currently) has also been declared as
Int2ObjectOpenHashMap to avoid autoboxing on put(), get(), etc
calls.
2019-05-13 20:37:18 -07:00
Zach Brown
d84080e6d1
MC 1.14.1 2019-05-13 21:20:58 -05:00
Zach Brown
5e7cfaf718
Add comment to MC-151674 fix
[11:00 PM] kashike: <snip> missed // Paper - MC-151674 comment here
2019-05-12 23:06:28 -05:00
Spottedleaf
4f47cbdb77 Fix MC-151674 Close RegionFiles when they get evicted from cache
https://bugs.mojang.com/browse/MC-151674
2019-05-12 23:57:49 -04:00
Spottedleaf
da850bab55 Review EntityPathfindEvent
Add missing target forward
2019-05-12 23:57:49 -04:00
Spottedleaf
a2db4c09a2 Remove TODO on Add more Zombie API
Testing in game verified the zombie's arms raise and fall correctly
when using the API.
Renamed the OBFHELPER since the method is placed on EntityInsentient
(since we want to conflict on changes).
2019-05-12 23:57:49 -04:00
Spottedleaf
a22dfd8c16 Remove TODO on Add ray tracing methods to LivingEntity
Note: The entity parameter stays 'this' since we want the block the
entity is targetting. This can change based on the block the player
has in their hand (see scaffholding). With a scaffhold in hand, the
scaffhold blocks in the world become solid 1x1x1 cubes, and without they
follow their model's shape.
2019-05-12 23:57:49 -04:00
Spottedleaf
dc97f7d401 Fix TODOs in Optional TNT doesn't move in water
Turns out the doWaterMovement method was never called.
Moved the tracker updates into tick() and delete doWaterMovement
2019-05-12 23:57:49 -04:00
Spottedleaf
5a44b38dc5 Resolve TODO on PlayerNaturallySpawnCreaturesEvent
- Add missing isCancelled check

We don't need to worry about going out of range of int
since the value is clamped to view distance, and view
distance is clamped to 33
2019-05-12 23:57:49 -04:00
Shane Freeder
92e77aa7cb
Merge branch 'master' into ver/1.14 2019-05-10 20:06:21 +01:00
Shane Freeder
150fb7cda8
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:
7d29eb5e SPIGOT-4899: Horse inventory title not set
2019-05-10 19:11:17 +01:00
Shane Freeder
026210202b
Fix MCUtils and other calls to postTaskOnMain
Method changed changed it's role to providing a TickTask object which
isn't automatically scheduled onto the server
2019-05-10 18:42:33 +01:00
Spottedleaf
994679a0c9 Fix patch "Faster redstone torch rapid clock removal" (#2014)
Tux pointed out the patch still has O(n^2) time complexity since
the sublist class in arraylist does not override clear() from
AbstractList, which uses a forward moving iterator to clear
the list.

Resolved by using a peek and poll from ArrayDeque.

This patch also removes the useless WeakHashMap which holds
the list (it mapped world->list) and replaces it with a
field on World.
2019-05-10 16:48:58 +01:00
Shane Freeder
e0d8e0dde5
fix missing reversion of api patch
(Let's pretend you didn't see this)
2019-05-09 15:36:43 +01:00
Shane Freeder
a72509fbe1
Fix accidental reversion of patches, oops 2019-05-09 15:23:52 +01:00
Shane Freeder
7f9b65035a
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:
fe0cadf0 Add BlockShearEntityEvent for Dispensers shearing Sheep
90e5cca3 SPIGOT-4892: Allow to set the currently viewed page of a book on a lectern inventory
a30337f7 SPIGOT-4887: Villager level minimum is 1
d88d828c SPIGOT-4886: Villager type SNOWY should be named SNOW

CraftBukkit Changes:
6ceffb0d SPIGOT-4895: Bed doesn't explode in Nether and The End
ee881847 SPIGOT-4888: setSleepingIgnored resets the night even when there is no one in a bed
15e02b40 SPIGOT-4890: EntityDeathEvent fires twice when breaking an armor stand in survival mode
b38a3c33 Add BlockShearEntityEvent for Dispensers shearing Sheep
70ebefca SPIGOT-4891: LecternInventory.getType() should return InventoryType.LECTERN
0036d1b7 SPIGOT-4887: Villager level minimum is 1
2019-05-09 08:20:01 +01:00
Spottedleaf
8191255cfa Use WorldServer#entitesById for entity iteration
WorldServer#globalEntityList is not the actual list of entities in a world
2019-05-07 18:49:41 -07:00