Commit Graph

1323 Commits

Author SHA1 Message Date
Aikar
39ea0d21dc
Restore World.loadChunkAsync API - but load chunks sync
We are still missing Async Chunk Loading, but plugins may be
depending on this API, so it missing blocks upgrading.
2018-07-21 16:55:43 -04:00
Aikar
1d28f62522
Rebuild patches for upstream merge 2018-07-21 16:43:00 -04:00
Aikar
6b63a88df0
Merge branch 'master' into pre/1.13
* master:
  Duplicate UUID Resolve Option
  Add more information to Entity.toString
  change LAST_EDIT to PAPER_LAST_EDIT for edit commands
  Add more information to Entity.toString()
  Add Debug Entities option to debug dupe uuid issues
  Guard the Entity.SHARED_RANDOM from seed changes
  Create a symlink on not-windows to current minecraft decompile dir
2018-07-21 16:25:36 -04:00
Aikar
dc8f516424
Update Upstream 2018-07-21 16:03:10 -04:00
Aikar
d0cd5b3b23
Duplicate UUID Resolve Option
Due to a bug in 2e29af3df0
which was added all the way back in March of 2016, it was unknown (potentially not at the time)
that an entity might actually change the seed of the random object.

At some point, EntitySquid did start setting the seed. Due to this shared random, this caused
every entity to use a Random object with a predictable seed.

This has caused entities to potentially generate with the same UUID....

Over the years, servers have had entities disappear, but no sign of trouble
because CraftBukkit removed the log lines indicating that something was wrong.

We have fixed the root issue causing duplicate UUID's, however we now have chunk
files full of entities that have the same UUID as another entity!

When these chunks load, the 2nd entity will not be added to the world correctly.

If that chunk loads in a different order in the future, then it will reverse and the
missing one is now the one added to the world and not the other. This results in very
inconsistent entity behavior.

This change allows you to recover any duplicate entity by generating a new UUID for it.
This also lets you delete them instead if you don't want to risk having new entities added to
the world that you previously did not see.

But for those who are ok with leaving this inconsistent behavior, you may use WARN or NOTHING options.

It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
2018-07-21 14:47:05 -04:00
Aikar
7279362307
Add more information to Entity.toString 2018-07-21 14:46:56 -04:00
NickAcPT
7dd5837dd0 Fixed more stuff 2018-07-21 18:17:54 +01:00
NickAcPT
09f013532a Remove unsed method 2018-07-21 16:54:52 +01:00
NickAcPT
e5ea4656b2 Extend player profile API to support skin changes
Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile
2018-07-21 16:22:10 +01:00
Aikar
4a4d299641
Add more information to Entity.toString() 2018-07-21 10:29:37 -04:00
Aikar
c1c9d850f1
Add Debug Entities option to debug dupe uuid issues
Add -Ddebug.entities=true to your JVM flags to enable more logging
2018-07-21 10:29:14 -04:00
Aikar
82bcd1408a
Guard the Entity.SHARED_RANDOM from seed changes
I don't clearly see any, but as a protection for future changes.
2018-07-21 10:28:45 -04:00
NickAcPT
e67d55d00d Extend player profile API to support skin changes
Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile
2018-07-21 15:17:59 +01:00
Brokkonaut
ff4ae7b05e 1.13: Resend bed on cancelled interaction (#1245)
Minecraft 1.13 requires resending the block for both parts of the bed
2018-07-21 08:47:22 -04:00
BillyGalbreath
c2d29a73ac PlayerElytraBoostEvent 2018-07-21 02:00:31 -05:00
Shane Freeder
1fe8472503
update B/CB/S 2018-07-20 20:57:43 +01:00
Zach Brown
dd66bcb809
Merge branch 'master' into pre/1.13 2018-07-20 14:15:12 -05:00
Minecrell
a081172687
Rebuild patch numbers 2018-07-20 14:07:54 -05:00
Minecrell
30ea96ab27 Update to TerminalConsoleAppender 1.1.1 (#1240)
See https://github.com/Minecrell/TerminalConsoleAppender/releases/tag/1.1.1
2018-07-20 14:04:11 -05:00
Zach Brown
0030708509
Move decomp fix from last up to fixes patch 2018-07-19 16:55:27 -05:00
Zach Brown
18ae09c90a
Fix crash in RegionLimitedWorldAccess 2018-07-19 16:51:32 -05:00
Shane Freeder
493df9ea5c
Merge branch 'master' into pre/1.13 2018-07-19 20:23:18 +01:00
Minecrell
8a5f46a0db Avoid adding NetworkManager twice
The removal of `ServerConnection.this.h.add(networkmanager);` got
lost in the 1.13 update, causing network managers to be registered
twice.

Fixes "handleDisconnection() called twice" warning spam in console.
2018-07-19 20:14:27 +02:00
Minecrell
ac58987add Fix decompile/deobfuscation error in BlockPosition iterator
Some of the fields in the anonymous class are named the same as the
surrounding method's parameters, which caused the fields to be
initialized incorrectly.

That way it keeps returning the same block position, resulting
in an infinite loop during chunk generation.
2018-07-19 19:50:34 +02:00
Hugo Manrique
ab5c87e570 Avoid item merge if stack size above max stack size (#1217) 2018-07-19 10:51:55 -05:00
Minecrell
bf21060ad9 Use asynchronous Log4j 2 loggers 2018-07-19 10:48:52 -05:00
Minecrell
0915495113 Update TerminalConsoleAppender to 1.1.0
Fixes a race condition when using TerminalConsoleAppender that may
result in IllegalStateExceptions or duplicate input prompts.
2018-07-19 10:48:52 -05:00
Aikar
ef099d2812
Update master patches just merged to 1.13 2018-07-19 01:51:01 -04:00
Aikar
dc1b407c7d
Merge branch 'master' into pre/1.13
* master:
  Don't process despawn if entity is in a chunk scheduled for unload
  Fix Squids corrupting the entire servers entity randomness....
  Fix placement of chunk tracking - Fixes #1199
2018-07-19 01:46:11 -04:00
Aikar
9aec6a9fe9
Don't process despawn if entity is in a chunk scheduled for unload
This won't happen anyways if the user has
"skip ticking for entities in chunks scheduled for unload" turned on,
but if they don't, protect from this instant killing the entity to
keep it vanilla in behavior

a player may teleport away, and trigger instant despawn
2018-07-19 01:25:18 -04:00
Aikar
5f8fac8acd
Fix Squids corrupting the entire servers entity randomness....
Really hope this solves #1223

Also re-add vanilla debug messages back and add uuid to toString
2018-07-19 01:13:53 -04:00
Shane Freeder
84c98c2ba8
NOT FINISHED! She compiles, and she... suffers the wrath of chunkgen... 2018-07-19 05:42:43 +01:00
Shane Freeder
3bcba64d28
NF! 1.13 - more fixes 2018-07-19 00:31:45 +01:00
Shane Freeder
c99e4a22aa
NOT FINISHED! 1.13 pre-7
I need more creative commit messages.
2018-07-19 00:16:19 +01:00
Shane Freeder
f3b00978d9
NOT FINISHED! 1.13 pre-7 - Holy moley, more patches!
Really, don't touch! may harm your cat!
2018-07-18 19:55:52 +01:00
Aikar
dd390c99fd
fix a patch catboy asked me to 2018-07-18 01:08:17 -04:00
Aikar
3d8746445e
NOT FINISHED: Current progress, updated upstream 2018-07-18 00:52:45 -04:00
Shane Freeder
f7a676930a
NOT FINISHED! restore dropped patches, fix one more! 2018-07-18 01:37:38 +01:00
Shane Freeder
130b9a0a36
NOT FINISHED! 1.13-pre7 - even more patches!
Patches, patches everywhere!
2018-07-18 01:08:13 +01:00
Shane Freeder
885edbdaf5
NOT WORKING! Even even more patches! 2018-07-17 21:32:26 +01:00
Shane Freeder
4ec5e6e37f
NOT FINISHED! Fixed a few decomp issues 2018-07-17 16:14:23 +01:00
Shane Freeder
8bf65f2872
NOT FINISHED! even more 1.13-pre patches! 2018-07-17 01:32:54 +01:00
Shane Freeder
63214cb795
NOT FINISHED!!! More progress on 1.13-pre7
This work is unfinished, keep your paws off this branch!
2018-07-16 16:43:38 +01:00
Aikar
878e963fc6
Delete some dupe patches (should be fixed going forward) 2018-07-16 00:32:35 -04:00
Aikar
5b6dfb3463
NOT FINISHED!!! Current Progress on 1.13-pre7 update
This work is 100% unfinished. I am pushing it up so that we as a team
can work on this update.

Do not try to use this branch. You will fail.
2018-07-16 00:13:29 -04:00
Aikar
5d8b3d4969
Fix placement of chunk tracking - Fixes #1199
Spigot had code that returned early in chunk add/remove methods.

This was causing our code added to set current chunks and counts to
be skipped over if the entity was default not persistent but made persistent.

This was the source of many issues

Fixes #1208
2018-07-15 02:44:37 -04:00
Aikar
230bf934b5
Fix issue with entity activation range check - #1199 2018-07-14 00:12:42 -04:00
Minecrell
801e2ee3b1 Refresh player inventory when cancelling PlayerInteractEntityEvent (#1205)
When interacting with entities with an item, the client will assume
the interaction is successful, and update the held item on the
client. However, if the interaction is cancelled on the server side,
the client will still mistakenly remove/replace the item in hand.

Examples for this are milking cows with a bucket or dyeing sheep.
The bucket is replaced with milk and the dye removed from inventory.

Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
2018-07-13 16:52:34 -04:00
Minecrell
778d4b24f3 Avoid visual issues for adjacent blocks when cancelling PIE (#1198)
The adjacent blocks of doors, double plants, pistons and beds need
to be updated manually from the server when cancelling a block break
from a player, as it otherwise causes the other parts to disappear
on the client.

This is already done for doors but only for the BlockBreakEvent,
not for PlayerInteractEvent. Move the code to a common method
and also handle the other blocks in similar ways.
2018-07-13 02:48:51 -05:00
Minecrell
81688d28d2 Avoid Netty buffer leak in LegacyPingHandler. Fixes #1200 (#1201)
The extra buffer used to decode the strings sent by the client
in the legacy ping protocol was never released. However, creating
an extra copy of the buffer just to decode it to a string isn't
actually necessary: We can just call toString() directly on the
original buffer.

Additionally, free the buffer in handlerRemoved() to handle cases
where the client never sends enough bytes to form a valid legacy
ping request.
2018-07-13 02:43:56 -05:00
Zach Brown
5b02e5736a
Update upstream B/CB 2018-07-13 02:39:44 -05:00
Aikar
db4ecc9d9d
Multitude of changes to attempt to fix #1199 2018-07-12 16:50:17 -04:00
Shane Freeder
73b214a515
Don't send digged block updates for unloaded chunks 2018-07-12 15:19:33 +01:00
Aikar
7bb3f45ce1
don't use a stream for entity counts (performance) 2018-07-10 01:06:09 -04:00
Shane Freeder
aa3751e974
hopefully fix entity issues - #1199
@Aikar
2018-07-09 19:48:49 +01:00
Aikar
6745297b05
Only use stored chunk ref if it matches current chunk registration
Closes #1197

While this really undoes a lot of the desired performance gains avoiding chunk lookups,
we sadly have to accept this because we are seeing lots of bugs with entities.
2018-07-08 22:39:46 -04:00
Aikar
18c1127fcd
Improve bed search pattern to go inwards out for bed search radius 2018-07-08 03:30:40 -04:00
Aikar
17525cd54b
Fix weird bugs with entities - Fixes #1195 2018-07-05 18:39:43 -04:00
Aikar
0ae8b2f893
Missed a case where to remove a chunk lookup on TE removal (performance, not bug fix) 2018-07-04 17:29:10 -04:00
Aikar
e4b436a05d
[CI-SKIP] Remove paper tags - Fixes #1192 2018-07-04 17:26:54 -04:00
Aikar
5da42b1fb2
Fix Tile Entities - #1192 Fixed 2018-07-04 17:22:38 -04:00
Aikar
3d1f804a22
Vex#getOwner API
Get's the NPC that summoned this Vex
2018-07-04 15:32:30 -04:00
Aikar
467d4d463e
Configurable Bed Search Radius
Allows you to increase how far to check for a safe place to respawn
a player near their bed, allowing a better chance to respawn the
player at their bed should it of became obstructed.

Defaults to vanilla 1.
2018-07-04 15:23:15 -04:00
Aikar
fcdc18e556
support plugins calling OBC directly for inventory close event 2018-07-04 12:33:38 -04:00
Aikar
bbfb696f30
Avoid Chunk Lookups for Entity/TileEntity Current Chunk
In many places where we simply want the current chunk the entity
is in, instead of doing a hashmap lookup for it, we now have access
to the object directly on the Entity/TileEntity object we can directly grab.

Use that local value instead to reduce lookups in many hot places.
2018-07-04 03:58:56 -04:00
Aikar
18c3716c49
Current Chunk for Entity and Block Entities, counts by entity type
This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.

We also store counts by type to further enable other performance optimizations in later patches.
2018-07-04 03:58:56 -04:00
Aikar
f534210885
InventoryCloseEvent Reason API
Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
2018-07-03 21:57:33 -04:00
Brokkonaut
e19ed02025
Add World.getEntity(UUID) API
This is the best way to get an entity when the world and its UUID are known.
It is faster than Server.getEntity(UUID) because it does not have to iterate all worlds
2018-07-03 14:53:28 -05:00
BillyGalbreath
8f1e26286f
Add config to disable ender dragon legacy check (#1167) 2018-07-03 14:48:54 -05:00
Brokkonaut
2ed792d699
Improve ProjectileHitEvent to include the BlockFace where the projectile has hit (#1182) 2018-07-03 14:34:42 -05:00
Shane Freeder
aedf167268
Cleanup allocated favicon ByteBuf (fixes #1191)
Cleanups a bytebuffer which was allocated during the encoding of the
favicon to be sent to the client.
2018-07-03 19:19:47 +01:00
Shane Freeder
a48b6064a8
Extend Player Interact cancellation to handle FlowerPots 2018-07-03 04:45:52 +01:00
Aikar
2adb879802
Add Critical missing Bukkit API - setTarget/getTarget moved down to SentientNPC
This fixes a CRITICAL missing part of the Bukkit API due to mistakes on upstream
refusing to implement the Sentient NPC baseclass of all NPC's.

Until now, the Bukkit API has not provided a way for accessing and setting
a non creature entities target.

Although Flying, Slime, Ambient, and Water mobs all supported targets internally,
you were unable to get/set it.

Now with the SentientNPC API and these API's moved down, every sentient NPC has
access to target data.
2018-07-01 22:10:21 -04:00
Aikar
b922ff9886
Fix issues with getBlockState(false) not loading Tile Entity data
This only impacted people who used our useSnapshots new API in a plugin,
which obviously was no one as the data result was completely broken.

Merged the NPE check patch into mine since it has to handle it too.
2018-06-30 01:40:52 -04:00
Aikar
98555e9b90
LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item

Also aliased isHandsRaised for isChargingAttack in RangedEntity
2018-06-29 00:55:29 -04:00
Aikar
7abf2eeeac
RangedEntity API
Allows you to determine if an entity is capable of ranged attacks,
and to perform an attack.
2018-06-26 22:08:01 -04:00
Minecrell
eb7341f821 Disable JLine event expansion. Fixes #1171 2018-06-25 17:40:35 +02:00
Aikar
f0cb089a24
Fix another case where villages load chunks 2018-06-21 22:58:09 -04:00
Aikar
9b1e9b43ff
Update Upstream 2018-06-20 23:29:33 -04:00
Aikar
980d53d156
Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
2018-06-20 23:19:46 -04:00
Brokkonaut
a5285de480 Add EntityKnockbackByEntityEvent (#1162)
This event is called when an entity receives knockback by another entity. The knockback can be modified in the event. If the event is cancelled the entity is not knocked back.
2018-06-20 21:59:11 -04:00
Aikar
d5817e9910
Fire EntityShootBowEvent for Illusioner 2018-06-18 22:19:59 -04:00
Zach Brown
384059607e
Tie PlayerList#moveToWorld safety to existing config
Also renames patch file to better express what it's doing.

It is presumed that those using this config option intend for
suffocation checks to be disabled in all instances. In doing so, they
inherently assume the advantages and issues associated with removing
said safety check.

If the community expresses a desire for more specific options regarding
the handling of this safety feature, we can investigate providing them.

Fixes GH-1149
2018-06-18 16:27:33 -05:00
Aikar
c92fa14d36
PlayerReadyArrowEvent
Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
2018-06-18 01:13:16 -04:00
Aikar
76d60b167f
EntityShootBowEvent consumeArrow and getArrowItem API
Adds ability to get what arrow was shot, and control if it should be consumed.
2018-06-18 00:39:04 -04:00
Aikar
9fee3b6963
accidently set the wrong collection on last commit
copy pasting...
2018-06-16 16:32:26 -04:00
Aikar
708d52ca03
Ignore Missing Recipes in RecipeBook to avoid data errors
This code was causing NPE's in saving player data, potentially related to reloads.
2018-06-16 16:30:29 -04:00
BillyGalbreath
1ae07ecf52 Make shield blocking delay configurable (#1154)
Resolves #1153
2018-06-16 15:54:35 -04:00
Aikar
4f29a0ce0a
Print Error details when failing to save player data 2018-06-15 20:40:39 -04:00
Aikar
50a23d5ea3
Configurable Alternative LootPool Luck Formula
Rewrites the Vanilla luck application formula so that luck can be
applied to items that do not have any quality defined.

See: https://luckformula.emc.gs for data and details
-----------

The rough summary is:
My goal was that in a pool, when luck was applied, the pool
rebalances so the percentages for bigger items is
lowered and smaller items is boosted.

Do this by boosting and then reducing the weight value,
so that larger numbers are penalized more than smaller numbers.
resulting in a larger reduction of entries for more common
items than the reduction on small weights,
giving smaller weights more of a chance

-----------

This work kind of obsoletes quality, but quality would be useful
for 2 items with same weight that you want luck to impact
in varying directions.

Fishing still falls into that as the weights are closer, so luck
will invalidate junk more.

This change will result in some major changes to fishing formulas.

-----------

I would love to see this change in Vanilla, so Mojang please pull :)
2018-06-15 00:32:35 -04:00
Aikar
1127a49ced
If we remove a corrupt TE, ensure we save the chunk 2018-06-15 00:11:39 -04:00
Black Hole
ea8801ce28 Actually call EntityTeleportEndGatewayEvent (#1147) 2018-06-13 16:29:49 -05:00
Brokkonaut
8b371226fb Avoid int overflow in lootable refill time calculations (#1146)
Fixes https://github.com/PaperMC/Paper/issues/1141
2018-06-13 14:15:31 -04:00
Shane Freeder
179439e48e
[CI-SKIP] Fix comment on unlit chunk sending patch 2018-06-12 15:46:08 +01:00
Aikar
84d350c24c
Fix CraftEntity hashCode
hashCodes are not allowed to change, however bukkit used a value
that does change, the entityId.

When an entity is teleported dimensions, the entity reference is
replaced with a new one with a new entity ID.

For hashCode, we can simply use the UUID's hashCode to keep
the hashCode from changing.

equals() is ok to use getEntityId() because equals() should only
be true if both the left and right are the same reference.

Since entity ids can not duplicate during runtime, this
check is essentially the same as this.getHandle() == other.getHandle()

However, replaced it too to make it clearer of intent.
2018-06-10 20:29:15 -04:00
Aikar
ca0ec24d64
Properly remove entities on dimension teleport
To teleport an entity between dimensions, the server makes a copy
and puts the copy in the new location, and marks the old one dead.

If this method got called for the same world in the same tick,
the entity would not have been removed from the UUID map, and the
world readd would fail.

This can be triggered even with a plugin if the entity is teleported
twice in the same tick, from world A to B, then back from B to A.

The re-add to A will fail to add the entity to the world. It will
actually be there, but it will not be visible on the client until
the server is restarted to re-try the add to world process again.

This bug was unlikely to be seen by many due to the double teleport
requirement, but plugins (such as my own) use this method to
trigger a "reload" of the entity on the client.
2018-06-10 20:09:56 -04:00
Shane Freeder
939ca17007
Fix missed change inside of CraftSkullMeta 2018-06-10 12:45:04 +01:00
Aikar
4fbed1adab
Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
2018-06-10 01:29:20 -04:00
Shane Freeder
5913a2cc1a
Add EntityTeleportEndGatewayEvent for entities (closes #1124) 2018-06-09 14:21:40 +01:00
Shane Freeder
ecc9347238
Allow plugins to replace texture if already set on skulls 2018-06-09 12:09:21 +01:00