1235 Commits

Author SHA1 Message Date
Dylan K. Taylor
90482e79bc Merge branch 'release/3.4' 2018-10-21 18:23:54 +01:00
Dylan K. Taylor
6dd2597934 Merge branch 'release/3.3' into release/3.4 2018-10-21 18:17:07 +01:00
Dylan K. Taylor
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
Dylan K. Taylor
159c3a1a91 Merge branch 'release/3.4' 2018-10-20 19:20:22 +01:00
Dylan K. Taylor
2a40c0d82c Make use of isInLoadedTerrain() 2018-10-20 19:13:34 +01:00
Dylan K. Taylor
831a35ec69 Merge branch 'release/3.4' 2018-10-20 15:26:17 +01:00
Dylan K. Taylor
d563b9e31b Level: Added API method broadcastPacketToViewers()
This supersedes addChunkPacket() in most cases, and has a more clear name. It broadcasts the given packet to every player who has the target position within their chunk load radius.
2018-10-20 15:14:41 +01:00
Dylan K. Taylor
e2af394c81 Revert "Level: Identify chunk loaders by their object ID"
This reverts commit 3bb450244fda8c2e7050e44e8a392960ef63f02f.

PhpStorm you lying piece of shit... you only showed me the usages in Level!

This change should be revised and redone later.
2018-10-10 03:59:07 -04:00
Dylan K. Taylor
9b31484655 Merge branch 'release/3.3' 2018-10-09 22:53:44 +01:00
Dylan K. Taylor
de6d62aba2 Merge branch 'release/3.2' into release/3.3 2018-10-09 22:51:40 +01:00
Dylan K. Taylor
8316e00927 Player: Throw exception on failure to encode form JSON 2018-10-09 22:39:48 +01:00
Dylan K. Taylor
3bb450244f Level: Identify chunk loaders by their object ID
chunkloader ID is completely unnecessary extra complication. spl_object_hash() would be fine for this as well, but a number is better. Since it's unique for the object lifetime (and the Level keeps a ref to loaders) this system should work just fine.
2018-10-09 16:32:34 +01:00
Dylan K. Taylor
495a0b1dc2 Merge branch 'release/3.3' 2018-10-05 18:11:33 +01:00
Dylan K. Taylor
1dd6591ac1 Migrate a bunch of PluginManager->callEvent() usages to Event->call
This has the triple bonus effect of a) making a lot of code easier to read, b) reducing Server::getInstance() usages, and c) removing a whole bunch of Server dependencies.

The network and block namespaces are untouched by this commit due to potential for merge conflicts. These should be dealt with separately on master.
2018-10-05 17:30:06 +01:00
Dylan K. Taylor
16f2ac14b3 Clean up block update sending, remove UpdateBlockPacket flag constants
These flags are not intended for network use, instead they are supposed to be used internally by the game. For network, we only need to care about the 0x02 flag (send to players) because that's necessary for the client to render the block.
2018-09-27 15:56:08 +01:00
Dylan K. Taylor
56d9943b0d Nuke Block->meta, split into variant and state properties, lots of cleanup
This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together.

The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
2018-09-21 19:28:10 +01:00
Dylan K. Taylor
d291345ed7 Clean up some unused imports 2018-09-19 16:20:16 +01:00
Dylan K. Taylor
caca097300 Merge branch 'release/3.3' 2018-09-19 16:18:53 +01:00
Dylan K. Taylor
5e94d20d79 Merge branch 'release/3.2' into release/3.3 2018-09-19 16:17:00 +01:00
Dylan K. Taylor
a0bb747d6d Merge branch 'release/3.1' into release/3.2 2018-09-19 16:16:18 +01:00
Dylan K. Taylor
4bc0d850b1 Added Block->getRuntimeId(), clean up some mess 2018-09-19 16:16:10 +01:00
Dylan K. Taylor
db2567f965 Separate use-item action from PlayerInteractEvent
This solves the age-old issue of PlayerInteractEvent firing twice when a player clicks a block with an item in the hand.

API changes:
- Removed PlayerInteractEvent constants LEFT_CLICK_AIR, RIGHT_CLICK_AIR and PHYSICAL.
- PlayerInteractEvent no longer fires when the player right-clicks the air.
- Added new event PlayerItemUseEvent.
2018-09-14 16:24:29 +01:00
Dylan K. Taylor
b660bcdb65 Merge branch 'release/3.3' 2018-09-14 16:20:22 +01:00
Dylan K. Taylor
22077c1fdd Merge branch 'release/3.2' into release/3.3 2018-09-14 16:18:19 +01:00
Dylan K. Taylor
7d54d18732 Merge branch 'release/3.1' into release/3.2 2018-09-14 16:18:12 +01:00
Dylan K. Taylor
bfbc845efa Remove impossible uses of PlayerInteractEvent CLICK_AIR constants 2018-09-14 16:17:55 +01:00
Dylan K. Taylor
653fa1213e
Added an event for handling duplicate logins (#2430) 2018-09-12 11:23:48 +01:00
Dylan K. Taylor
ebc1524f9a Merge remote-tracking branch 'origin/release/3.3' 2018-09-12 10:39:49 +01:00
Dylan K. Taylor
a9fc67663c
Strip anti flight out of the core (#2428)
This may later be developed into a plugin if it is a desired feature, but having it in the core is unnecessary and a pain in the ass.
2018-09-12 10:06:57 +01:00
Dylan K. Taylor
034472bfe7 Merge branch 'release/3.3' 2018-09-04 11:58:19 +01:00
Dylan K. Taylor
e621cde8f1
Player: Tighten validity checks for addWindow() (#2419)
- Don't allow the same window ID to be used when another window is already using it
- Detect window ID collisions when selecting IDs for regular containers (should never happen, but anything is possible)
2018-09-01 15:25:46 +01:00
Dylan K. Taylor
888dba704b Merge branch 'mcpe-1.6' into release/3.2 2018-08-29 16:23:53 +01:00
Dylan K. Taylor
d6376a236d Player: assign allowFlight directly instead of using setter
fixes #2397

This was changed by a4939b6bf11e3da6f3ffc569540fafd8eba84545 without apparent reason. It causes AdventureSettings to be sent too early.
2018-08-22 19:20:21 +01:00
Dylan K. Taylor
9ca38ba868 Protocol changes for 1.6.0.8 + resource packs "fix" 2018-08-21 17:36:55 +01:00
Dylan K. Taylor
986077e03c Protocol changes for 1.6.0.1 2018-08-21 17:14:53 +01:00
Dylan K. Taylor
1177a381c8 Merge branch 'release/3.2' 2018-08-19 11:45:16 +01:00
Dylan K. Taylor
0dc4bd36e1 Form: change handleResponse() return type to void
this returning is counter intuitive and doesn't make any sense without the queuing mechanism. Instead it's simpler to just use Player->sendForm().
2018-08-19 11:44:59 +01:00
Dylan K. Taylor
06d7ee283d Player: Don't use iusername in cases where it's useless
these calls all do strtolower() anyway, so having iusername here just makes it confusing.
2018-08-18 13:42:00 +01:00
Dylan K. Taylor
a306421737 Entity: remove lastX lastY lastZ lastYaw lastPitch, replace with lastLocation object field 2018-08-18 13:38:19 +01:00
Dylan K. Taylor
d32b9ec5dc Player: remove useless write to NBT
the parent constructor doesn't care about this tag, and the tag is discarded afterwards.
2018-08-15 14:56:02 +01:00
Dylan K. Taylor
b3d8d10bec Player: move flight toggling to its own method 2018-08-14 19:21:13 +01:00
Dylan K. Taylor
d8198d8130 Fixed setItemInHand() regressions when placing or breaking blocks
this was causing any items set into the hand during these events _at all_ to get overwritten, rather than just tools. That's a bit of a problem for buckets because buckets rely on a bad hack to handle the modified items.

This doesn't fix the tools bug, but that's a job for another time.
2018-08-14 16:44:14 +01:00
Dylan K. Taylor
cef1fe9524 Merge branch 'release/3.2' 2018-08-14 16:11:42 +01:00
Dylan K. Taylor
df8e10cad9 Forms API, part 1: add Player->sendForm() and Form interface
There's no implementation here yet, but that can come later. This lays the ground for allowing plugins to have an integrated method to send forms, as well as a solution to the ID conflict problem.

A built in implementation should not be a concretion and it should be able to be swapped for third party implementations. This enables the possiblity to do so.
2018-08-14 16:06:55 +01:00
Dylan K. Taylor
0273e2484e
Kill entity runtime NBT (#2361) 2018-08-14 13:33:02 +01:00
Dylan K. Taylor
15bac8c58a
Implement send buffering and queuing for network sessions (#2358)
Async compression and broadcasts are now reliable and don't have race condition bugs.
This features improved performance and significantly reduced bandwidth wastage.

Reduce Level broadcast latency by ticking network after levels. This ensures that session buffers get flushed as soon as possible after level tick, if level broadcasts were done.
2018-08-13 14:37:18 +01:00
Dylan K. Taylor
ec9ef891ee Player: clean up some runtime usages of NBT
the goal is to get rid of this completely, but that's slightly complicated by the mess that is player creation right now.
2018-08-07 18:27:22 +01:00
Dylan K. Taylor
16b789a528 Player: remove useless checks from save()
this should never be called for a player with an empty username (because data isn't saved unless the player was spawned) and the instanceof is laughable.
2018-08-07 17:37:55 +01:00
Dylan K. Taylor
55ac1c80c9 Player: replace redundant usage of Server->broadcast() 2018-08-07 17:33:57 +01:00
Dylan K. Taylor
ff6d590d0c PlayerInventory: Send updates to viewers automatically on setItemInHand() 2018-08-05 19:31:21 +01:00