Compare commits

...

2750 Commits

Author SHA1 Message Date
6e5759b1d1 Made incompatible client disconnect messages more informative 2017-09-25 14:30:11 +01:00
03d3e595d6 Implement JWT signature verification and Xbox Live checks, close #315
This can be enabled or disabled using the "online-mode" directive in
server.properties.

NOTE: For safety reasons it is enabled by default, since many naive server owners currently believe that authentication is not needed because "the client is forced to sign-in".
Newsflash for readers: the forced authentication is easily bypassed using a LAN proxy.

Un-authenticated LAN connections will still work fine if the online mode is disabled.

Added the following API methods:
- Server->getOnlineMode() : bool
- Server->requiresAuthentication() : bool
- Player->isAuthenticated() : bool

JWT verification is rather expensive, so it is done in an AsyncTask. Make sure you don't hog your worker threads.
2017-09-25 12:30:58 +01:00
8ca59d12e9 Updated PocketMine-Language submodule 2017-09-25 11:36:39 +01:00
89e4defa29 use null coalesce in Server->getLevel() 2017-09-25 09:51:21 +01:00
f5534a9ab0 Server: add some typehints 2017-09-25 09:49:19 +01:00
28bce8d48c Fixed plugins causing crashes by using Level->unload() and add a warning
yes, we don't want you to use this, but it still shouldn't crash if it can be prevented...
2017-09-25 09:46:19 +01:00
3c02a6a8ed Fixed eating sounds 2017-09-24 21:18:08 +01:00
6b0ac8adb8 Don't overwrite the input map with reindexed stuff
we might need this again?
2017-09-24 19:17:00 +01:00
38ec5da260 Refactored API compatibility checking code into its own method (#1394)
Refactored API compatibility checking code into its own method so plugins can use it
this change was inspired by https://github.com/poggit/devirion/blob/master/src/poggit/virion/devirion/DEVirion.php#L140-L172
2017-09-24 15:00:08 +01:00
240cc3043a Rewritten crafting, fixed #45 2017-09-24 14:14:24 +01:00
043ae487de Fixed some inconsistent uses of new ShortTag vs setValue() in Furnace 2017-09-24 10:34:25 +01:00
f12701e582 Fixed possible undefined NBT in Furnace, close #1398 2017-09-24 10:29:36 +01:00
6e961ae897 Addition of Coarse Dirt (#1396) 2017-09-23 22:25:03 +01:00
e1d10f595a AdventureSettingsPacket: removed leftover TODO comment 2017-09-23 16:51:58 +01:00
178dd1b981 Fixed block picking, added PlayerBlockPickEvent 2017-09-23 14:42:28 +01:00
826ec90856 Revert "Workaround for some plugins crashing clients during PlayerLoginEvent"
This reverts commit 087a994393.
2017-09-23 13:23:19 +01:00
0523f26613 Send forced movement when getting bad movements after teleport, fixes AlwaysSpawn-type plugins
it's mostly harmless to send it here anyway
2017-09-23 12:49:46 +01:00
5190d9c1e2 Fixed possible issue with JWT decoding
this is url-encoded, these characters should be replaced before base64_decode()ing. Not sure how this didn't get noticed before now.
2017-09-22 19:52:08 +01:00
c8fd0eaf8b Removed autogenerated stub TODO from BoneBlock 2017-09-21 19:50:03 +01:00
53ef9b653a Added some getters to FloatingTextParticle 2017-09-21 19:10:30 +01:00
030cc4afb0 FloatingTextParticle: import cleanup & typehints 2017-09-21 19:09:33 +01:00
9bd7f771d3 "Fixed" FloatingTextParticle yet again
- nametag visibility flags don't work properly, only players show them all the time
- invisibility overrides nametag visibility
- scale 0 triggers asserts on debug builds

..... how hard is it to NOT break these simple things each update Mojang?

closes #1205
2017-09-21 19:04:45 +01:00
10f6a0eef0 FloatingTextParticle: fixed incorrect parameter type doc 2017-09-21 18:31:12 +01:00
d0a96f35da ./ hack is back (/help is client-side >_<) 2017-09-21 17:51:39 +01:00
65e908a403 Move Travis Test server files into a separate directory
this is for convenience locally running Travis Test so my existing data doesn't interfere
2017-09-21 17:16:27 +01:00
d7091f4460 Fixed not being able to disable stats reporting using command line options 2017-09-21 17:14:44 +01:00
c6670b2e74 Fixed Nether Wart's name 2017-09-21 16:56:41 +01:00
194278d986 Updated TesterPlugin submodule 2017-09-21 16:56:27 +01:00
0e2e9aab2e Fixed crash when block classes override the constructor but don't specify a fallback name 2017-09-21 16:43:33 +01:00
1b5fed983b Revert "Fixed slab placement, close #145", reopen #145, close #1314
This reverts commit f2ff0198cc.
2017-09-21 14:41:18 +01:00
5aba87b250 Added brown and red mushroom blocks 2017-09-21 14:07:51 +01:00
f01ce8e994 null and void typehints 2017-09-21 12:54:04 +01:00
d89b8cf12e Clean up SlotChangeAction inventory handling 2017-09-21 12:44:03 +01:00
6aa9b081e9 Cleanup unused imports 2017-09-21 12:26:41 +01:00
dbed80386a Removed redundant interface 2017-09-21 12:22:47 +01:00
cefad0444c Merge branch 'master' into mcpe-1.2 2017-09-21 10:32:35 +01:00
ee052f91d4 Fixed some air items with count 1 instead of 0 2017-09-21 10:30:14 +01:00
ef6250967f Use Item->isNull() more 2017-09-21 10:29:29 +01:00
61cfdac6a1 Fixed a mistake in entity attack handler 2017-09-21 10:18:52 +01:00
fd7fb10223 Return null on unmatched inventory action and log details 2017-09-20 18:38:14 +01:00
6897cb4774 Moved inventory action magic slot constants where they belong 2017-09-20 18:27:29 +01:00
8e7ad532f1 Updated RakLib submodule 2017-09-20 18:16:41 +01:00
9e8366725a Bump for 1.2.0.81 2017-09-20 17:30:27 +01:00
b14ecc18c4 Remove unused imports 2017-09-20 12:24:44 +01:00
55720d9f0a Added InventoryAction->onPreExecute(), fixed PlayerDropItemEvent deleting items 2017-09-20 12:19:42 +01:00
0262465a26 Fixed dupe cake glitch
this is what happens when you try to be clever when not properly awake
2017-09-20 11:19:15 +01:00
7996a7b08c Testing handling multiple result items for ShapedRecipes
this doesn't work yet, I wanted to see how glitchy it is with cakes. The answer is: very glitchy.
2017-09-20 11:14:09 +01:00
4a1fc1bdf7 don't try to send contents during inventory construction 2017-09-20 10:18:24 +01:00
85b2b2ae2e Don't send tile inventory slots during the constructor
This is completely pointless and a waste of time.
2017-09-20 10:15:28 +01:00
38e11aae5e Some cleanup to how EntityInventoryChangeEvents are handled 2017-09-20 10:13:05 +01:00
f0755d1659 Fixed handling of recipes that require a crafting table 2017-09-20 09:43:49 +01:00
fd33a65e3b Small cleanup of recipe UUID handling (furnace recipes don't need UUIDs) 2017-09-20 09:34:00 +01:00
7baadf9dad Throw updated pthreads at Travis 2017-09-19 20:49:41 +01:00
ca23864e4c CraftingManager: use null coalesce for matching furnace recipes 2017-09-19 20:03:21 +01:00
8728547a11 Remove unused imports 2017-09-19 19:58:53 +01:00
90fb3c5e12 Moved getNetworkType() to ContainerInventory since it's not used anywhere else 2017-09-19 19:57:22 +01:00
1fb6d12a6b Add getInventory() to Container interface where it's actually useful 2017-09-19 19:26:41 +01:00
1323d89139 Remove redundant duplicated code for sendContents() and sendSlot() 2017-09-19 19:07:12 +01:00
136ab1dba1 Inventory->getItem(): Removed useless clones
this already returns a copy of the item anyway... wtf?
2017-09-19 18:49:08 +01:00
8cae20e818 Removed hotbar slot linking (works like PC now) 2017-09-19 18:36:57 +01:00
ff2b3bfa2a SimpleCommandMap: remove some dupe and arrange commands alphabetically 2017-09-18 18:43:06 +01:00
361b262d3a Merge branch 'master' into mcpe-1.2 2017-09-18 10:29:38 +01:00
1fd7f441b4 Travis: use older version of pthreads
master is broken - https://github.com/krakjoe/pthreads/issues/757
2017-09-18 10:20:15 +01:00
3f56d6ddc8 RakLibInterface: removed useless needACK condition 2017-09-18 09:42:25 +01:00
1e4cbb0dd9 RakLibInterface: move array initialization to default value
doesn't make sense to do this in the ctor when all the others are normal
2017-09-18 09:34:00 +01:00
a99eee9def Removed redundant assignment 2017-09-17 20:01:11 +01:00
bdee746e46 Automatically enable ANSI colours on Windows versions that support it
Note that stream_isatty() and sapi_windows_vt100_support() are ONLY defined on PHP 7.2, and the latter is only available on Windows.
2017-09-17 19:57:20 +01:00
642c7733cd Cleaned up ShapedRecipe handling, ShapedRecipe API changes
use shapes from json instead of just generating maps
fix a ton of bugs
2017-09-17 11:45:16 +01:00
c8199e14ad Removed redundant duplicate method call 2017-09-16 23:09:14 +01:00
0f37bc35ba Always evacuate the crafting grid on close, no matter whether it's big or not
otherwise items will get deleted and people will cry
2017-09-16 21:58:10 +01:00
8dc3d019f6 Return handled on fake window close 2017-09-16 21:55:25 +01:00
bd64172750 Added API method Item->equalsExact() and removed some boilerplate code 2017-09-15 16:48:46 +01:00
0e51820dfb Merge remote-tracking branch 'origin/master' into mcpe-1.2 2017-09-15 15:54:30 +01:00
30d2318bb7 Merge pull request #1383 from pmmp/quoted-command-args
Quoted command args & allow playernames with spaces
2017-09-15 14:04:48 +01:00
63634d7e7d Added compaction and sorting for repeated slot changes in a single transaction
Now items should be able to move around the crafting grid correctly.
2017-09-15 13:32:17 +01:00
d941bf8e74 Add vanilla-style crafting grid item evacuation server-side when closing the window in case something goes wrong 2017-09-15 13:22:53 +01:00
8c9d9626ab Merge branch 'new-pack-codes' 2017-09-14 19:53:07 +01:00
6b34c47c96 Merge branch 'master' into mcpe-1.2 2017-09-14 18:16:45 +01:00
77241e14ce Bumped to ALPHA8 to account for AsyncTask API changes 2017-09-14 17:49:12 +01:00
15b08c1417 Added capability to dump AsyncWorkers' memory (#1379)
This now actually works with PHP 7.2 + latest pthreads, before it was too unstable.
2017-09-14 16:45:48 +01:00
4d1daecd91 oops! 2017-09-14 11:01:47 +01:00
53e5db5142 Updated PreProcessor submodule 2017-09-14 10:58:46 +01:00
ad72fe6232 Make use of awesome new pack() codes for floats 2017-09-14 10:41:53 +01:00
8b33f711d0 Allow spaces in player names 2017-09-14 10:15:35 +01:00
319735db3a Add support for quoting command arguments
Un-escape quotes in inputted strings
2017-09-14 10:15:30 +01:00
c283d87494 Some minor cleanup of PocketMine.php 2017-09-13 19:14:31 +01:00
be27e03126 Some minor AutoUpdater cleanup, stop hardcoding everything 2017-09-13 18:51:06 +01:00
c1c290cd39 Beware matching items that aren't actually correct
This would only ever happen if we received the actions in the wrong order, but that wouldn't surprise me.
2017-09-13 11:37:10 +01:00
5267c571e9 add handling for -100 fake source type (evacuate crafting table contents) 2017-09-13 11:15:31 +01:00
0fac3b9a9d Added encode for InventoryTransactionPacket and refactor some stuff 2017-09-13 11:14:04 +01:00
23a38400e2 Added CraftingGrid and BigCraftingGrid, WIP stuff for crafting
moving whole stacks in & out of the crafting grid works now, splitting stacks is fucked up because the transaction system can't handle the same slot changing multiple times in one transaction
2017-09-12 19:34:06 +01:00
297172d111 Send creative inventory for all gamemodes, fixed recipe book 2017-09-12 14:40:16 +01:00
825d4f9702 Location cleanup (#1380)
There's no sense rewriting code that the parent constructor already implements.
2017-09-12 12:18:35 +01:00
1d31958ce6 Updated preprocessor submodule 2017-09-12 09:12:38 +01:00
130a60f2b2 Fixed ItemFactory::isRegistered() returns false for blocks 2017-09-11 18:23:26 +01:00
07268e4b37 Added API methods to determine if a block or item is already registered 2017-09-11 16:22:55 +01:00
441efc4ae2 Merge branch 'master' into mcpe-1.2 2017-09-11 14:40:25 +01:00
88bd7713c5 Fix preprocessor 2017-09-11 09:42:31 +01:00
aaa3b6e59a Added explicit AsyncTask->storeLocal(), removed AsyncTask->__construct() object storage (#1322)
Far too often I see people using IDEs which generate the constructors for them and then accidentally unintentionally store things in the object store. This parent constructor behaviour is unexpected. If a developer wants to store something, they should now do so explicitly by calling storeLocal().
2017-09-10 20:31:28 +01:00
25adac8859 Added support for Composer (#323) 2017-09-10 19:23:34 +01:00
8d0b881762 fixed command arg types 2017-09-10 13:56:34 +01:00
16cb75ef38 Merge branch 'master' into mcpe-1.2 2017-09-09 21:58:30 +01:00
3b9689674d Merge remote-tracking branch 'origin/php/7.0' 2017-09-09 21:57:44 +01:00
7f5d8cc900 Always log stack traces regardless of whether log-debug is enabled 2017-09-09 19:27:26 +01:00
8761256246 Be more clear about WHY not to use source installs in production 2017-09-09 19:21:32 +01:00
8c363cb571 Added capability to specify arguments to PocketMine.php when running start.ps1
Example: .\start.ps1 --disable-ansi --debug.level=2
2017-09-09 18:44:18 +01:00
10b765e17a Merge branch 'php/7.0' into mcpe-1.2 2017-09-09 18:08:47 +01:00
0eb866bf25 Updated AvailableCommandsPacket 2017-09-09 14:23:19 +01:00
c46caa38e1 merge 2017-09-09 11:33:00 +01:00
17d949f476 Fixed SPL being reported as incompatible when it's actually not found 2017-09-09 11:25:59 +01:00
c569f55933 Fixed can't find sources when PocketMine.php is run from anywhere other than the repository root 2017-09-09 11:22:56 +01:00
01d8d216ca Yet another merge commit 2017-09-09 00:53:03 +01:00
f1ccee505b Submodule update (this is getting annoying) 2017-09-09 00:51:20 +01:00
a61adb5991 Merge branch 'php/7.0' 2017-09-08 21:40:25 +01:00
cae1a3bb4b Updated DevTools submodule 2017-09-08 21:38:14 +01:00
6681bd250a Merge branch 'php/7.0' 2017-09-08 20:37:09 +01:00
38293913ee Updated DevTools submodule 2017-09-08 20:36:32 +01:00
8493ce8a35 Merge branch 'php/7.0' 2017-09-07 20:07:16 +01:00
9b7868238c Improved Travis Test, capture error output from console, test phar 2017-09-07 20:03:58 +01:00
953c1ef4ec Fixed formatting issues in Travis test script 2017-09-07 20:03:54 +01:00
021a9a4820 Merge branch 'php/7.0' 2017-09-07 19:33:01 +01:00
5b7565664c Removed WeakRef from Travis CI 2017-09-07 19:32:04 +01:00
ebdfbe6bb9 Removed flight controls hack for spectator mode
THEY FINALLY FIXED IT
2017-09-07 19:06:36 +01:00
85ff236461 Fixed formatting issues in Travis test script 2017-09-07 17:27:07 +01:00
d7422d9283 Updated for 1.2.0.31 beta 2017-09-07 10:50:53 +01:00
fcb3c4820e Merge branch 'php/7.0' into mcpe-1.2 2017-09-07 10:42:20 +01:00
c72ef605b9 Fixed server crash when a garbage timezone value is set in php.ini, fallback to auto-detection 2017-09-07 10:40:32 +01:00
e274f1b7f8 Merge branch 'php/7.0' 2017-09-06 17:54:50 +01:00
69514c5763 Submodule update: Fixes little-endian longs being written in the wrong order, closes #1358 2017-09-06 17:54:38 +01:00
2c6205e3f3 Added new events for network interface handling, close #1232 (#1250)
Added 
- NetworkInterfaceRegisterEvent (cancellable)
- NetworkInterfaceUnregisterEvent
- NetworkInterfaceCrashEvent
2017-09-06 11:22:10 +01:00
12c154badf Merge branch 'php/7.0' 2017-09-05 20:06:02 +01:00
2215543e39 Fixed not being able to remove logger attachments, closes #1141 2017-09-05 20:04:19 +01:00
b310959fd1 Added --php parameter to start.ps1 2017-09-05 19:57:38 +01:00
c9ee206fe6 Merge branch 'php/7.0' 2017-09-04 19:42:03 +01:00
d065e76a41 Fixed plugins with unknown dependencies saying they have circular dependencies, close #356 (#1342) 2017-09-04 19:41:21 +01:00
6877ac35eb Merge branch 'php/7.0' 2017-09-04 10:01:47 +01:00
f0c1ea7dd7 Fixed string seeds in pocketmine.yml crash the server, close #1355 2017-09-04 10:01:21 +01:00
6aaef1660a Added dependency checks for BC Math 2017-09-04 08:08:04 +01:00
78d49f8e66 Merge branch 'php/7.0' into mcpe-1.2 2017-09-03 15:02:41 +01:00
de6ebc5791 Merge branch 'php/7.0' 2017-09-03 15:00:29 +01:00
815c697767 Fixed sticks being useless as furnace fuel 2017-09-03 14:59:04 +01:00
231617b9d0 fuel time should be ticks here, not seconds 2017-09-03 14:27:17 +01:00
90cb3c010f Added some new items (the basic ones) 2017-09-03 14:24:21 +01:00
2398e2450a Allow building inside spectators
This check is pretty ugly, it'll need cleaning up later. For now, this will suffice.
2017-09-03 13:47:44 +01:00
bb9299070d Fixed several Cake bugs
fixed cake flat-out doesn't work
fixed last slice of cake vanishing (NOOOOO)
fixed EntityEatBlockEvent not getting called
made AABB calculation less confusing
2017-09-03 13:09:53 +01:00
58bf5d6679 Use null coalesce in EntityDamageEvent 2017-09-03 12:48:57 +01:00
cb7911ee9c Improved Absorption, now only applies to living entities, now controllable by plugins 2017-09-03 12:37:34 +01:00
aa9fd1b4f9 Remove redundant gamemode checks
The caller will check the player's gamemode, so there is no use for these checks.
2017-09-03 12:22:37 +01:00
7483f22e8b Fixed a PhpStorm inspection 2017-09-03 12:10:56 +01:00
89f5567476 Use Entity->getDirectionVector() more 2017-09-03 12:08:40 +01:00
4df261b75a Made some variable names in Bucket less confusing 2017-09-03 12:00:24 +01:00
41780fd195 Made entity collision checks for block placement more logical and less wasteful
We don't care how many entities collide, only that a non-zero number collided.
2017-09-03 11:50:15 +01:00
0b83c61494 Fixed cyclic reference with chest tiles and DoubleChestInventory 2017-09-03 11:24:34 +01:00
1d338bfdf9 Fixed uncaught exceptions during Task->onCancel() causing all kinds of nasty behaviour
including crashing the server on shutdown, preventing self-cancellation, and causing memory leaks
2017-09-02 19:28:51 +01:00
2cff5a500c Merge branch 'php/7.0' 2017-09-02 19:05:27 +01:00
f077ba4748 Merge branch 'php/7.0' into mcpe-1.2 2017-09-02 19:05:18 +01:00
2f614c5dc2 don't break the preprocessor 2017-09-02 19:04:10 +01:00
dcf34b7188 Merge branch 'php/7.0' 2017-09-02 18:57:49 +01:00
ca84532640 Merge branch 'php/7.0' into mcpe-1.2 2017-09-02 18:57:39 +01:00
4d8d57ca5e Fixed LongTags in tile NBT 2017-09-02 18:57:23 +01:00
75e32b11b7 Merge branch 'php/7.0' into mcpe-1.2 2017-09-02 18:29:53 +01:00
9f44b2ed75 fixing ClientboundMapItemDataPacket 2017-09-02 18:22:53 +01:00
62aba15f9e Updated RakLib submodule 2017-09-02 16:52:55 +01:00
1c02c747ca Merge branch 'php/7.0' 2017-09-02 13:13:54 +01:00
22d8626e23 Fixed sign bug introduced in #1204 rebase, close #1346 2017-09-02 13:12:55 +01:00
b071ce9c5a Refactored projectile handling, added Item->onClickAir() 2017-09-02 11:57:26 +01:00
a6c0f1512c Send the hotbar instead of contents when resetting hotbar
This used to be fine before 1.2, but now hotbar is handled separately.
2017-09-02 11:07:14 +01:00
604d8ecf9a Protocol changes for 1.2.0.25 2017-09-02 11:05:49 +01:00
5d75d3d5b6 Merge branch 'php/7.0' into mcpe-1.2 2017-09-01 23:10:58 +01:00
8b13b520e0 Merge branch 'php/7.0' 2017-09-01 20:22:25 +01:00
2603f5cc63 Fixed RakLib crashing when exceptions are thrown in packet handlers after the player was closed
This occurred if the player happened to be closed during the packet being handled, and then an uncaught exception bubbled up to the RakLibInterface. This resulted in a crash due to trying to get the address of a player who no longer had a network session, in order to block their IP address.
2017-09-01 20:22:02 +01:00
00e4fff259 Fixed Item fromString() crash on PHP 7.2 2017-09-01 20:05:04 +01:00
a06c934f4d Merge branch 'php/7.0' 2017-09-01 19:37:27 +01:00
14ea76ecd7 Fixed PlayerBucketEmptyEvent never called, close #1339 2017-09-01 19:36:57 +01:00
c81b76cbf6 Make plugin load errors more descriptive 2017-09-01 18:52:55 +01:00
517609dc2e Cleaned up plugin property reading 2017-09-01 18:36:31 +01:00
506118e28f Fixed exception thrown when plugins specify API version like 3.0 instead of 3.0.0
This could only be seen in a build with a non-suffixed API version, for example 3.0.0. When attempting to load plugins which specify API like 3.0 the server would raise errors.
2017-09-01 18:13:07 +01:00
6e8631347d Added capability to specify compatible protocol versions in plugin.yml (#1247)
Protocol-dependent plugins may specify the `mcpe-protocol` attribute in plugin.yml to disallow plugin loading when the protocol changes.
2017-09-01 17:57:40 +01:00
5335ed9394 Merge branch 'php/7.0' 2017-09-01 16:57:51 +01:00
138d85307b Fixed double chests being openable when the other half has a solid block above it, close #1165 2017-09-01 16:50:55 +01:00
226175f961 setText now nullable instead of overwriting with empty lines (#1204) 2017-09-01 08:34:40 +01:00
297cfcf168 Check for existence of ChunkUtils extension 2017-08-31 21:42:24 +01:00
9ea39ea3d7 Stop clearing chunk cache after 768 batched packets are cached. (#1320) 2017-08-31 21:14:18 +01:00
16aeb0ac85 Update .travis.yml 2017-08-31 21:12:45 +01:00
8caabd3267 Check for existence of ChunkUtils extension 2017-08-31 21:04:36 +01:00
ddfe828445 Require PHP 7.2, bump PocketMine-MP version to 1.7dev 2017-08-31 20:27:05 +01:00
67ad2d25b9 Added FireImmune data flag 2017-08-30 18:36:36 +01:00
b9c4a65307 Don't save players with chunks!
I can't believe I didn't notice this
2017-08-30 16:55:17 +01:00
23752548fe Address several LevelDB related crashdumps in the crash archive 2017-08-30 15:42:31 +01:00
190f4dd6ab New entity metadata flags 2017-08-30 14:13:24 +01:00
120cf56a47 Misc return typehints 2017-08-30 12:59:26 +01:00
21f09d5fdb Cleaned up Effect handling and replacement 2017-08-30 12:53:41 +01:00
bde6d7db8d Remove redundant duplicate implements 2017-08-30 12:21:09 +01:00
adc6b03d4c Typehinted up Entity API and some cleanup 2017-08-30 12:17:56 +01:00
fd52022065 Refactor of health int -> float and fixed armor being useless when
computed damage reduction is less than 1
2017-08-30 11:03:07 +01:00
ea5bd0348a Fixed liquid flow attempting to set negative block damage values
This should only execute if the current liquid block is actually still existent. When decay is negative, it means the water block doesn't exist anymore.
2017-08-29 14:22:12 +01:00
c3cf82ab26 Updated RakLib submodule 2017-08-29 11:05:25 +01:00
6abef6b22d Made block and item factory lists private to stop people doing stupid things with them 2017-08-29 10:53:01 +01:00
9902d29734 ServerScheduler::scheduleAsyncTask() returns the worker used (#1312) 2017-08-29 10:29:24 +01:00
7475aa3a18 Do not allow use of PHP 7.1 due to not compatible 2017-08-28 23:42:22 +01:00
6d6283b7f3 Fixed Player->sendPosition() not working correctly 2017-08-28 20:07:04 +01:00
a3d21de559 Cleaned up network inventory action reading and core action creation 2017-08-28 20:04:35 +01:00
6a717d8050 Fixed PlaySoundPacket
thanks @undrfined
2017-08-28 18:32:56 +01:00
ece0692229 Fixed UUID corruption in recipe data
this is important for MultiRecipes to work correctly (yes I know we don't use these yet!)
2017-08-28 18:04:11 +01:00
b5d2402c9b Merge branch 'master' into mcpe-1.2 2017-08-28 18:02:09 +01:00
37b050f864 Return an UnknownBlock if the BlockFactory hasn't been initialized yet 2017-08-28 17:07:39 +01:00
d07b5ba1e1 Added missing return to Bow, fixed #1329 2017-08-27 20:40:30 +01:00
697ea55fb7 Another typehint 2017-08-27 20:01:38 +01:00
8b3fad8a7b Removed redundant condition 2017-08-27 19:44:40 +01:00
f2402f2122 Strict-compare these to strings since they cannot return anything but 2017-08-27 19:32:57 +01:00
b548c4fdbe Use null coalesce in BanList->addBan() 2017-08-27 19:29:04 +01:00
a982344b96 Cleaned up Level->addSound() and Level->addParticle() 2017-08-27 19:09:05 +01:00
0b2b9126a2 Improved tile spawning
There's no need to recreate the spawn packet for every single player, or re-serialize the NBT.
2017-08-27 18:40:18 +01:00
f4f2323518 Fixed entityBaseTick not being timed for Players 2017-08-27 18:29:54 +01:00
badd669b3d Removed use of literal ints for block ID checks in Dandelion 2017-08-27 16:16:37 +01:00
c7fd3eb725 Merge branch 'master' into mcpe-1.2 2017-08-27 16:09:23 +01:00
a5f5502380 Moved bow functionality out of Player 2017-08-26 19:04:04 +01:00
6d5620606e Block->place() parameter refactor to make things clearer 2017-08-26 14:41:49 +01:00
20f34fba53 Missed another dupe 2017-08-26 14:34:21 +01:00
61968cca28 Cleaned up duplicated spawn protection code and refactor some variable names 2017-08-26 14:25:34 +01:00
13187e1749 Removed damage-table mess and added API methods Item->getAttackPoints() and Item->getDefensePoints() 2017-08-26 12:59:03 +01:00
7c212d3d53 Fix formatting issue in AsyncPool 2017-08-25 19:15:57 +01:00
9e142655ea Removed redundant count parameter from item constructors, added some documentation and tightened safety checks
the count parameter is useless since Item ctor should now only be used for constructing item _types_, not actual items. All item creations for inventories etc, should go through the ItemFactory.
2017-08-25 19:06:23 +01:00
1fec16f167 Fix Block::get() regression introduced in 02f42eba 2017-08-25 18:15:53 +01:00
4ab286a142 Generated some Item TODOs 2017-08-25 14:35:50 +01:00
44dd7c2222 Removed some redundant item classes 2017-08-25 14:07:50 +01:00
97911aa9cf Fix undetected collision of nether brick block and nether brick item 2017-08-25 13:36:36 +01:00
7ff143c793 Some minor tool cleanup 2017-08-25 13:19:21 +01:00
cd7724d94a Added concrete 2017-08-25 13:13:11 +01:00
76e213ae73 Cleaned up shared rotation code, fixed quartz pillar rotation, added bone blocks 2017-08-25 13:06:16 +01:00
8ce833bf74 Stripped redundant trailing commas 2017-08-25 12:41:49 +01:00
ba27fff853 Fix formatting derp 2017-08-25 11:53:41 +01:00
80f2519d7d Fixed obsidian hardness, no more destroying obsidian with TNT 2017-08-25 11:52:46 +01:00
ebda6ec19b Cleaned up random-block-ticking registration 2017-08-25 11:47:38 +01:00
6553c82320 Fix random block ticking losing randomness on third iteration
More expensive to do it this way, but this should be foolproof. The old method ran short by 4 or 5 bits, causing the Y coordinate of the third loop to be always < 8 and the Z coordinate to always be 0.
2017-08-24 22:14:07 +01:00
1b0ed0f1b8 Use metadata for git hashes 2017-08-24 20:01:19 +01:00
5433a3f964 Merge branch 'master' into mcpe-1.2 2017-08-24 19:26:52 +01:00
3ee8f2b182 Require RakLib version 0.8.1 2017-08-24 19:26:30 +01:00
238b3ca4c1 Fixed UUID variant corruption in UUID->toString(), close #1286
This class may encapsulate any type of UUID, not just RFC 4122. Additionally, an RFC 4122 UUID may have this set as 8, 9, A or B.
2017-08-24 12:51:46 +01:00
2c3d7c49f9 Updated creative inventory data with new item json serialization (more compact) 2017-08-24 12:17:17 +01:00
76acb1da7b New crafting recipe data format, more readable & more compact 2017-08-24 12:05:35 +01:00
17518195d1 Be more smart about json-serializing items
Don't include nbt_hex if we don't have a NBT tag
Don't include damage unless it's non-zero
Don't include count unless it's non-1
2017-08-24 12:02:03 +01:00
2443a57234 Merge branch 'master' into mcpe-1.2 2017-08-24 11:57:41 +01:00
90edb8ebe7 Make decoding accessible 2017-08-24 10:45:30 +01:00
55e32424a0 Ability to get a player's quit reason from PlayerQuitEvent (#1308) 2017-08-23 19:26:24 +01:00
d6266d19b6 Added correct friction factor for ice & packed-ice 2017-08-23 18:38:09 +01:00
95752ef542 Merge branch 'master' into mcpe-1.2 2017-08-23 13:20:35 +01:00
84c8ac03fb Fixed #1179
This solution isn't ideal, but it works...
2017-08-23 13:19:34 +01:00
da4c9cf404 Fixed inventory cyclic references causing players to not get garbage-collected 2017-08-23 13:13:15 +01:00
0f2ca99c67 Merge remote-tracking branch 'origin/pr/1310' 2017-08-23 10:44:33 +01:00
a7674c52e6 Micro optimization to movement update checking
No need to keep abs()ing this, because next time we have a movement update, motion < 0.00001 will be flattened to zero anyway.
2017-08-23 10:42:23 +01:00
a52fa93998 Remove Entity->length 2017-08-23 02:21:33 -04:00
770616d4ab Merge branch 'master' into mcpe-1.2 2017-08-22 20:48:32 +01:00
d1852834de Revert "Added capability to dump AsyncWorker memory"
This reverts commit eb4594348b.

This is far too unstable with more than one worker thread.
2017-08-22 20:46:20 +01:00
eb4594348b Added capability to dump AsyncWorker memory 2017-08-22 19:57:00 +01:00
5a3ce42f74 Updated RakLib submodule (again) 2017-08-22 19:55:47 +01:00
0712979908 Fixed blastResistance array not being initialized 2017-08-22 19:45:53 +01:00
ae715cf2f2 Updated RakLib submodule 2017-08-22 17:54:45 +01:00
3a5fc78c53 Fixed players getting kicked for flying when standing still when blocks near them get updated, fixed item movement being too slippery 2017-08-22 17:47:48 +01:00
445a67954d Merge changes from master 2017-08-22 14:13:31 +01:00
50580f4408 Added server ID proper to ping response, fixes #1208, closes #1306 2017-08-22 12:39:33 +01:00
4250e99e3a Updated for 1.2.0.22 2017-08-22 11:35:56 +01:00
8229410e27 typo/OCD 2017-08-22 10:48:13 +01:00
938af60733 Update ISSUE_TEMPLATE.md 2017-08-22 10:46:20 +01:00
8a35b9da29 Added some documentation 2017-08-22 10:28:43 +01:00
c32b75fa18 Further (major!) performance enhancements to entity ticking 2017-08-21 20:28:56 +01:00
b8ade18888 Fixed double plants and beds sometimes dropping in creative 2017-08-21 19:25:04 +01:00
592ce3c9e9 Adding some missed commands typehints and documentation 2017-08-21 19:02:30 +01:00
876659cc73 Item factory refactor and added capability to register custom items 2017-08-21 17:49:26 +01:00
604d11a8fd import cleanup and fixed an inspection 2017-08-21 17:39:02 +01:00
d2ace6bdd2 added some typedocs
shut up PhpStorm
2017-08-21 17:17:47 +01:00
672b7610a9 Maybe I should stop using PhpStorm EAPs 2017-08-21 13:51:58 +01:00
456ddd3fb3 Removed obsolete parameters from Entity->attack() and Entity->heal() 2017-08-21 13:25:11 +01:00
b62597fe63 Fixed some minor issues in Player events API 2017-08-21 13:05:32 +01:00
9e54980ded Fixed some usages of Block::get() 2017-08-21 12:58:35 +01:00
121777375e Rewired eating 2017-08-21 12:52:20 +01:00
93e149e91c Rewiring release-item action to fix bows 2017-08-20 22:14:31 +01:00
1f70a7830e Branch merge 2017-08-20 21:07:19 +01:00
2f3c77c68a Fixed entity move performance issue and a ton of entity movement bugs
- fixed zombies and villagers movement not updating
- fixed dropped items "movement" lagging the living **** out of the server when not actually moving
- fixed arrows not falling when the supporting block is removed
- fixed knockback
- fixed zombies + villagers being un-attackable after hitting them

... the list goes on
2017-08-20 20:31:09 +01:00
02f42eba48 Move block registration to its own class 2017-08-20 18:05:01 +01:00
9451dd361e Fixed some issues in MovingObjectPosition 2017-08-20 17:12:25 +01:00
da83b879c0 Major performance improvement to explosions
These changes produce about 3x performance improvements. Some numbers
from my machine (i7-7700k @ 4.5GHz) with TNT:
- before changes: 35ms
- after changes: 11ms

in powersave mode (0.9GHz):
- before changes: 170ms
- after changes: 60ms
2017-08-20 16:12:30 +01:00
d1fd6aef44 add type doc 2017-08-20 14:04:02 +01:00
cd02f1e4be Minor performance improvement to explosions
This improves calculation time by 20-25% per explosion on flat terrain.
2017-08-20 13:28:31 +01:00
eeedcf7332 Refactor Block->getResistance() -> Block->getBlastResistance() and added some documentation 2017-08-20 13:25:43 +01:00
216fc6fe31 Fixed incorrect comment 2017-08-20 12:17:44 +01:00
17053389b0 Added memory limits for AsyncWorkers 2017-08-20 12:15:48 +01:00
8475c63426 Remove redundant brackets from WoodenSlab 2017-08-20 11:02:34 +01:00
f2ff0198cc Fixed slab placement, close #145 2017-08-20 10:52:07 +01:00
c394aea803 Replaced more literal ints with Vector3 constants 2017-08-20 10:43:48 +01:00
e1d894057c Changed face position floating-point params to Vector3s 2017-08-20 10:23:34 +01:00
5b3bed8b06 Don't check entity movement or in-air ticks if player dies due to movement, close #1226
Not an ideal solution but it'll do.
2017-08-20 09:49:02 +01:00
159b2e3d5e Merge branch 'master' into mcpe-1.2 2017-08-19 21:42:33 +01:00
bed68a012d Don't bother doing null checks for block copy
This will never be null if the block factory was initialized correctly. This will also cause a crash if bugs like e88053faf4 occur again in the future instead of silently causing unexpected behaviour.
2017-08-19 21:29:24 +01:00
e0307411da Cleaned up PlayerList handling 2017-08-19 19:36:15 +01:00
e88053faf4 ... 2017-08-19 18:25:08 +01:00
e51106e64c Fixed bad overrides of getBoundingBox() 2017-08-19 17:16:22 +01:00
0e24596aed Changed block construction calls to Block::get() 2017-08-19 13:46:17 +01:00
276fccf4bb Typehinted block events API 2017-08-19 11:25:32 +01:00
64f2e7587d Some cleanup and added missing strict types declare for EndRod 2017-08-19 11:11:49 +01:00
bedfca8698 Fix some type errors on custom ExplodePacket use (#1297) 2017-08-19 08:16:10 +01:00
4a3f01703e Removed redundant override method 2017-08-18 19:52:23 +01:00
41c6cb6f97 Added Block->getVariantBitmask(0 to cut down on getDrops() boilerplate, fixed several blocks incorrectly retaining meta when broken 2017-08-18 19:49:28 +01:00
384a4b3a09 Who put this here? 2017-08-18 18:59:34 +01:00
e5e76d4c93 Merge branch 'master' into mcpe-1.2 2017-08-18 18:39:39 +01:00
a7ad26426f Add stained glass and stained glass pane (#1298) 2017-08-18 18:30:03 +01:00
2688228a6f Don't dump subchunk raw data 2017-08-18 16:57:07 +01:00
e15eefc58f ... 2017-08-18 13:58:33 +01:00
f73d3d086e Added some new blocks, fixed collisions not being detected when standing on top of a full block 2017-08-18 13:58:05 +01:00
41f5cba971 Added End Rods, close #940 2017-08-18 13:05:39 +01:00
8853452feb Updated for 1.2.0.18 2017-08-18 12:36:04 +01:00
d8f0dd6db8 Changed Block->getDrops() to return Item[] 2017-08-18 11:21:33 +01:00
09c53552c1 Merge branch 'master' into mcpe-1.2 2017-08-18 08:29:40 +01:00
c8ed2406d7 Fix bad setChunk() documentation 2017-08-17 21:03:07 +01:00
a4ec2b7f2c Removed copy-pasted code from Player 2017-08-17 19:50:17 +01:00
1f6d325328 Added API for assigning permanent windows, fixed teleportation breaking inventory 2017-08-17 19:43:59 +01:00
f35ca147bb Merge branch 'master' into mcpe-1.2 2017-08-17 18:38:30 +01:00
9efd350e78 Return unhandled on desktop crafting instead of hitting errors 2017-08-17 18:34:21 +01:00
be4f48a119 Updating submodules 2017-08-17 18:26:06 +01:00
b6fb2bca13 forgot to add this to the merge 2017-08-17 17:27:49 +01:00
4f1302adf2 Merge branch 'master' into mcpe-1.2 2017-08-17 17:14:16 +01:00
83f29e5639 Fixed tests failing since 83af4dcd 2017-08-17 17:02:13 +01:00
e825ebd8fa Added some wrapper methods to make data flags less of a pain in the ass to work with 2017-08-17 16:52:17 +01:00
83af4dcd59 Block API typehints 2017-08-17 13:50:19 +01:00
f6c31680f6 Fixed unknown blocks dropping themselves 2017-08-17 13:25:11 +01:00
6320a63ca5 Use standard format for color hex, some minor name alteration 2017-08-17 13:08:18 +01:00
9e02f3c4e3 Fixed redstone lamp light levels and hardness 2017-08-17 11:47:10 +01:00
2cd05bf5b5 Removed redundant Block constructor overrides 2017-08-17 11:42:26 +01:00
5b4035253b Casting cleanup and removed some 32-bit string-int leftovers 2017-08-17 11:24:49 +01:00
77376d3e33 No idea how this happened 2017-08-17 11:15:42 +01:00
56e45a031b Fixed missing returns for Player->switchLevel() 2017-08-17 11:15:22 +01:00
21a1e0eb6b Player API typehints 2017-08-17 11:08:54 +01:00
670a9fe44f Fix some crashy issues when incompatible players get disconnected 2017-08-17 10:29:12 +01:00
6efa4343b1 Cleaned up fuel duration handling, fixed some fuel items not working in furnaces 2017-08-17 10:22:47 +01:00
dc3f13cd30 Cleanup from previous commit 2017-08-17 09:42:00 +01:00
b4c4005009 Some condition simplifications suggested by static analysis 2017-08-16 20:06:48 +01:00
eebc52e00b Added API method Entity->isClosed() and made Entity->closed protected 2017-08-16 19:30:23 +01:00
20aa519f3a Added capability to remove owners/target entities 2017-08-16 19:14:15 +01:00
741394dab1 Typehinted up entity API
Did you guys think ALPHA7 changes were done?!
Sone stuff still needs some work, most notably data-properties can't be typed yet because they are just mushed into a couple of methods.
2017-08-16 19:04:30 +01:00
ea414ea72d Fixed MetadataStore 2017-08-16 17:09:03 +01:00
696c67f541 Missed a couple 2017-08-16 14:43:18 +01:00
021dbd65d7 Cleaned up some copy-pasted code for coloured blocks names 2017-08-16 14:38:41 +01:00
8510be062c Nether Reactor block is back
This should never have been removed, it exists as an unobtainable block in vanilla which drops iron and diamond.
2017-08-16 14:17:14 +01:00
7b142d4742 Generated some TODO comments for blocks 2017-08-16 13:25:36 +01:00
643e10037c Merge branch 'master' into mcpe-1.2 2017-08-16 13:19:37 +01:00
0257432afc Fixed a typo in BlockIds 2017-08-16 13:17:22 +01:00
4950157f1d How did this escape notice? 2017-08-16 13:08:30 +01:00
c4d8c28338 Some inspection fixes 2017-08-16 13:07:33 +01:00
eda2473e78 New LevelEventPacket constants 2017-08-16 12:53:53 +01:00
4b65fef957 Fixed LevelEvent broadcasting 2017-08-16 12:53:32 +01:00
fbe2567e58 Merge branch 'master' into mcpe-1.2 2017-08-16 12:31:12 +01:00
9a0b3a6e22 Updated RakLib submodule 2017-08-16 12:28:44 +01:00
5fc50aeda5 Found an unknown field in StartGamePacket 2017-08-16 10:10:42 +01:00
ebb71fc6c5 Typehints and docs for MemoryManager 2017-08-15 19:48:19 +01:00
ae3a8a5493 Added capability to unblock addresses without a restart 2017-08-14 14:12:06 +01:00
9be1b929a5 Added PhpDoc for packet field types and changed float x,y,z to Vector3 2017-08-13 20:02:07 +01:00
6480f7a989 Found an unknown field in TextPacket and added some docs 2017-08-13 18:20:06 +01:00
1576a79644 more packets 2017-08-13 17:43:33 +01:00
02cbf800d0 Added encode/decode for ModalFormResponsePacket 2017-08-12 19:33:16 +01:00
5a4fbc6f5a Handle exception for crafting and resend inventories 2017-08-12 19:11:57 +01:00
83fcec3e94 Don't add actions to the transaction if a crash occurred when getting the source inventory 2017-08-12 14:29:12 +01:00
5d436a06ec Added a method to get player cursor inventory 2017-08-12 14:10:47 +01:00
8958b3c51c Many many changes related to inventory transactions, fixed item dropping, fixed creative menu 2017-08-11 19:57:30 +01:00
c1ff7bbef4 Added creative-inventory magic slot numbers and renamed some constants 2017-08-11 12:31:11 +01:00
74ee94b385 Duct tape for inventory transactions, removed ContainerSetSlotPacket 2017-08-10 20:05:15 +01:00
5208ad885c Added crafting use-ingredient fake transaction source 2017-08-10 18:42:14 +01:00
0c798222a4 ... blame PhpStorm EAP 2017-08-10 18:04:44 +01:00
e8bd0c3e09 add typehints to Metadatable interface and implementations, fix missing return for Block->hasMetadata() reported in #1285 2017-08-10 18:02:01 +01:00
51be88c698 Fixed AdventureSettings not working 2017-08-10 13:01:20 +01:00
0dc8362536 Added custom player permission level 2017-08-10 11:34:34 +01:00
9bae4d8ef6 updates for 1.2.0.11 2017-08-10 11:15:23 +01:00
bb4808c23e attacking entities working
just moved some code :P
2017-08-10 10:49:14 +01:00
3025f76cd0 Fix a couple of Sign bugs 2017-08-10 08:57:57 +01:00
1e539c4e3b fix some 1.2 translation issues, close pmmp/PocketMine-Language#19 2017-08-09 21:40:20 +01:00
590003d7c1 Fixed PlayerListPacket 2017-08-09 19:51:39 +01:00
72d40860f3 Remove useless else branch and and return unhandled for unmatched window IDs 2017-08-09 19:05:00 +01:00
d3d1e32309 Removed teleport zero-offsets (not needed in 1.2) 2017-08-09 17:01:56 +01:00
36d47a33f3 Fixed crash on player death 2017-08-09 13:34:25 +01:00
260179197b Use SplFixedArrays in inventory, added more typehints and cleaned up some duplicated code 2017-08-09 13:12:07 +01:00
82fd3b540e Fixed a mistake in Block->isBreakable() doc 2017-08-08 22:15:44 +01:00
75644b5df2 s/windowid/windowId 2017-08-08 12:37:26 +01:00
3ad1b1ba7f Added some ContainerSetDataPacket constants 2017-08-08 12:19:11 +01:00
b4c2305c7f Minor cleanup of Human->initEntity() 2017-08-08 10:44:11 +01:00
1d0f0a2999 Merge branch 'master' into mcpe-1.2 2017-08-08 10:23:19 +01:00
8ca37b3813 Fixed a bug in multiline chat handling 2017-08-07 19:41:08 +01:00
2ba601b6e9 Fixed signs 2017-08-07 19:40:45 +01:00
06083d6dc4 s/Item/Block 2017-08-07 16:26:27 +01:00
2d8395f70e Absorption should be a float. Fixed #1071 2017-08-07 16:09:10 +01:00
6b5c0af161 Separation of effect handling from Entity, fixes #886 2017-08-07 16:03:54 +01:00
c84218c55b Remove overloaded parameter from GeneratorUnregisterTask construction
PhpStorm, pls tell me why you only found this _now_ and not back in January when I started using PhpStorm...
2017-08-07 15:46:57 +01:00
6b7a382625 import cleanup and missing strict types declare 2017-08-07 15:42:46 +01:00
54b6a5710e Fixed entityBaseTickTimer doesn't cover child overrides 2017-08-07 14:21:06 +01:00
7958fffa07 Move some code around to fix block placing, breaking, and throwing snowballs 2017-08-07 12:28:07 +01:00
98e0a2ecba Removed InventoryType, added new inventory API methods 2017-08-07 11:31:36 +01:00
44f1dedbf8 Give creative players carte blanche
Close #879, close #431

This will be solved properly in 1.2 when creative transactions are
actually trackable. For now... HACK!
2017-08-06 21:16:08 +01:00
899e318a88 Merge branch 'master' into mcpe-1.2 2017-08-06 18:46:56 +01:00
23eb8600ab Added methods for endian-flipping 2017-08-06 18:46:03 +01:00
989505c42c Updated crafting & creative data from 1.2.0.7 2017-08-06 17:21:52 +01:00
d9da9accbc Fix packet buffers when encoding twice 2017-08-06 17:21:52 +01:00
711d62b5eb Updated block & item IDs from 1.2.0.7
Note to self: these may need updating again later in the beta.
2017-08-06 17:21:52 +01:00
49506659e0 More constants 2017-08-06 17:21:51 +01:00
7886918140 Cleaned up some bad code in DataPacket, added encode/decodeHeader and made encode/decodePayload protected 2017-08-06 17:21:51 +01:00
8a151dc373 Fixed PlayerSkinPacket for 1.2.0.7 2017-08-06 17:21:51 +01:00
58a12fdfa3 Updated for 1.2.0.7 2017-08-06 17:21:51 +01:00
50dffeb6a1 Day 3, part 1 2017-08-06 17:21:51 +01:00
63d2b341b9 Day 2 2017-08-06 17:21:51 +01:00
77cd8e7799 More broken mess to spawn 1.2 2017-08-06 17:21:51 +01:00
10ff2948ac Fixed double wooden slab name inconsistency 2017-08-06 17:15:35 +01:00
0d0df3390a Added glazed terracotta 2017-08-06 17:10:06 +01:00
e4a5cb6021 Changed NBT representation in JSON to hex, fix encoding problems with UTF-8 2017-08-06 14:50:18 +01:00
71e354cf1d Added chest open/close sounds and cleanup duplicated code 2017-08-06 12:48:46 +01:00
7d3fca83f0 Tile NBT usage enhancements (#1259)
* Do not create new NBT objects on Tile::getSpawnCompound()

* PocketMine's string formatting

* Remove more useless array indices and create lesser new NBT objects.

* Remove unused imports and type-hint Sign::setText() params

* Do not mess with Sign::setText() params due to #1204

* Fix formatting

* Make getSpawnCompound() final and add abstract addAdditionalSpawnData()

* Make the same changes for Bed tile

* Fix a missing "->" and remove some unneeded int casting.
2017-08-06 12:35:37 +01:00
3fdbcee10f Add some typehints and documentation to MainLogger 2017-08-06 11:43:42 +01:00
4e9af1ac45 Fixed several extremely stupid bugs in MainLogger
- Fixed log writes being blocking (these were executed on a thread, but IN A SYNCHRONIZED BLOCK - what the fuck shoghi?!)
- Fixed log file being open for reading as well as writing
- The logger will now be buffered for 25ms before writing to disk, as it should have been to begin with.
- Moved the log resource to a local variable (it's unsafe to try to access resources from different threads, this takes away the ability to do so)
- Fixed line endings to use PHP_EOL instead of hardcoded LF, fix viewing logs in Notepadi
2017-08-06 10:56:39 +01:00
475066c9f5 Removed minor code duplication in MainLogger 2017-08-06 08:55:46 +01:00
d5f6966ce3 Fixed server freeze due to bad light filter values 2017-08-05 23:22:33 +01:00
0ad4a59d5a Added test for light filter levels (must always be >= 1) 2017-08-05 23:03:13 +01:00
5f6dc25c9f Fixed EnchantCommand being retarded, close #1012 2017-08-05 21:27:57 +01:00
3b7fc21839 Enchantment API changes, understandable constant names 2017-08-05 21:27:57 +01:00
ecba80fd63 Fixed some trailing whitespace
$ shopt -s globstar
 $ sed -i 's/[ \t]*$//' src/pocketmine/*/**.php

:P
2017-08-05 21:07:21 +01:00
fb59b57bdf Improve item enchantment API and fix some bugs (#512) 2017-08-05 20:50:28 +01:00
2b4e303f52 Fix client-side translation for gamemode change 2017-08-05 12:05:35 +01:00
2103c981a9 Replaced literal ints with Vector3 constants for Block->getSide() calls 2017-08-04 13:33:23 +01:00
3188f1c053 Removed redundant override 2017-08-04 13:23:46 +01:00
fdf71841e1 Added missing strict type declares 2017-08-04 13:17:59 +01:00
11fae493a5 Added Nether Wart 2017-08-04 13:17:53 +01:00
3135fe3c69 Added API method Block->getItemId(), cleaned up excess wooden stairs and fence-gate classes, added more wooden door types 2017-08-04 13:02:24 +01:00
561d8e7a39 Regenerated block/item id lists and refactored some names for consistency with MCPE 2017-08-04 12:17:24 +01:00
3048a3b39b Added precision and mode arguments to Vector3::round() (#1256)
If the precision is positive (i.e. there are numbers after the decimal point), the results should be floating-point numbers rather than integers, hence the additional check.

Even if the precision is negative or zero, the $mode parameter may still be useful.
2017-08-04 09:56:42 +01:00
63c12440dc Fixed items ordering 2017-08-03 17:48:56 +01:00
b912b9173c Changed how blocks are registered, add API to allow registering custom blocks 2017-08-03 16:46:48 +01:00
ca3cf3e067 Fixed ordering of blocks list and duplicated RedstoneTorch registration 2017-08-03 15:27:46 +01:00
8a02dbb15a fix crash when var_dumping packets 2017-08-03 08:47:10 +01:00
f0b4a33e2e www.pocketmine.net -> update.pmmp.io (#1263) 2017-07-31 22:44:02 +01:00
306bf7be5f Moved dimension id constants to their own interface (PHP needs enums) 2017-07-31 16:38:01 +01:00
0b47324fe3 Add some constants to AnimatePacket 2017-07-31 16:03:45 +01:00
17be06a56d Rough implementation of double plants, fixes #882 2017-07-31 08:14:01 +01:00
caff686827 Fixed grass growth and death, close #436
way too fast to grow back though :S
2017-07-31 08:00:03 +01:00
210bdc2436 Fixed liquid CPU leaks and some flow issues
Liquid still needs a total rewrite, but at least it won't constantly waste CPU anymore.
2017-07-31 07:24:22 +01:00
acaa0d2740 Translate command usage messages server-side, close #236 2017-07-30 21:14:40 +01:00
ffefcd4473 Fixed 'moved too fast' when respawning 2017-07-30 20:59:42 +01:00
8957dbf08e Use occupied bitflag and added distance check for beds
must be < 2 blocks from either half of the bed
2017-07-30 20:02:48 +01:00
2d626d1d90 Improved Beds, fixed bed tiles not getting removed for other halves
relates to #880
2017-07-30 19:57:10 +01:00
253db40a11 Fixed bed placement with head over a transparent block 2017-07-30 19:50:47 +01:00
8a3b31077e Fixed some items not keeping meta when constructed, close #968 2017-07-30 19:46:24 +01:00
1f4e6535bb Added Bed tile and support for coloured beds 2017-07-30 19:34:06 +01:00
6ae24c5c19 Removed unnecessary methods Block->canBeActivated() and Item->canBeActivated() (needless extra confusion) 2017-07-30 18:14:43 +01:00
036663e0b5 Made rails less weird
Not up to the task of implementing rail connectivity today, some other time
2017-07-30 18:02:24 +01:00
344500785c Fixed wrong drops for Bookshelf 2017-07-30 17:58:34 +01:00
a95d173989 Fixed a couple of repeated Level->getBlock() calls in Liquid 2017-07-30 17:57:40 +01:00
e72d8cf8f5 Remove a couple of obsolete TODO comments 2017-07-30 17:43:14 +01:00
c0e0730923 Fixed PE armor screen glitching when equipping armor items 2017-07-30 17:41:44 +01:00
b6fe231bc1 Added melting for ice and snow layers 2017-07-30 17:27:28 +01:00
3bd94c9da7 Heads do not drop when the supporting block is removed
https://github.com/PocketMine/PocketMine-MP/pull/4087 didn't get reviewed properly, or at all 🤦
2017-07-30 17:26:55 +01:00
2e5e016b87 Remove redundant TODO from CraftingTable 2017-07-30 17:26:06 +01:00
822c048af0 Fixed wrong docs in Block 2017-07-30 17:24:59 +01:00
6e4b8ba677 Removed some useless code 2017-07-30 17:24:33 +01:00
a5a8732800 Removed redundant overriden method from Furnace 2017-07-30 17:24:02 +01:00
21887b283f Removed some copy-pasted code, fix leaves2 drops 2017-07-30 17:22:28 +01:00
3e141afe48 Exposed LoginPacket chain data to allow plugins to access this data 2017-07-29 14:27:16 +01:00
aa6eef26e9 Fixed #1255 2017-07-28 14:23:27 +01:00
87c16dab23 Don't allocate subs that aren't going to be modified 2017-07-28 11:26:15 +01:00
c1542d853f Improved flat world initial chunk generation speed by ~50% 2017-07-27 21:57:28 +01:00
8274f5b3cc More hack-fixes for #1220
Player and network really need to get divorced, and fast.
2017-07-27 11:25:40 +01:00
e8be8550a0 Fixed possible issues with tick counters being inaccurate when the server lags 2017-07-27 10:58:34 +01:00
b3dada4cb9 Fix wrong documentation in ServerEvent 2017-07-26 21:24:19 +01:00
ed5f69f170 Fixed documentation and expiration date nullability in BanEntry, close #1242 2017-07-26 19:37:08 +01:00
7d777510c5 Use the Crash Archive for crashdump submission instead of pasting them into an issue 2017-07-25 10:12:02 +01:00
6ff92f2adf Fix player timeouts crashing the server 2017-07-24 21:12:05 +01:00
f32e880542 Fixed really dumb copy bug breaking crafting 2017-07-22 12:04:52 +01:00
6cacb368ce Add PlayerJumpEvent (#1223) 2017-07-22 11:18:53 +01:00
6fa59230db Added documentation for Thread->registerClassLoader() and Worker->registerClassLoader() 2017-07-22 10:55:00 +01:00
1a7f567a70 Return the dropped item entity in Level->dropItem() (#1222) 2017-07-20 12:27:58 +01:00
42fb1d1fef Improve usability of Sign API (#1202)
* Improve usability of Sign API

* PHP

* Throw exceptions if out of range

* Fix phpdocs

* Formatting, additional checks in the SignChangeEvent.

* Blame php storm

* require line count to always be 4

* Adjust exception message
2017-07-19 15:22:04 +01:00
cca9cf2c86 Workaround for plugin versions being read as strings from plugin.yml
Config is a real pain in the ass to work with... need to split it up so this can be handled properly
2017-07-16 11:31:21 +01:00
7c00982fff Fixed furnaces crashing the server
Beware ListTag indices being strings! Should be impossible, but the NBT library is poorly designed.
2017-07-15 21:53:43 +01:00
3150c50cac Typehinted AxisAlignedBB 2017-07-15 18:43:10 +01:00
57e7c3d91f Missed one 2017-07-15 13:30:02 +01:00
3e8825f826 Fix bad documentation in Block 2017-07-15 12:48:41 +01:00
ab3b50f062 Stop it PhpStorm, you're making me look bad 2017-07-15 12:15:15 +01:00
dbb92096e4 More typehints, documentation fixes and static analysis cleanup 2017-07-15 12:12:06 +01:00
24bdf330d5 Merge branch 'moar-typehints' 2017-07-15 09:43:43 +01:00
b28128f835 Submodule updates 2017-07-15 09:43:33 +01:00
fb5587350d Solved issue of builds hanging when TesterPlugin fails to load (for example incompatible API version) 2017-07-14 16:48:42 +01:00
e6a2b0f270 Fix inaccurate documentation for ServerCommandEvent 2017-07-14 16:28:47 +01:00
bb230c5812 Shut up PhpStorm 2017-07-14 14:13:04 +01:00
6de8415c79 Merge network refactors 2017-07-14 13:04:02 +01:00
2018ad6376 Merge master 2017-07-14 12:12:35 +01:00
b5790d19bf Cleaned up MainLogger registration and declared a typehint
Remove null hint from MainLogger::getLogger() so static analysis doesn't complain everywhere
just make sure you register the logger before trying to use MainLogger::getLogger() on a different thread!
2017-07-14 11:39:04 +01:00
9390866a13 Fix derp 2017-07-14 11:00:59 +01:00
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
b9355387da fix some inspections related to crafting recipes 2017-07-14 08:53:37 +01:00
7f99d9019a API bump and submodule updates 2017-07-14 08:52:27 +01:00
8bb0c53797 More typehints for Command stuff 2017-07-14 08:52:27 +01:00
46a2e6cbf8 Some breaking changes for plugins >:D 2017-07-14 08:52:27 +01:00
8fc1501e89 Moar typehints 2017-07-14 08:52:27 +01:00
6a191b5069 Remove useless condition 2017-07-13 19:59:01 +01:00
08b8debd78 Added a FIXME for generator 2017-07-13 19:53:48 +01:00
2a7b736f18 Heap of bugfixes, cleanup and PHP 7 upgrades 2017-07-13 19:18:56 +01:00
c2a7c2c6cd Remove duplicate Quartz class (cc @PEMapModder)
how did nobody ever notice this...
2017-07-13 16:48:25 +01:00
4d874e7e78 static analysis 2017-07-13 16:45:24 +01:00
23866359c9 Fix some PSR-2 violations 2017-07-13 16:14:28 +01:00
3a214b7ce6 Cleaned up isEncoded mess 2017-07-13 12:21:26 +01:00
6341d3a0dc don't break the preprocessor 2017-07-13 12:09:03 +01:00
72d1948f30 Improved batch handling 2017-07-13 12:04:47 +01:00
a7f5ee2f3e Added capability to get/set screen height in lines for each CommandSender to alter page sizes of command output such as /help (#1144) 2017-07-13 10:57:10 +01:00
6b773dc04d Make resource-pack error messages a little clearer 2017-07-13 10:55:42 +01:00
6af87b7b30 Fixed clearCustomBlockData(), close #1118 2017-07-13 10:44:49 +01:00
5283975f20 Move inventory ID constants to their own interface
ContainerSetContentPacket will be removed in 1.2, and these aren't specific to ContainerSetContentPacket anyway.
2017-07-12 20:04:36 +01:00
a5c6c8b973 Added some fields to new packets
gave up on EventPacket because it's a mess, and StructureBlockUpdate is a job all by itself
2017-07-12 19:31:20 +01:00
caa229a25f Fix wrong generator name returned for Nether->getName() (#1194) 2017-07-12 18:10:54 +01:00
4731bf0a16 Fix autogenerated version numbers (didn't mean to commit this)
I'm working with a beta version >_>
2017-07-12 16:36:04 +01:00
30df0c2418 Refactor a bunch of network-related things for easier auto-generation of protocol stuff 2017-07-12 16:32:39 +01:00
e485999218 Just cut the adapter loose instead of needing extra fields for this 2017-07-12 12:28:54 +01:00
650afe2d94 Added PlayerNetworkSessionAdapter to allow abstraction of NetworkSession base 2017-07-12 12:28:54 +01:00
fa58736360 Remove derpy little try/catch for RakLib dependency check (not necessary anymore) 2017-07-11 20:00:16 +01:00
c33972aa67 Update submodule 2017-07-11 19:53:50 +01:00
6bcc8cea8e Fixed BossEventPacket breaks, now shut up and go away 2017-07-11 15:32:46 +01:00
f2467d3dbc Workaround for grass-path/farmland anti-flight issue, close #1170 2017-07-11 10:37:01 +01:00
be7e97e0bb Fixed server ping responses showing up in the wrong entries on the client
Seems it doesn't like negative numbers
2017-07-11 09:28:50 +01:00
767f0dcbf6 Fixed not being able to connect to Jenkins builds 2017-07-11 08:10:40 +01:00
c9fdb66c78 Made flat-world generation faster and less stupid
No need to set blocks which are obviously already going to be air >_>
2017-07-10 18:14:13 +01:00
8a28dfa64d Don't send crashdumps if git hash is invalid 2017-07-10 08:50:11 +01:00
c6a6571c07 Revert bad optimization due to broken logic
Revert "Small optimization to light propagation"

This reverts commit 6d7b76f356.
2017-07-09 12:45:11 +01:00
6d7b76f356 Small optimization to light propagation 2017-07-09 12:21:07 +01:00
8cca8e1256 Fixed a bug in light removal 2017-07-09 12:19:38 +01:00
30c5487f94 Drastically improved performance of basic chunk sky-light population
back 2 commits: 53ms per chunk
back 1 commit: 27ms per chunk
this commit: 3ms per chunk

(on my machine, of course)
2017-07-08 17:13:22 +01:00
728851594b Improved performance of basic chunk sky-light population
No need to recalculate this 256 times
2017-07-08 13:37:45 +01:00
2726f2a011 Solved packet encode/decode boilerplate code issue
Something as simple as forgetting the reset() when encoding would cause lots of problems which could go unnoticed. This should be fully backwards-compatible but needs more tests.
2017-07-07 13:59:09 +01:00
1a5e3b2ad0 Fixed outdated movement problem, fixed #1171 2017-07-06 10:40:03 +01:00
1493cde07f Added pause-game LevelEvent constant 2017-07-05 17:51:53 +01:00
6cd4d2c5a2 Added typehints and PhpDoc for events API
excluded blocks and entities events API to avoid merge conflicts
2017-07-05 16:42:06 +01:00
6504fdabab Fixed squid not updating and added some debug 2017-07-05 11:42:24 +01:00
394f420059 Fixed chunks not loading when respawning and some minor spawn sequence cleanup (#1153)
* Fixed chunks not loading when respawning and some minor spawn sequence cleanup

* This causes too much unexpected behaviour to be useful

Revert "Make use of Mojang's pitch hack, close #821"

This reverts commit c2dfef700f.

* Removed delayed-teleport system and cleaned up movement reset for dead players

* Fixed health resetting to max when quitting and rejoining
2017-07-05 10:31:16 +01:00
b8a30309bb Improve checks for Position::equals() and Location::equals() (#929)
* Add files via upload

* Position::$level can be null.

* Use getLevel() in place of $level

because of WeakPosition.
2017-07-04 20:25:25 +01:00
1a6517ea4e Added timings for console title ticking
As stupid as this seems, this can actually cost a significant amount of tick time due to reading from disk and/or executing commands.
2017-07-04 17:05:53 +01:00
9c9095060f Register MainLogger on AsyncWorkers to make MainLogger::getLogger() usable in AsyncTasks
Threaded static properties aren't thread-local anymore in pthreads 3.1.7dev
2017-07-04 16:50:17 +01:00
97f6a32557 Changed usage message displaying to exceptions to reduce boilerplate code
Someday this won't need to be done by commands themselves, it'll be done by the parser.
2017-07-04 13:45:00 +01:00
409fc282d2 Cleaned up ping response and added missing fields (#1114) 2017-07-04 11:17:47 +01:00
d474f73665 Move base offset to Human from Player
fixes jojoe77777/Slapper#58
2017-07-03 19:58:07 +01:00
c2dfef700f Make use of Mojang's pitch hack, close #821 2017-07-03 13:35:27 +01:00
dca7efa03c Fixed crash when /teleporting with yaw/pitch 2017-07-03 13:26:38 +01:00
b4a149cce8 Fix some issues with entities in leveldb worlds 2017-07-02 13:37:30 +01:00
2a67507997 Require php-leveldb version 0.2.0 or greater 2017-07-02 12:52:22 +01:00
70bd9afd37 Updated leveldb implementation to support MCPE 1.1 worlds 2017-06-30 09:11:26 +01:00
56dfa7d000 Added some debug for ChunkRequestTask 2017-06-29 11:31:28 +01:00
390df00966 Remove useless condition 2017-06-29 10:38:24 +01:00
82fd0e8d47 Added debug for view distance setting 2017-06-29 09:46:02 +01:00
6259f42d81 Fixed trace parameter list showing boolean instead of being empty for function calls with no parameters 2017-06-28 10:33:07 +01:00
08d4d7fe0e Fix /banlist and /whitelist list when no players are in the lists, close #1146 2017-06-28 10:28:43 +01:00
ae612b913e Fixed config type detection, fixed configs being saved empty
Fixes LegendOfMCPE/EssentialsPE#354

When the config file didn't exist, no type detection was performed. This resulted in the case statement for Config->save() falling through and not writing anything to the file.
2017-06-27 16:44:05 +01:00
adbc298909 Fixed item CompoundTags keeping the tag name after NBT serialize/deserialize, close #1145 2017-06-27 15:58:00 +01:00
d92a6240d8 Moved spawn check to sendChunk() instead of sendNextChunk(), fix #828
doesn't make sense to put it anywhere else regardless...
2017-06-27 13:36:26 +01:00
4a7c40edd5 ExplodePacket records have a signed Y coordinate -_- 2017-06-26 23:09:20 +01:00
1dd8fc008b Fixed players taking forever to spawn when generating a new world 2017-06-26 18:37:20 +01:00
ec079b68a6 Fixed missing packet registrations 2017-06-25 17:36:12 +01:00
ecfcf49984 Added basic encode/decode for gamerules data and added GameRulesChangedPacket
needed it for tests

Squashed:

oops

PhpStorm you asshole
2017-06-25 15:43:08 +01:00
f7aad8e2fe Use CRLF for PowerShell scripts 2017-06-25 14:15:34 +01:00
a73c6f1861 Fixed some unnecessary FQNs in docs 2017-06-25 12:43:04 +01:00
a365c831a8 Fixed some doc problems 2017-06-25 12:07:28 +01:00
c0377fc63a more typehints, removed more 32-bit leftovers 2017-06-25 11:40:12 +01:00
22d148a59d Fixed TAG_Short being read as unsigned 2017-06-24 11:22:32 +01:00
a1ce535d02 Remove the old plugin repo from README since it is dead/outdated 2017-06-23 23:21:34 +01:00
993af0fa30 Added build-denied action constant
don't need this, but good to have for completion's sake
2017-06-23 16:58:28 +01:00
b83c135c3f Made Item::setLore() fluent (#1120) 2017-06-23 08:39:56 +01:00
8bf1cc9e48 PHP version should be the very first thing to be checked 2017-06-23 01:52:53 +01:00
c70690a600 Fixed cleanPath() not working when the current working dir case doesn't match the actual path case 2017-06-22 19:49:27 +01:00
4b4f2af9e3 Fixed some very unusual crashdumps reporting non-fatal errors when plugins use die() or exit() 2017-06-22 19:08:33 +01:00
9047c2c1ef Updated DevTools submodule with /makeserver fix 2017-06-22 17:16:59 +01:00
89ca2ac2d5 Found an unknown field in ChangeDimensionPacket
No idea what this is actually used for though. It's set when a client dies in a different dimension and respawns in the overworld.
2017-06-22 15:52:29 +01:00
6a2a74a457 Improved git hash handling, add dirty git detection and disable automatic reporting for dirty builds 2017-06-22 13:35:04 +01:00
7ba807fd42 Update submodules 2017-06-22 09:41:07 +01:00
19410754c6 API bump 2017-06-22 09:34:04 +01:00
8cd31c2dc4 Fixed crashes starting RCON 2017-06-21 18:15:57 +01:00
c09a5ab301 Revert botched fix that broke teleports
Revert "Do chunk orders and sending during onUpdate() when we know the player has been constructed"

This reverts commit 080b35bf53.
2017-06-21 17:51:16 +01:00
a0ef15b15e New CrashArchive is up 2017-06-21 14:25:54 +01:00
03826d9cbc Fixed player spawnpoints glitching and not saving 2017-06-21 12:17:26 +01:00
080b35bf53 Do chunk orders and sending during onUpdate() when we know the player has been constructed 2017-06-21 11:54:05 +01:00
e9c46da7f0 Fixed glitching on respawn due to player 1.62 position offset 2017-06-21 11:27:50 +01:00
0f79b19fdc Removed masks for Y coordinates, fixed bugs related to out-of-bounds coordinates, fixed #914 (#915) 2017-06-21 10:55:38 +01:00
69ae37d191 Added no PvP flag for spectator mode, fixes nodamage sound in spectator 2017-06-21 09:42:26 +01:00
86742fcf30 Workaround for flight controls fail on teleport (TODO: fix this properly) 2017-06-20 20:10:20 +01:00
a4b8dd43e6 Removed useless confusing array indices in CompoundTag constructors (#1116) 2017-06-20 12:11:24 +01:00
e11f1e94e9 Cleaned up SubChunk implementation 2017-06-19 15:40:31 +01:00
938452bfe9 Clarified guidelines on useless issues 2017-06-19 13:43:10 +01:00
a724395148 Added exception handling to Player->close(), mitigates #1060 and #1101 2017-06-19 13:37:38 +01:00
bc10edfdd3 Removed incorrect use of \pocketmine\ANSI constant for debug logging in MainLogger constructor 2017-06-18 16:50:34 +01:00
f7d07ca155 Updated DevTools submodule 2017-06-18 11:46:31 +01:00
be7b057fa5 Improved metadata sending and made it less spammy
Add changed properties to a list to send in a group on tick in a single packet
2017-06-17 20:00:45 +01:00
8637e0224f Check protocol version before anything else 2017-06-17 19:30:37 +01:00
8919d4a372 Some refactoring to allow for light updates to be executed asynchronously 2017-06-17 17:38:47 +01:00
0cf3914f5d Player base offset doesn't change with scale, close #943, close #945 2017-06-17 12:59:41 +01:00
e9a638d84a Set a default value 0 for tick counter (#1108) 2017-06-17 12:42:42 +01:00
e3b3f60c66 Fixed item stack count and effect amplifier overflows, close #1072 2017-06-17 12:22:38 +01:00
1bae973502 Fix server crashing while crashing when trying to decode an invalid response from the crash-archive post 2017-06-17 10:31:20 +01:00
e0f8a02bb8 Catch and log all crashes occurring while creating crashdumps 2017-06-17 10:25:34 +01:00
846be84324 Fixed all file headers 2017-06-16 16:18:16 +01:00
8ef24423d1 This should never be null 2017-06-16 15:48:08 +01:00
8fc38c36f9 Fixed some derp Vector3 aliases 2017-06-16 13:48:53 +01:00
eb05f2ecde Added UpdateNotifyEvent 2017-06-15 11:16:13 +01:00
478e954b3f Updated preprocessor submodule 2017-06-15 11:04:52 +01:00
313fdb9e87 Added INT32_MIN and INT32_MAX constants and an exception throw for out-of-range effect amplifiers 2017-06-14 19:38:39 +01:00
1bf18ba8d2 Fixed messed-up header in ItemFrame 2017-06-14 18:46:35 +01:00
5011198a4e Cleaned up SetupWizard and fixed crash when pressing CTRL+C during setup 2017-06-13 17:38:19 +01:00
e96fa8b682 TODO: REVERT - Added a hack for InteractPacket spam issue 2017-06-12 19:50:31 +01:00
bf3868c078 Missed one 2017-06-12 09:33:48 +01:00
3167817e34 Fixed crash when memory hard limit is disabled, close #1074 2017-06-12 09:32:31 +01:00
433b8369f5 Point updater to new host update.pmmp.io 2017-06-11 19:15:35 +01:00
0612244b5e Fixed warn-ops config being useless 2017-06-11 19:07:41 +01:00
487233a101 Improved AutoUpdater error handling and made it more robust 2017-06-11 18:41:18 +01:00
4341fb8347 AddEntityPacket's attributes encoding is still non-standard -_-
I thought they fixed this...
2017-06-11 18:09:58 +01:00
789df942b6 Don't try to order packets sent with immediate priority, fixes #1026 2017-06-11 13:04:43 +01:00
9e99252817 Improved ListCommand and fixed crash when no players are online
I <3 closures
2017-06-11 10:56:16 +01:00
75cc2d6914 Cleaned up Utils::getIP(), resolved strict-type issues, close #1062 2017-06-11 10:25:48 +01:00
61b857a81c Fixed ExplodePacket
fixed-float my ass!
2017-06-10 19:54:04 +01:00
2024e9ecdf Fixed extremely stupid zero-length bug in BinaryStream
pls don't kill me 😢
2017-06-10 18:33:54 +01:00
4765242397 Drop support for 32 bit systems/PHP (#984)
* Cutting out 32-bit and minor improvements to bootstrap

* Byeeeeee

* Removing legacy code

* added note to the issue template
as suggested by @xxFlare
2017-06-10 16:11:28 +01:00
3687b149b9 Fix a couple of bugs exposed by php 7.2.0alpha1 2017-06-10 14:51:28 +01:00
1aae9e03b6 Fixed reference parameter fail in UpdateCheckTask, close #1048
not sure _why_ this doesn't work... maybe something to do with the old property being a member of a threaded object?
2017-06-09 19:51:18 +01:00
c43ab12a9a Fix spawnForced not specified in SetSpawnPositionPacket, close #1046 (#1047)
* Fix #1046

* Change spawnForced to false
2017-06-09 18:12:57 +01:00
cd66f58526 Restrict XpSeed to the bounds of an int32, close #1040 2017-06-09 16:05:28 +01:00
7870a8672e Remove useless duplicate check 2017-06-09 16:02:30 +01:00
eac756470a Fixed trying to save health as a ShortTag, close #1039 2017-06-09 09:11:02 +01:00
a302b4988f Fixed bad values assigned to LongTags
PhpStorm you bitch... why didn't you tell me these were a problem?!
2017-06-08 19:28:29 +01:00
2193adf844 Removed auto-generated stub comments 2017-06-08 19:22:52 +01:00
890f72dbf2 Type-hinted NBT tag constructors, made getValue() and setValue() more strict, fix dozens of assorted related bugs 2017-06-08 19:17:52 +01:00
595e1ab52f Added Plugins section to the issue template (#1034)
* Added Plugins section to the issue template

* break it down a little
2017-06-08 18:26:53 +01:00
4a7abb7033 Fix flat worlds crashing when generating 2017-06-08 13:47:13 +01:00
d358e13868 Strict type all the things and fix lots of assorted bugs exposed by strict types (#993)
Strict type all the things
2017-06-08 11:21:51 +01:00
1f630e57f2 Fixed vine block update crashes, close #1032
The meta->side array was the wrong way round (keys & values inverted).
2017-06-08 09:32:38 +01:00
cc1d1b0f45 Fix type error in Furnace due to useless floor(), close #1031 2017-06-08 09:12:58 +01:00
78c09267e5 Typehinted things in BinaryStream, sorted some methods and related bugfixes 2017-06-07 13:53:10 +01:00
c445db421f Fixed stupid bug in resource pack chunk counting, close #1028 2017-06-07 13:29:13 +01:00
e18a3ac933 Fixed UUID-related issues 2017-06-07 13:11:03 +01:00
75863e2a44 OCD commit 2017-06-07 12:54:12 +01:00
5aea9220c9 Fixed chat and some TextContainer documentation issues 2017-06-07 12:54:12 +01:00
bd7205dd64 PhpStorm doesn't understand variable class names :( 2017-06-07 12:54:12 +01:00
82a63ed18e Added an assert to shut PhpStorm up 2017-06-07 12:54:12 +01:00
cf07af8b55 Fix some strict type violations reported by PhpStorm (strict types <3) 2017-06-07 12:54:12 +01:00
b775e8c88a Fix Achievement bug (thanks strict types <3)
as if nobody ever noticed this... LMAO
2017-06-07 12:54:12 +01:00
51091fe87b Fix player data saving 2017-06-07 12:54:12 +01:00
7c14ffbcfa More type fixes 2017-06-07 12:54:12 +01:00
db93827650 Fix world saving 2017-06-07 12:54:12 +01:00
c2186041d6 Fix TranslationContainer issue 2017-06-07 12:53:16 +01:00
481114281e Server starts! 2017-06-07 12:53:16 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
606b9b687d Fix level ticking errors (these methods return floats >_<) 2017-06-07 12:53:15 +01:00
45618c7cfe Enable strict types for Server and add a bunch of type-hints 2017-06-07 12:53:15 +01:00
3f03d9e683 Fixed DevTools getting disabled when a plugin throws an exception during load (#1025) 2017-06-07 11:12:47 +01:00
f0d12a0b30 Implemented asVector3(), asPosition() and asLocation()
Squash merge, closes #973
2017-06-07 16:40:45 +08:00
9cc27b2719 Force sync 'compression' under the batch threshold
Since we aren't actually compressing these anyway, only writing a checksum, sending these asynchronously causes strange bugs due to race conditions.
2017-06-06 11:40:41 +01:00
87e54d7a3a Send block updates in batches 2017-06-06 11:40:30 +01:00
29e88d8592 Send area broadcasted packets in batches
- I don't know why it wasn't done like this to start with
- This provides a significant lightening of workload for large servers with lots of players in the same area because packets are only compressed once instead of for each player.
- Improves client-sided performance receiving these in batches instead of being spammed with many individual packets.
2017-06-05 23:39:16 +01:00
c6e800cf42 Use compression level 0 when batch size is below threshold
This isn't free, because of the adler32 checksum... but it's much lighter on performance for small packets.
2017-06-05 22:05:46 +01:00
b7b7bcee4f Fixed some weak comparisons 2017-06-05 21:07:35 +01:00
6ea0eb47ec Fixed PlayerInventory in_array recursion issue, close #1008
This is INTENDED BEHAVIOUR for comparing objects?????
2017-06-05 20:51:12 +01:00
b9a87ed147 New fields for InventoryActionPacket
TODO: use this packet
2017-06-05 20:04:20 +01:00
742f593758 Added a new constant to ContainerSetContentPacket 2017-06-05 19:15:30 +01:00
1e9ff44890 New field for MobEquipmentPacket
If anyone wants to play with the off-hand, the window ID is 0x77 ;)
2017-06-05 19:10:00 +01:00
55c4e35407 Added a new PlayerActionPacket constant
thanks @jojoe77777
2017-06-05 18:37:53 +01:00
e83ffd5afe Fixed players don't see teleport movement, close #921 2017-06-05 16:47:12 +01:00
54453d0b0a Refactored entity IDs in packets for consistency and to clarify on types 2017-06-05 15:41:27 +01:00
51d510aa4f Who set these stupid values... fixed #1011 2017-06-05 14:22:45 +01:00
4cd97a7c7a Fixed UpdateAttributesPacket not being registered for reading 2017-06-05 14:14:50 +01:00
d586ad03ec Update submodules 2017-06-05 10:15:03 +01:00
61d354a4ea Block constructor mass-replace to fix #963 and related issues 2017-06-05 10:02:27 +01:00
6f126ad239 Fix outdated preprocessor rules for varints, close #1003 2017-06-04 23:27:39 +01:00
efea39e0a4 Change buffer unread assertion to debug
I lost count of how many times I changed this now... what happened to the other times?
2017-06-04 19:19:50 +01:00
d4bb078566 Fixed some formatting issues in Player 2017-06-04 18:32:45 +01:00
6686bd4442 Quick fix for melons and pumpkins, close #965 2017-06-04 16:57:51 +01:00
2b02fcfe2c fixed #992 2017-06-04 16:54:35 +01:00
138fb88431 More default packet fields 2017-06-04 14:53:31 +01:00
26577d9d5b fixed a doc warning 2017-06-04 14:37:06 +01:00
2f4943ac90 Fixed some doc issues 2017-06-04 14:27:30 +01:00
eda7965f86 Fixed wrong types in ParticleCommand 2017-06-04 14:22:12 +01:00
4666560731 Removed some tags that don't exist in vanilla McRegion chunks 2017-06-04 13:04:06 +01:00
b01ad01eff Merge branch 'spammy-backtrace' 2017-06-03 22:04:31 +01:00
4ba3a3af3d fix FloatingTextParticle 2017-06-03 20:51:48 +01:00
5baf59ca56 fix #990 2017-06-03 20:25:24 +01:00
902957cb53 more defaults for optional fields, close #985 2017-06-03 17:41:40 +01:00
3463bea932 add defaults to MobEffectPacket
these fields may be unspecified if we are only removing effects
2017-06-03 15:21:24 +01:00
105917a534 Fixed type issues writing longs and var-longs on 32-bit 2017-06-03 12:04:08 +01:00
b83082f224 Fixed missing field in ContainerSetContentPacket, close #980 2017-06-03 11:59:19 +01:00
840a3883b1 Fixed type of empty ListTags and removed some undefined behaviour (#974)
* Fixed fallback type of empty ListTags, close #972

* Less undefined behaviour
2017-06-03 11:18:00 +01:00
ad4659365a Use default amplifier 0 instead of implicit null
(how did nobody ever notice this?!)
2017-06-03 11:06:22 +01:00
8d858e3e6d Removed __toString() from backtrace, fixes ludicrous amounts of spam when something crashes involving EncapsulatedPackets or NBT 2017-06-03 10:36:04 +01:00
22ba017965 Binary strict types (#969)
* Some Binary cleanup, type-hints and strict types
yes, I know this is very crashy... that's good, because it highlights unexpected behaviour

* added some default values
2017-06-03 09:39:45 +01:00
8bb0e8d398 Fixed a mistake in DropItemPacket encode 2017-06-02 17:52:10 +01:00
087a994393 Workaround for some plugins crashing clients during PlayerLoginEvent 2017-06-02 17:06:01 +01:00
e4e4ef5f2a Fixed preprocessor issues with signed bytes and floats, close #967 2017-06-02 12:50:48 +01:00
3ac51e1095 TAG_Byte should always be signed (#962) 2017-06-02 11:30:44 +01:00
2db6ea6b18 Updated creative inventory data
some items will show wrong damage values due to a bug in meta handling on master
2017-06-02 11:00:36 +01:00
b6ae92e1a7 Updated crafting data and item serialization for 1.1, fixed #963 2017-06-02 10:36:14 +01:00
31e2c1d26c fix stupid bug in PlayerInventory 2017-06-01 20:19:17 +01:00
846e3b6f1e New fields for StartGamePacket 2017-06-01 19:48:06 +01:00
0e525ac1c3 Autogenerated data for 1.1.0.55 2017-06-01 19:24:17 +01:00
8382970d56 Merge branch 'master' into mcpe-1.1 2017-05-30 16:09:46 +01:00
db3cd1829c Made Binary::readVarInt/VarLong methods less useless 2017-05-30 14:19:34 +01:00
caced595d2 Fixed server crash on startup on 32-bit with memory limit set >= 4096MB 2017-05-30 14:15:40 +01:00
86f3b257a7 Remove unneeded foreach loop in Human::getDrops() (#941)
* Remove unneeded foreach loop in Human::getDrops()

* Use array_values() for backwards compatibility.
2017-05-30 13:27:47 +01:00
1ed5de1d3b Merge branch 'nbt-cleanup' 2017-05-30 12:26:17 +01:00
63358a8065 Merge branch 'master' into mcpe-1.1 2017-05-30 09:45:20 +01:00
f6ff03fc31 Added support for MCPACK resource packs 2017-05-30 09:43:28 +01:00
0ad16c1919 Added PlayerDataSaveEvent, resolved #487 (#920)
* Added PlayerDataSaveEvent, resolved #487

* Added getPlayer() to PlayerDataSaveEvent
may return an IPlayer

* Fixed quit messages
This TranslationContainer vs. string mess... >_<
2017-05-29 18:50:45 +01:00
38b8f14758 Fixed wrong reported slot in PlayerItemHeldEvent, fixed assert failures due to negative slot numbers in the hotbar
fixes some issues reported in #525
2017-05-29 16:33:48 +01:00
8779259734 Stop spawning entities to players twice
This will be done when the chunk is sent to the player anyway.
2017-05-29 15:57:05 +01:00
2f306c3a38 Fix crash when new players join due to attempting to send negative inventory slot 2017-05-29 15:30:11 +01:00
57379b93ce Fixed a mistake in metadata decoder 2017-05-27 14:18:40 +01:00
954271b90f Found unknown fields for SetSpawnPositionPacket 2017-05-27 13:13:19 +01:00
645d744e05 Added a check for Phar extension 2017-05-26 21:39:43 +01:00
4c764072b2 Check the entity is actually inside a block before trying to shove it out, fix #271 2017-05-26 17:15:25 +01:00
3446f68c74 Workaround for PowerShell escape code issue after using git in the same window
I don't have any idea why the bug happens. Starting the server in a child PowerShell process resolves the issue.
2017-05-26 13:46:34 +01:00
ca6826898b Added API method Server->broadcastTitle() (#932) 2017-05-25 14:05:41 +01:00
76ab3d4288 This worked fine locally... 2017-05-24 14:50:33 +01:00
b6c1139b27 Fixed lint scan ignoring PHP_BINARY argument 2017-05-24 14:25:48 +01:00
af06d78725 Merge changes from master 2017-05-24 09:54:11 +01:00
8cc1003956 Fixed FloatingTextParticle 2017-05-24 07:37:11 +01:00
92281da514 Fix wrong comment in FallingSand
This is actually a bug in MCPE
2017-05-23 20:02:23 +01:00
5c8297f4a1 Fixed some logic issues with falling blocks, fix #897 #899 #935 2017-05-23 19:48:49 +01:00
23ed3334c2 added creative mode check for block picking 2017-05-23 16:26:29 +01:00
674394c4f5 Fixed undefined offset when retrieving something from the thread store that doesn't exist (#919) 2017-05-22 13:53:57 +08:00
4e381ab033 Added DATA_COLOR alias 2017-05-21 14:40:49 +01:00
c5527db424 Be more clear about ProtocolInfo being automatically generated and add notice to not bother submitting PRs for changing version numbers (#931) 2017-05-21 13:58:01 +01:00
aecff7c782 Revert "Improved handling of incompatible protocols"
This reverts commit 576702ffa9.

This crippled plugins which use data fromm LoginPacket :S
2017-05-21 13:27:27 +01:00
0207b22110 Fixed Mojang world converters barfing on PocketMine-MP generated McRegion worlds
blame @shoghicp
2017-05-21 12:44:42 +01:00
a77c1ce13c remove leftover 2017-05-20 12:24:10 +01:00
afd90adb1c Refactored JSON-parsing NBT utilities into their own class 2017-05-20 12:24:10 +01:00
2e480b5ea1 Fixed broken logic for recursive counts of ListTag 2017-05-20 12:24:10 +01:00
d4cc7d13cd Fixed setValue() being useless for CompoundTags and ListTags 2017-05-20 12:24:10 +01:00
f6c0ba9846 Cleaned up some duplicated code in NBT parser 2017-05-20 12:24:01 +01:00
f3c38700f5 Removed options for disabling assertion exceptions 2017-05-20 12:24:00 +01:00
77b1b565a4 Stop silently blocking people 2017-05-19 12:11:40 +01:00
36c95660e6 Fixed some logic issues with async compression 2017-05-19 11:30:23 +01:00
905d3f1610 Only save batch buffer when compressing chunks
faster due to not needing to serialize, and reduces memory footprint of caching
2017-05-18 19:46:20 +01:00
0f174f7605 Fixed ServerKiller always killing on shutdown on single-core machines, close #170 2017-05-18 15:58:09 +01:00
60f5c7ccef Async chunk compression and serialization is now non-optional 2017-05-18 12:19:27 +01:00
85c1535c75 Merge branch 'master' into mcpe-1.1 2017-05-18 11:29:52 +01:00
568e2760f1 Collect workers when cancelling all tasks 2017-05-17 19:30:50 +01:00
fe8cb8cd86 Server->batchPackets() now only accepts DataPacket objects, fixed players receiving double PlayerListPackets with their own data 2017-05-17 17:15:42 +01:00
15b47fcb2f Merge branch 'master' into mcpe-1.1 2017-05-17 15:52:01 +01:00
00e6d6a6b1 Fixed AsyncTask memory leak (#922)
* Added PocketMine-TesterPlugin submodule with regression test
2017-05-17 15:43:44 +01:00
8887a92d4b Removed useless break statements 2017-05-16 21:20:22 +01:00
a9afad10bc BinaryStream no longer extends stdClass, fixed a couple of minor bugs
Seems :shoghi: used stdClass to silence IDEs, which before ALPHA5 would complain about myriad undefined fields due to lack of type checking (switch based on packet id 🤦)
2017-05-15 19:28:39 +01:00
b41fef0276 Fixed some field types 2017-05-15 16:38:02 +01:00
fe3b5bac51 New fields for PlaySoundPacket and StopSoundPacket 2017-05-15 16:19:08 +01:00
0a4d62b405 Added encode and decode methods for more packets 2017-05-15 15:56:59 +01:00
0935855def Fix issue with colored message on some languages (#910) 2017-05-15 10:07:01 +01:00
c7c7a40899 Added "extensions" attribute in plugin.yml with version checking (#903)
* Added "extensions" attribute in plugin.yml with version checking

* Renamed getExtensions() to getRequiredExtensions()

As per recommendation from @dktapps
2017-05-15 10:04:26 +01:00
162a08b8cb Removed options for disabling assertion exceptions 2017-05-14 20:48:58 +01:00
b9ad0b99a5 Merge master into mcpe-1.1 2017-05-14 16:42:42 +01:00
576702ffa9 Improved handling of incompatible protocols
Allow plugins to hack around incompatible protocol numbers 🙈
2017-05-14 16:15:15 +01:00
dbb8e8ad0a Improved checks for event registration 2017-05-14 12:07:15 +01:00
4a9acf564c Silence PlayerFallPacket unhandled spam
we're not using this packet
2017-05-13 19:26:57 +01:00
69f64dd802 BossEventPacket
lots of stuff doesn't work (not implemented in MCPE, bug, or are we doing something wrong???)
2017-05-13 17:33:56 +01:00
11169b0777 add ifndef for BatchPacket 2017-05-13 14:57:48 +01:00
71af694cc1 Use getBool() more 2017-05-10 11:30:24 +01:00
c51c8ae700 Standardised attributes encoding 2017-05-10 10:48:53 +01:00
713f3facf9 Fixed stupid bug with Arrows 2017-05-09 21:09:34 +01:00
df577bddc2 Updated LevelSoundEventPacket constants (again) 2017-05-09 14:02:51 +01:00
046f17c9e2 Merge branch 'master' into mcpe-1.1 2017-05-08 17:43:09 +01:00
50f7d04044 Import cleanup 2017-05-07 16:55:10 +01:00
4ccd955647 Fixed possible memory leak with projectiles, use owner/target metadata 2017-05-07 16:50:32 +01:00
c383c7b0dd Found an unknown field in LevelSoundEventPacket 2017-05-05 18:34:52 +01:00
adbb53929e Fixed scaling issues with height and width on the client, close #819
Seems these metadata fields are actually the _base_ height/width. Setting the scale will cause the client to calculate bounding boxes with the scale already taken into account. This caused the scale to be applied twice on the client.
2017-05-05 16:51:15 +01:00
8a7259aa73 Merge #826: use getEffectLevel() instead of getAmplifier() + 1
Closes #412
2017-05-05 19:01:04 +08:00
76ceddf266 Reduced deltas for player movement, significantly smoother player movement and rotation (#883)
Send movement to viewers if the player moved more than 0.01 blocks in a tick or rotated more than 1 degree in any direction.
2017-05-05 11:23:06 +01:00
11f35d28c2 Call PlayerInteractEventm when receiving ItemFrameDropItemPacket to allow plugins to prevent item frame item removal (#887) 2017-05-05 11:18:58 +01:00
c4f461f65d Fixed fall damage in 1 block of water, close #470 2017-05-05 10:41:44 +01:00
702c129a97 Added basic support back for block-crack animations when breaking blocks
TODO: improve this to take stuff like swimming, ladders, enchanted tools into account, fix wrong tool break time calculations for bad tools (pmmp/PocketMine-MP#211)
2017-05-05 09:40:55 +01:00
56306f6636 Merge branch 'master' into mcpe-1.1 2017-05-04 21:15:49 +01:00
18f1376c65 Added handling for punch-block player action, added block punch particles 2017-05-04 21:11:47 +01:00
49eb0eb050 Fixed falling sand glitching on landing, minor logic improvements 2017-05-04 17:48:39 +01:00
13fd8b681e Added some sounds, fixed DestroyBlockParticle wrong particles for blocks with different meta values 2017-05-04 16:50:13 +01:00
40f2d7fcdc Updated LevelSoundEventPacket sound constants 2017-05-04 16:00:49 +01:00
c537cea87e Resolved issues with incorrect item and TNT position offsets, close #848 2017-05-04 13:52:10 +01:00
eaef2bd169 Fixed some inspections 2017-05-04 12:19:50 +01:00
966e4bf8a1 Added name field to crashdump data 2017-05-02 19:37:35 +01:00
f889bf9cf5 Fixed player list self-duplication 2017-05-02 12:28:27 +01:00
6d90f91be0 Fixed crashes while crashing related to plugins 2017-04-30 16:22:50 +01:00
0a52e210db Fixed crash when crashing while generating a crashdump due to crashing 2017-04-30 16:01:08 +01:00
971703a618 Dump object counts when dumping memory 2017-04-29 19:12:46 +01:00
de359a2bce Fixed a microscopic Command TimingsHandler memory leak
This reduces memory usage of an idling server by about 20kb. Definitely worth the time.
2017-04-29 18:03:45 +01:00
1266f8f1aa Fixed static properties not being dumped if an instance of the class was not referenced by Server 2017-04-29 12:25:00 +01:00
a22306d418 Fixed static property refcount bug 2017-04-28 18:43:36 +01:00
b542277eca Disable memory limit before performing a mem dump
Fix memory dumps not completing due to exhausting available memory
2017-04-28 16:53:05 +01:00
edf1fbb6e6 Removed a couple of useless null checks from PermissibleBase 2017-04-27 18:00:20 +01:00
653b6b55a9 Added title command and API for resetting title duration 2017-04-27 16:38:51 +01:00
7f09a2a26e Added Announcement type to TextPacket 2017-04-27 16:10:42 +01:00
7aeb3129ac Merge conflict resolution 2017-04-27 14:27:29 +01:00
84ec944b6b Use short class names for unhandled packet logging, added some documentation 2017-04-27 12:16:24 +01:00
6ef132e468 Updated PocketMine-Language submodule 2017-04-27 11:50:17 +01:00
dc71eb5246 Protocol updates for 1.1.0.9 2017-04-27 11:24:49 +01:00
2a59977440 Added various checks for region file validity (#393)
Check size, check header size, check location table offsets point to valid locations, check for shared offsets, prevent issues with corrupted or junk data
2017-04-27 09:14:02 +01:00
bf9b8722c9 Cleaned up batching checks 2017-04-26 22:02:45 +01:00
4d897b824b Added more metadata properties, fixed some wrong values, fixed too many oxygen bubbles 2017-04-26 19:48:31 +01:00
caf4937222 Fixed arrow flight and spawning bugs, fixed critical trail, close #420 2017-04-26 18:55:48 +01:00
2f87dfdcb0 Merge branch 'master' into mcpe-1.1 2017-04-25 18:05:32 +01:00
716efe2549 Fixed a stupid mistake in AddEntityPacket 2017-04-25 18:04:41 +01:00
ffcada88f3 New data flags 2017-04-25 16:27:29 +01:00
946d7e2bb1 Merge changes from master 2017-04-25 12:32:10 +01:00
5a9b5db103 Better cURL API, use async in timings (#834)
* Improved cURL functions
* Created BulkCurlTask
* Use asynchronous cURL posting in /timings paste

Closes #509
2017-04-25 11:52:18 +01:00
beed94dfb9 Update DevTools submodule 2017-04-25 11:41:55 +01:00
c6229b1e52 Merge network current changes - checkpointing
This is stable enough for everyone to be using it in production, and we're about 200 commits up from the previous tag. This branch contains hundreds of bug fixes, regardless of other changes which are not yet finished.
2017-04-25 11:00:51 +01:00
7a2ed232cc Merge branch 'api3/network' into api3/network-mcpe-1.1 2017-04-24 13:56:19 +01:00
d682fdfdf0 Food and exhaustion should not apply in creative, close #860 2017-04-24 13:31:05 +01:00
0e7f364a41 Fixed chunk object memory leak when chunks are changed, close #419
If a player quit the server in the 1-second between a chunk changing and a fresh chunk-order requesting a resend of that chunk, the player wouldn't know they were using that chunk and did not unregister themselves, causing the subject chunks to always remain loaded.
2017-04-24 11:55:33 +01:00
1be4bd67e4 Fixed assert failure when player join in un-generated areas of the world 2017-04-24 10:32:50 +01:00
559504225a Throw an exception before calling base entity constructor if skin is not set or invalid, close #835 (#855) 2017-04-24 09:50:55 +01:00
8ddf781a51 Oops, a typo 2017-04-22 20:24:24 +08:00
7cafaf2844 This line in README is a bit ambiguous
It sounded like "Poggit" was an adverbial clause to specify the name of "the old plugin repository".
2017-04-22 20:22:55 +08:00
fcff6961a8 Bump for 1.1.0.8 and removed LoginPacket zlib hack 2017-04-22 11:10:13 +01:00
db4027cdb2 New fields for MovePlayer and MoveEntity packets 2017-04-22 00:58:18 +01:00
e22bb213af Oops 2017-04-22 00:47:01 +01:00
179210aa27 Merge branch 'api3/network' into api3/network-mcpe-1.1 2017-04-21 22:50:14 +01:00
6ece57e23e Merge changes from master 2017-04-21 22:48:18 +01:00
be631ad6f7 Fixed disconnects properly 2017-04-21 20:31:47 +01:00
2204942338 Fixed the half-done hunger implementation, fixed lots of bugs related to hunger
- Fixed starvation doesn't deal any damage at all (Human->getFood() returns a float, not an int, === 0 won't work so great)
- Added exhaustion for sprinting, walking, jumping and sprint-jumping as per MCPE (these use MCPE values, and yes MCPE does walking exhaustion!)
- Fixed attributes don't get reset after player death
- Added food and hunger regeneration in peaceful difficulty
- Added API methods Living->jump() (motion isn't updated yet, so this won't actually do much if plugins try to use it) and Living->getJumpVelocity()

TODO: implement exhaustion for swimming
2017-04-21 19:48:25 +01:00
00a226921c Fixed server crash when taking damage after being killed when having Health Boost effect 2017-04-21 18:52:04 +01:00
e7406ba096 Fixed squid health attribute errors 2017-04-21 14:42:19 +01:00
a356e36340 Autogenerated data for 1.0.7.0
Did they actually _change_ anything or just trying to keep it on par with the game version? >_<
2017-04-21 13:22:36 +01:00
547a09c8d4 Fix "Creating default object from empty value" (#858)
while setting lore to items.
2017-04-20 20:39:09 +01:00
3f1790bcb8 Found some missing data flags and proper fix for ladders 2017-04-20 19:42:00 +01:00
a0ba8f0098 Added some new metadata, fixed others, fixed TNT (again) 2017-04-20 17:52:24 +01:00
feb538900b Added a couple of entity metadata properties 2017-04-20 16:05:46 +01:00
5ce860c2f5 Updated AnimatePacket with extra float handling 2017-04-20 15:39:12 +01:00
6c5ca9b256 Protocol updates for 1.1.0.5 2017-04-20 13:54:55 +01:00
de95046c11 Reduce header sizes on PR template
Stop getting in my face
2017-04-20 10:43:10 +01:00
9e2b26de23 Remove redundant null check in PluginCommand (#853) 2017-04-19 17:59:01 +01:00
b867cf4c91 Fix a potential newline issue in PULL_REQUEST_TEMPLATE.md 2017-04-19 11:50:49 +08:00
d3f4b185f3 Fixed typo in PULL_REQUEST_TEMPLATE.md 2017-04-19 11:49:46 +08:00
86de0bddd9 World should only be completely immutable if we're in spectator mode
Fixes being unable to break any blocks at all in adventure mode
2017-04-18 20:01:51 +01:00
207056fb9d Fixed adventure mode being useless 2017-04-18 19:51:42 +01:00
17e4f45e97 Fixed kicking players not working properly 2017-04-18 19:41:09 +01:00
6828ce66b6 Fixed farmland appearing black on clients (farmland is transparent in PE) 2017-04-18 19:40:54 +01:00
930945db18 Create PULL_REQUEST_TEMPLATE.md (#845)
Adapted from the PHP RFC template
2017-04-18 16:33:37 +01:00
b7b7a93e4e Merge branch 'api3/network' into api3/network-mcpe-1.1 2017-04-18 14:52:06 +01:00
d2efcee115 Fixed tiles and entities being closed when replacing chunks, should fix #490 2017-04-18 14:47:42 +01:00
eefa8abaf2 Throw exceptions if something attempts to add a closed Tile or Entity to a chunk 2017-04-18 14:45:33 +01:00
a34573643f Fixed transparent blocks filtering direct sky light 2017-04-18 14:14:19 +01:00
dab73d8950 Implemented sky light generation-time population and updating, obsolete and close #160 2017-04-18 13:05:01 +01:00
5e6a0e7ba0 More metadata changes, fixed TNT 2017-04-16 22:03:52 +01:00
c5eccc8e1c Minor improvements to Batch encoding 2017-04-15 19:40:06 +01:00
b55929b382 Merge branch 'api3/network' into api3/network-mcpe-1.1 2017-04-15 10:30:02 +01:00
8a775e0c45 Fix PopSound giving failed click sound. (#829) 2017-04-15 10:02:00 +01:00
d7378fe6f4 Some new metadata properties 2017-04-14 19:56:23 +01:00
66924729ff Fixed climbing blocks such as ladders and vines
Seems we can now climb ANY block if the climbing flag is true, and nothing if false. This commit adds local block checks to see if a climbable block exists at the entity's feet and if so, sets the flag.
2017-04-14 19:02:53 +01:00
f12a6eed29 Fixed vine block placement 2017-04-14 18:25:50 +01:00
f2159c5948 Fixed unlit furnaces glowing in the dark, close #508
Whether Furnace extending BurningFurnace actually makes logical sense is a different question, but that cna be resolved any other time.
2017-04-14 15:30:37 +01:00
4ab8233fe0 Fixed shooting bow while sprinting, close #827 2017-04-14 15:27:32 +01:00
a327a74ece Protocol changes for 1.1.0.3, fixed red sky, fixed crashes 2017-04-14 15:17:56 +01:00
f3ab45e7d5 Merged in 1.0.6 changes, added autogenerated data for 1.1.0.3 (doesn't work yet) and deliberately made the same merge error as Mojang 2017-04-14 13:00:43 +01:00
cdf6d200ef More protocol changes for 1.1, fixed resource packs 2017-04-14 12:48:50 +01:00
40775f5d86 Fixed issues with subtitles not working correctly, close #823 (#825) 2017-04-14 10:42:23 +01:00
319763dd93 Fix #823
Thanks to @SuperMaXAleX
2017-04-13 22:32:53 +03:00
a455e25665 Merge remote-tracking branch 'jacknoordhuis/patch-2' 2017-04-13 13:28:06 +00:00
1c7773c5f1 Visibility keyword before final or abstract keyword. (#814) 2017-04-13 20:58:53 +08:00
7c66af5994 "Fixed" resource packs
TODO: new fields
2017-04-12 11:54:47 +01:00
cb7264e0e5 Hexdump unhandled packets 2017-04-12 11:20:58 +01:00
f7e1939ae8 Changed some handling of unknown packet content 2017-04-12 11:16:50 +01:00
172d7339f9 Autogenerated data for 1.0.6.52 2017-04-12 11:11:37 +01:00
894beed59b Removed time stopping fields from SetTimePacket and fixed #526
TODO: rules
2017-04-11 20:13:37 +01:00
c01e0354bd Address #816
Removes redundant compression argument from NBT::readCompressed() and
NBT:: readNetworkCompressed()
2017-04-12 00:42:27 +10:00
e312c697fd Merge master into api3/network 2017-04-10 21:21:29 +01:00
80292c6c7a Actually use iusername instead of repeatedly lowercasing player names (#811)
#blameshoghi
2017-04-10 21:15:38 +01:00
dda47ee566 Fix typo in explosion (#700) 2017-04-10 09:17:34 +01:00
5863d001bd Merge pull request #524 from pmmp/issues/516
Allow custom JSON pretty print options
2017-04-09 16:15:35 +08:00
6b72bbc234 Allow custom JSON pretty print options
Resolves #516
Closes #517
2017-04-06 15:05:39 +08:00
1c2895eb12 Fixed absorption application logic, close #518 2017-04-05 21:16:40 +01:00
fd982afce6 Removed misleading outdated documentation (#519) 2017-04-05 20:31:56 +01:00
022f33b256 Fixed encoding of StartGamePacket, fixed world name not showing up in settings screen 2017-04-03 16:04:15 +01:00
f1510428d0 Fixed double gc_enable call (#492) 2017-04-03 09:40:48 +01:00
90f1efc667 Found use of extra bytes in Item serialization
No idea why these are separate from the NBT data, but this is what they do.
2017-04-02 19:29:14 +01:00
f7e959d602 Fixed inventory crash, fixed crafting 2017-04-02 10:58:39 +01:00
630f0fab7f Fixed block update recursion issues (#464)
* Schedule all neighbour block updates to execute at the end of the tick, fixed recursion crash, close #251

* doTickPending timings now include neighbour block update times, refactored some var names
2017-04-01 20:18:56 +01:00
202bac28fc Merge master into api3/network 2017-04-01 19:37:15 +01:00
874afc2fd2 fixed players need to move to pick up dropped items, close #498 2017-04-01 19:33:16 +01:00
9c25ec3afd Some protocol changes for 1.1.0.0 2017-04-01 19:20:30 +01:00
e47c7ea55f A bunch of really dirty hacks to get 1.1.0.0 working
Mojang: once again, what the hell have you done.
2017-04-01 19:18:15 +01:00
f75cc93160 HOW did nobody notice this?! 2017-04-01 14:08:02 +01:00
b24d516eda Send TransferPacket with immediate priority, should fix #497 2017-04-01 10:40:05 +01:00
845b124f89 Stop autosaving players who haven't joined yet, close #494 2017-03-31 20:33:15 +01:00
16972bf9a5 Fix issues with writing negative numbers as non-zigzag varints, close #493 2017-03-31 18:59:40 +01:00
87a52a4f35 Fixed yet another crash when level-settings.always-tick-players is set to true 2017-03-31 16:09:40 +01:00
7f838a8c36 Fixed crashes due to adding players 'online' far too early, fixed some Player save logic 2017-03-31 13:45:28 +01:00
b5f473a3df Throw an exception when attempting to tick closed Levels 2017-03-31 13:14:05 +01:00
40a6f4dee9 Elevated level close check to exception level
As an assertion, this will crash on save if the level is already closed due to the provider being null.
2017-03-30 19:41:42 +01:00
69ac80518c some improvements to the horrendous mess that is the handling of joining and quitting, fixed some crashes, probably caused some other crashes
I can't fix this completely because it's just too much of a fucking mess. NEED to separate network stuff from Player.
2017-03-30 19:33:47 +01:00
45e5b6b04c Do not subscribe to broadcast permissions until the player spawns
This is unnecessary since the player won't see any messages sent before they spawn anyway. This was also causing an occasional client-sided crash due to TextPackets being sent to players at bad times during the login sequence.
2017-03-30 16:29:18 +01:00
cb059ea713 fix some PhpStorm inspections 2017-03-30 12:10:59 +01:00
afb2e0c51f fixed setting entity scale doesn't resize bounding box, close #484 2017-03-30 09:34:52 +01:00
cd477163cd New Timings v1 host is up 2017-03-30 09:15:01 +01:00
6b747f9272 Added basic API for working with titles 2017-03-29 20:02:16 +01:00
868602a559 Add __clone to CompoundTag and ListTag, fixed issues with items sharing the same NBT tag objects 2017-03-29 13:58:36 +01:00
bc1c75a15a Throw exceptions when failing to deserialize item NBT data, fixed weird crashes when an invalid NBT tag is set on an item 2017-03-29 13:39:43 +01:00
1c3d89cfef Fixed lighting issues with subchunks containing no blocks
A subchunk with no blocks is not necessarily empty.
2017-03-29 11:34:43 +01:00
c84ec90398 Set forceMovement to null when player is closed (#472)
Cater for the very very very slim chance that a player could quit while teleporting, be leaked and then have their level unloaded and leak their level.
2017-03-29 09:20:31 +01:00
3e76c3a6dd Added handling for tile picking, added API for setting item lore
worked almost out of the box (some W10 equipment bugs though)
2017-03-28 18:47:51 +01:00
52f2596dc5 Merge branch 'master' into api3/network 2017-03-28 12:27:40 +01:00
2079e2fd88 Fixed entity visibility Player object memory leak, close #416 2017-03-28 12:26:02 +01:00
217f66e180 Removed redundant method override leftover from 0.15 2017-03-28 12:25:54 +01:00
07f32765ba Merge branch 'api3/network_mcpe-1.0.5' into api3/network 2017-03-26 18:52:30 +01:00
788bd6fc20 Fixed resource packs/login sequence fail, added basic safety restrictions for packet sending before clients are logged in
close #452
2017-03-26 14:42:23 +01:00
01440fb659 Fixed players receiving double SetEntityMotionPackets for themselves 2017-03-26 13:40:39 +01:00
dda8c6cc8f Removed a condition that's been useless almost since the beginning of PocketMine
This condition has been useless since before NBT was introduced to PocketMine.
If there was a use for it, it should have been placed BEFORE anything attempted to read from the NBT.

However, Server now handles bad data automatically now, so Server->getOfflinePlayerData() will never _not_ return a CompoundTag. Hence I've added a CompoundTag type-hint.
2017-03-26 13:20:46 +01:00
1da870b298 Measure block break times in ticks instead of floating-point real-time 2017-03-26 10:36:19 +01:00
7a36d80384 Fixed broken block-break timer logic causing creative players to be unable to remove fire after breaking blocks
This also causes some annoying issues with instabreak (false positives). Shoghi dude, this did _not_ fix those issues, only hid them and replaced them with different ones.
2017-03-26 10:36:19 +01:00
bb79684480 Merge branch 'api3/network' into api3/network_mcpe-1.0.5 2017-03-25 21:31:48 +00:00
4245274aec Merge branch 'master' into api3/network 2017-03-25 21:26:46 +00:00
b9dfc7551a Added Permission to bypass spawn protection, close #440 (#451) 2017-03-25 20:34:42 +00:00
839a2ce07e Merge branch 'patch-4' of https://github.com/SOF3/PocketMine-MP-Original 2017-03-25 16:58:46 +00:00
34f833fa79 Do not save empty inventory slots 2017-03-25 12:02:09 +00:00
c9cf3d5aa4 Throw an exception when something attempts to serialize Server (#459) 2017-03-25 10:33:05 +00:00
5332887a0a Fixed command name case sensitivity issue noted in #462 2017-03-25 10:26:06 +00:00
5926bab323 Block light bug fixes (#454)
* Fixed an age-old light calculation bug causing solid blocks to filter their own light, fixed #375, probably fixed #288
Light spread reduction should be done based on the _target's_ light filter level, not the source.

* Revert "Fix Glowing Obsidian lighting"
This hack is no longer necessary.
This reverts commit 35c33ba980.

* Fixed wrong light levels for torch and redstone torch

* Take adjacent light levels and opacity changes into account, block light will now spread when an obstruction is removed, close #455

* Added timings for Level->setBlock() and lighting updates
2017-03-24 17:56:26 +00:00
0750b3ab59 Added pocketmine.yml option to disable the title ticker (#447)
This gets really spammy on some consoles when you stick it in the background, but I don't want to lose colour for the sake of that.
2017-03-24 16:03:10 +00:00
96801be3d3 Fixed #453 multiple refs to the same cached NBT object tree 2017-03-23 11:40:49 +00:00
2fb92c1c62 Fixed wrong constant value for EntityEventPacket::RESPAWN 2017-03-22 16:10:42 +00:00
c040579e09 Fixed a mistake in spaced command handling
Nothing drastic, just a self-defeating line of code.
2017-03-21 15:11:48 +00:00
9a35b4fbc8 Removed redundant TODO comment 2017-03-21 14:03:53 +00:00
940b20c191 Implemented Absorption effect
This is a little buggy due to a client-sided bug. https://bugs.mojang.com/browse/MCPE-20520
TODO: add attribute save/restore
2017-03-21 13:23:57 +00:00
c21768df26 Updated Effect constants, removed incorrect/misleading SWIFTNESS constant
So what? I'd rather crash plugins than have them suddenly behave strangely because SWIFTNESS is now an alias for SPEED instead of HASTE.
2017-03-21 11:49:18 +00:00
2d927db264 Implemented Instant Health and Instant Damage effects 2017-03-21 11:38:08 +00:00
a5a51fb9c5 Merge branch 'master' into api3/network_mcpe-1.0.5 2017-03-21 10:47:41 +00:00
47f7af6739 Fixed usage reporting cannot be disabled 2017-03-20 21:26:20 +00:00
b7a3230f73 Fixed botched effect override condition for equivalent amplifiers 2017-03-20 18:56:54 +00:00
6a03f8d434 Fixed server creating resource packs directory inside itself when running from a phar
Once again, epic facepalm @dktapps
2017-03-20 13:28:45 +00:00
06f2a9c674 Fix client-side death bug (#438) 2017-03-20 12:21:58 +00:00
0e64d4bbc2 Given Player->iusername a use, added Player->getLowerCaseName()
Micro optimizations by not repeatedly lowercasing names when searching
2017-03-20 12:21:02 +00:00
284c18d401 Added debug for mismatched item equipment
tool damage packets sent in the wrong order?
This could be bad for performance since the entire inventory is resent every time this issue crops up.
2017-03-20 10:58:43 +00:00
6ba4a8fe5c Moved batch packet handling into BatchPacket->handle(), fixed data packet receive timings to include MCPE packet decode time 2017-03-20 10:26:53 +00:00
4638ccbb68 Remove this workaround (client bug fixed in 1.0.5 beta) 2017-03-19 21:58:12 +00:00
36cda5de61 Merge branch 'api3/network' into api3/network_mcpe-1.0.5 2017-03-19 21:54:14 +00:00
9c350dbe47 Fixed DataPacketReceiveEvent, fixed packet receive timings, gave Player->handleDataPacket() a new use 2017-03-19 21:50:09 +00:00
2673e4de7f More anti-leak measures for double chest inventory issues 2017-03-19 11:25:56 +00:00
be449b6106 Removed useless condition from RemoveBlockPacket handler 2017-03-19 10:32:54 +00:00
4c61ad9f2d Stop skipping stack frames (#425) 2017-03-19 10:24:33 +00:00
66fbfdd47b Fixed hunger not saving, resolves 1 of #435 (#439) 2017-03-18 21:58:02 +00:00
8a28021b44 Use hash_file instead of OpenSSL for resource pack hashing
Epic facepalm. I totally forgot this function existed. >_<
2017-03-18 21:47:04 +00:00
ab1150382a Merge branch 'api3/network' into api3/network_mcpe-1.0.5 2017-03-18 16:30:06 +00:00
8114ceaf68 Merge branch 'master' into api3/network 2017-03-18 16:29:38 +00:00
0d37d0d896 Added some documentation to resource packs namespace 2017-03-18 16:07:03 +00:00
cc0b4d888e Use a resource for reading resource packs from disk 2017-03-18 15:49:48 +00:00
116cba9fae Added expected and actual result questions to issue template 2017-03-18 15:32:58 +00:00
51a20470f6 Switch back to the old chunk-packet method since MoveEntityPacket and SetEntityMotionPacket no longer have lists 2017-03-18 15:03:41 +00:00
6e1abe7b15 Fixed some formatting issues in FlowerPot 2017-03-18 14:24:23 +00:00
cbb003bf29 Guard against leaked closed tiles leaking chunks and NBT trees
Once again, this does not fix the actual issue, only reduces the impact of it.
2017-03-18 11:50:05 +00:00
fa5e66478c Auto update checks are now asynchronous, improves startup time (#433) 2017-03-17 14:43:12 +00:00
bcbb5de5bb Added reference parameters for errors for Utils::getURL() and Utils::postURL(), close #332 (#357) 2017-03-16 19:15:31 +00:00
548df21645 Small docs fix (#432) 2017-03-16 18:19:30 +00:00
b7b73aab23 Fixed username regex failing, close #427 2017-03-15 19:22:43 +00:00
a8650a241c Removed @deprecated warning from PlayerInventory->setHotbarSlotIndex()
Core uses it, it's just that plugins shouldn't.
2017-03-14 17:37:29 +00:00
d26713ab59 Use assoc instead of object for command data, fix data modifications affecting all commands
how did I do manage to do somthing this stupid -_- smh what an idiot
Lucky permission is a root node, or the whole commands system would've been compromised. Epic fail.
2017-03-14 11:39:59 +00:00
3138e02acb Added support for commands with spaces in their names (#422) 2017-03-13 20:55:06 +00:00
d264a04db4 Added detection for recursive server aliases (#424)
* Added detection for recursive server aliases, close #423

* Oops
2017-03-13 20:43:34 +00:00
3c709b1d3e Return false on unhandled/unknown resource pack client response status 2017-03-13 15:52:00 +00:00
c344caaf78 Refactor InventoryNetworkIds as WindowTypes 2017-03-13 11:39:54 +00:00
9e341f74d8 Added new window types and found some UpdateTradePacket fields 2017-03-13 11:27:44 +00:00
e7dbda922a Rename some CommandBlockUpdatePacket fields 2017-03-13 10:44:40 +00:00
92193fd27b Use entity IDs in EntityDamageBy*EntityEvents, fixed memory leaks related to PvP/PvE/PvM (#418) 2017-03-13 10:30:31 +00:00
bb85308b01 Fix undefined variable 2017-03-13 09:46:39 +00:00
565335f29e Revert "TODO: REVERT - Added a workaround for client text duplication"
This reverts commit 52748fcf64.
2017-03-12 16:18:30 -04:00
78278a0b93 Fixed a mistake in old effect handling 2017-03-12 20:15:21 +00:00
955dc38be4 Fixed botch-job implementation of Health Boost, will now actually work and not crash the server 2017-03-12 20:06:39 +00:00
f58ee2028e Moved effects stuff to json 2017-03-12 19:52:57 +00:00
083d1e9ef8 Deprecated Item->deepEquals(), added automatic deep checking in equals(), added some documentation for Item API methods 2017-03-12 14:46:34 +00:00
90abc28c29 Merge branch 'api3/network' into api3/network_mcpe-1.0.5 2017-03-12 12:30:56 +00:00
6c5dbd7359 Merge branch 'master' into api3/network 2017-03-12 12:22:11 +00:00
4f27bce5b3 Destroy NBT references when closing entities, alleviates memory issues on leaked Player objects
This does NOT FIX THE ACTUAL ISSUES, only eliminates some of the symptoms.
2017-03-12 10:53:27 +00:00
6f1b12b021 Added new 1.0.5 packets 2017-03-11 19:58:32 +00:00
a71747347f Updated Doxygen documentation link 2017-03-11 16:51:20 +00:00
004880548c Autogenerated data for 1.0.5.0 2017-03-11 12:13:55 +00:00
91a92b4e57 Use a pre-created resource packs config with comments to explain how to use it 2017-03-11 11:40:58 +00:00
ed765a2c9b Added debug messages for resource requests with invalid pack IDs 2017-03-11 11:19:14 +00:00
e1fb4a44e9 Updated PocketMine-Language submodule 2017-03-11 11:03:14 +00:00
2cb98c48c2 Improved dependency checking 2017-03-10 21:51:05 +00:00
d41bdfc31c Added resource packs support 2017-03-10 21:10:46 +00:00
c925845173 Added forceSend for attribute value setting, fixed slowness >= 7 removed client-side when sprinting 2017-03-09 21:33:55 +00:00
7fb3c7343f Fit attribute value to range when applying slowness, close #410
According to http://minecraft.gamepedia.com/Status_effect#Slowness, anything higher than slowness 7 will cause the player to be unable to move. Therefore this value should be clamped to a minimum of 0, not crash.
2017-03-09 21:01:10 +00:00
132e04fdbb Hotbar/inventory bugfixes (#399)
- Fixed most issues with item equipment in creative
- Added save and restore of currently-held item
- Reset hotbar on death, added API method PlayerInventory->resetHotbar()
- Creative players now have more leeway to get items, alleviates issues with item equipment in desktop GUI
- Fixed creative players wearing armour
- Found unknown field in ContainerSetSlotPacket
- Removed outdated/redundant constants
- Use a case statement in ContainerSetSlotPacket handler, added handling for 0x7a hotbar slot link update
2017-03-09 20:31:55 +00:00
1f2b584400 Merge branch 'master' into api3/network 2017-03-09 18:31:10 +00:00
d31e92bbe7 Remove beta tag, bump client version to 1.0.4.11 2017-03-09 18:30:51 +00:00
08cd944e5d Merge branch 'master' into api3/network 2017-03-09 18:12:37 +00:00
dbb579aa73 Updated LevelSoundEvent constants 2017-03-09 17:55:26 +00:00
bc0598c0f1 Autogenerated data for 1.0.4.1 2017-03-09 17:55:26 +00:00
f87b745771 New entity metadata and found some UpdateTradePacket fields 2017-03-09 17:55:26 +00:00
8d43faf16e Added Inventory network IDs interface 2017-03-09 17:55:26 +00:00
f00e7ccb54 Forgot preprocessor header include 2017-03-09 17:55:26 +00:00
7b5e5832cb Added UpdateTradePacket 2017-03-09 17:55:25 +00:00
dd6abff712 Autogenerated data for 1.0.4.0 2017-03-09 17:55:25 +00:00
7e1bdd474a Revert multi-world hack (client issue fixed in 1.0.4.0), close #260
This reverts commit 162b993e65.
2017-03-09 17:55:25 +00:00
e31333edd4 Update ISSUE_TEMPLATE.md 2017-03-09 16:35:12 +00:00
c052ee5847 Set alpha value to 0xff, fixed potion bubbles, close #407
TODO: implement transparency
2017-03-09 12:26:24 +00:00
f8c2eb8c3a Fixed signed VarInt encoding on 64-bit systems
Numbers represented as hex or binary with the 32nd bit set, for example 0xffffffff, were not considered as signed on 64-bit.
2017-03-09 12:23:24 +00:00
94d78ca554 Added missing returns 2017-03-08 20:38:11 +00:00
c7fdbea0f0 Merge branch 'master' into api3/network 2017-03-08 20:35:41 +00:00
a19996a7cf Added deprecation warning for 32-bit 2017-03-08 20:29:25 +00:00
9311b4f248 Remove unneeded comments 2017-03-08 20:29:24 +00:00
295d9bc80b Cleaned up muddled varint/varlong mess, added separate methods for entity unique and runtime ids, moved some MCPE-protocol-specific methods out of BinaryStream 2017-03-08 20:29:24 +00:00
3a044f0154 Added methods for VarLong, limited Binary::readVarInt() to 5-byte numbers 2017-03-08 20:29:23 +00:00
adb7df212c Let the parent caller catch this so we get encapsulated packet hexdumps 2017-03-08 20:29:22 +00:00
9e92a350e3 ClientboundMapItemDataPacket 2017-03-08 20:29:15 +00:00
005c2419e9 Fixed batched packets being encoded twice 2017-03-08 20:29:14 +00:00
d823ff18d8 Bump API version to 3.0.0-ALPHA5 (not finalized) 2017-03-08 20:29:14 +00:00
9b47aed0ab Added MapInfoRequestPacket 2017-03-08 20:29:13 +00:00
55598ba703 Moaaaar resource packets 2017-03-08 20:29:13 +00:00
425686755b Added basic resource-pack response handling, fixed sounds, broadcast sounds received from client
There are still a lot of sounds which do not work, these are supposed to be sent by the server and will be fixed at a later date.
2017-03-08 20:29:04 +00:00
6676029319 Improved some handlers, added detection for no-clip 2017-03-08 20:29:03 +00:00
e008a3cd5e Added handling for unknown packets 2017-03-08 20:29:03 +00:00
5aed0fb0d5 Remove redundant TODO comment 2017-03-08 20:29:02 +00:00
d0faf3df91 Added S2C and C2S handshake packet classes and stub handlers
TODO: implement encryption

Add boilerplate reset() for C2S packet encode

This crap really needs fixing
2017-03-08 20:28:52 +00:00
564b50ea33 Added API methods for validating usernames and skins 2017-03-08 20:28:41 +00:00
ea0f291cb5 Added class method DataPacket->canBeBatched() 2017-03-08 20:28:40 +00:00
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00
477cb77002 Exploded Player->handleDataPacket() into 70+ methods 2017-03-08 20:28:20 +00:00
93896977d0 Add default 2017-03-07 10:18:58 +00:00
554816b8b6 Added configuration option to pocketmine.yml to allow changing timings host, added new host mcpetimings.com 2017-03-07 09:24:32 +00:00
fc5fa01442 Removed type-hint silently breaking use of CompoundTags in Item::get() 2017-03-06 19:45:49 +00:00
f204422432 Fixed precedence issue 2017-03-06 11:40:28 +00:00
d6d3184e37 Fixed players can't join if spawn-radius is higher than the player's view distance
TODO: use this properly instead of calculating a count
2017-03-06 11:37:39 +00:00
c569fd86b1 Simplified Vector3::getOppositeSide() (#377)
* Simplified Vector3::getOppositeSide()

* Throw exception on bad input values

* @throws doc
2017-03-05 19:30:12 +08:00
e33eb0ddb6 Fixed missing permission registration in in #355 (#396) 2017-03-05 10:03:59 +00:00
0a8bd72e11 New Jenkins server is up
This reverts commit 68998bac48.
2017-03-04 22:35:38 +00:00
4ee8d14584 Added API for transferring players to other servers (#355)
* Added API method `Player->transfer()` and PlayerTransferEvent
2017-03-04 18:22:31 +00:00
663cb514e2 Fixed missing Cake recipe
TODO: add support for multiple crafting recipe result items
2017-03-04 15:03:53 +00:00
15f098074a Fixed batched packets being encoded twice 2017-03-03 17:33:30 +00:00
8bf3b6bbea Added ShowCreditsPacket 2017-03-02 11:04:51 +00:00
eb13cec5d0 Added new packets 2017-03-02 11:04:51 +00:00
0cd1e82c52 Fixed encode/decode of ResourcePacksInfoPacket and ResourcePackClientResponsePacket 2017-03-02 11:04:50 +00:00
1ee689e759 Fixed mess of entity ID 0 for players, fixed emeralds 2017-03-02 11:04:00 +00:00
d25c8d93ca Revert "Better time ticking and sync (#2)"
didn't consider modded clients, how naive 🤦

This reverts commit e9f2bf0085.
2017-03-02 10:53:40 +00:00
4fbc5738e3 Re-implemented chunk sending (#304)
Re-implement chunk sending, send chunks inside a radius instead of below a count

This sends chunks in concentric squares around players. When the radius is hit, it will pad out the radius until a full circle of chunks is loaded around the player.
TODO: implement radius-per-tick, send chunks in concentric circles, use radius for player spawning.

To set your server chunk radius, change `view-distance` in server.properties. Values are intended to be the same as MCPE render distance values. With matching client and server render distances the chunks should reach the horizon.

NOTE: You may notice significantly increased memory usage per player when increasing these values to something respectable. This is normal and expected.
A player with render distance 14 for example will cause loading of 600+ chunks. A player cannot however exceed the render distance limit set in server.properties - the server will simply not send any more chunks.

Render distance of 8 chunks is approximately 200 chunks. This is roughly equivalent to the original default max-chunks of 192 in pocketmine.yml, but sent in a circle instead of a square.

Wait for client to request a chunk radius before ordering chunks

Use 8 for default maximum radius (roughly matches old setting of 192)

Calculate spawn chunk count from chunk-sending.spawn-radius
2017-03-02 10:30:30 +00:00
d588222e84 Added an exception throw for accessing permissions of closed players 2017-02-28 10:49:09 +00:00
c3fb2e9f23 Fixed broadcasting quit messages to quitting player, fixed accessing permission of closed players on quit 2017-02-28 10:43:11 +00:00
cfb6856634 Fixed Player object memory leak when players with admin channel permissions are closed 2017-02-25 15:39:36 +00:00
11e0387e19 Show an error if no language files found during setup, mitigates #380 2017-02-25 11:21:32 +00:00
dc7b5b14d5 Fixed wrong encoding of ResourcePacksInfoPacket 2017-02-24 12:38:02 +00:00
5eab956da6 Add block-break check for spectator mode, fixes players in spectator able to break blocks when adventure settings are not set correctly 2017-02-23 19:39:08 +00:00
ad88ca09bd Fixed cannot remove block metadata 2017-02-23 15:18:42 +00:00
f98a964cdc Fixed and silenced some inspections 2017-02-23 15:17:28 +00:00
99995579d7 Added WorldBuilder flag to AdventureSettingsPacket 2017-02-23 12:20:36 +00:00
4ae18526d1 Fix fence gates opening in opposite direction to expected
This still occasionally occurs due to a bug that seems to exist with
entity rotation calculations. May happen at 45° 135° 225° and 315°
2017-02-22 09:46:54 +00:00
282095513a Throw exception when attempting to save a non-generated chunk (#367) 2017-02-21 19:24:16 +00:00
c21197ef17 Removed entanglement between chunks and providers. WARNING: BREAKING API CHANGES.
- All entity and tile constructors now require a \pocketmine\level\Level instead of a \pocketmine\level\format\Chunk.
- Chunk->getProvider() and Chunk->setProvider() have been removed.
- Chunk::__construct() has had the $provider parameter removed.
- Chunk->unload() has had the unused $save parameter removed.
- ChunkEvents now take a Level parameter instead of going through the Chunk

API bump to 3.0.0-ALPHA4
2017-02-21 17:08:45 +00:00
0a8826b21f Fixed anti-fly triggered when walking on unknown blocks 2017-02-21 13:43:00 +00:00
dac6c49bce More php7 mess (EndTag Stone, EndTag Portal Frame) 2017-02-21 12:32:50 +00:00
9f7dc32650 Fix some php7 update DoubleTag leftovers 2017-02-21 12:27:27 +00:00
9195375af4 Don't allow these blocks to be washed out, we're only inheriting properties 2017-02-21 11:51:36 +00:00
c6cf3458de Added UnknownBlock class, fixed not-yet-added blocks in imported worlds killing people, close #181 2017-02-21 11:46:44 +00:00
e2cdd9eddc Fixed missing hardness on unimplemented blocks causing gameplay issues 2017-02-21 11:33:06 +00:00
f933107af0 Fix some non-properly-implemented blocks killing people and bad inheritances 2017-02-21 11:17:33 +00:00
408f63f8fa Accuracy again -_- 2017-02-20 19:46:10 +00:00
68998bac48 Update README.md 2017-02-20 16:21:29 +00:00
2ff565afe5 Fix heightmap crashes at the corner of chunks
Stupid unpack() return array indices start at 1, not 0 >_<
2017-02-20 10:28:50 +00:00
20c7e51077 Allow 0.01 of a block diff
Fixes loss of precision when handling player movements causing some position issues.
2017-02-19 17:35:23 +00:00
89216c3bd4 Use parse_ini_file instead of home-grown solution (#366)
* Use parse_ini_file instead of home-grown solution

* Updated PocketMine-Language submodule
2017-02-19 15:53:22 +00:00
834dc343b0 Updated ItemFrameDropItemPacket for >=1.0.3, fix decode errors
Sorry, this DOES NOT FIX creative, blame Mojang. https://bugs.mojang.com/browse/MCPE-20070
2017-02-18 15:09:44 +00:00
91907485b4 Fixed prismarine bad meta crashes 2017-02-18 10:42:25 +00:00
ee523eb5cc Reverted botched fix for #284, close #362
Revert "fixed player data not saving"

This reverts commit b3beb9f71d.

Revert "Call PlayerQuitEvent after unloading chunks, removed some weird code, fixed crash when unloading player level on quit, close #284"

This reverts commit 14a0ff5caa.
2017-02-16 21:04:39 +00:00
f2f51a88e5 Updated PocketMine-Language submodule (again) 2017-02-15 17:55:55 +00:00
abffe1297d Fixed crashes closing entities with unloaded levels 2017-02-15 17:51:41 +00:00
f8b9a13440 Updated PocketMine-Language submodule 2017-02-15 16:06:02 +00:00
5c281c6435 Merged #103 2017-02-15 14:58:41 +00:00
1908ed5812 Fix for incorrect gamemode messages, close #83 (#86)
Shows the correct message ingame but not in the console.
PocketMine doesn't handle the translation for gamemode changes, MCPE
does. No idea why but it requires the second and third parameter....

commands.gamemode.success.other=Set %2$s's game mode to %3$s
commands.gamemode.success.self=Set own game mode to %3$s

To solve the problem we have to change the language files and let
PocketMine-MP translate it.
2017-02-15 14:48:11 +00:00
2d5567d9dd Removed InstallerLang mess, language improvements, updated PocketMine-Language submodule 2017-02-15 14:44:12 +00:00
b3beb9f71d fixed player data not saving 2017-02-14 13:40:58 +00:00
14a0ff5caa Call PlayerQuitEvent after unloading chunks, removed some weird code, fixed crash when unloading player level on quit, close #284 2017-02-14 12:44:31 +00:00
119e458ac8 Removed SQLite3 dependency (no longer used by PocketMine-MP core)
BEFORE anyone yells at me about plugins, having the core demand every extension that a plugin could possibly need is very much sub-optimal. An API for plugin-required extensions will be added in the future.
2017-02-14 11:04:20 +00:00
01a07a0b09 Removed years-old leftovers from old PocketMine 2017-02-13 14:41:30 +00:00
903534572d Shut some inspections up 2017-02-13 14:27:17 +00:00
8a3c30ee7e Moved entity metadata methods out of Binary 2017-02-13 14:05:16 +00:00
91fd99d76a Fixed DestroyBlockParticle 2017-02-12 16:01:23 +00:00
27f2aec160 Fixed wrong docs for Plugin->getPluginFilters() 2017-02-12 12:52:02 +00:00
8f9c52507a Some PhpStorm cleanup 2017-02-12 12:36:02 +00:00
5a12f40074 Only Region file formats are allowed as parameters for RegionLoaders 2017-02-12 12:18:25 +00:00
b89a17ffe2 Added missing attributes encoding to AddEntityPacket 2017-02-12 10:35:35 +00:00
6dc6e32656 Added some very useless functions for easier size changing of entities. (#348) 2017-02-11 21:24:38 +00:00
d430ad50be Fixed wrong temperature and temperature -> rainfall (#347) 2017-02-11 20:15:22 +00:00
06de85fd33 Revert "Fix entities missing in imported leveldb worlds", fixed entities missing after restart in anything OTHER than LevelDB
🤦 I should test this stuff more

This reverts commit ffadc34691.
2017-02-11 19:22:59 +00:00
ffadc34691 Fix entities missing in imported leveldb worlds 2017-02-11 11:15:15 +00:00
f5e39ea9ad Merge branch 'mcpe-1.0.3.0' 2017-02-09 16:36:47 +00:00
595fffc432 Fix chunks not being updated client-side when Level->setChunk() is called (#328)
Fixes half-trees, probably fixes #265
2017-02-09 11:10:25 +00:00
c4d0fdb436 Added clientData field so plugins can access extra data 2017-02-08 21:25:02 +00:00
2a4fb93a92 Updated RakLib, use reliability constants instead of literal values 2017-02-07 11:34:25 +00:00
50bf671c28 Update .travis.yml 2017-02-06 19:32:34 +00:00
4a2b83ab47 Use xargs multi-process to improve lint scanning speed in tests 2017-02-06 18:57:21 +00:00
f332d3647c Fixed lint scan scanning some files twice 2017-02-06 17:21:18 +00:00
0c35c16727 Fix some doc comments 2017-02-06 14:50:05 +00:00
7c8586684e Fixed resource not closed after memory dump (#324) 2017-02-04 18:31:00 +00:00
6999388dd1 Updated DevTools submodule 2017-02-04 13:53:56 +00:00
662652f745 Update SPL submodule 2017-02-03 15:58:35 +00:00
987d492c1c Removed CompatibleClassLoader (not needed anymore) 2017-02-03 12:14:18 +00:00
80920a1673 Remove shutdown after memory dump. (#310) 2017-02-03 10:42:42 +00:00
613226c661 Fix sea lantern lighting doesn't save (#316) 2017-02-02 09:09:54 +00:00
06dd410340 Merge branch 'master' into mcpe-1.0.3.0 2017-02-01 18:15:08 +00:00
cf83143bbd Silence unread buffer assertion on incompatible protocol 2017-02-01 18:13:50 +00:00
28baae8154 Fix RakLib crashing without logging any useful crash information 2017-02-01 17:59:13 +00:00
7701555005 added default port 19132 2017-02-01 15:23:16 +00:00
38937fc4cc Added TransferPacket
TYSM MOJANG
2017-02-01 12:59:01 +00:00
bf6e8db941 Autogenerated data for 1.0.3.0 2017-02-01 10:11:55 +00:00
06c399fa05 Get MainLogger directly, in case translations are needed without a running server 2017-01-31 17:21:21 +00:00
82cf38d46c Installer: No need for force-kills 2017-01-31 12:05:56 +00:00
eb1ec2df05 Removed deprecated network constants 2017-01-31 11:49:55 +00:00
17102058ca Unknown in PlayerFallPacket is fallDistance 2017-01-28 22:03:28 +00:00
f881cea8e0 Remove some unused properties from Player 2017-01-28 17:53:52 +00:00
8beefabbbc Remove useless unset() from 2014 2017-01-28 16:14:37 +00:00
4cca3b866a Enchanted Golden Apples give the eater Absorption 4 (#305) 2017-01-28 12:49:04 +00:00
0535acf211 Update some LevelEvents 2017-01-27 18:21:11 +00:00
478a62e17b Merge branch 'master' into mcpe-1.0 2017-01-27 16:58:53 +00:00
9661d845bb Fix some command stupidity
This is why NOT to write code at 11PM when one is shattered.
2017-01-27 16:57:07 +00:00
69d6d24a38 Removed use of stfu operator 2017-01-27 10:53:49 +00:00
713ee753e4 Fixed wrong git commit hash parsing, fixes #295, closes #297 (#299) 2017-01-27 10:49:54 +00:00
740a8ad436 Lock player position for delayed teleport, and add related assertions 2017-01-26 11:13:35 +00:00
ccef0455ab Fixed CPU/mem leak when teleporting with movement checks disabled, close #231 2017-01-25 19:45:47 +00:00
755f4d232f Merge branch 'master' into mcpe-1.0 2017-01-25 17:37:54 +00:00
09a6776674 Fixed a bug in CrashDump
@xxFlare really?
2017-01-25 17:36:40 +00:00
661f17b6e0 Anti-cheat fixes, settings and API (#287)
* Added options to disable movement checks and anti-instabreak and API methods to control this
* Fixed anti-flight false positives
* Fix flight toggle kick cannot be disabled
* Added PlayerIllegalMoveEvent
2017-01-25 09:40:48 +00:00
77456702e9 Remove some old protocol leftovers 2017-01-24 12:08:25 +00:00
75a38699e2 Fix metadata block coords (signed Y coordinate), close #286 2017-01-23 13:13:29 +00:00
9c36e0cd1c Added crafting data packet cache, reduces on-join lag spikes, close #248 (#269) 2017-01-23 11:03:46 +00:00
21f5be27b6 Added options and API to enable/disable random ticking for specific block IDs 2017-01-23 10:59:27 +00:00
4dd0a13511 Updated DevTools submodule 2017-01-22 16:09:20 +00:00
904c52bb0f Merge branch 'master' into mcpe-1.0 2017-01-22 16:08:34 +00:00
3ab9722a9f Add DevTools as submodule, build DevTools for Travis Test 2017-01-22 16:02:22 +00:00
08ed2cd353 Merge branch 'master' into mcpe-1.0 2017-01-22 11:36:22 +00:00
06f0534d65 Fixed wrong encoding of NBT strings, fixed invisible signs issues 2017-01-22 11:24:55 +00:00
b22232730e Fixed eating golden apple with full hunger, fixed wrong implementation of enchanted golden apple, close #276 2017-01-21 18:25:32 +00:00
50b9034e16 Merge master into mcpe-1.0 2017-01-21 13:43:41 +00:00
8bf8e2e22f Moved crashdumps to their own folder (#275) 2017-01-20 10:52:35 +00:00
52748fcf64 TODO: REVERT - Added a workaround for client text duplication 2017-01-20 10:24:52 +00:00
19572b8c51 Remove multiline separation (unnecessary) 2017-01-20 10:24:52 +00:00
496061ba54 Travis: Build DevTools on the spot 2017-01-20 10:12:16 +00:00
2488d6e957 Updated preprocessor submodule 2017-01-20 10:00:20 +00:00
8ea03524ff Fixed most movement-check false-positives (finally!)
Removed ySize hack, fixes ladders, fixed original autojump and dropdown issues. These were due to a tiny, tiny tiny margin for error when decoding network floats (usually less than 0.000001, but enough to cause issues. Added Binary floating-point decode accuracy option to combat this. Network Vector3s are now rounded to 4 decimal places.
2017-01-20 10:00:20 +00:00
e4aa3d72fe Check for unloaded chunks, fix triple chest bug, fix Chest object leak, close #256
Revert "Fixed double chest tile memory leak on shutdown, close #256 (#261)"

This reverts commit 9869aaa46a.
2017-01-19 15:34:51 +00:00
26fc21d56c API version suffix is now non case sensitive 2017-01-19 10:57:32 +00:00
e4c889ae16 Check if the array contents are already the same, massive performance improvement for Anvil in a lot of cases 2017-01-18 20:04:19 +00:00
7de7593b89 Improved nibble array re-ordering in most cases by checking for common values 2017-01-18 19:51:43 +00:00
162b993e65 Added a hack for multiworld. This is not always reliable! (#263) 2017-01-17 10:28:48 +00:00
cb187be1a1 Remove derp comment 2017-01-16 16:30:52 +00:00
ab943a0462 Fix crashes 2017-01-16 14:50:32 +00:00
2290c33143 Add type-hints to Item::get() (these parameters cannot be null anymore) 2017-01-16 14:08:43 +00:00
9869aaa46a Fixed double chest tile memory leak on shutdown, close #256 (#261) 2017-01-15 19:41:15 +00:00
bcf049a660 Remove obsolete methods from Chunk 2017-01-15 18:03:40 +00:00
0114cb8399 Better vanilla layers support (no meta, MCPE doesn't support it) 2017-01-15 17:26:21 +00:00
b72218ac5b Fixed flat world terrain generation by MCPE 2017-01-15 17:26:21 +00:00
6b9c2b961b Fix invalid timestamp causing W10 Edition to crash, fixes one bug in #254 2017-01-15 17:26:20 +00:00
8ba0b49022 Initial working R/W of 0.16 + 1.0 worlds, highly unstable 2017-01-15 17:26:20 +00:00
74c9ed04a0 LevelDB is loaded? Tell me about it 2017-01-15 17:17:57 +00:00
b28e38ab26 Move some exceptions out of utils into their relevant namespaces, move some Chunk methods to ChunkUtils for I/O, refactor "colour" -> "color" 2017-01-15 11:31:12 +00:00
4577f3ee22 Added config to warn if assertions are enabled and to disable exception throws 2017-01-15 00:38:30 +00:00
3b82a5fddf Fix loop counter and add delay between restarts 2017-01-14 15:28:40 +00:00
2d3b8845fd Add a message for movement reverting 2017-01-14 10:19:53 +00:00
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
946d301bc7 Fix lighting population, fix lighting issues when read by vanilla Minecraft 2017-01-13 11:33:55 +00:00
39c3b16e49 Micro optimization (#252) 2017-01-12 15:38:30 +00:00
3daa2723bf Bump to 7 entries per page (matches MCPE) 2017-01-12 09:42:07 +00:00
085d1a1359 Remove deprecated Utils::getRandomBytes() 2017-01-11 11:53:54 +00:00
3bbf2c245a Shut PhpStorm up 2017-01-11 10:11:13 +00:00
8f797442b3 Merge branch 'master' into mcpe-1.0 2017-01-10 10:55:05 +00:00
57f3f9b4ed Fix setting custom name erases CompoundTag, fixes #244 ...
... even though this bug was introduced AFTER said issue was reported.
Nice work @Muqsit
2017-01-10 08:58:31 +00:00
058468104a Fix setting item custom name does not update inventory
If a NamedTag was already present, it was modifying the object directly
WITHOUT serializing the tag back to raw NBT for sending. This commit
fixes that by always serializing the tag on change.
2017-01-10 00:38:23 +00:00
b566c4e609 Fix Normal generator logic fail 2017-01-09 22:27:35 +00:00
0428894cc6 Merge branch 'master' into mcpe-1.0 2017-01-09 16:04:11 +00:00
41d36e4e7a Fix .gitignore
Ignore the whole folder, stop deleting my damn PhpStorm files
2017-01-09 15:57:38 +00:00
4bf8f00b0f Use MODE_RESET for forceMovement, fixes most teleportation issues 2017-01-09 15:41:05 +00:00
6e87a48100 Revert "Fix a really annoying movement bug on player join", close #231
This reverts commit b16f7e4dd5.
2017-01-09 15:32:10 +00:00
441961b199 Fix players regenerating health from food while dead, fixes issue 2 in #23 2017-01-09 14:10:34 +00:00
92b85e0f15 Fix players regenerating health from food while dead, fixes issue 2 in #23 2017-01-09 14:10:05 +00:00
6fbb9b6083 Check for closed target Levels in Position (#241)
More foolproof
2017-01-09 13:18:28 +00:00
67940ad6ab Added PowerShell start script with loop capability, mainly useful for Win10 users (#240) 2017-01-09 13:16:46 +00:00
0a3fd8737a This is not needed anymore 2017-01-09 11:00:39 +00:00
8902992473 Fix McRegion read corruption errors, close #232
According to the wiki, McRegion heightmap should be ByteArray, not
IntArray. This caused issues with converted worlds with pretty much
every conversion tool. Blame @shoghicp.

IntArray McRegion heightmaps will now be converted to
ByteArray on save.
2017-01-08 21:16:57 +00:00
2e865a3af9 Fix doc comment fail 2017-01-08 19:35:28 +00:00
ed13f7f8e7 Add guideline to test bugs on a clean test server without plugins before reporting 2017-01-08 10:38:53 +00:00
02ddcef24e Fix calls to undefined method Human->getServer() (#234)
* Fixes sendHeldItem to stop crashes when executing.

* Fix server calling for food consuming.
2017-01-07 13:01:26 +00:00
3c9db45cf8 Fix tiles with async chunk sending, TODO: remove this 2017-01-07 10:52:39 +00:00
16e7eaaaa4 Merge branch 'master' into mcpe-1.0 2017-01-07 10:32:47 +00:00
4ace4b9542 Fixed CommandReader hanging on shutdown, close #25 (#171)
Use stream_select to poll stdin status before reading
Add detection for FIFO pipes, rewrite half of the CommandReader (again)
Add timeout for CommandReader to prevent hang in Windows custom consoles (unknown reason)
2017-01-07 10:28:03 +00:00
86dc8c48b9 Fix player burn time in creative 2017-01-06 20:01:21 +00:00
aaf549a469 Docs for Chunk 2017-01-06 17:57:00 +00:00
ad0553fbf8 Bump to API 3.0.0-ALPHA2 - READ DESCRIPTION!
Refactored level\format\generic\GenericChunk -> level\format\Chunk.
Re-added support for async chunk sending
Refactored most Level IO into new namespaces for more organisation
Removed LevelDB loader completely (will be re-added at a later date)
2017-01-06 17:13:45 +00:00
d8908676ac Refactor GenericChunk::fastSerialize() to be non-static, fix some unbelievable bugs, clean up some leftovers 2017-01-05 17:04:02 +00:00
598e7aac8f More PhpStorm inspections, import cleanup 2017-01-04 14:55:11 +00:00
07f18d8f6c Merge branch 'master' into mcpe-1.0 2017-01-04 11:34:39 +00:00
1cb96d24ce Some fixes, thanks PhpStorm 2017-01-04 11:29:24 +00:00
40600be4c1 Better README and contribution guidelines 2017-01-03 22:26:43 +00:00
096836faaa Moved Entity initialization into Entity class 2017-01-03 22:24:41 +00:00
b68df2da5c Remove unused files in preparation for rewrite 2017-01-03 22:24:41 +00:00
e2dc1a3bc6 Some consistency would be nice... fixed inconsistency between block light and sky light, always use Mojang order 2017-01-03 22:24:40 +00:00
8a29e77f5e Add missing byte, fix network sending issues, partly fixes #227 2017-01-03 22:24:40 +00:00
0bd7ea211d Refactored Server::broadcastPacket() to be non-static
Why the hell was this static at all? Seriously Shoghi?
2017-01-03 22:24:40 +00:00
55791e0819 Fix doc formatting from FullChunk -> Chunk mass-replace 2017-01-03 22:24:28 +00:00
69369c8998 Fix dropped items not saving due to missing CompoundTag name, close #223
The NBT library is really badly designed.
2017-01-03 22:24:27 +00:00
c36fc8c027 MobHeads are stackable to 64 2017-01-01 21:54:12 +00:00
7e15c6638a Fix dropped items not saving due to missing CompoundTag name, close #223
The NBT library is really badly designed.
2017-01-01 21:34:07 +00:00
88e36eda59 Stop wasting CPU calling functions 2017-01-01 15:50:13 +00:00
40d1394e3c Reuse empty chunk objects, stop creating new ones 2017-01-01 14:13:06 +00:00
69061ba4ad Removed the need for subchunks to know their Y coordinates 2017-01-01 14:12:58 +00:00
e85d6d134e Fix mob head crashes and drops, fix #221 2017-01-01 01:57:39 +00:00
0e10a149ef Refactor Level::chunkBlockHash() (makes no sense to put it here) 2017-01-01 01:10:10 +00:00
736ec6edac Auto-generated crafting and creative inventory data for 1.0.0.16, do not modify by hand 2016-12-31 16:33:53 +00:00
25b9581254 Make sure tag exists, prevent issues with bad world conversion
Addresses @legoboy0215's comments on #212
2016-12-31 10:24:21 +00:00
b263d81baf Explicit checks for missing tags, fix issues with converted worlds, close #212 2016-12-30 11:18:38 +00:00
0c3780de40 Re-added basic chunk skylight population for GenericChunk (#183) 2016-12-29 11:45:23 +00:00
850afed2c6 Merge branch 'master' into mcpe-1.0 2016-12-29 11:36:14 +00:00
efc6d429f6 Add some 0.16 blocks and items (#210) 2016-12-29 11:35:10 +00:00
b082bec150 Fix instabreak anti-cheat false positive on obsidian broken (#209) 2016-12-28 23:07:57 +00:00
2e1f572356 Fix netherrack and remove redundant override from NetherBrickFence 2016-12-28 23:07:57 +00:00
18ebc64ea0 Rename LevelSoundEventPacket field and add defaults 2016-12-28 23:07:56 +00:00
4f4bdea104 Fix trailing slashes in MOTD breaks server list, close #153 (#154)
Fixes #4083
2016-12-28 23:07:56 +00:00
c556ec84a2 MemoryManager: Fix sprint too less arguments if $from contains %x (#199) 2016-12-28 23:07:55 +00:00
a3a07ca847 Fix instabreak anti-cheat false positive on obsidian broken (#209) 2016-12-28 22:44:42 +00:00
227e1c42ea Fix netherrack and remove redundant override from NetherBrickFence 2016-12-28 22:30:03 +00:00
cb55cefa44 Fix trailing slashes in MOTD breaks server list, close #153 (#154)
Fixes #4083
2016-12-27 21:36:44 +00:00
10c8632417 Fixed effect amplifier overflow crash, close #147 (#191) 2016-12-27 21:30:54 +00:00
942b35ee4c Some metadata flags 2016-12-26 16:59:52 +00:00
440d66bd59 Runtime conversion would be far too slow, remove this redundant option 2016-12-23 20:48:56 +00:00
747aae94ec Refactor PMCustomAnvil -> PMAnvil 2016-12-23 20:38:31 +00:00
6d2a57f83a Prevent attempting to calculate lighting changes below y = 0 (#201) 2016-12-23 20:16:28 +00:00
a63020d6e5 Small performance improvement to nibble array re-ordering
thanks @Intyre
2016-12-23 20:07:55 +00:00
e2bbb76900 Use PMCustomAnvil as the default format for new worlds
mcregion is now "deprecated" due to its lack of suitability (fullchunk style, and no support for 256-high worlds)
2016-12-23 18:15:10 +00:00
f180167955 Add PMCustomAnvil format
Exactly the same as Anvil, but with XZY data ordering. Significantly more performant than Anvil due to no re-ordering necessary.
2016-12-23 18:15:09 +00:00
1eaf7c5431 Workaround for glob() fail, fix worlds not loading properly on some systems, close #197 2016-12-23 18:14:56 +00:00
3672d60bf4 More foolproof region file extension check 2016-12-23 12:40:04 +00:00
7e1557dc94 MemoryManager: Fix sprint too less arguments if $from contains %x (#199) 2016-12-23 12:20:55 +00:00
3848f6f39c Remove Anvil/McRegion circular dependency, more scalable region validity checks 2016-12-23 12:13:32 +00:00
00158d4805 Refactor namespace of Anvil/McRegion 2016-12-23 11:52:55 +00:00
3dcfa7b3ce Fix 32-bit crash and incorrect use of IntTag for Time 2016-12-22 21:03:18 +00:00
acd141e5aa Enable strict types on SubChunk and EmptySubChunk 2016-12-22 18:48:43 +00:00
8ee3723588 Removed Anvil RegionLoader, made mcregion RegionLoader usable for anything 2016-12-22 18:25:18 +00:00
29c27993ad Some mcregion/anvil improvements, add type-hints and enable strict-types 2016-12-22 16:57:03 +00:00
8bdfe0d297 Report CPU and tick usage accurately using averages (#195) 2016-12-22 14:11:46 +00:00
669af6f7b3 Fix a mistake in ItemFrame
thanks @awzaw
2016-12-22 13:47:33 +00:00
f4065dd411 Type-hints, strict-types, doc comments and rearrangement for LevelProviders 2016-12-22 13:16:25 +00:00
a99d7f93d9 Remove redundant return values
why am I still up at 6AM
2016-12-22 06:24:38 +00:00
363b24c663 Fix height limits on subchunks, fixed #196
facepalm
2016-12-22 04:46:28 +00:00
9e938baea0 Merge branch 'master' into mcpe-1.0 2016-12-21 20:27:49 +00:00
fb0c8c2c97 Merge branch 'item-fixes' into mcpe-1.0 2016-12-21 17:15:19 +00:00
772abc609d Fix ItemFrame crash 2016-12-21 17:11:03 +00:00
5feff79875 Fix deepEquals() crash when tag check is specified and only one item has a tag (#188) 2016-12-21 15:25:50 +00:00
7190f6a4ca Fix bow cannot be shot after jumping or sneaking, fix #190 2016-12-21 15:23:03 +00:00
6a066cdf31 Fix deepEquals() crash when tag check is specified and only one item has a tag (#188) 2016-12-21 15:00:00 +00:00
77b3cd71a3 Fixed cannot use items with custom NBT in regular crafting recipe, close #135 2016-12-21 14:55:13 +00:00
5443b10257 Use -1 for anydamage and empty string for null NBT, closes #146 2016-12-21 14:45:34 +00:00
300a3d5ccd Fix default hotbar mapping for W10 2016-12-20 21:19:25 +00:00
17a418f133 fix travis 2016-12-20 16:12:13 +00:00
e2b143a7cf Merge branch 'master' into mcpe-1.0 2016-12-20 13:03:49 +00:00
a1c3ca18ce Fix FlowerPot bugs 2016-12-20 13:01:28 +00:00
8c772fe671 Working item frames 2016-12-20 13:01:28 +00:00
c4d4277a6c Better BlockEntityDataPacket handling 2016-12-20 13:01:27 +00:00
2987c7a80c Remove unnecessary duplication 2016-12-20 12:59:27 +00:00
4063bc4ffb Relocated Server->registerTiles() to Tile::init() 2016-12-20 12:59:27 +00:00
90957cd908 Some tile improvements and added ItemFrame tile 2016-12-20 12:59:26 +00:00
50d59619a6 Remove unnecessary @throws 2016-12-20 12:25:46 +00:00
8db4b7116c Silence this error
Apply STFU operator
2016-12-20 11:08:46 +00:00
4b21e35d6e Fix head rotation issues, thank @jojoe77777 2016-12-20 09:38:47 +00:00
76a1165c0e Fix can't teleport over 128 2016-12-20 09:38:46 +00:00
35fbf78a77 Major API bump due to backwards-incompatible changes (not complete yet) 2016-12-19 21:50:13 +00:00
b86185519a Merge branch 'api-version-suffix' into mcpe-1.0 2016-12-19 21:49:22 +00:00
3433a931c1 Fix load order (no tolerance for mismatches with suffixes) 2016-12-19 19:30:11 +00:00
d9eb767420 Merge branch 'master' into mcpe-1.0 2016-12-19 18:38:13 +00:00
71704228a9 Added support for API alpha/beta/whatever suffixes 2016-12-19 18:08:45 +00:00
a122ea9e75 Merge pull request #161 from pmmp/deprecate-version-constants
Deprecate Minecraft game version constants in the `pocketmine` root namespace
2016-12-19 21:21:38 +08:00
a8694dcbf7 Relocated MINECRAFT_VERSION and MINECRAFT_VERSION_NETWORK to ProtocolInfo and deprecated the originals 2016-12-19 13:16:29 +00:00
1ec83420c8 Show debug messages in Travis test 2016-12-19 02:55:23 +08:00
bb7263beac Fixed script plugins not using first doccomment only 2016-12-17 23:56:43 +08:00
d84f990574 Fix Windows console unresponsive after a few hours, close #104 (#106) 2016-12-17 10:31:10 +00:00
61e8828f94 Fix ladder drops when supporting block is removed 2016-12-16 21:26:54 +00:00
aa8a13c4a3 Fix a bunch of block update bugs due to ancient code 2016-12-16 17:08:38 +00:00
0380c78926 Remove redundant override in Fallable 2016-12-16 16:33:31 +00:00
2930cf80b4 Merge branch 'master' into mcpe-1.0 2016-12-16 10:29:58 +00:00
5ce6c6227f Fix a couple of particle constants
Thanks @thebigsmilexd for information
2016-12-15 23:05:26 +00:00
5dca11dafb Increase ladder bounding box to 3/16, fix kicked for flying when sneaking on ladders (#168) 2016-12-15 16:18:49 +00:00
252d1988dc Merge pull request #166 from pmmp/0.16-isp
0.16 isp (PhpStorm inspections)
2016-12-15 18:45:05 +08:00
bd722bb85f fix misplaced doc 2016-12-15 09:22:51 +00:00
e1253db37c Some more minor changes for autocompletion in IDEs 2016-12-14 21:49:36 +00:00
175dd0efa6 PhpStorm inspections
Fixed some minor bugs and dropped some obsolete code

pocketmine\level\generator namespace is ignored in this commit
2016-12-14 21:49:35 +00:00
146f5a567f Add cases for some unhandled Player Actions and add unknown field to ContainerSetSlotPacket 2016-12-13 11:43:37 +00:00
e790573f2e Fix NBT "getArray()" (#163) 2016-12-12 16:03:05 +00:00
6ea45c5c4a Formatting and doc comments, overall useless commit 2016-12-12 14:25:42 +00:00
544d99f161 Added ability to force literal gamemode checks for Player->isSurvival(), Player->isCreative() and Player->isAdventure() (#155) 2016-12-12 10:07:34 +00:00
42b78cfba2 Some new particle IDs 2016-12-10 15:25:12 +00:00
99e8bcf26b Auto-generated sound constants from 1.0.0.2 2016-12-10 15:10:14 +00:00
6224f0cdf6 Protocol bump for 1.0.0.2 2016-12-10 12:22:28 +00:00
5e6d452678 Fix TNT flashing, add explosion particles and add DATA_FUSE_LENGTH entity data constant 2016-12-09 17:20:07 +00:00
ae6e0773ef Do not perform scheduled updates on still lava/water (#134) 2016-12-09 16:13:39 +00:00
cc9736314e Protocol update for 1.0.0.1
Added PlayerFallPacket
2016-12-08 12:34:31 +00:00
adabd7ef65 Merge branch 'master' into mcpe-1.0 2016-12-06 12:04:42 +00:00
5d16ecc003 Entity Effect Events (#141)
Add EntityEffectEvent class that the EntityEffectAddEvent and
EntityEffectRemoveEvent classes extend. Add event calls to Effect class.
2016-12-06 11:59:49 +00:00
288bf0fe6c Use folder name for saves instead of display name (#150) 2016-12-06 11:58:25 +00:00
e92052c2ab Fix blockhash fail (this would have returned excessive Y coordinates including the bits for X!) 2016-12-05 16:31:47 +00:00
25560a52b0 Remove unused Level field 2016-12-05 16:26:45 +00:00
d625a20934 Remove mess 2016-12-05 10:22:57 +00:00
a0cda3b45a Fixed extra data encoding 2016-12-04 17:46:56 +00:00
d74486a64a Fixed tile spawns 2016-12-04 15:12:45 +00:00
aafe0c4f69 Remove biome colours and fix biome id arrays 2016-12-04 15:12:23 +00:00
4674d34469 Update start.cmd 2016-12-04 14:16:15 +00:00
43b3b41039 Clean up unused files
Clean up unused files
2016-12-04 21:29:33 +08:00
d37afde0dc Disable Travis emails 2016-12-04 10:49:00 +00:00
fecbdc5ff2 Clean up unused files 2016-12-04 10:42:30 +00:00
4d121f7d84 Fix some entity metadata 2016-12-03 22:12:52 +00:00
6a8976c534 New PlayerActionPacket constants 2016-12-03 22:12:52 +00:00
74e31fe712 Fix ./command detection by old plugins (#138)
* Fix ./command detection by old plugins

* plugins might change it 🤦
2016-12-03 20:05:00 +00:00
28c3a882f8 Add new field to UseItemPacket 2016-12-02 18:43:35 +00:00
ebd2830770 Remove nonexistent NBT tags and fix movement issues in PC worlds 2016-12-02 18:06:36 +00:00
2e540300d8 Remove Twitter Link (#136)
Do you guys still have access to the Twitter account? I just noticed that it never got updated. If you still want to use it though, by all means keep this link in here :)
2016-12-02 13:26:32 +00:00
fb74d93e00 Protocol changes for 1.0.0.0 2016-12-02 13:20:52 +00:00
6696b7ed52 Clean up .travis.yml 2016-12-02 12:21:06 +00:00
35b3259053 Fix explosions over 128 do not damage blocks 2016-12-02 00:01:38 +00:00
577dbbce1f Support 256-block build height and fixed world saving 2016-12-01 23:45:12 +00:00
ce289cbe25 Merge branch 'master' into 0.17-chunks 2016-12-01 17:50:12 +00:00
756760a2f0 Fixed clicking on fire to extinguish it (#132) 2016-11-30 15:27:14 +00:00
d6629d6843 More ?? (#131)
* More ??

* fix undefined variable
2016-11-30 10:07:37 +00:00
43a36dba40 Fix op players automatically switching to creative/survival when set to spectator/adventure
Disable GUI gamemode switching, treat it as a cheat.
2016-11-30 09:22:45 +00:00
5025b4aba1 More nibble array re-ordering optimisation 2016-11-29 14:46:49 +00:00
dd01407dd4 Optimized byte re-ordering 2016-11-29 14:46:49 +00:00
d70be232d8 More tweaks 2016-11-29 14:46:48 +00:00
ecabe945e6 Changes for more performance, fixed some crashes and hacked out dodgy light population 2016-11-29 14:46:48 +00:00
2b46794ca2 Optimised nibble array re-ordering (halved loop count) 2016-11-29 14:46:08 +00:00
0be8fa4157 Optimized byte and nibble array re-ordering 2016-11-29 14:44:46 +00:00
b1ce19856f Fix adventure settings not updated for GUI gamemode changes 2016-11-28 11:25:29 +00:00
252afde06f Bump version numbers
Getting as bad as Mojang :O
2016-11-27 21:58:00 +00:00
039d6a488a Fix lighting *facepalm*
http://rmsnews.com/wp-content/uploads/2015/06/clavier-avec-uniquement-ctrl-c-et-ctrl-v.jpg
2016-11-27 21:57:59 +00:00
15f7cfb4f7 Add missing return value, fix blocks vanishing when placed 2016-11-27 21:57:59 +00:00
4c49db6036 New generic in-memory chunk format, fixed 0.17.0.1 chunk loading
Terrible performance, needs profiling. TODO: fix this.
2016-11-27 21:57:59 +00:00
60260a294b Remove chunk order fields 2016-11-27 21:57:59 +00:00
18c0567944 Autogenerated data for 0.17.0.1 (not functional yet) 2016-11-27 21:57:59 +00:00
367fa41161 Remove GUI remnants from start.cmd 2016-11-27 19:29:47 +00:00
439f418b0d Remove debug output 2016-11-27 16:00:54 +00:00
fa5624f87e Check rotation changes. Fix #124, fix #128 2016-11-27 15:58:37 +00:00
c79077cbed Fix MobHead bounding box and properties 2016-11-27 15:50:02 +00:00
995d0847f9 Fix tile derp 2016-11-27 13:06:11 +00:00
aa713c4e4a Added ability to specify tag name for serializing 2016-11-27 12:17:11 +00:00
3b3abab3ad Fix W10 throws away held item on inventory close
This issue will however still crop up if there are actual items in the crafting grid instead of air.
2016-11-27 12:01:09 +00:00
5f5f71cfbe Fix fail due to merge commit 2016-11-26 16:14:29 +00:00
363431dac2 Updated preprocessor submodule 2016-11-26 16:09:43 +00:00
1b543b2c16 Improved varint write performance (#126) 2016-11-26 15:07:27 +00:00
763ef7f937 Removed outdated GUI submodule (#125) 2016-11-25 13:46:41 +00:00
e51a2725de Remove circular dependency between Item and NBT modules (#121) 2016-11-25 10:17:50 +00:00
a0111d04ee Log exception with backtrace 2016-11-24 21:20:10 +00:00
958473b333 update PHP-YAML to 2.0.0 for Travis 2016-11-24 12:04:52 +00:00
744f5a8384 Fix ServerKiller and make it less useless (#122) 2016-11-24 08:47:28 +00:00
fe348b0a9d Speed up region file creation by only using ftruncate(). (#116)
* Speed up region file creation by only using ftruncate().

The old method was extremely slow (~200ms to create a single region file), but the new one is much faster (in the order of ~15ms). (Numbers were measured on a Linode 2048)

* Replace manual array fill with array_fill().

* Spaces -> tabs.

* Update RegionLoader.php
2016-11-23 21:23:38 +00:00
8d842732e0 Ignore MovePlayerPacket if position is the same 2016-11-22 16:55:40 +00:00
bee342691d Remove NetherBrickFenceGate derp 2016-11-22 15:47:20 +00:00
36623d8a5b Update links to .io 2016-11-21 17:55:14 +00:00
7eb9530346 Fix CraftItemEvent not return inputs 2016-11-21 17:43:04 +00:00
bd85d53a0b Removed unsafe use of potential non-Player-object parameter 2016-11-20 20:03:56 +08:00
ac37af3a46 Added types and changed to sendWhisper 2016-11-20 20:03:56 +08:00
208884422d Added whisper 2016-11-20 20:03:56 +08:00
da23568546 Disallow scheduling the same AsyncTask instance more than once 2016-11-20 01:12:38 +08:00
f0f6d85809 Merge branch 'asynctask-progress' 2016-11-19 23:17:26 +08:00
92bd1a755d Fix Installer server name bug (server name uses MOTD now 2016-11-18 11:41:25 +00:00
3ee43c5a17 Fix some varints 2016-11-17 18:28:39 +00:00
8ced6547f2 Fixed #109 2016-11-17 01:25:01 +08:00
d29e96407e Update another link
[ci skip]
2016-11-15 13:31:14 +00:00
8214e50bcc HTTPS [ci skip] 2016-11-14 14:25:17 +00:00
802bc21c53 Change forums link
[ci skip]
2016-11-14 10:04:04 +00:00
25b51b4dfd Update ISSUE_TEMPLATE.md 2016-11-14 09:32:29 +00:00
794ff643a7 Add new forum link (#102) 2016-11-13 16:33:52 +00:00
37ae760417 Fixed crashes after scheduleAsyncTaskToWorker() calls 2016-11-13 18:32:11 +08:00
ab4d6b1e36 Clarified that AsyncTask should not run for a long time 2016-11-13 18:14:41 +08:00
383df298a6 fix crash at server stop when RCON is enable (#101) 2016-11-13 10:11:15 +00:00
7314aaf7f7 Particles for 0.16
Added BlockForceFieldParticle, removed LargeExplodeParticle and added HugeExplodeSeedParticle
2016-11-12 21:05:01 +00:00
75fa2f1132 Fixed array progress crashing
Forgot to serialize them. They would be converted to Volatile, which is Threaded. Threaded objects still crash with progressUpdates.
2016-11-12 18:57:52 +08:00
d5881dbe83 Disallow Threaded objects to be passed as progress parameter 2016-11-12 18:33:25 +08:00
8404ce88bd Fixed pthreads crashes with progressUpdates 2016-11-12 18:30:55 +08:00
7861822a0f Fixed garbage AsyncTasks cannot be accessed 2016-11-12 17:47:07 +08:00
e6485c4734 Added AsyncTask progress update API 2016-11-12 17:31:59 +08:00
bd5bbbea10 Missed one
TODO: fix this properly
2016-11-10 13:28:27 +00:00
0ac04b52ff Merge pull request #95 from pmmp/timings-verbose
Make /timings command more verbose about errors
2016-11-10 08:48:09 +00:00
2d37d361a7 Make /timings command more verbose about errors 2016-11-09 22:09:16 +00:00
d696049a0a Fix anvil rotation and variant drops 2016-11-09 20:28:59 +00:00
1d876e30c8 Clean up some EnchantmentList mess 2016-11-09 14:20:25 +00:00
ea7313779e Update crafting recipes 2016-11-09 14:20:24 +00:00
5a8008367f Updated creative inventory json with better NBT encode/decode, fixes enchanted books issues 2016-11-09 14:20:24 +00:00
911529a6cc Added jsonSerialize() to Item and fixed some crafting data decode issues 2016-11-09 14:20:24 +00:00
bee6c546dc Added decode for CraftingDataPacket and shell for MultiRecipe 2016-11-09 14:20:23 +00:00
e3c900e071 Merge pull request #70 from pmmp/24-level-leak
Fixed bugs related to #24 such as getName() on null. Close #24
2016-11-09 10:51:15 +00:00
e50311f1ea Fix wrong SPL submodule branch 2016-11-07 16:52:29 +00:00
0bdb8a46f7 Update submodules 2016-11-07 16:49:01 +00:00
074583d104 Builtin thread-local object storage for AsyncTask (#1)
* Added AsyncTask::fetchLocal()
2016-11-06 22:02:53 +08:00
3b7377370c Critical error upon missing submodules (#77)
* Critical error upon missing SPL

* Added checks for RakLib and PocketMine-Language

* It actually throws ClassNotFoundException, not simply returns false :(

Should I blame :shoghi:?
2016-11-06 11:46:39 +08:00
1ac74fe5bc Temporary fix for commands, remove permission filter 2016-11-05 19:02:08 +00:00
c494af618c Clean up some old code 2016-11-04 21:46:14 +00:00
557257baed Fix wrong SetHealthPacket decode 2016-11-04 16:29:51 +00:00
75cc99a003 Fix client crash on join. TODO: new recipe type 4 (no longer enchantment entry) 2016-11-04 12:57:11 +00:00
7dc839fbe8 Merge pull request #75 from pmmp/fix-op-perm-calc
Fix double permission recalculation on op status change, fixes double…
2016-11-04 10:13:52 +00:00
d3fb8c46f5 Fix double permission recalculation on op status change, fixes double sending of AvailableCommandsPacket 2016-11-03 18:05:12 +00:00
fffa5488fd Fix command resending when permissibles are recalculated 2016-11-03 17:35:20 +00:00
e60364d7c9 Corrected encode/decode of TextPacket parameters 2016-11-03 15:55:08 +00:00
cf222324d6 Fix high load when teleporting and some teleportation weirdness 2016-11-02 14:18:47 +00:00
d3c62988b0 Add unknown field to ResourcePackInfoEntry 2016-11-02 13:41:59 +00:00
b34d438ed9 Fix AddPlayerPacket field ordering 2016-11-02 09:38:31 +00:00
f50c63a0c2 update docs link 2016-10-31 18:07:30 +00:00
d1f59632c2 Merge pull request #67 from KnownUnown/system_php
Fixed detection of system PHP binaries
2016-10-31 17:45:49 +00:00
03003ffa50 Improved invalid spawnpoint checking 2016-10-31 14:05:50 +00:00
7a1cdf88e8 Fixed bugs related to #24 such as getName() on null 2016-10-31 13:50:18 +00:00
4856dbd1c6 Add PreProcessor as submodule, and fixed for 0.16. Close #69 2016-10-31 13:24:57 +00:00
16d07e1f3d Remove redundant return value for setImmobile() 2016-10-30 17:07:06 +00:00
daed82612c fixed system PHP detection 2016-10-30 12:07:01 -05:00
16d72c7f86 Remove redundant type-hint causing crashes 2016-10-30 17:03:29 +00:00
ce5fa0e836 Fix FallingSand metadata 2016-10-30 15:54:02 +00:00
dc07fc42b4 Merge pull request #42 from pmmp/0.16
Update to 0.16 (1.6.1dev, API 2.1.0)
2016-10-30 11:27:10 +00:00
fdf3c0c1c7 Change Unknown Command message colour to Gold to highlight client command issues 2016-10-30 10:20:17 +00:00
656ec60805 Fix plugin metadata crashes 2016-10-29 17:56:34 +01:00
293af3d55d Add levelId to StartGamePacket (previously unknown) 2016-10-29 14:46:51 +01:00
0ce25f8b29 Fix #59 (FloatingTextParticle undefined ) 2016-10-29 09:59:34 +01:00
06f8390b30 Fix furnaces and wrong smelting data recipe encoding 2016-10-28 21:46:20 +01:00
55ad6c6b95 Fix wrong comment 2016-10-28 13:31:47 +01:00
46af92f781 Fix dataless crafting and furnace recipes 2016-10-28 12:17:11 +01:00
2765e87677 Add slashes (my bad -_-) 2016-10-28 10:01:57 +01:00
5df916099d Fire PlayerCommandPreProcessEvent for CommandStepPacket 2016-10-27 22:08:27 +01:00
137972098f Fixes for AnimatePacket and added TextPacket::TYPE_WHISPER constant 2016-10-27 14:05:49 +01:00
3d2f9f0e74 Better InteractPacket handling and added ACTION_MOUSEOVER constant 2016-10-27 13:15:53 +01:00
9d16f145dd Creative inventory update with unknown item filter 2016-10-27 12:13:27 +01:00
ae1501884b More metadata and some cleanup 2016-10-27 10:55:06 +01:00
5234327b3f Improved action check for InteractPacket (#55)
Fixes issues with 0.16 combat, where the server thinks the player is attacking an entity they're looking at
2016-10-27 10:55:05 +01:00
689a052bda Update game permissions when op status changes 2016-10-27 10:55:05 +01:00
813bb98850 Add some permission constants to AdventureSettings 2016-10-27 10:55:05 +01:00
d9e6676176 Fix wrong flag names 2016-10-27 10:55:05 +01:00
bfc77a772a New entity data flags
@Intyre, you are beyond awesome
2016-10-27 10:55:05 +01:00
6bcb3aeb26 Add new values for potion colour and ambient. TODO: bubble transparency. 2016-10-27 10:55:05 +01:00
0f8a6481c6 Fix snowball throw direction
Blame Mojang, TODO: Revert this once the bug is fixed
2016-10-27 10:55:05 +01:00
db3e801478 Fixed snowballs 2016-10-27 10:55:05 +01:00
0f261b7baa Fixed player flags (now can sleep!) 2016-10-27 10:55:05 +01:00
6c1dd81130 Remove type-hints, fix some crashes 2016-10-27 10:55:05 +01:00
eed8c37eab Addresses issues noted by @SOF3 2016-10-27 10:55:05 +01:00
6e0cebbe38 Add missing import 2016-10-27 10:55:04 +01:00
902dd4258b Bump version to 0.16.0.5 and protocol to 91 2016-10-27 10:55:04 +01:00
ce72f634b0 Update some old code 2016-10-27 10:55:04 +01:00
2dfca14714 Add varint length checks (10 bytes, currently no proper varlong support) 2016-10-27 10:55:04 +01:00
2ffbb452bb Fix a bunch of metadata bugs, fixed air ticking and added some new API methods 2016-10-27 10:55:04 +01:00
468b3e8d44 Flags now work on mobs, but not on players
This commit no doubt breaks something, somewhere
2016-10-27 10:55:04 +01:00
035084a5ac Remove useless override 2016-10-27 10:55:04 +01:00
869721a8ee Add more unknowns 2016-10-27 10:55:04 +01:00
787f6594b2 More new data properties 2016-10-27 10:55:04 +01:00
867ec6b509 Fix leads, crashes 2016-10-27 10:55:03 +01:00
b6e1a21566 Add new metadata type vector3f and correct metadata encoding. Result = client crash. TODO: new data values and flags. 2016-10-27 10:55:03 +01:00
694c9b151f Move default data to json 2016-10-27 10:55:03 +01:00
ed69303b4a Add permission checks back in 2016-10-27 10:55:03 +01:00
192fba9c88 Resend command data when op status changes 2016-10-27 10:55:03 +01:00
018897062c Initial working slash commands on 0.16. TODO: new API 2016-10-27 10:55:03 +01:00
b198f287db Add AvailableCommands and CommandStep packet shells 2016-10-27 10:55:03 +01:00
750462aa75 Fix large signed varint/negative number CPU leak 2016-10-27 10:55:03 +01:00
b1df4728d3 BatchPacket payload checks, fix crashes when older versions try to join 2016-10-27 10:55:03 +01:00
5eb2459355 Fix player list duplicates 2016-10-27 10:55:02 +01:00
1120dff492 Fix player lists and skins 2016-10-27 10:55:02 +01:00
bd1b18d9af Fix issues on 64-bit systems -_- (hate php) 2016-10-27 10:55:02 +01:00
01d465b038 Add decode for LevelSoundEventPacket
TODO: find new fields, find out when client sends this
2016-10-27 10:55:02 +01:00
d6fcc59a49 Support changing gamemode in GUI and fixed spectator flight controls 2016-10-27 10:55:02 +01:00
a45e232829 Fix wrong SetDifficultyPacket decode 2016-10-27 10:55:02 +01:00
9497dff3ee Add decode for ResourcePackClientResponse (fields unknown) 2016-10-27 10:55:02 +01:00
df88e9272e Fix DisconnectionScreen, add getBool() and putBool() methods, update some packets 2016-10-27 10:55:02 +01:00
ec328a8160 >_> 2016-10-27 10:55:02 +01:00
7cd7a7fbf6 Spawn working on new build. TODO: Resource packs. 2016-10-27 10:55:02 +01:00
9a12aa689e New StartGamePacket fields for 0.15.90.8 2016-10-27 10:55:02 +01:00
39ffc28f2a Auto-generated data for 0.15.90.8 (not functionalyet) 2016-10-27 10:55:01 +01:00
9242f89221 Add PlayerToggleFlightEvent 2016-10-27 10:55:01 +01:00
e35ed7f04a New fields for LevelSoundEventPacket (previously unknown) 2016-10-27 10:55:01 +01:00
08f11412a4 AdventureSettings fixes and added isFlying properties and methods 2016-10-27 10:55:01 +01:00
2bb50792c3 Fast commands hack for old plugins. 2016-10-27 10:55:01 +01:00
85c50731f8 Fixed crafting (cannot test enchanting) 2016-10-27 10:55:01 +01:00
ff40c0a070 NBT updates and tile spawns fixed 2016-10-27 10:55:01 +01:00
8f9574dec5 Fixed FOV and attributes 2016-10-27 10:55:01 +01:00
86ed0f1397 Updated existing packets and added new ones 2016-10-27 10:55:01 +01:00
affed33066 Add length check assertions 2016-10-27 10:55:00 +01:00
9cde63a327 Base inventory fixes 2016-10-27 10:55:00 +01:00
401de97719 Fixed chunk loading and movement 2016-10-27 10:55:00 +01:00
dd0c5efb56 Initial spawn on 0.16 2016-10-27 10:55:00 +01:00
bb9ab525b6 Fix quadruple-quote key parser bug 2016-10-26 22:18:06 +01:00
8053066ac0 Remove useless statement (#50)
* Remove useless statement

* Delete instead of commenting.
2016-10-23 17:03:51 +01:00
88d14e9923 Remove redundant ifndefs 2016-10-23 15:14:59 +01:00
702ab53e69 Moved the default mcr/mca worlds' spawn in the center of the r.0.0.mc* region file (#28)
The default mcr/mca spawn was not centered in the 0,0 region causing the generation of not needed regions walking just a bit
2016-10-21 13:50:30 +01:00
0163555d3e Add warning for xdebug on server startup 2016-10-21 13:44:38 +01:00
1c41667b9b Remove useless submodule (unused) (#39) 2016-10-20 20:22:44 +01:00
c2299b521f change homepage link 2016-10-20 11:43:32 +01:00
3692ddab1d Remove duplicate call to gc_collect_cycles
This is already done in forceShutdown(), and if it is not then the
process will have committed suicide and this will never be called
anyway. Either way, it's useless.
2016-10-19 22:08:44 +01:00
3ddfb97921 Support PC item save format with string ID, close #32 (#33)
* Fixed #32

* StringTag check, throw exception for other types

* Short, not int

* Fix misleading exception message
2016-10-19 09:41:59 +01:00
e7e476b65e Wooden and Stone slabs both placable 2016-10-18 18:19:58 +02:00
f3f853056a This messed up movement
Revert "Removed unneeded vars - fixed logical condition (#29)"

This reverts commit ef7a843fa3.
2016-10-18 17:10:06 +01:00
bcc641a25a Fix for slab placing, close #31 2016-10-18 17:37:40 +02:00
ebcc16d283 Fix --disable-readline command-line option does not work, close #34 (#35)
* Fix --disable-readline command-line option does not work, close #34

* add parentheses
2016-10-18 14:33:38 +01:00
4bc2275fc3 Merge branch 'ci' 2016-10-18 13:57:13 +01:00
ef7a843fa3 Removed unneeded vars - fixed logical condition (#29) 2016-10-18 12:52:18 +01:00
10698c892e Remove old script, add disable-readline option 2016-10-18 12:45:56 +01:00
43842691fe Merge branch 'new-labels' 2016-10-18 12:03:27 +01:00
8637a04e2b New label scheme 2016-10-18 12:03:11 +01:00
d53810c6bc Fix banlist crash when | is entered in any /ban arguments 2016-10-17 18:29:33 +01:00
f3e35bb94a Update some links 2016-10-17 14:41:59 +01:00
707847b46e Shell-based CI with lint scans 2016-10-17 12:59:20 +01:00
e81c738010 Update ISSUE_TEMPLATE.md 2016-10-17 12:14:16 +01:00
8f3b95164a Fix preprocessor issues
Blame @SOF3
2016-10-16 19:47:32 +01:00
19601f998a New Jenkins server 2016-10-16 19:04:18 +01:00
2fba1073dd Fix wrong comment 2016-10-12 13:24:00 +01:00
6b06e407c6 Delete .mailmap 2016-10-10 14:38:17 +01:00
0b270342b1 Update .mailmap 2016-10-10 14:33:30 +01:00
23e4ca64e4 Remove dupe load() causing reload debug spam
This call is completely redundant.
2016-10-10 14:10:37 +01:00
36207debe0 Update RakLib submodule
Fix DoS with empty packets does not trigger blocking
2016-10-08 13:41:50 +01:00
de28ddabdb Update RakLib submodule 2016-10-08 11:25:53 +01:00
c328d7359c Labels do not have restricted length
WhataTerribleFailure
@sekjun9878 why did you add that?
2016-10-08 18:11:09 +08:00
5e72850a62 Merge branch 'pmmp-cntrb' of https://github.com/pmmp/PocketMine-MP 2016-10-08 18:05:58 +08:00
a9cbe4f63e Updated CONTRIBUTING.md to adapt into pmmp org
Updated CONTRIBUTING.md to adapt into pmmp org
2016-10-07 18:52:53 +08:00
beabc5a85c Merge pull request #14 from pmmp/disable-player-dat
Added options to disable saving <player>.dat
2016-10-07 18:47:01 +08:00
2a07638af3 Do not show playerNotFound notice if player data should not be saved 2016-10-07 17:52:25 +08:00
d6fd9259cf Added options to disable saving player.dat 2016-10-07 10:25:26 +01:00
16c09e3610 Merge branch '0.15.10'
Skin models again
2016-10-06 09:46:59 +01:00
b78dd70f72 Bump version to 0.15.10.0 and protocol version to 84
Changes unknown
2016-10-05 15:29:27 +01:00
92784054cd Creative inventory fixes 2016-10-05 10:07:00 +01:00
98ea674d20 Ouch 2016-10-04 18:48:07 +01:00
4b869c8615 Merge branch 'master' of https://github.com/pmmp/PocketMine-MP 2016-10-03 23:29:39 +08:00
ec79477b3e gitignore memory dumps 2016-10-03 23:24:34 +08:00
58ff381557 PhpStorm automated formatting (#11)
* PhpStorm reformatting

* Tuned PhpStorm reformatting

* Improved ItemIds and BlockIds formatting

* Tuned more PhpStorm reformatting

* Improved string concatenation
2016-10-03 19:05:48 +08:00
2b6d058760 Fixed kicked for flying when walking on lily pads (#7)
Add an optional extended description…
2016-10-03 09:17:50 +01:00
535e1a0eb4 Merge branch 'master' of https://github.com/pmmp/PocketMine-MP 2016-10-03 01:59:22 +08:00
4133f98b23 Updated a few tabs, updated SPL submodule 2016-10-03 01:59:06 +08:00
d7a78ee00f Merge pull request #10 from SOF3/master
Fixed some lines indented with 4 spaces rather than tabs
2016-10-03 01:05:23 +08:00
e913b16804 Fixed some lines indented with 4 spaces rather than tabs 2016-10-03 00:58:34 +08:00
6fc435da0e Imports rearrangement 2016-10-03 00:43:46 +08:00
84e15b6b1a Remove derp brackets (#8) 2016-10-02 17:22:19 +01:00
e9f2bf0085 Better time ticking and sync (#2)
* Remove unnecessary SetTimePacket spam

This is handled automatically client-side, as long as it is calculated correctly server side there is no issue (unless the server hits a spot of bad lag)

* Better client/server time sync when lagging
2016-10-02 12:54:27 +01:00
5f26c21b9f Remove unused RemovePlayerPacket 2016-10-01 21:39:05 +01:00
ee4854d07c Typo fix (#5) 2016-10-01 17:07:00 +01:00
9a379734ba Use \pocketmine\Thread::getThreadName() instead (#6) 2016-10-01 17:03:24 +01:00
a7366324e5 Fixed RawChicken::getAdditionalEffects return values (#4)
* Fixed RawChicken::getAdditionalEffects returns void

* Update RawChicken.php
2016-10-01 16:35:20 +01:00
39f731aa06 Remove use of deprecated Utils::getRandomBytes(16) (#3)
Whichever guy did that, somehow this one just got missed out?
2016-10-01 16:08:59 +01:00
7c41aa66f1 Update submodules 2016-10-01 15:49:25 +01:00
98d129f1f4 Fix bad copy-paste job, blame @shoghicp 2016-10-01 14:54:50 +01:00
99622c5ce7 Fix wrong network IDs for inventories, fix anvil/enchanting table windows 2016-10-01 14:48:42 +01:00
ad64a074cb Fix furnace NBT assertion errors and inventory not working 2016-10-01 14:14:55 +01:00
23f3097390 Travis: Build all branches 2016-10-01 13:44:31 +01:00
abf004de7d Change Travis links 2016-10-01 11:37:52 +01:00
ff4b7612a6 Update submodules 2016-09-30 20:25:17 +01:00
2d95bdc10f Remove derp semicolon (#11)
* Update Furnace.php

* fix formatting
2016-09-30 19:20:03 +01:00
50c5c1de92 Bump version to 0.15.9 and protocol to 83
Seems the only thing that changed was the cape skin models, which would not be rendered correctly by older clients.
2016-09-30 19:20:01 +01:00
e2e31d345d Allow vanilla trapdoor placement 2016-09-30 19:20:00 +01:00
7145e16bce Fix getHandler() returns null on tasks (#3) 2016-09-30 19:19:59 +01:00
5485b63e6e Added ChangeDimensionPacket 2016-09-30 19:19:58 +01:00
f2f70480ee Fixed precedence problem (#1)
as mentioned in 4cb76f369a (commitcomment-19068812)
2016-09-30 19:19:57 +01:00
900c4adb66 Create sign tile like it should be. 2016-09-30 19:19:56 +01:00
5f8dc5829c Better inheritance for wooden stairs 2016-09-30 19:19:55 +01:00
e962f7fb0a Fixed bug in updateAround where only one block is updated 2016-09-30 19:19:54 +01:00
a3e3a5f631 RNG: XorShift128 adapted from php-random library
Fixes world generation problems on 32-bit systems
2016-09-30 19:19:53 +01:00
b156480550 Fix redstone ore glowing immediately when placed
Do not update the block when placed
2016-09-30 19:19:52 +01:00
7b8548b2b1 Added Flower Pots 2016-09-30 19:19:51 +01:00
fbe17344fb Fix plugin crashes when attempting to get metadata of offline players 2016-09-30 19:19:50 +01:00
e143fb80da create .editorconfig to improve code displaying on github 2016-09-30 19:19:49 +01:00
795d6c8ddf Fix entity-related memory leak on chunk unload 2016-09-30 19:19:48 +01:00
6bd028f8b3 Fix Wood2 crashes 2016-09-30 19:19:47 +01:00
35c33ba980 Fix Glowing Obsidian lighting 2016-09-30 19:19:46 +01:00
895790f46c Fix signs going blank
Sign text is not limited to 16 characters anymore, but to the width of
the sign. Server: Stop being such a control freak
2016-09-30 19:19:45 +01:00
378c3d7994 Patch %0 client translation exploit 2016-09-30 19:19:44 +01:00
9808f874c8 Remove Stonecutter remnants 2016-09-30 19:19:43 +01:00
4198c445b0 Fixed Furnace crash 2016-09-28 13:59:53 +01:00
42e8120961 Remove creative container open checks (lines up with 0.14) 2016-09-28 13:59:53 +01:00
2a4f85107d Less duplication, more consistency 2016-09-28 13:59:53 +01:00
97f6b80969 Fix players levitating in beds and teleportation of sleeping players 2016-09-28 13:59:52 +01:00
a6f8379c40 Fix time bugs 2016-09-28 13:59:52 +01:00
bf4b96e144 Block: Fix fence gate rotation when opened or closed. TODO: fix gate opening direction 2016-09-28 13:59:52 +01:00
4f26e5598c Network: Fix crashes caused by AddEntityPacket 2016-09-28 13:59:52 +01:00
e00176b677 Closes #4181 @ PM
https://github.com/PocketMine/PocketMine-MP/issues/4181
2016-09-28 13:59:51 +01:00
f32d588b9b Inventory: Creative Inventory update 2016-09-28 13:59:51 +01:00
f14a8e46be Inventory: Fix creative/spectator inventory sending 2016-09-28 13:59:46 +01:00
5851e7fe55 Network: Do not attempt to decode further for non-accepted protocols
Prevents 0.16 players crashing 0.15 servers
2016-09-06 11:54:52 +01:00
Tux
8e9a078ff9 Use built-in random_bytes functionality 2016-09-06 11:47:58 +01:00
b16f7e4dd5 Fix a really annoying movement bug on player join 2016-09-06 11:42:30 +01:00
15b9578245 Fix reach distance bugs 2016-09-06 11:33:27 +01:00
765bd5ced7 Inventory: Fix hotbar spaz 2016-09-06 11:23:49 +01:00
df4c3ec4a6 Bump version and protocol to 0.15.4 2016-09-06 11:12:18 +01:00
d6e343c2cf Premature optimization again 2016-08-24 17:15:22 +08:00
6fb41c5c7f UpdateBlockPacket fixed and changed skinName to skinId 2016-06-22 01:09:48 +02:00
df8e1e8702 Spawn unleashed, movement fixed and some Player DataProperty cleanup 2016-06-22 00:08:52 +02:00
ef8227a074 Bump version to 0.15.0.0 and protocol changes 2016-06-15 23:59:35 +02:00
80d6f8dfb3 Updated submodule 2016-06-07 10:41:57 -04:00
e2d079a7df Bump version to 0.14.3.0 and protocol changes 2016-05-20 00:21:44 +02:00
ee9ba9f1a0 Merge branch 'mob-heads' 2016-05-18 10:10:10 -05:00
292a212827 Merge branch master 2016-05-18 10:07:57 -05:00
ac482621a1 Bump version to 0.14.2.0 and protocol changes 2016-04-28 01:50:54 +02:00
754ff9b4c4 Fixes #3223 2016-04-04 17:59:23 +08:00
aade3fe390 Closes #3432 2016-03-28 02:42:08 +08:00
8441169365 Fixed warning messages when parsing @notscript files 2016-03-28 02:27:03 +08:00
e51c6b4b42 Merge branch 'notscript' 2016-03-28 01:26:29 +08:00
73f24786cd Fixed @notscript without trailing spaces not detected 2016-03-28 01:26:15 +08:00
13d1089d30 Fixed PluginManager:: type doc 2016-03-23 23:57:02 +08:00
eb3c1f95b0 Updated .gitignore to stage src/pocketmine/resources/pocketmine.yml 2016-03-23 23:56:29 +08:00
012d46dfd8 Added Mob Heads
Fixed duplicated items in JSON file
2016-03-22 22:25:36 -06:00
2fb3b41b8d Added the @notscript tag in potential script plugins
Then we can have .php files in the plugins folder that contain /** but are not script plugins
2016-03-23 02:32:11 +08:00
085ff56362 Clearer Config::__construct() documentation. 2016-03-21 14:41:49 +08:00
23da42f8a4 Merge pull request #4068 from PocketMine/PEMapModder-patch-2
Promotes the use of reactions
2016-03-18 23:35:36 +08:00
f82c59bdc4 Fixes #3991, closes #4011 2016-03-15 22:52:49 +08:00
3f801ff6f4 Promotes the use of reactions 2016-03-13 23:40:30 +08:00
6ba0abf587 Update README.md
Mentions that mbstring is used (already used in Player.php)
2016-03-11 01:16:07 +08:00
0b06a4f703 Fixed #3692; fixed "arrows should not catch fire in fire blocks" 2016-03-10 17:45:06 +08:00
8a0c2b7c4a Fixed time 2016-03-09 19:13:20 +08:00
8e909f05ca Fixed setSaturation() working incorrectly 2016-03-09 19:13:06 +08:00
27b7260c0a Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-03-09 18:03:50 +08:00
dd22e4963f Fixed #4051 2016-03-09 18:02:35 +08:00
54254ffc88 Merge pull request #2955 from TruDan/master
Add DATA_SIZE to Slime!
2016-03-08 23:05:39 +08:00
9a3929d8ad Merge pull request #3724 from thebigsmileXD/patch-2
Fixed commit #3595
2016-03-07 18:58:01 +08:00
913a1fdce4 Fixed #3463 2016-03-07 18:56:24 +08:00
6e41e6837f Fixed #3266 2016-03-07 18:50:26 +08:00
df7eaa7242 Closes #3548 2016-03-07 18:48:27 +08:00
08e6caad88 Fixed #3563 2016-03-07 18:38:42 +08:00
fc08759199 Merge pull request #3978 from PEMapModder/attr
Implemented attributes
2016-03-07 18:15:15 +08:00
09ce8fab82 Fixed speed and slowness potions 2016-03-07 18:12:54 +08:00
781de3efab Addresses #4024 2016-03-06 23:13:33 +08:00
95abec1886 Merge pull request #4009 from Falkirks/patch-1
Update ISSUE_TEMPLATE.md
2016-03-02 01:31:47 +08:00
5e1f38bdb3 Update ISSUE_TEMPLATE.md 2016-03-01 08:42:46 -08:00
de10dfa737 Added issue template 2016-02-29 00:06:20 +01:00
a43db5ca25 fixed #4006 2016-02-28 22:54:56 +01:00
ccadb5f2bb Merge pull request #3526 from PEMapModder/patch-9
Fixed getNested() using cache desynchroinized from set()
2016-02-28 23:10:12 +08:00
218eed1e7a Merge pull request #3959 from dongjoon-hyun/show_travis_build_status
Show Travis-CI Build Status on README.md.
2016-02-28 10:29:29 +08:00
d39f3059dd Show Travis-CI Build Status on README.md.
For Github visitors, many projects shows its project build status in README.md.
It would be nice if PocketMine-MP shows Travis-CI build status, too.
Here is the sample layout in this PR branch.

https://github.com/dongjoon-hyun/PocketMine-MP/tree/show_travis_build_status

Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2016-02-27 18:05:56 -08:00
2c1ef0ada3 Updated raklib module 2016-02-28 00:14:25 +01:00
e11b76318c fixing chunk sending 2016-02-27 16:35:38 +01:00
b766b969e2 Merge pull request #3387 from PEMapModder/patch-6
Allow saving resources with parent directory being recursively created
2016-02-27 20:52:03 +08:00
d6c9bcbabb Merge pull request #3993 from dongjoon-hyun/fix_travis_test
Fix Travis Test.
2016-02-27 19:40:53 +08:00
f00b52f04d Fix Travis Test. 2016-02-24 19:10:07 -08:00
Dan
35f0f36524 Update Grass.php
@PEMapModder is that all correct now?
2016-02-24 12:06:28 +01:00
e9eaf69a41 Removed redundant debug code 2016-02-23 22:33:53 +08:00
f34f54664f Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-02-23 21:13:29 +08:00
7ba7eaf303 Fixed wrong InteractPacket constants
Thanks @thebigsmileXD
2016-02-23 21:05:59 +08:00
16c36d5a50 Updated TesterPlugin submodule 2016-02-23 13:36:03 +01:00
ad70e23659 Updated travis 2016-02-23 13:08:57 +01:00
ccb60ff81e update loop die 2016-02-23 18:25:04 +08:00
eb00dee8a6 removed int return from getSeed 2016-02-22 13:03:27 +01:00
068ad5e924 Added ACTION_JUMP
Thanks @thebigsmileXD
2016-02-22 19:41:30 +08:00
ed9888a2cb Fixed #3963, closes #3979, added hash for non-numeric seeds 2016-02-22 19:40:40 +08:00
41a847567c RandomSeed should be a TAG_Long 2016-02-22 18:42:49 +08:00
d59fd42fc6 Fixed EntityEatItemEvent::setResidue() declaration 2016-02-22 18:34:11 +08:00
86ec7ed771 Fixed player not dying 2016-02-22 18:24:51 +08:00
1574a823d4 Fixed #3864 2016-02-22 16:29:41 +08:00
17c73e9764 Fixed #3690 2016-02-22 16:26:35 +08:00
6945256e30 Resolved #3684 2016-02-22 16:05:45 +08:00
56644fed9d Fixed #3961 2016-02-22 15:42:44 +08:00
e2f7d657e8 Fixed trapdoors 2016-02-22 15:32:07 +08:00
83f29fd871 Fixed a crash 2016-02-22 15:06:45 +08:00
a2641f923d Merge branch master 2016-02-22 14:32:48 +08:00
36028679d8 Merge pull request #3956 from redcrab2016/redcrab2016-patch-1
PR: Bug Fix - Crash if player is spawn to Y coord. >0 & <1
2016-02-22 14:15:11 +08:00
542781c2b1 Merge branch 'php7-0.14-64ff00-01' of https://github.com/PurePlugins/PocketMine-MP 2016-02-22 01:11:55 -05:00
3640e13f17 Added some assertions for level seed 2016-02-21 22:46:44 -05:00
f98f180bbd fix for #3972 2016-02-21 22:21:50 +01:00
a6cd526e60 PHP7 to master 2016-02-21 12:47:30 +01:00
9acbd85b25 Bump version to 0.14.0.0 2016-02-19 13:39:42 +01:00
ffa835d730 Fixed #3557 2016-02-19 18:50:38 +08:00
80250aa78e Resolved 1️⃣ in #3961 2016-02-19 18:33:21 +08:00
675583293f Crash if player spawn back to Y coord. >0 & <1
The issue come from  line 2664 : $v = $spawn->floor()  
If $spawn->y is in ]0..1[ then $v->y == 0
Then getBlockId : line 2670 use  'y' as -1 => Crash boom
2016-02-18 10:54:54 +01:00
fc42fc534b Merge pull request #3952 from dongjoon-hyun/add_docs_for_throws
Add @throws docs.
2016-02-18 16:45:54 +08:00
302fb9e65e Add @throws docs.
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2016-02-17 14:22:47 -08:00
fe2957c315 Fixed imports 2016-02-18 01:43:42 +08:00
21c2e2d429 Closes #3832 2016-02-18 00:08:44 +08:00
3a184ddf97 Merge pull request #3915 from legoboy0215/patch-3 2016-02-18 00:05:10 +08:00
92ee4b3c73 Merge pull request #3876 from PEMapModder/patch-12
Add return value for PluginBase::saveDefaultConfig()
2016-02-17 20:33:15 +08:00
420007cef8 Merge remote-tracking branch 'origin/php7-0.14' into attr 2016-02-17 19:58:48 +08:00
5459576833 Added hunger and experience saving 2016-02-17 19:56:19 +08:00
05530bedc6 Bump to 0.14.0.7, new packets and fixes 2016-02-16 00:43:59 +01:00
1b4880a22f Merge branch 'patch-1' of https://github.com/Pub4Game/PocketMine-MP 2016-02-14 21:36:12 +08:00
a75c713d34 Merge pull request #3665 from zhsj/fix-start-sh
fix test php binary in start.sh
2016-02-14 21:30:02 +08:00
ef0f74bbd8 Merge pull request #3564 from PEMapModder/patch-11
Added additional information to Plugin::getDataFolder()
2016-02-14 16:09:45 +08:00
03c19aefbf Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-02-12 14:09:39 +08:00
3b51d2c217 Resolved #3937 2016-02-12 14:08:59 +08:00
e79976bdac Added events 2016-02-11 22:07:04 +08:00
8807617480 Fixed attriutes not sending 2016-02-11 18:45:58 +08:00
cfca0a8726 Fixed TallGrass::getDrops() 2016-02-11 16:51:27 +08:00
28967ca495 Fixed eating 2016-02-11 15:42:07 +08:00
52e8781d36 Implemented hunger-related regen and damage 2016-02-11 01:53:51 +08:00
329a525ea1 Implemented food and hunger 2016-02-10 22:49:48 +08:00
d538a254ee Resolves #3918 2016-02-09 18:25:16 +08:00
074d7ed95c Resolve CompressBatchedTask-related crashes 2016-02-07 23:36:16 +09:00
1b6e8c14f0 Bump protocol version for 0.13.2 2016-02-06 22:01:26 +01:00
1082e32fd7 Fixed ShapedRecipe constructor 2016-02-07 01:02:40 +08:00
d5d2f46db2 Added "getter" for in air ticks. 2016-02-01 07:25:40 +08:00
e5937926cd Fix typo on ContainerSetSlotPacket
hotboar -> hotbar ![](http://i.imgur.com/n97uQb9.png)
2016-01-30 14:03:28 +01:00
e597314331 Read creative menu items from json 2016-01-28 04:39:30 +01:00
8a0bd85656 Item and Block, some wont work yet 2016-01-28 04:37:09 +01:00
b7d8956f23 Use ingredient damage to check inventory items on crafting event 2016-01-26 23:43:54 +01:00
bc3dca4736 Support for 0.14.0.1 2016-01-26 22:01:35 +01:00
d5f3c19054 Fix crafting not taking item from inventory 2016-01-25 23:10:18 +01:00
c7c78b1159 Read recipes from json 2016-01-25 20:40:26 +01:00
e2a400dd6b Fix for command alias arguments 2016-01-25 18:47:20 +01:00
99855773d7 Fix for command alias arguments 2016-01-24 18:33:34 +01:00
a2734f6dc0 Merged master into php7 to support 0.13.1 2016-01-22 17:36:45 +01:00
b66ce90c94 Add return value for PluginBase::saveDefaultConfig() 2016-01-16 11:39:11 +08:00
73b97c9490 fix sound error 2015-12-29 19:11:39 +03:00
ee0d4aa124 Merge pull request #3810 from markkrueg/markkrueg-patch-1
Fix Stair.php : add "use pocketmine\item\Tool;"
2015-12-28 17:42:26 +01:00
0b42ead2ab Update Stair.php to add use pocketmine\item\Tool;
Without this >= Tool::TIER_WOODEN does not work; so stone stairs do not give drops when broken. They also revert to not being broken on next connection.
2015-12-27 12:44:56 -08:00
78525e1f74 Seperated kick/ban messages 2015-12-22 21:26:26 +01:00
fb87165cd5 Merge branch 'PEMapModder-patch-12' 2015-12-20 00:41:03 +01:00
9f481fbdbe Merge branch 'patch-12' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-12 2015-12-20 00:40:52 +01:00
7125148756 Merge branch 'MagicDroidX-patch-6' 2015-12-20 00:39:32 +01:00
9ca8c06f82 Merge branch 'patch-6' of https://github.com/MagicDroidX/PocketMine-MP into MagicDroidX-patch-6 2015-12-20 00:39:19 +01:00
32a0b61c2d Merge branch 'PEMapModder-patch-14' 2015-12-20 00:37:28 +01:00
15d6bf663d Merge branch 'patch-14' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-14 2015-12-20 00:37:07 +01:00
d67fb9a721 Merge branch 'TrinityDevelopers-patch-1' 2015-12-20 00:32:07 +01:00
9ff58f6ab3 Merge branch 'patch-1' of https://github.com/TrinityDevelopers/PocketMine-MP into TrinityDevelopers-patch-1 2015-12-20 00:31:52 +01:00
b83964e527 Merge branch 'PEMapModder-patch-19' 2015-12-20 00:31:04 +01:00
c3e756a712 Merge branch 'patch-19' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-19 2015-12-20 00:30:53 +01:00
55ce453e17 Merge branch 'Creeperface01-patch-11' 2015-12-20 00:30:15 +01:00
e4ab7a08ec Merge branch 'patch-11' of https://github.com/Creeperface01/PocketMine-MP into Creeperface01-patch-11 2015-12-20 00:28:50 +01:00
c1a484ee5c fixed #3702 and fix for setting timezone from php.ini 2015-12-19 23:58:05 +01:00
261ce1ba8b Merge branch 'mcpe-0.13' 2015-12-19 11:38:05 +01:00
90c3e66e6b Updated for .13.1. skinName replaces isSlim, API bump 2015-12-16 14:37:46 +01:00
7954754d4c Update Cake.php 2015-12-04 16:00:02 +01:00
2ddc4455c5 Added some blocks and items 2015-11-29 01:46:35 +01:00
c803dd8e69 skins fixed and added SetPlayerGameTypePacket 2015-11-26 00:47:58 +01:00
2e5490fb5b Merge pull request #3743 from hmy2001/patch-3
From TileEntityDataPacket in BlockEntityDataPacket
2015-11-25 17:05:16 +01:00
4f12533ad3 Update ChestInventory.php 2015-11-25 21:08:28 +09:00
8edebed11c Update DoubleChestInventory.php 2015-11-25 21:08:04 +09:00
963f7ee077 Update Spawnable.php 2015-11-25 21:00:03 +09:00
734736492a Added some creative items and removed nether reactor 2015-11-23 21:56:38 +01:00
58709293cf Fixed crafting 2015-11-23 21:04:23 +01:00
2ea81710ad Bump protocol and fixed packets for 0.13.0 2015-11-23 21:01:02 +01:00
Dan
f35db4a183 Fixed commit #3595
See https://github.com/PocketMine/PocketMine-MP/pull/3595
2015-11-20 13:01:28 +01:00
815411968b Silence the ifconfig not found message 2015-11-20 00:34:29 +08:00
cbed8d40ff Fix a mispelled "new" call 2015-11-05 17:11:42 -06:00
680d40d070 fix test php binary in start.sh 2015-11-01 20:47:41 +08:00
ea8ba995ac Update Player.php 2015-10-31 21:18:06 +08:00
6ae0f3c8d8 Cleaner (and maybe faster) INI parsing 2015-10-31 20:31:24 +08:00
4d5da41cd0 Fix autoSave in PlayerQuitEvent 2015-10-31 13:22:45 +08:00
f9d7e204c8 Block update on WallSign fix 2015-10-11 01:32:33 +02:00
94b79ac28a Tool tier added to getDrops 2015-10-11 00:52:44 +02:00
958c3589c9 Fix for #3569 NetherBrickFence 2015-10-10 23:40:59 +02:00
8ce02d8687 Hunger effect is not implemented 2015-10-10 23:30:42 +02:00
09b4d4dc7a Fixes for derps found with PHPStorm code inspector 2015-10-10 23:10:24 +02:00
813acc54dc Fixed translation for banlist command usage 2015-10-10 23:06:28 +02:00
c4fb469b4e Fixed recursive call 2015-10-10 05:26:01 +02:00
04fc062b2a Merge pull request #3568 from MagicDroidX/patch-3
Fixed recursive call
2015-10-08 07:40:58 +10:30
4e59d85cca Fixed recursive call 2015-10-07 17:04:27 +08:00
ae9a3dbd81 Added additional information to Plugin::getDataFolder() 2015-10-06 20:32:33 +08:00
84be56fefb edited TODO.md 2015-10-02 00:49:56 +02:00
19b2e1b4af sorted items in init() 2015-10-01 20:05:31 +02:00
cc8eca3084 Fixed string class conflict 2015-10-02 01:52:10 +08:00
6013213159 More items 2015-10-01 08:23:05 +02:00
a7413dac92 Merge branch with fixes for recipes 2015-09-30 18:14:51 +02:00
34df516d94 new branch to fix all issues with items and blocks 2015-09-30 18:09:09 +02:00
85dc136631 Crafting recipes, and packet fix 2015-09-29 00:45:57 +02:00
72e9765ec8 Merge branch 'Stonecutter-Recipes' of git://github.com/willowmaster66/PocketMine-MP into recipes-0.12-fix
Testing pull request.
2015-09-29 00:40:23 +02:00
cf3d8f449e Added some asserts 2015-09-27 19:48:42 +02:00
eaef40618b Send default reliable and ordered packets on RakNet 2015-09-27 19:48:31 +02:00
f560d07c97 Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-27 14:31:28 +02:00
606948ef8e Fixed return value of Level::getTickRateTime() 2015-09-27 14:31:15 +02:00
46760abafc Require pthreads 3.0.7 2015-09-27 14:30:50 +02:00
a7e5e33db8 Merge pull request #3507 from alejandroliu/crafting-event
Added Player to CraftItemEvent
2015-09-27 14:05:38 +02:00
ddc140af5e Updated to new pthreads version, updated RakLib 2015-09-27 13:37:27 +02:00
a3ad5783b7 Fixed getNested() using cache desynchroinized from set() 2015-09-26 12:21:43 +08:00
cbef0e25a1 Merge pull request #3454 from Yosshi999/master
Fixed DoorSound won't be played
2015-09-25 10:01:15 +02:00
6273875a22 Added Player to CraftItemEvent 2015-09-19 23:08:57 +02:00
0b9ef5b856 Update of the stonecutter recipes
Added the shaped recipes and removed the shapeless ones.
2015-09-18 22:18:14 +02:00
a3bce67d35 Updating blocks and items
Added new blocks/items and added constants to existing blocks/items for
clearer recipe making.
2015-09-18 22:17:24 +02:00
cd6afb2020 Merge remote-tracking branch 'PocketMine/mcpe-0.12' into Stonecutter-Recipes 2015-09-18 22:14:34 +02:00
0bcf639a98 Changed how exceptions work and are logged, throw proper exceptions on tasks 2015-09-18 12:03:24 +02:00
472fcfa4c7 Removed ThreadedFactory 2015-09-18 11:18:41 +02:00
8768b7fdbd Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-17 12:25:05 +02:00
86c1198648 Merge pull request #3495 from 0929hitoshi/mcpe-0.12
Changing the return value of getName
2015-09-17 09:47:30 +02:00
9665dfd63e Changing the return value of getName 2015-09-16 01:21:07 +09:00
ed559fdf98 Fixed not sending UUIDs properly 2015-09-15 12:23:15 +02:00
24f8de2cc3 Bad hack, TODO REMOVE, workarounds client bug by sending inventory contents specifically for creative players <-- this commit is full of sadness 2015-09-14 20:25:57 +02:00
885fc07e5c Merge pull request #3481 from LouisBHirst/patch-getOnlinePlayers
getOnlinePlayers() only returns the players already connected
2015-09-13 21:01:51 +02:00
3892d5d74f Removed call to detach 2015-09-13 17:56:21 +02:00
c7b915639d getOnlinePlayers() only returns the players already connected 2015-09-13 11:43:51 -04:00
21c3d03000 Removed sleep from ServerKiller 2015-09-13 17:38:55 +02:00
2d1b2050dc Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-12 17:10:45 +02:00
3ffdb8e552 Removed @deprecated classes, methods and properties, added some type hints 2015-09-12 17:10:11 +02:00
79aa7583ec Merge pull request #3471 from PEMapModder/patch-7
Update Player.php
2015-09-12 15:16:10 +02:00
0d6f13cb4f Update Player.php 2015-09-12 20:53:35 +08:00
29a5012c02 Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-12 01:03:09 +02:00
a1a1327415 Removed signed parameter in BinaryStream->getShort() in favor of getSignedShort() 2015-09-12 00:57:09 +02:00
16ff2d99b0 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-09-11 17:34:11 +02:00
cb222601fd Haters gonna hate, also fix misleading interface default parameter 2015-09-11 16:50:57 +02:00
922e9d93d5 Moved exception handler to a big try catch 2015-09-11 09:09:45 +02:00
e137ac4c56 Base PHP7 work to make it "run" - READ NEXT LINES!
All plugins will need to bump the API if they want to use this.
NOTE THAT THIS IS NOT THE FINAL API 2.0.0 AND THAT THERE WILL BE MORE CHANGES.
To start updating, you might also want to read https://secure.php.net/manual/en/migration70.php and specifically https://secure.php.net/manual/en/migration70.incompatible.php

To compile PHP7 with some of the required dependencies, use https://gist.github.com/shoghicp/166ab26ce5cc7a390f45
ONLY LINUX IS TESTED, DO NOT ASK FOR OTHER PLATFORMS!

----- THIS VERSION IS NOT SUPPORTED -----

This version WILL crash randomly in unexpected places due to PHP7, pthreads, PocketMine or cosmic rays.

Handle with care, and store under direct sunlight for the best performance.
2015-09-10 21:29:29 +02:00
9501d03552 FIxed a bug No sound for TrapDoor
missing "use pocketmine\level\sound\DoorSound;"
2015-09-06 22:59:02 +09:00
ccca3ec0bf FIxed a bug No sound for FenceGate
missing "use pocketmine\level\sound\DoorSound;"
2015-09-06 22:55:56 +09:00
8f24306d65 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-09-05 18:22:28 +02:00
59a775f82c Merge pull request #3448 from willowmaster66/willowmaster66-patch-4
First item in the hotbar is not loaded correctly
2015-09-05 18:19:45 +02:00
5baa87e9fe First item in the hotbar is not loaded correctly
When you logon the first hotbar item contains the first item of the inventory, but it should contain the previously selected item.
2015-09-04 23:40:19 +02:00
bdf5c46793 Merge branch 'master' into mcpe-0.12 2015-08-31 17:51:07 +02:00
4bd14e7424 Revert commit that removed useful parameter for plugins that made backwards-incompatible changes
Revert "@PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427."

This reverts commit 9adcc19154.
2015-08-31 17:48:52 +02:00
a18826473b Added enderman teleport sound 2015-08-31 17:48:28 +02:00
9adcc19154 @PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427. 2015-08-31 22:05:49 +09:30
66b86c3685 Merge pull request #3423 from willowmaster66/willowmaster66-patch-1
Block cache not cleared with a call to clearcache
2015-08-31 21:43:03 +09:30
7d18b92ea1 Merge pull request #3426 from PEMapModder/patch-7
Remove unused parameter in Level::requestChunk
2015-08-30 02:56:26 +09:30
0348d181d4 Remove unused parameter in Level::requestChunk 2015-08-29 18:03:40 +08:00
0b9b1738b3 Block cache not cleared with a call to clearcache
While trying to figure out Github and looking for a different bug I found this small bug in the code. The ClearCache function on Level.php did not correctly clear the blockcache.
2015-08-27 10:44:44 +02:00
244cef3b00 . <-- descriptive commit ftw! 2015-08-23 00:25:30 +02:00
b47cebb1d5 PHP7 changes 2015-08-23 00:25:30 +02:00
7f8b39a63c Renamed NBT tags to have Tag in the name 2015-08-23 00:25:29 +02:00
34dc6ea0d6 NOTE! THIS SHOULD BE REVERTED LATER! Removed WeakRef dependency 2015-08-23 00:25:29 +02:00
d7d05c20a9 Bumped to API 2.0.0 2015-08-23 00:25:29 +02:00
91bda131be Merge pull request #3395 from luca28pet/patch-1
Spelling fix
2015-08-22 23:37:23 +02:00
1a9ec65983 Spelling fix 2015-08-22 15:58:45 +02:00
4e0fc6d1de Allow saving resources with parent directory being recursively created 2015-08-18 10:20:04 +08:00
fabb632286 More changes! 2015-08-13 18:02:10 +02:00
99df6f8edc Updated language 2015-08-13 09:17:43 +02:00
6e2ea63ce1 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-08-12 15:00:04 +02:00
31ef7721b1 Removed network channels, bumped protocol 2015-08-12 14:59:48 +02:00
f1cc8ddde4 Merge pull request #3372 from SuperMarcus/patch-2
Fix wrong id passed to constructer in CookedFish.php
2015-08-11 19:57:33 +02:00
25b9946d9e Fix wrong id passed to constructer in CookedFish.php 2015-08-11 23:06:40 +08:00
5a626405e3 Merge pull request #3368 from thebigsmileXD/patch-2
Added sound for opening/closing (FenceGates)
2015-08-11 12:58:34 +02:00
311d8d94dd Added sound for opening/closing (FenceGates)
Added DoorSound on opening/closing FenceGates depending on #3367 @0929hitoshi 's Idea
2015-08-11 12:48:41 +02:00
7d0810a5af Merge pull request #3367 from thebigsmileXD/patch-1
Added opening/closing sound
2015-08-11 12:27:18 +02:00
a5efd0bdf8 Added opening sound 2015-08-11 11:52:08 +02:00
ff232a9f04 Merge pull request #3332 from PEMapModder/dec
Disallow registration of events without handlerList, fixes #3330
2015-08-11 16:12:59 +09:30
8889e687c9 Changed TextPacket 2015-08-10 23:40:14 +02:00
0f993f8beb setDisplayName skin fix 2015-08-10 16:33:27 +02:00
d5c2702908 Update PluginManager.php 2015-08-10 22:14:11 +08:00
62848b914d Fixed String values on NBT parsing 2015-08-10 15:09:23 +02:00
0ce343d8ca Fixed escaping values in NBT parser 2015-08-09 13:52:15 +02:00
534b988a1c Added basic Nether generator 2015-08-09 00:38:23 +02:00
a9ead5567b Improved NBT json parsing, attribute base 2015-08-08 22:39:43 +02:00
f5429ef585 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-08-08 16:50:37 +02:00
d729961bde Merge pull request #3331 from PEMapModder/patch-5
Fixes #3330
2015-08-09 00:12:35 +09:30
f093a6498d Added base enchantment adding utilities, /enchant command 2015-08-08 16:03:04 +02:00
4dd0469792 Base enchantment class 2015-08-08 14:53:03 +02:00
fe196c6404 Added display of names on death 2015-08-08 13:35:57 +02:00
fdf10b60dc Added PlayerToggleSneakEVent and PlayerToggleSprintEvent 2015-08-08 13:10:59 +02:00
d4163ea01c Added sneaking, sprinting 2015-08-08 13:02:59 +02:00
b3efb733a2 Improved block breaking timing, added faster block breaking with swords 2015-08-08 00:33:52 +02:00
fcba9596d6 Added CanDestroy and Lock tag 2015-08-07 22:20:01 +02:00
01d93d6e10 Added CanPlaceOn tag 2015-08-07 22:13:52 +02:00
1fa467eb58 Proper recipe ingredient matching, fixed crafting type resetting 2015-08-07 22:00:35 +02:00
3e2cce3c2c use cleanup 2015-08-07 21:26:24 +02:00
d026e2ecf0 Implemented new crafting mechanism 2015-08-07 21:26:12 +02:00
696edfd31f Added custom block data (example, chests), better deep checking of same NBT 2015-08-07 17:24:35 +02:00
e9c981b586 Updated lang 2015-08-07 16:28:49 +02:00
75b7b03857 Added support for more NBT data, renaming inventories, fixed tags not being saved, added support for tags in /give 2015-08-07 16:28:27 +02:00
d1bfb304cb Added some extra tile entities, fake enchanting table 2015-08-07 12:07:39 +02:00
cba9ff393c Fixed properties for NBT, fixed dropping items removing extra data set 2015-08-06 21:51:39 +02:00
02cb9d69a9 Save items properly on several places, added NBT::getItemHelper() and NBT::putItemHelper() 2015-08-06 21:44:00 +02:00
554bfb4855 Added methods for adding custom names directly to items 2015-08-06 21:09:37 +02:00
091d0b3ff9 Added compound tag checking for Item->equals() 2015-08-06 20:25:22 +02:00
a65109ff34 Oh well that fixes block placing 2015-08-06 17:47:17 +02:00
8a3c5ab6a1 Removed DropItemPacket field 2015-08-06 16:26:38 +02:00
2cec6812a8 Added extra data printing for Items, non-automatic bytearray on NBT 2015-08-06 14:51:41 +02:00
d0bfc826ea Updated protocol details, anvil menu creation 2015-08-06 11:51:41 +02:00
2e0ef645fa Fixed several issues with spawning/despawning Players/Humans, close #3345, close #3342 2015-08-05 13:40:11 +02:00
09720a2d90 Properly implemented Shaped recipes on Network and manager, no crafting! 2015-08-04 21:59:54 +02:00
9456e20770 Added support for extra data, improved BinaryStream 2015-08-04 18:29:13 +02:00
7fd053fb09 More changes! Alsp added Anvil block and BinaryStream 2015-08-03 18:04:13 +02:00
522932d7c0 Added new sounds, events, particles 2015-08-03 12:42:47 +02:00
2b2a1b18e7 Updated RakLib protocol 2015-08-03 10:54:24 +02:00
1b812d373c Updated protocol packet ids 2015-08-03 10:53:23 +02:00
5621ab0c49 Updated some packets for 0.12, UUIDs, other stuff! 2015-08-02 01:22:36 +02:00
4258e22c02 Made some changes for 0.12 2015-08-01 19:14:44 +02:00
ff16f2ef05 Disallow registration of events without handlerList 2015-07-29 21:47:39 -04:00
9bbaf5d00d Possible workaround with #3330
Filters away non-public event handlers
2015-07-30 09:21:35 +08:00
0380e9009a Added block break tool type, fixed falling sand, fixed duplicated jungle leaves 2015-07-27 20:31:55 +02:00
866fde5351 Improved speed of some int arrays, fixed block metadata 2015-07-27 20:31:55 +02:00
9f953fa675 Fixed #3232 2015-07-27 20:31:55 +02:00
4d95c65d95 Changed TIER_IRON to TIER_STONE 2015-07-27 20:31:55 +02:00
26c9eed82e Added all block hardness 2015-07-27 20:31:55 +02:00
f3c46b12c5 Block breaking part 1 2015-07-27 20:31:55 +02:00
b14d14d3d5 Merge pull request #3305 from SuperMarcus/patch-1
Fix wrong size increasing code.
2015-07-24 09:19:55 +02:00
60ab35774a Fix wrong size increasing code. 2015-07-24 15:14:17 +08:00
2df901b064 Merge pull request #3274 from SopaXorzTaker/patch-1
Update Utils.php #2
2015-07-17 06:44:15 +09:30
0c09361c46 Added main-hard-limit memory property similar to old memory-limit, use less memory on startup (RakLib) 2015-07-11 13:16:39 +02:00
1ebf2476df Merge pull request #3245 from alejandroliu/lastPlayed-fix
Fixes lastPlayed
2015-07-03 08:33:42 +02:00
fe85b5026d Fixes lastPlayed 2015-07-02 00:54:20 +02:00
bfd3fb6636 Merge pull request #3199 from alejandroliu/tile-fix-teleport-glitch-new
Teleport glitch fix
2015-06-20 09:48:08 +02:00
0723112207 Once again... 2015-06-19 21:06:15 +02:00
be9f5521e1 Fixed undefined index on async worker crash 2015-06-19 18:36:08 +02:00
6063738e69 Fixed setting inventory index after new entity id 0 for players 2015-06-19 17:14:09 +02:00
ef738ef299 Fixed effect entity id 2015-06-19 15:34:33 +02:00
5796784442 Stop calculating permissions on closed Players 2015-06-19 14:52:08 +02:00
a1cc60d472 Fixed eye height 2015-06-19 14:49:41 +02:00
f7ec1de0fd Players now have entity id 0 2015-06-19 14:40:05 +02:00
b856e5e909 Fixed #3093 2015-06-19 13:42:20 +02:00
f7e6246dc2 Destroy cycles that reference player for faster collection 2015-06-19 13:31:29 +02:00
b166628940 Added ability to dump memory 2015-06-19 13:01:49 +02:00
4e76c30788 Update Utils.php
Correct a typo
2015-06-17 08:39:18 +03:00
33e312c7d0 Added extra memory reportings (heap, stack), stop tasks faster, added extra timeouts fro ServerKiller 2015-06-13 15:37:02 +02:00
2ac27bd382 Improved safe spawn calculation, fixes #3094 2015-06-13 14:43:14 +02:00
f490ff8074 Added mossy stone brick recipe, added chiseled stone brick recipe, added cracked stone brick furnace recipe, fixed crafting stone bricks, fixed crafting stone brick slabs, closes #3161, fixes #3160 2015-06-13 13:45:05 +02:00
eeef81e2b1 Fixed #3154 2015-06-10 10:10:07 +02:00
4a8ca96aaa Skip getting bigger bounding boxes on higher tick rates 2015-06-09 18:24:17 +02:00
eef33d64e6 Fixed new players having air ticks to 0 instead of 300 2015-06-09 15:26:28 +02:00
7cf5df7e46 New console output formatting 2015-06-09 14:40:40 +02:00
ac2bcf7e30 Made /list output similar to PC output 2015-06-09 12:21:00 +02:00
ec226105e4 Added support for overriding properties over the command line 2015-06-09 11:23:57 +02:00
2a1a09a923 Create chunks in case of dropping items outside of world boundaries 2015-06-09 09:45:40 +02:00
20911930cf Fixed bad permission nodes on /kill, closes #3139 2015-06-09 09:45:10 +02:00
2eaa12005e Changed knockback process 2015-06-08 15:52:57 +02:00
fdcddcc04b Fix entity unloading after teleporting, closes #3136 2015-06-08 15:02:00 +02:00
4fd5e9ba7d Improved RakNet encapsulated packet encoding 2015-06-08 12:45:52 +02:00
7b17bf416e Fixed Arrows not hitting entities, added new movement system 2015-06-07 21:08:46 +02:00
d0f743a99e Fixed /time add message, chunk tick reset default 2015-06-07 20:15:30 +02:00
cbb1c55a06 Improved biome generation, get grass color from gradient interpolation, improved performance of generation, try to recreate grass colors from imported chunks, closes #2845, closes #1792 2015-06-07 15:17:02 +02:00
d881dbf1a2 Only spawn break particles when needed 2015-06-07 12:33:53 +02:00
383fcba8e1 Fixed skins issue 2015-06-07 12:17:27 +02:00
e5f28e0f7a Throw exception on invalid parameters on Inventory addItem() and removeItem() 2015-06-07 12:05:10 +02:00
cf3f32fdae Added Script plugin loader 2015-06-06 23:09:54 +02:00
c4bdbc5443 Report players as EntityPlayer all the time 2015-06-06 23:09:43 +02:00
62a8f58bb0 Improved block and chunk cache, fixed PlayerQuitEvent player save 2015-06-06 20:28:37 +02:00
f21ed39c1c Improved timing reports 2015-06-06 19:07:12 +02:00
b358a2e474 Fixed underscores >.< 2015-06-06 18:12:39 +02:00
21c6eeef11 Fixed A-Z range 2015-06-06 17:57:07 +02:00
96f67bdadf Added auto save to PlayerQuitEvent 2015-06-06 17:56:36 +02:00
6ee61cce7b Faster player login 2015-06-06 17:38:32 +02:00
7f6704f761 Chunk ticking depends on chunk loaders, fixes #3118 2015-06-06 17:38:10 +02:00
9e4d88a852 New extended packet timings 2015-06-06 16:58:49 +02:00
5682026eae Fixed state corruption for auto saving 2015-06-06 15:53:28 +02:00
2a805dc0ed Limited chat and sign length using UTF-8 2015-06-05 17:08:24 +02:00
bdb9b1865b Added exception when unloading the default level without switching it first, #3112 2015-06-05 16:48:27 +02:00
1e03c5b795 Workaround for players getting stuck on far chunks 2015-06-05 16:48:27 +02:00
ec82434ef4 Added charcoal for torches, improved recipe matching for wildcards, closes #3108 2015-06-05 16:48:27 +02:00
7bafa217c8 Fixed some saving 2015-06-05 16:46:53 +02:00
fe55023761 Better Terminal detection 2015-06-05 14:07:32 +02:00
ac4194eb3f Added lily pad, checked some bounding boxes 2015-06-05 13:58:59 +02:00
6e69e15dfd Moved network check out of level, added server killer for long stops 2015-06-05 11:46:33 +02:00
a53b041984 Improved region save and saving of chunks before population 2015-06-05 02:27:37 +02:00
d542dfc2ce Split player into more methods, added extra timings 2015-06-05 00:19:45 +02:00
188f4d7778 Clear chunk cache on tile change 2015-06-04 17:36:12 +02:00
71490f60f2 Fixed other invisibility issues 2015-06-04 16:51:48 +02:00
05dbf7b47f Fixed some corrupted states, probably fixed most invisible players cases 2015-06-04 15:46:57 +02:00
14ff537e71 Improved damage sources for projectiles, falling blocks, TNT, and items 2015-05-31 14:19:47 +02:00
9e14435dbb Moved network ids to constants, improved some entity methods, more performance 2015-05-30 23:59:24 +02:00
32680843fa Added multisize loading 2015-05-30 19:38:57 +02:00
9768bf4f8a Added BlockBreakEvent::getDrops() and BlockBreakEvent::setDrops(Item[] $drops) 2015-05-30 18:26:47 +02:00
7c806c7920 Added missing brace 2015-05-30 17:29:38 +02:00
b61c54c9cb Send motion to players on downwards movement 2015-05-30 17:16:12 +02:00
a349f6d4dd Merge pull request #3083 from PEMapModder/patch-5
Added Location::fromObject(Vector3, Level, yaw, pitch)
2015-05-30 17:11:40 +02:00
9541c9751b Merge pull request #3087 from PEMapModder/patch-6
Block break optimization
2015-05-30 17:09:36 +02:00
3c0efe9af2 Block break optimization 2015-05-30 22:20:05 +08:00
24c1e6880d Added Location::fromObject(Vector3, Level, yaw, pitch) 2015-05-30 12:46:40 +08:00
74917923b6 Improved checks, area collision checks, etc 2015-05-29 15:13:19 +02:00
f20d5b2c69 Fixed MainLogger 2015-05-29 11:38:18 +02:00
eaa42f8449 Workaround for bad calls to teleport, closes #3074 2015-05-29 10:17:27 +02:00
1e2038fac5 Faster respawn when needed 2015-05-29 10:04:56 +02:00
c8abbf4f2f Added Snowballs to the creative inventory 2015-05-29 10:04:31 +02:00
009a3b657f Merge pull request #3076 from xpyctum/patch-1
Torches didn't craft
2015-05-29 08:27:24 +02:00
5b57fe6967 Update CraftingManager.php
Torch can't crafting
2015-05-29 10:30:20 +05:00
f133154919 New chunk ordering algorithm 2015-05-29 00:35:40 +02:00
8d4decc548 Fixed bad vector initialization 2015-05-28 23:58:29 +02:00
3bb037204e light population is now optional via pocketmine.yml 2015-05-28 23:39:09 +02:00
c578898aa4 Moved light population to an async task when needed, improved empty chunks 2015-05-28 23:34:07 +02:00
0f5f71e612 Forgot to check chunks after moving 2015-05-28 22:55:09 +02:00
75cab3dfc3 Improved updates after first tick 2015-05-28 22:43:39 +02:00
03f178379e Fixed items getting corrupted pickup delay, not being able to be killed by other damage sources 2015-05-28 22:17:12 +02:00
ce59703dd0 Merge pull request #3072 from alejandroliu/Kill-entity-bug
Fixes bug #3071
2015-05-28 17:34:38 +02:00
a77d82ac81 Changed how creator tag works on signs 2015-05-28 16:44:31 +02:00
1833da01fe oops 2015-05-28 15:16:09 +02:00
c97e1fdce0 Made Player::close() final, fixes several plugin issues that crashed the server 2015-05-28 15:03:45 +02:00
0e9bff6f4e Fixed armor not being sent correctly to current player, fixes #3073 2015-05-28 14:28:23 +02:00
3dd4fe706c Changed Vector3 floor() and ceil() 2015-05-28 14:20:50 +02:00
9a2170d296 protocol 27, added player spawn events after death from new protocol, added EntityEvent constants 2015-05-28 14:19:00 +02:00
8a41512194 Fixes bug #3071 2015-05-28 00:44:16 +02:00
51062940c5 Implemented QueryRegenerateEvent as base for other interfaces 2015-05-26 01:17:34 +02:00
66435d4f6a Workaround client-sede issue, remove this when fixed 2015-05-24 10:16:43 +02:00
c4d63326be Fixed fix for flowers, removed corrupted flower state, added proper identifiers that do not collide, added remaining IDs everywhere for consistency, removed magic number for constants, closes #3058 2015-05-23 22:49:06 +02:00
f91a3a2666 Fixed invalid fix for block updates that corrupted state 2015-05-23 22:47:46 +02:00
d429992f5b Fix Fallable not dropping after explosion, Fixes #2735, Fixes #2806.
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 22:36:23 +09:30
76c27fc18b Use broadcast permission to broadcast tips and popups 2015-05-23 22:05:48 +09:30
a0f8bc15dc Fix small whitespace issues, make broadcasts return count() as specified in PHPDoc 2015-05-23 22:05:48 +09:30
adc5aa11ac Added Server->broadcastTip() and Server->broadcastPopup()
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 22:05:48 +09:30
388f5c2c91 Added flowers compatible with MCPE 0.11.
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 21:57:59 +09:30
f64caf6c96 Use best method to create identifier on linux 2015-05-23 14:10:42 +02:00
b2b4cf788c Fixed possible channel order issue with chunks and start game packet 2015-05-23 13:38:50 +02:00
d7be531868 Limit amount of messages per tick per player to 2 2015-05-23 12:09:26 +02:00
5ad4f44dce Fixes sending newlines on messages to impersonate chat messages 2015-05-23 12:03:47 +02:00
7201372b0d oops 2015-05-23 12:02:20 +02:00
744ea6af8f Fixed #3023 2015-05-23 11:47:07 +02:00
1da0a48edb Fixed #3055 2015-05-23 11:37:48 +02:00
be6b0656a0 Do async saving only when needed 2015-05-23 10:54:15 +02:00
4f7aac50d3 build 13 2015-05-22 16:46:23 +02:00
149234f125 Added asynchronous file writing 2015-05-22 16:32:08 +02:00
cfe5ca91b2 Updated endpoint 2015-05-21 16:31:42 +02:00
46f20d36b3 Improved unique id generation for server 2015-05-21 12:59:33 +02:00
cde2d39029 New statistics system 2015-05-21 11:41:11 +02:00
36ddbf286d Build 12, added SILENT flag to entities, closes #3052 2015-05-21 11:40:51 +02:00
8d4abe2f39 Improved world loading, added chunk queue delay, closes #3046 2015-05-20 11:05:35 +02:00
32722856ea Updated FloatingTextParticle to use less heavy method 2015-05-19 21:59:23 +02:00
7753b1d8be Fixed items (and other entities) vibrating, bad offsets in tile calculation 2015-05-19 21:29:30 +02:00
92a2be024a Improved saving of modified properties 2015-05-19 20:49:47 +02:00
66f28f6dc4 Fixes #3042 2015-05-19 17:48:35 +02:00
1122a3c511 More undefined variables D: 2015-05-19 16:02:59 +02:00
0c6d8b9815 Fixed loader counter on Level, closes #1147 2015-05-19 14:49:18 +02:00
70a7c4c552 Added nametag saving 2015-05-18 19:04:37 +02:00
840690d801 Replaced old deprecated calls 2015-05-18 15:52:31 +02:00
f3a53be117 Moved Human->setNameTag() to Entity 2015-05-18 15:29:31 +02:00
ea7c0cb357 Removed debug code 2015-05-18 14:00:21 +02:00
85c43ba011 Allow setting nametag for any kind of entity 2015-05-18 13:08:06 +02:00
fbbe02a3bc Fixed some issues related to new indexes 2015-05-16 22:36:55 +02:00
fb05636694 Fixed Item vibration 2015-05-16 21:38:10 +02:00
63a5269313 Added settings.profile-report-trigger to only extract timings on a given tps rate 2015-05-16 16:02:32 +02:00
7705d8c52f Updated translations 2015-05-16 15:49:08 +02:00
419abdaad6 Proper chunk unloading in case of generation/loading without players 2015-05-16 15:43:34 +02:00
d6ebff412c Added ChunkLoader interface 2015-05-16 15:28:31 +02:00
7a34417e67 Kill player below -16 as now the bottom of the world can be rendered, send player count 2015-05-15 16:51:20 +02:00
76e6ccebd5 Proper recipe matching from network, bumped protocol, build 11, fixed entities not being killed on void (closes #3021), fixes achievement acquireIron not being possible (fixes #2600) 2015-05-15 13:59:29 +02:00
e61db8ad06 Added login timeout for players that do not complete the login process in time 2015-05-14 14:52:39 +02:00
b1edfd7631 Improved Falling blocks physics, entity kill, chunk unserialize, fixed flat generator color, fixed nbt tags __toString(), fixed explosion offsets, fixed increased player interaction range in creative 2015-05-13 12:18:59 +02:00
f3bdef7513 Fixed Anvil chunks not having NBT set 2015-05-12 16:52:11 +02:00
9791071262 Added Player->teleportImmediate() for tp force 2015-05-12 00:21:02 +02:00
aa38a4885f Fixed some issues with world generation and not creating chunks, closes #3008 2015-05-11 23:53:01 +02:00
de0f653027 build 10, improved levelDB constants 2015-05-11 20:31:28 +02:00
13906b32b8 Check connection status on batch, check sleep when players leave a level 2015-05-10 14:58:07 +02:00
925b0c1b07 Fixed empty chunks on generation, closes #2998 2015-05-10 13:18:39 +02:00
db409851e9 World generation is timed by type and chunks can be created on the fly 2015-05-09 19:03:41 +02:00
ab18b7833f Fixed light population happening before population 2015-05-09 16:37:34 +02:00
1a1b8830a4 Added MemoryManager object watcher for object leak debugging, improved SPL Thread/Worker stopping, fixed some possible weak references crashing unexpectedly 2015-05-09 16:11:12 +02:00
7e539ec85a Fixed invalid check 2015-05-08 15:38:51 +02:00
563f6f8e4f Interaction checks happen using the plane and not 3d space 2015-05-07 15:38:22 +02:00
82b0dbfe8e Improved /status, added world information 2015-05-06 19:11:47 +02:00
a4769248fb Set nextTick on start 2015-05-06 19:11:47 +02:00
fb03df3d06 Calculate skylight on chunk population 2015-05-06 16:57:49 +02:00
44b5c23ee1 Fixed dead entities and Item picking, improved timing reports 2015-05-06 16:21:35 +02:00
bff51322af Merge pull request #2986 from 64FF00/master
Fixed /tell command not displaying the sender's name correctly (aka "I'm Bored x3")
2015-05-05 14:27:49 +02:00
cc58d96071 Fixed /tell command not displaying the sender's name correctly 2015-05-05 19:59:12 +09:00
001915fcd6 beta build 9 2015-05-04 17:58:29 +02:00
cd607b0cec Oops distance 2015-05-04 17:57:03 +02:00
5ec4b3f46f "Fixed" #2982 2015-05-04 17:53:48 +02:00
d9a9808844 Added interaction and 3rd person cheat protection 2015-05-04 17:52:55 +02:00
f718d06a7d Updated RakLib, tick inside thread instead of depending on main thread 2015-05-03 23:40:36 +02:00
563f7404fe Time less than target fix 2015-05-03 23:20:40 +02:00
0ddf396b08 Use time_sleep_until() instead of usleep(), improved thread kill 2015-05-03 23:17:39 +02:00
d830386786 Changed default async compression 2015-05-03 22:14:57 +02:00
49f34ec524 Send spawn position after respawn on death, fixes #2976 2015-05-03 21:46:46 +02:00
9ec609d025 Improved Player flight detection after setMotion(), other method improvement 2015-05-03 13:42:54 +02:00
0ead3ec781 Changed round/floor to floor on BlockIterator 2015-05-02 17:38:45 +02:00
fdf395721e Improvements on player move updates 2015-05-01 15:09:37 +02:00
211e1ae121 Fixed slots on creative 2015-04-30 17:51:04 +02:00
923be2fffc Improved slot selection on creative mode, closes #2960 2015-04-30 12:53:03 +02:00
fb257c16f1 Set entities on fire if hit by an entity on fire 2015-04-30 11:40:22 +02:00
b33706d427 Merge pull request #2959 from LDX-MCPE/patch-1
fixed typo
2015-04-30 08:34:57 +02:00
LDX
6bcb319fb5 fixed typo 2015-04-29 23:12:22 -04:00
d4b2e3d1b7 Improved heightmap generation 2015-04-29 23:19:27 +02:00
7754aa71a3 Fixed end of regex on Config 2015-04-29 21:09:35 +02:00
978aa2ba0f Protocol changes 2015-04-29 17:04:34 +02:00
f74f5cfde7 Add DATA_SIZE to Slime! 2015-04-29 15:55:11 +01:00
c2b3f7cd7f Noclip in spectator mode, changed chunk format 2015-04-29 12:29:59 +02:00
3872a21474 Allow setting the flying status for any given player 2015-04-29 11:31:04 +02:00
11e2d23b83 Improved LoginPacket and BatchPacket handling 2015-04-29 10:55:29 +02:00
2cd78d4ae3 Merge pull request #2951 from EnderBrine101/patch-1
No longer needed :P
2015-04-28 18:52:21 +02:00
08f09cc3c8 No longer needed :P 2015-04-28 17:34:38 +01:00
1b13a4c1ec Protocol 25 2015-04-28 16:56:59 +02:00
71587db2be Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-04-28 14:49:52 +02:00
8caf04ade5 build 8, allow setting selected hotbar slot, auto_jump setting 2015-04-28 14:20:35 +02:00
488fbc27fe Fixed issue reading/writing YAML 2015-04-27 21:26:50 +02:00
84d1f4596b Improved Anvil live conversion speed 2015-04-27 14:43:33 +02:00
6fc7ee2775 Fixed some bad defaults, improved spawning 2015-04-27 14:43:33 +02:00
ef00103fec Merge pull request #2944 from alejandroliu/generator-list
Added a getGeneratorList
2015-04-27 09:53:50 +02:00
bdf069ebe1 Added a getGeneratorList 2015-04-27 01:18:04 +02:00
5942cafa53 Send in the correct channel 2015-04-26 23:11:07 +02:00
fbdbac06cc New delayed teleporting system 2015-04-26 23:04:24 +02:00
fba12f2a13 Be sure that AsyncTask finish executing, fixes #2931 2015-04-25 17:52:57 +02:00
7ad98d4659 Deprecated CallbackTask, moved sleep checking to level 2015-04-25 17:28:30 +02:00
1d8c29add7 Fixed Block Iterator and getLineOfSight() 2015-04-24 18:10:45 +02:00
d4cae729c3 Added AsyncTasks timings 2015-04-24 17:21:39 +02:00
529f9b148b Save/reload skin on Human based entities 2015-04-24 17:05:00 +02:00
20842636f9 Added timings to chunk sending 2015-04-24 16:59:46 +02:00
7b699d9afd Improved fall damage while on jump boost, new protocol update, build 7, allow for live inventory resizing 2015-04-24 16:43:59 +02:00
ba635b8858 Fixed particles being emmited on non-player block breaks 2015-04-23 17:02:37 +02:00
04f3cc4905 Measure highest TPS load and lowest TPS between measurements 2015-04-23 15:34:42 +02:00
4a1e122605 Move UUID generation before PreLogin 2015-04-23 12:07:34 +02:00
a0739a7b03 Added more level tick options, force player ticks, base tick rate for levels 2015-04-23 11:34:01 +02:00
f73bd02198 Allow to tick players partially 2015-04-23 11:19:27 +02:00
ec7db3be4f build 6! 2015-04-22 17:08:59 +02:00
2ea8835b12 Removed possible crash on RakLibInterface 2015-04-22 15:45:04 +02:00
0aebcb9f81 Correctly load Anvil worlds 2015-04-22 12:07:27 +02:00
1578fc3ddb Improved world generation manager, UUIDs (some work for future usage) 2015-04-21 19:54:16 +02:00
514ce0fb04 Fixed colors not being shown on windows :s 2015-04-20 17:55:49 +02:00
f6e88ec055 Protect against null chunk on entity 2015-04-20 17:29:58 +02:00
15b4cd8fb3 Improved format constants, fixed cake eating when max health is > 20 2015-04-20 17:25:58 +02:00
f88aed1208 Fixed NBT parsing on false properties 2015-04-20 13:57:16 +02:00
6ed63edd89 Removed some remaining references, removed duplicated code on Anvil 2015-04-19 16:49:15 +02:00
897774f848 Increased manuall garbage collection rate 2015-04-19 16:16:05 +02:00
bf4a8398c4 Moved chunk garbage collector to memory manager 2015-04-19 16:14:54 +02:00
05385acb36 Added Memory Manager timings 2015-04-19 16:01:46 +02:00
094234dc0f Updated references and submodules 2015-04-19 15:37:18 +02:00
c2f72ea9ac Updated languages 2015-04-19 11:50:30 +02:00
e3c48b22cb Anvil fixes, improved memory settings 2015-04-19 11:45:43 +02:00
5860bdcc4d Improved network 2015-04-18 22:38:57 +02:00
1b84340e3f Improved manager 2015-04-18 22:35:00 +02:00
61828baa8f Improved manager 2015-04-18 22:33:50 +02:00
11ecaaa87f fixed oops in RakLib 2015-04-18 21:04:07 +02:00
b2c25eaf36 Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs 2015-04-18 20:13:52 +02:00
ddc152ae0a Merge pull request #2903 from PEMapModder/patch-4
Added paramter types for some Config.php functions
2015-04-17 18:15:12 +02:00
08a612954e Added creative mode block list API 2015-04-17 18:01:10 +02:00
5b10ccf431 0.11.0 build 5, removed chat format workaround, improved gamemode switch, send allowed creative blocks (TBI as API) 2015-04-17 17:10:25 +02:00
2add19a4c8 Added paramter types for some Config.php functions 2015-04-17 16:32:40 +08:00
7ee21f6254 Try to clean chunks on other threads 2015-04-15 22:14:51 +02:00
f79476f530 Fixed health setting 2015-04-15 22:00:01 +02:00
4fbafe7c2f HACK: added workaround for MCPE eating characters, enable settings.force-language 2015-04-15 21:14:24 +02:00
d6186fa7c6 Moved Player->setGamemode() message to /gamemode command 2015-04-15 20:49:38 +02:00
88797d4c6c Enabled GC on AsyncWorker 2015-04-15 20:47:34 +02:00
fc2e4ddc63 Fixed long trunk generation 2015-04-15 20:47:18 +02:00
7f28deefcb Better BatchPacket decoding and LoginPacket handling 2015-04-15 19:30:49 +02:00
81fe98d4cc Added Milk bucket to creative inventory 2015-04-15 17:19:05 +02:00
dfec44645b Added milk drinking 2015-04-15 16:45:03 +02:00
1ef6328635 Allow negative potion effects 2015-04-15 16:37:13 +02:00
c0782caab9 Added alternate name for Swiftness 2015-04-15 16:15:17 +02:00
298b973604 Fixed a crash when saving chunks 2015-04-15 15:54:27 +02:00
5ca4f5416c More protocol updates 2015-04-15 15:53:11 +02:00
c36c0dfa66 Fixed health boost addition 2015-04-15 13:04:53 +02:00
64c366bdb5 Protocol 22 2015-04-15 12:38:52 +02:00
68ea9b067f Added health boost potion effect, added Player->sendTip(), MCPE 0.11.0 build 4 2015-04-15 12:33:16 +02:00
79adbdeafe Fixed trees not generating trunk 2015-04-15 11:04:00 +02:00
e09ebb0623 Oops! 2015-04-14 21:12:57 +02:00
91388c6b86 Added chunk-sending.cache-chunks property (old advanced-cache), improved chunk unload saving times 2015-04-14 20:57:09 +02:00
42eda170b5 Oops, forgot to do it correctly! 2015-04-14 20:39:37 +02:00
6ee3a7b8d7 Updated languages 2015-04-14 18:28:57 +02:00
18f6e1805f MCPE 0.11.0 build 3 2015-04-14 18:25:05 +02:00
0b176b3fe0 Implemented Channeled packet sending 2015-04-14 18:24:40 +02:00
bb945446b7 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-04-14 14:04:26 +02:00
1d1766a876 Removed format characters correctly :) 2015-04-14 14:04:10 +02:00
bd560ab3b1 Spawning mechanics change 2015-04-14 01:04:17 +02:00
547aa2ae31 Removed formatting on signs, allow OPs to use colored chat (or people with disabled remove format) 2015-04-13 16:45:20 +02:00
a993f15387 Added tick ms to level warning, call correct method on Anvil 2015-04-13 16:34:42 +02:00
1865622b89 Added settings.force-language property to force server language on clients 2015-04-13 12:02:40 +02:00
31387ff0be Added localized invalid name message 2015-04-13 11:36:15 +02:00
928660d59a Updated languages 2015-04-13 00:25:39 +02:00
5e2a21fc26 Added level-settings.auto-tick-rate property, added Level tick rate 2015-04-12 14:13:36 +02:00
410f6ba618 Fixed some potion effect names 2015-04-12 12:46:06 +02:00
05a9ad57bd Fixed BaseLang->get() 2015-04-12 12:41:38 +02:00
ba226d03c3 Added more translations 2015-04-12 12:27:55 +02:00
674a486654 Fixed #2863 2015-04-12 12:19:28 +02:00
e9963b603d Fixed #2864, closes #2864 2015-04-12 12:17:53 +02:00
e2bae92df8 Updated language files and command descriptions 2015-04-12 00:59:12 +02:00
8d468a1efb Format fix 2015-04-11 21:59:55 +02:00
ddeea2942c Updated RakLib, improved packet reading 2015-04-11 21:41:05 +02:00
a65c300a0a Fixed moving from different chunks, lots of issues fixed (all kind of strange things) 2015-04-11 21:39:51 +02:00
363e0e3b13 Revert slot change harder 2015-04-11 18:50:27 +02:00
6504047292 New translations, fixed multiplayer.player.leave 2015-04-11 18:19:28 +02:00
87a779afaf Enforced max distance checks 2015-04-11 18:07:12 +02:00
6b1b6711bd Send extra id on Add/Remove player 2015-04-11 18:00:25 +02:00
f71cf1c749 Added Fallback formatting codes to Windows/Android 2015-04-11 17:27:20 +02:00
3685d967a8 Fixed crash on /ban 2015-04-11 17:09:01 +02:00
d1006de421 Added fallback to BaseLang, better use by plugins 2015-04-11 16:15:45 +02:00
3cf42b558c Fixed language selection 2015-04-11 15:37:44 +02:00
5a0d1affcc Base translations moved to submodule! 2015-04-11 15:31:22 +02:00
414549659a Fixed crash on already dead players, closes #2856 2015-04-11 15:13:27 +02:00
3b6e10b759 More langs :D 2015-04-11 14:59:15 +02:00
c2138aa30c More language files 2015-04-11 12:56:38 +02:00
de052a79de Localized kick messages 2015-04-11 02:31:34 +02:00
c29ae333a2 Translate format text 2015-04-11 02:15:46 +02:00
0c041ebca3 Added base translation system 2015-04-11 01:32:08 +02:00
3224cd7dc5 Added Grass Path block, fixed redstone blocks not being able to be placed 2015-04-10 19:05:10 +02:00
3f60f7c0fb Merge pull request #2847 from matcracker/patch-3
Added Iron Shovel
2015-04-10 16:52:01 +02:00
c786ace355 Skin methods 2015-04-10 16:47:18 +02:00
60ac8f91ba Fixed pre-login disconnect messages 2015-04-10 15:26:32 +02:00
5720cb2be7 Added Iron Shovel
I think to have add Iron Shovel in creative inventory.
2015-04-10 15:06:02 +02:00
c32a7467bb Fixed wrong shift due to compiler change 2015-04-10 15:05:15 +02:00
0626d27003 Moved skin checks after protocol checks 2015-04-10 10:23:28 +02:00
2ae095a15a Fixed disable-ansi not working 2015-04-10 10:16:57 +02:00
5d102c2ede Fixed backwards compatibility issue on PlayerInteractyEvent 2015-04-10 10:16:03 +02:00
a7b1c6e086 Merge pull request #2844 from Falkirks/patch-1
Fix #2843
2015-04-10 08:48:22 +02:00
d855bbba0b Fix #2843 2015-04-09 20:59:42 -07:00
73d1d131e1 Added skin checks to Player and Human 2015-04-09 20:58:38 +02:00
0aa9586a52 Packet crashes fixed :D 2015-04-09 20:44:04 +02:00
205f6d50c1 Fixed PlayerActionPacket encode 2015-04-09 20:00:39 +02:00
ac6e2f9bf7 Fixed packet issues 2015-04-09 19:55:19 +02:00
1ddd58fd3b Fixed a few issues 2015-04-09 18:50:34 +02:00
66b58e36a1 Updated Code Guidelines 2015-04-09 18:24:29 +02:00
86184a230e Merge branch 'mcpe-0.11' 2015-04-09 18:18:10 +02:00
b4a0afc2c8 Getting ready, protocol changes! 2015-04-09 17:42:06 +02:00
f2e2cec024 Removed entity mask 2015-04-09 14:23:37 +02:00
0117e8dfae New codename, MCPE version, bumped split packet limit 2015-04-09 12:30:07 +02:00
69f841a00c Added Squids with basic AI 2015-04-09 00:12:50 +02:00
02ba9ffc16 Improved entity movement ySize offset 2015-04-08 22:09:06 +02:00
71657a2a4e Improved effects, threading changes 2015-04-08 17:31:06 +02:00
76767294bf Fish items, block of redstone! 2015-04-08 15:34:50 +02:00
3cae81c01b Added Nausea effect 2015-04-08 13:40:48 +02:00
141c0a297e Skins, protocol changes, handle split packets 2015-04-08 13:00:15 +02:00
45c6694ef9 Merge pull request #2827 from PEMapModder/patch-3
Removed useless code in Entity::getDirectionVector()
2015-04-07 10:11:09 +02:00
9b09b7ddd1 Removed useless code in Entity::getDirectionVector() 2015-04-03 15:15:35 +08:00
c9adc336ee Fixed items doing crazy things 2015-03-29 18:10:02 +02:00
d5ba2a72a5 Added strength, weakness, resistance effects, fixed entity area 2015-03-29 14:49:47 +02:00
9f6b5992e3 Merge pull request #2813 from Gamecrafter/patch-1
Really small fix
2015-03-29 20:32:11 +10:30
e51858ae17 Update ReloadCommand.php 2015-03-28 11:58:32 -07:00
c2baaf435d Merge branch 'master' into mcpe-0.11 2015-03-28 19:14:02 +01:00
c422b83abf Merge pull request #2812 from alejandroliu/patch-1
Added missing LEATHER_BOOTs to Item::$list
2015-03-28 18:08:08 +01:00
e0a6d0feab Critical arrows, fixed arrow interception calculation 2015-03-28 17:54:10 +01:00
0a85ad0d1f Improved trees, improved inventory transactions, improved snowball/bow usage 2015-03-28 16:59:15 +01:00
91315645cd Added missing LEATHER_BOOTs to Item::$list
For some reason the leather boots are missing.
2015-03-28 07:25:42 +01:00
47de616ac5 Fixed commands, added level automatic tick delay, improved biome gradient 2015-03-28 01:26:06 +01:00
e0522d8b1a Fixed data on generation, biome gradient 2015-03-27 12:42:59 +01:00
08f2b7f291 Moved chunk population to async tasks, and no more cut trees! 2015-03-27 01:57:08 +01:00
72c4c01542 Yay generation uses async tasks 2015-03-26 18:21:39 +01:00
668ddeeb13 Removed outdated Cache 2015-03-26 11:55:51 +01:00
286c1ee880 Added chunk spawn threshold for players 2015-03-26 11:28:44 +01:00
ed2ba70a29 Merge remote-tracking branch 'origin/master' into mcpe-0.11 2015-03-26 01:32:44 +01:00
962c28aaca BatchPacket, compress any packet depending on the size, really fast threaded chunk sending 2015-03-26 00:06:46 +01:00
7d1313c63d >= <= on move 2015-03-25 20:00:55 +01:00
d19631226f Improved Entity attack()/heal() event firing 2015-03-25 11:11:02 +01:00
6836e4fe58 Merge pull request #2800 from alejandroliu/patch-1
Corrected MINECART constant definition on Item.php
2015-03-25 11:03:39 +01:00
4a79c65544 Corrected MINECART constant definition on Item.php
MINECART was defined as 329, where it should be 328.
2015-03-24 23:47:33 +01:00
d1760d9bb8 Synchronize hotbar slots, removed RotateHeadPacket, improved MoveEntityPacket, FullChunkDataPacket 2015-03-24 16:26:46 +01:00
355ddc469c Merge pull request #2788 from alejandroliu/patch-1
Clone initial chunk in Flat.php
2015-03-24 10:23:35 +01:00
4e934654ef More awesomeness, No AI flag! 2015-03-23 14:44:04 +01:00
38f3dda13b Oops! 2015-03-23 11:15:03 +01:00
c68cd2c496 Cloned the initial empty chunk 2015-03-23 10:28:29 +01:00
a6b8170d9c Improved biomes 2015-03-23 08:02:18 +01:00
9da26fdb88 World generation with biomes! 2015-03-22 22:57:40 +01:00
1666602652 Improved memory output, logging, removed locks 2015-03-22 03:20:48 +01:00
d2bf92c3ed New batched UpdateBlockPacket, added Level->sendBlocks() 2015-03-22 02:44:39 +01:00
93a50d08e7 Merge branch 'master' into mcpe-0.11 2015-03-22 02:20:32 +01:00
1f977f68c0 Merge pull request #2794 from sekjun9878/master
Utils\Config preserves document type between reloads. Fixes #2777
2015-03-21 15:03:05 +01:00
91a26c15dd Utils\Config preserves document type between reloads. Fixes #2777 2015-03-21 21:35:57 +10:30
add380c7ed A few fixes! 2015-03-21 00:45:29 +01:00
652987110a Added popup notices! 2015-03-20 17:56:07 +01:00
58253be0a0 Implemented swiftness, added invisible status to FloatingTextParticle 2015-03-20 17:19:06 +01:00
b42424eb22 Sounds! 2015-03-20 16:42:50 +01:00
1d1a8a316e Take-2: Delay "parsePreset" until we have to really generate a block 2015-03-20 08:13:55 +01:00
a2b3e48b45 Added /particle command 2015-03-20 03:37:58 +01:00
ebc8928c21 Implemented effect colors 2015-03-20 02:31:54 +01:00
62ba36b474 New TextPacket, second part! 2015-03-19 20:27:51 +01:00
2c59983672 New TextPacket, first part 2015-03-19 18:48:03 +01:00
8ae9cd4eaf Clone initial chunk in Flat.php
The Flat generator destroys Chunk at 0,0.

What happens is that it request the level to read Chunk at 0,0.  It then uses that chunk to create the template chunk.  However this obliterates whatever was in Chunk at 0,0.

Added a line to "clone" this chunk, so when parsePreset generates the template chunk, all this goes to a copy rather than the original file chunk 0,0.
2015-03-19 15:41:26 +01:00
275a1e3f60 Water breathing potion 2015-03-19 10:14:35 +01:00
6735234bf4 Protocol update 2015-03-19 10:12:09 +01:00
d66a2d7105 Merge branch 'master' into mcpe-0.11 2015-03-19 09:18:39 +01:00
c882df7465 Fixed destroyblock particle duplicating on clients 2015-03-19 08:30:07 +01:00
f21e457dc0 Fixed particle constructor 2015-03-18 21:49:01 +01:00
6bf30c133a Merge pull request #2785 from PocketMine/revert-2776-armor-fix
Revert "Implemented proportional armor modifier, applied armor in other ...
2015-03-18 17:26:53 +01:00
d34499e67b Revert "Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged" 2015-03-18 17:26:06 +01:00
c2a3298a7e Particles. 2015-03-18 16:34:19 +01:00
b31604a536 Fixed data sending, more particles 2015-03-18 12:11:44 +01:00
c00370cfbf Added experimental particles 2015-03-18 08:51:38 +01:00
7c0bd45d1d Merge pull request #2779 from alejandroliu/patch-1
Fixed a silly typo in Server.php line 1142.
2015-03-18 14:04:36 +10:30
5f2254cc42 Fixed a silly typo in Server.php line 1142.
Fixed a silly typo in Server.php line 1142.  Yes, the "t" is next to the "y" on my keyboard too!
2015-03-17 23:48:23 +01:00
8169803bb4 Updated Water/Lava to use new methods 2015-03-17 21:22:51 +01:00
5a35e7b058 Removed damage reduction by armor for lava 2015-03-17 21:10:54 +01:00
1b25cd6ffa Merge branch 'master' into mcpe-0.11 2015-03-17 19:12:03 +01:00
891eeff75a PocketMine 1.4.1 2015-03-17 18:01:58 +01:00
b4f62bf423 Fixed salling sand breaking on full BB partial blocks, closes #2770 2015-03-17 18:00:19 +01:00
7c76c1e3d7 Changed generator choosing logic, add proper preset if needed, fixes #2751 2015-03-17 18:00:19 +01:00
37bc1273ee Implemented double chest fix, closes #2744, fixes #2493 2015-03-17 18:00:19 +01:00
ffcdf49912 Allow plugins to cancel some kicks better, closes #2743 2015-03-17 18:00:18 +01:00
3e893ed0f7 Implemented hardcore banning, closes #2574 2015-03-17 18:00:18 +01:00
bfb7e8bb9e Merge pull request #2776 from PEMapModder/armor-fix
Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged
2015-03-17 17:57:28 +01:00
5067b96184 Merge pull request #2631 from 64FF00/master
TallGrass blocks should be only placed on grass blocks
2015-03-17 17:49:46 +01:00
cb2157ea80 Merge pull request #2614 from mmlmml1/master
Fixed for Iron bars and stonecutter
2015-03-17 17:36:01 +01:00
6af87814e3 Added 64-bit entity data field 2015-03-17 16:26:02 +01:00
5b3e65345f Fixed a typo
`$source->isCancelled()` shouldn't be checked twice
2015-03-17 22:20:33 +08:00
8aa8ae5094 Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged 2015-03-17 20:04:59 +08:00
b5b46bfd7e Improved thread count 2015-03-17 00:47:43 +01:00
2ae80031f0 New implementation of sending/setting/getting entity data, added effect saving 2015-03-17 00:01:54 +01:00
85c5714cbf API 1.12.0, 1.5dev 2015-03-16 21:39:32 +01:00
bc31df37d0 Added invisibility potion, metadata sending for invisibility/nametags 2015-03-16 19:05:31 +01:00
29ca349b3d Less protocol madness 2015-03-16 12:13:52 +01:00
4ec584d800 Added real memory and thread usage 2015-03-16 11:56:00 +01:00
4383e272eb Added Effects base, /effect and methods 2015-03-15 23:15:54 +01:00
f9361aa931 Use new colors in terminal 2015-03-15 18:32:36 +01:00
220d2b7bee Fixed NBT IntArray off-by-one reading 2015-03-15 16:40:44 +01:00
d5601b0c9f Generator works! 2015-03-15 16:40:18 +01:00
5bfc747622 Fixed NBT IntArray off-by-one reading 2015-03-15 16:39:53 +01:00
b0f8c14640 Added Terminal class, Improved normal generator speed 2015-03-15 00:15:24 +01:00
328cd585c0 Merge branch 'biome-generation' into mcpe-0.11 2015-03-14 15:52:38 +01:00
807107e581 Fixed constructors, default memory to -1, default async generator 2015-03-14 15:51:21 +01:00
94c2ec8498 Fixed constructors, default memory to -1, default async generator 2015-03-14 15:50:33 +01:00
9158cc4f19 Implemented Threaded ClassLoader, improves class loading while on different threads (no need to synchronize states) 2015-03-14 15:22:42 +01:00
11c13cd666 Implemented Threaded ClassLoader, improves class loading while on different threads (no need to synchronize states) 2015-03-14 15:22:13 +01:00
284958a21e Merge branch 'mcpe-0.11' of bitbucket.org:pocketmine/pocketmine-mp into mcpe-0.11 2015-03-14 02:39:12 +01:00
91e8bdbd37 Fixed size on MobSpawnParticle 2015-03-13 16:21:33 +01:00
9e0b9a6e5b Added right and left click interaction events 2015-03-13 14:39:37 +01:00
e48a3e5713 Added some types of Particles, Block break particles 2015-03-13 14:24:19 +01:00
1ce7cc64a6 Use ContainerSetSlotPacket instead of ContainerSetContentsPacket 2015-03-13 10:25:48 +01:00
7f9aad6840 Removed player foreach on Entity 2015-03-13 09:27:09 +01:00
3af784012c Fixed packets 2015-03-13 09:27:09 +01:00
a6c19734ce Fixed picking up items, entity IDs on packets 2015-03-13 09:27:09 +01:00
8ddd701d76 Renamed LoginStatusPacket to PlayStatusPacket, added spawn status, new colors 2015-03-13 09:27:09 +01:00
15ee0c37c6 Fixed Entity->setMotion() for Players 2015-03-13 09:27:09 +01:00
fc128affc5 Removed chat wrapping, deprecated TextWrapper 2015-03-13 09:27:09 +01:00
218fd999b0 More packets changed, unique IDs D: 2015-03-13 09:27:09 +01:00
eeeaac04e9 Updated packet order, removed player entity id as 0 2015-03-13 09:27:09 +01:00
8679ad5b86 Added colors, Disconnect Packet, protocol 21 2015-03-13 09:27:09 +01:00
2cd757d80a Fixed formatting of #2771 2015-03-13 09:26:45 +01:00
be20f61a93 Merge pull request #2771 from alejandroliu/ChunkCorruption
Fix some Chunk corruption due to Chunk overlap
2015-03-13 09:24:24 +01:00
59e9446fe5 Added another place where the same happens 2015-03-13 08:19:47 +01:00
4f47dac8ec Fix some Chunk corrumption due to Chunk overlap 2015-03-13 06:23:32 +01:00
b54c0835b7 Update RakLib 2015-03-12 18:40:12 +01:00
1e00ff9e4a Update RakLib 2015-03-12 18:37:22 +01:00
1ac7f9f061 Removed player foreach on Entity 2015-03-12 15:58:10 +01:00
5b3ce2da9d Fixed packets 2015-03-12 15:38:17 +01:00
00942d3a2b Fixed picking up items, entity IDs on packets 2015-03-12 12:02:37 +01:00
4b442a9d7c Renamed LoginStatusPacket to PlayStatusPacket, added spawn status, new colors 2015-03-12 11:43:50 +01:00
44dfb59409 Fixed Entity->setMotion() for Players 2015-03-12 11:43:50 +01:00
696ba08a81 Removed chat wrapping, deprecated TextWrapper 2015-03-12 11:43:50 +01:00
d80b8524fb More packets changed, unique IDs D: 2015-03-12 11:43:50 +01:00
2175d7922a Updated packet order, removed player entity id as 0 2015-03-12 11:43:50 +01:00
5fcb0d6aa5 Added colors, Disconnect Packet, protocol 21 2015-03-12 11:43:50 +01:00
9ca3ad8971 Merge pull request #2767 from alejandroliu/blockskylight
Fixed some typos in Anvil
2015-03-10 09:57:48 +01:00
a644b46ec4 Fixed some typos 2015-03-09 23:57:53 +01:00
9d3f59fab6 Merge pull request #2750 from LDX-MCPE/patch-2
Fixed Dark Oak Fence's name
2015-03-09 11:10:17 +01:00
6309d4abf1 Fixed #2762 2015-03-08 15:53:01 +01:00
LDX
39291e4061 Fixed Dark Oak Fence's name 2015-03-02 16:14:31 -05:00
bb71a3c4a6 Added Entity->fastMove() for players and direct-controlled entities, improved speed checking 2015-02-22 21:16:05 +01:00
eb0525e892 Ignore spawn protection when no ops are set 2015-02-22 19:07:45 +01:00
f49db47b2e Added basic speed protection 2015-02-18 00:37:57 +01:00
3ff5e12302 Updated RakLib 2015-02-17 21:12:28 +01:00
99ad65ba44 Catch file saving exceptions 2015-02-15 20:01:47 +01:00
5f4f996efe Fixed #2599 2015-02-15 19:01:25 +01:00
21e0739845 Fixed #2598 2015-02-15 18:48:30 +01:00
3a157d0f02 Future workaround for #2626 2015-02-15 18:45:25 +01:00
8e56782138 Fixed #2619 BlockMetadataStore 2015-02-15 18:25:40 +01:00
116ede3679 Improved flight detection, added Entity->resetFallDistance(), closes #2632 2015-02-15 17:40:17 +01:00
7c0f5987d3 Fixed players getting kicked for flying when going through special blocks 2015-02-15 16:26:05 +01:00
547e152e40 Fixed #2615, closes #2634 invalid pull request 2015-02-15 15:12:33 +01:00
7905fbdd29 TallGrass blocks should be only placed on grass blocks 2015-02-12 19:33:44 +09:00
ae65701a23 Update IronBars.php 2015-02-05 20:11:08 +08:00
9134a69936 Merge pull request #2613 from 64FF00/master
OH-GAWD-WHY blame @PEMapModder
2015-02-05 12:57:44 +01:00
907fe8aff6 Fixed for wrong hardness and stonecutter 2015-02-05 19:05:00 +08:00
afa9acf22f OH-GAWD-WHY 2015-02-05 19:30:52 +09:00
9a5afff4ab Merge pull request #2612 from PEMapModder/patch-1
Added Location::__toString()
2015-02-05 11:06:52 +01:00
2f8c281a2e Added Location::__toString() 2015-02-05 18:00:25 +08:00
2096dace68 fixed for some bugs
Signed-off-by: mmlmml1 <mmlmml1@126.com>
2015-02-04 23:12:06 +08:00
8421985102 Merge pull request #2577 from Falkirks/master
Improve FallingSand behaviour
2015-01-28 08:48:01 +01:00
f63e859b3a Falling sand will become block when in contact with a Liquid
This replicates the behaviour of MCPE.
2015-01-27 17:09:31 -08:00
c56eb0b9df Merge pull request #2566 from sekjun9878/master
Fixed #2565
2015-01-26 19:01:22 +10:30
3f2e5bbef4 Fixed #2565 2015-01-26 18:59:56 +10:30
9886eb4768 Return on Level->getSafeSpawn() in case of invalid position 2015-01-25 10:23:04 +01:00
ea44eee5df Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-01-24 10:35:24 +01:00
9173f930ca Fixed #2541 server not saving chunks on chunk unloading 2015-01-24 10:35:08 +01:00
80b6a8ebaf Merge pull request #2555 from Striker209MPE/patch-6
Removed useless spawned check...
2015-01-24 10:29:18 +01:00
7c64a33389 Fixed #2557 2015-01-21 14:48:31 +01:00
9fac896f28 Removed useless spawned check...
because it has already be done before
2015-01-20 16:29:29 +01:00
5bd76e955c Added rotation transformations to remaining packet 2015-01-16 01:43:40 +01:00
63f1a50be4 Added new predictive flight protection 2015-01-14 23:47:01 +01:00
24c6cca664 Updated RakLib, fixed help message not showing command, added documentation to Plugin->getResource() 2015-01-14 17:23:16 +01:00
9fac990b19 Throw exception when RakLib crashes 2015-01-13 18:44:15 +01:00
e8e7938490 Fixed PHPRC env. variable being set 2015-01-13 17:25:52 +01:00
f6c4a726b3 Bump Minecraft version to 0.10.5 2015-01-12 20:00:11 +01:00
8eec5e6b5e Allow placing Snow Layers on top of solid transparent blocks 2015-01-12 02:18:02 +01:00
bd7fa71d7f Updated RakLib 2015-01-11 20:33:17 +01:00
7d406066a7 Added outdated event static properties 2015-01-11 19:37:21 +01:00
3e9196d224 Changed max speed per tick from 100 to 10 blocks 2015-01-11 17:31:34 +01:00
f30986d187 Block saving chunks too big 2015-01-11 15:48:08 +01:00
f8c144be31 Fixed #2529 2015-01-11 15:06:16 +01:00
c61e4adcf1 Improved chunk ticking a bit more 2015-01-08 23:27:14 +01:00
5a55040ab9 Improved chunk ticking 2015-01-08 23:22:47 +01:00
83360187c9 Removed fence classes, added fence damage (¬¬ Mojang) 2015-01-08 17:51:29 +01:00
a893174473 Second biome generator iteration 2015-01-08 01:05:23 +01:00
9d97a940a6 Merge pull request #2517 from PEMapModder/patch-1
Fixed /timings off
2015-01-07 14:42:17 +01:00
cd21c28d46 Fixed /timings off
When issuing `/timings off`, the message `Please enable timings by typing /timings on` is sent to the issuer. This commit fixes this issue.
2015-01-07 17:34:45 +08:00
a76be6cf38 First biome based generator iteration 2015-01-07 04:07:11 +01:00
37fd0372cc Added GarbageCollectionTask, workaround for weird PHP behaviour when using --disable-ansi 2015-01-06 19:45:41 +01:00
ed02026815 Improved file resource usage 2015-01-06 19:04:24 +01:00
042a143dd6 Unload unused regions after 5 minutes 2015-01-06 18:59:21 +01:00
4b73dbd9f8 Fixed Flat generator on existing chunks, region issues 2015-01-06 18:46:18 +01:00
d4e4430df0 Fixed Entities being placed in recreated chunks 2015-01-06 18:45:08 +01:00
469ef84733 Fixed issue where plugins schedule a Player update before log in 2015-01-06 00:25:40 +01:00
efe75f2836 Catch more coruption issues in Region-based worlds, fixed first chunk being generated on an invalid sector 2015-01-06 00:11:38 +01:00
53f2f21f2d Fixed #2511 2015-01-05 16:15:57 +01:00
9c28f0a5be Decrease async worker task amount after crashed task 2015-01-05 02:41:14 +01:00
5bf5014b60 Added Async Task crash warning 2015-01-05 00:16:47 +01:00
f37e79b611 Added Level->getChunks(), fixed some Doc Comments 2015-01-04 23:16:03 +01:00
7a0118820c Improved chunk saving times by not marking it as changed when Players are added/removed 2015-01-04 23:07:08 +01:00
c8b5c023cd Fixed visual typo in /ban-ip, closes #2503 2015-01-04 09:36:07 +01:00
f9dd929e04 Fixed phar check 2015-01-03 16:49:10 +01:00
87970726e4 Added PlayerCreationEvent->setBaseClass() 2015-01-03 16:46:00 +01:00
1daf9a96a3 Added PlayerCreationEvent->setBaseClass() 2015-01-03 16:45:43 +01:00
6c8b33fcc8 Fixed PlayerCreationEvent 2015-01-03 16:41:14 +01:00
438591bd75 API 1.11.0, fixed phar check 2015-01-03 16:38:36 +01:00
7ef8edccf4 Added PlayerCreationEvent 2015-01-03 16:38:00 +01:00
074c8b876d Cleaned up code 2015-01-03 16:07:49 +01:00
f9762c870a Cleaned up BanEntry creation 2015-01-03 15:47:03 +01:00
4039895d3c Fixed #2489 2015-01-03 03:43:41 +01:00
d207a5daea WTF, ghost objects and why does this fix it? (and btw, fixes #2488) 2015-01-03 03:38:25 +01:00
8e3667c95b Fixed messages and default settings 2015-01-03 02:56:46 +01:00
0da628deca Fixed some crashes related to crashing 2015-01-02 19:19:34 +01:00
04bdb13103 Improved move offset check 2015-01-02 19:14:18 +01:00
e8ad828498 Catch exceptions on level generation 2015-01-02 18:56:27 +01:00
f46473bbe8 Removed all @mkdir() calls 2015-01-02 18:52:45 +01:00
692045d714 Improved threading and resource usage, new defaults 2015-01-02 18:46:39 +01:00
47cbf56725 Version bump 2015-01-02 07:04:20 +01:00
3de14d8ba6 Preparing release 2015-01-02 01:37:33 +01:00
5fffabe05b Fixed players not calculating onGround correctly 2015-01-02 01:22:33 +01:00
3128ae9736 Improved exception handling and trace creation 2015-01-01 22:50:45 +01:00
7be4e2fa81 Merge pull request #2438 from PocketMine/new-version-format
New release version format
2014-12-31 17:53:12 +01:00
95b305ce87 Detect really big corrupted chunks, closes #2471 2014-12-31 12:40:11 +01:00
767800662c Added chunk check on Level 2014-12-30 15:54:12 +01:00
fe32e6f5d0 Merge branch 'master' into new-version-format 2014-12-29 12:43:15 +01:00
2cec0d9f36 Improved Simplex 2D noise 2014-12-28 03:51:08 +01:00
d800a21bd4 Higher chunk defaults 2014-12-28 02:58:17 +01:00
8d9fbec4ce Fixed memory leak issues on chunk generation under 32-bit hosts, fixed issue with generated chunks not having a provider. Closes #2419, fixes #2308, closes #2421 2014-12-28 02:22:13 +01:00
ab72c32769 Improved Normal generator speed 2014-12-28 02:12:48 +01:00
346626305c Corrected fence crafting recipes, closes #2457 2014-12-28 01:49:42 +01:00
fafbd500e1 Added typehints to HelpCommand 2014-12-28 01:49:10 +01:00
2db2e8cfc4 Block IP addresses on ban-ip 2014-12-26 13:56:35 +01:00
854479180f Move Query exceptions to debug level > 1 2014-12-26 13:47:15 +01:00
902ba81e02 Added automatic/manual RakLib IP address, block addresses when exceptions are thrown 2014-12-26 13:33:41 +01:00
1ac17abec0 Fixed #2446 2014-12-24 23:00:11 +01:00
714ea54121 Players won't take damage 60 ticks after spawning / respawning. 2014-12-24 20:44:22 +01:00
aa992684ba Possible workaround for some PHP bug 2014-12-24 00:55:23 +01:00
0c58de86b7 New version format 2014-12-23 14:02:35 +01:00
7ecac019a9 Bitmask block state 2014-12-23 13:58:30 +01:00
6cb88afe1a Improved block breaking time and event handling 2014-12-22 23:49:17 +01:00
a677bcb331 Increased transaction timeout, not needed anymore due to packet ordering 2014-12-22 23:38:47 +01:00
2f6007342c Fixed server.log created in two different places on path changed 2014-12-22 23:00:28 +01:00
b6c0eb8c96 Added optional parameter for multiple NBT read 2014-12-22 16:25:12 +01:00
afa8496767 Fixed possible memory leak when hiding players from each other 2014-12-21 20:03:39 +01:00
d7be2ce439 Added Chest recreation on imported levels 2014-12-21 14:29:18 +01:00
6dcb5da069 Added Double Plant block, fixes damage walking inside it. 2014-12-21 14:28:45 +01:00
3cf1692c96 Possible fix for #2424 2014-12-21 13:59:04 +01:00
d04af590d1 Updated RakLib
* Fixes issues with packets without messageIndex
* Workarounds possible CPU-hog DoS attack over ACK/NACK packets
2014-12-21 13:45:28 +01:00
d4c43215b1 Fixed typo about async chunk generation 2014-12-19 16:10:01 +01:00
a40918aabf LevelDB load/write fixes 2014-12-19 10:35:16 +01:00
20f9352714 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-19 01:07:13 +01:00
a605e90dfc Added experimental LevelDB support, fixed a few issues with NBT, spawning and Binary R/W 2014-12-19 00:28:50 +01:00
9fc250956f Merge pull request #2395 from PEMapModder/patch-6
Allow $base in knockback() to be dynamic and getters/setters in EntityDa...
2014-12-18 20:39:48 +09:00
db2dfc47a6 Update RakLib 2014-12-18 03:33:33 +01:00
408a537001 Added TesterPlugin submodule, updated RakLib to fix packet loop issues 2014-12-17 23:29:57 +01:00
922bfb33ac Updated .gitignore 2014-12-16 18:50:57 +01:00
8e47c93fbc Fixed some issues with chunks being generated on a loop 2014-12-16 02:57:44 +01:00
c175485cd8 Added World Generation timings 2014-12-15 17:52:07 +01:00
b6981cc31d Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-15 01:05:55 +01:00
1f9cd6a99b Added default parameter to Config getters, implements and closes #2398 2014-12-15 01:05:32 +01:00
ded7ada7d7 Merge pull request #2399 from PEMapModder/patch-7
Update documentation of PluginBase::getCommand() for IDEs' auto completion
2014-12-15 00:52:43 +01:00
1b50879823 Snow layer recipe added: Fix for #2400 2014-12-13 17:10:17 +01:00
1bd9cbd4d3 Update documentation of PluginBase::getCommand() for IDEs' auto completion 2014-12-13 20:42:23 +08:00
96122d3be7 Allow $base in knockback() to be dynamic and getters/setters in EntityDamageByEntityEvent
This change is backwards-compatible.
2014-12-12 23:01:31 +08:00
71d602a4cf Faster chunk setting on provider 2014-12-12 15:51:31 +01:00
c81bbdaaa9 Possible fix for #2394 2014-12-12 12:05:36 +01:00
2752393c42 Fixed #2392 2014-12-12 12:05:15 +01:00
312e064b07 Updated RakLib, changed some Entity move AABB calls 2014-12-11 17:39:59 +01:00
94f91967f3 Updated RakLib: Implemented packet reordering, fixed packet recovery in both sides, errors are now debug level 2014-12-11 03:13:44 +01:00
fe900b417e Less calls! 2014-12-10 02:42:02 +01:00
4c30b6b8a1 Optimized Liquid spreading, optimized light updates, improved side block get/update, fixed raw set not cleaning Block cache (TNT explosions) 2014-12-10 00:37:04 +01:00
c41ac7b0a2 Updated PocketMine-SPL, added trait autoloading 2014-12-09 16:33:42 +01:00
b220bd2a45 Updated chunk indexes on generator 2014-12-09 15:14:11 +01:00
04ee94dc91 Fixed #2388 2014-12-09 15:05:36 +01:00
ea8f10efa4 Limited death animation to Living entities 2014-12-09 14:57:28 +01:00
04ecbd1a76 Level optimization, added new chunk/block hashes 2014-12-09 14:55:21 +01:00
ddfc9d9ce1 Fixed players not getting sound when they are harmed 2014-12-09 02:22:42 +01:00
a4735eaf76 Replaced some instanceof to null checks 2014-12-09 02:22:18 +01:00
306f492fc0 Added Player death animations, improved spawning behavior to correct invisible players, fixed players getting stuck when dead, closes #2304 2014-12-09 01:36:46 +01:00
5e5f8bf33d Better block creation on Level 2014-12-08 22:02:36 +01:00
3bb2f12cde Improved block reading
* Created global block states array
* Improved Level->getBlock() using block states
* Improved Level->getBlock() for 64-bit systems
* Added Level->getFullBlock()
* Added FullChunk->getFullBlock()
* Added Chunk->getFullBlock()
* Added ChunkSection->getFullBlock()
* Deprecated FullChunk->getBlock()
* Deprecated Chunk->getBlock()
* Deprecated ChunkSection->getBlock()
2014-12-08 20:54:47 +01:00
1041bb0e6a Do not quiet error messages when parsing config files 2014-12-07 23:21:47 +01:00
49e93cee80 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-07 22:05:58 +01:00
8b6681c56d FIxed some preprocessor includes 2014-12-07 22:05:45 +01:00
9e3d432b9e Faster Level provider chunk unloading 2014-12-07 21:51:57 +01:00
841a3d5ee6 Merge pull request #2381 from PocketMine/revert-2379-master
Revert "Fixed small possible error in permission"
2014-12-07 20:54:46 +01:00
a5294d5ec7 Revert "Fixed small possible error in permission" 2014-12-07 20:54:38 +01:00
5373e6be07 Merge pull request #2379 from sudoku173/master
Fixed small possible error in permission
2014-12-07 20:41:08 +01:00
075137bd3c Fixed small possible error in permission
Changed permission to "pocketmine.command.deop" from "pocketmine.command.op.take"
2014-12-07 11:38:44 -08:00
68da4b5b39 Collect unallocated chunks from the Level provider 2014-12-07 18:27:11 +01:00
e4557a2e8e Added HeightMap get/set methods on chunks, Level 2014-12-07 18:02:07 +01:00
964bf98ca6 Added Config->getNested(key) and Config->setNested(key, value) 2014-12-07 16:41:43 +01:00
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
bb82e7be50 Handle a hotbar queue to allow using more than the first slot (won't save order due to the protocol) 2014-12-07 16:01:45 +01:00
7506f01302 Improved Item property handling 2014-12-07 15:51:00 +01:00
a98da3bab1 Renamed old getID() calls to getId() 2014-12-07 15:21:32 +01:00
f0d6128282 Use squared distance on movement handling 2014-12-07 15:18:14 +01:00
161e7ae7ec Fix CPU issue when starting without STDIN 2014-12-07 02:42:38 +01:00
6104c5b5a3 API 1.9.0, backwards-compatible 2014-12-07 02:24:45 +01:00
af82d616c1 Block creating and property handling rewrite, part2 2014-12-07 02:20:26 +01:00
a0d4bff385 Block creating and property handling rewrite, part1 2014-12-07 01:53:27 +01:00
79236c971c Possibly fix issues related to new lines on different operating systems and event listeners modifiers 2014-12-05 22:43:31 +01:00
20e63ae543 Force player setting their new position 2014-12-05 02:24:34 +01:00
add7879720 Implemented no damage ticks 2014-12-05 02:24:08 +01:00
1a064d38b1 Merge remote-tracking branch 'origin/master' 2014-12-04 00:04:18 +01:00
294e680d5d Added armor items and max stack size for them. 2014-12-04 00:04:09 +01:00
811970e58d Merge pull request #2352 from PEMapModder/patch-3
Added internal use warning for TaskHandler::cancel()
2014-12-01 12:07:30 +01:00
941961f5ef Added internal use warning for TaskHandler::cancel()
It is confusing for some developers to whether to use this function or `ServerScheduler::cancelTask($taskId)`. It is better to add warning in the documentation.
2014-12-01 16:25:37 +08:00
1963d8fde0 Change last X/Y/Z/Yaw/Pitch on teleport 2014-11-30 12:49:35 +01:00
e44ed4da3b Enabled batch block sending again 2014-11-29 12:58:31 +01:00
a72488d41e Updated player movement processing and event handling 2014-11-29 12:43:34 +01:00
3930f379cf Updated light filter values 2014-11-29 11:58:50 +01:00
66ba327e62 Improved light spread algorithm even more 2014-11-29 11:27:22 +01:00
329ca62465 Improved light spread algorithm 2014-11-28 19:54:25 +01:00
26e47ef694 Removed old revert flag from Player->processMovement() 2014-11-28 14:49:06 +01:00
61ea149ff0 API 1.8.0 2014-11-28 14:44:56 +01:00
b3c3f896a3 Implemented light population, added Level->getFullLight() 2014-11-28 14:44:27 +01:00
d139e5f342 Removed temporal pthreads workaround 2014-11-28 13:01:25 +01:00
3abf36ad07 Fixed invalid worlds property being set by users 2014-11-28 12:47:28 +01:00
0bc9a9bdab Fixed armor dropping twice 2014-11-27 23:19:46 +01:00
98340522d9 Fixed items getting added on the same empty slot 2014-11-27 20:49:18 +01:00
6d09754ea7 Improved Inventory->addItem(), fixed breaking containers duplicating the last slot, removed not necessary slot changes 2014-11-27 20:10:55 +01:00
a3b1d318cc Fixed ladder crafting recipe 2014-11-27 20:02:38 +01:00
f866efb622 Removed unused Block->isLiquid property 2014-11-27 17:26:43 +01:00
b1c4578726 Fixed #2340 2014-11-27 16:18:43 +01:00
f4181a6e36 Bump Minecraft: PE version 2014-11-27 14:37:44 +01:00
38089af098 Improved global entity motion encoding using per-player queues 2014-11-27 14:26:36 +01:00
cd135b39ad Improved player spawn item in hand sending 2014-11-27 13:59:32 +01:00
dd3207cbd8 Possible fix for #2267, #2314 2014-11-27 13:47:17 +01:00
a7abd5ff9d Catch exceptions when chunks are unloaded 2014-11-27 13:35:54 +01:00
a3e50f6337 Properly close inventory windows from Players 2014-11-27 13:32:07 +01:00
441a98e60a Removed old trigger_error() calls, closes #2335 2014-11-27 13:16:39 +01:00
4a90ac270f Improved exception handling and debugging 2014-11-22 13:52:36 +01:00
a906a2988b Bumped Minecraft: PE version string 2014-11-22 13:44:34 +01:00
545f68382c Increased Fence, Fence Gate and Stone Wall Y bounding box 2014-11-22 13:44:05 +01:00
8249cac592 Catch corrupted chunk data errors 2014-11-20 22:02:00 +01:00
7b7bbe9105 Regenerate corrupt player data if invalid data is found 2014-11-20 21:58:27 +01:00
05679c7872 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-11-20 21:46:14 +01:00
8eb80be691 Remove duplicated tiles from chunk table automatically 2014-11-20 21:45:52 +01:00
f55b0d0b45 Merge pull request #2295 from LukeDarling/patch-1
Fixed Server->getOps() capitalization
2014-11-19 13:10:03 +01:00
754e0dbb49 Protect permission removal against bad plugins 2014-11-18 18:43:30 +01:00
525c8db779 Improved chunk loading/unloading 2014-11-18 18:33:24 +01:00
c7f578f297 Possible fix for #2297 2014-11-18 13:57:03 +01:00
19c030281f Fixed #1969 2014-11-18 13:53:38 +01:00
ca9fe1b89a Improved and fixed command exception message, closes #2301 2014-11-18 13:46:00 +01:00
9fd6a695f6 Fixed permission-related memory leak 2014-11-18 13:42:24 +01:00
c07b0ff35b Fixed tile entities not being placed in the correct array 2014-11-15 11:49:09 +01:00
00be3f0dd3 Fixed Server->getOps() capitalization
I'm not 100% sure, but I believe this is how it's supposed to be.
2014-11-15 00:01:57 -05:00
6796fca2b6 Merge pull request #2294 from LukeDarling/patch-1
fixed version message color
2014-11-15 14:20:14 +10:30
5657cce3db fixed version message color 2014-11-14 15:52:38 -05:00
05ac256cc3 Fixed Acacia / Dark Oak logs crafting recipes 2014-11-14 15:58:31 +01:00
49977c5410 Bumped weakref version, fixes travis builds 2014-11-14 10:30:06 +01:00
ca40bb678c Merge pull request #2288 from sekjun9878/master
Get timezone directly. Fixes #2287.
2014-11-13 23:08:22 +10:30
2068cc9cdf Merge pull request #2243 from PEMapModder/patch-1
cmd files comment syntax should be like this.
2014-11-13 21:42:25 +10:30
ea4617cedd Get timezone directly. Fixes #2287. 2014-11-13 21:13:12 +10:30
1a5544f68c Fixed Chunk tile indexes 2014-11-08 15:00:18 +01:00
0128a7aeb2 API version 1.7.1 (fixes) 2014-11-07 09:45:30 +01:00
fd954ce708 Fixed PlayerInventory->setItem() with null items 2014-11-07 09:43:36 +01:00
d63a82de0a MCPE protocol 20 2014-11-06 19:08:32 +01:00
92143d523c Added SetDifficultyPacket 2014-11-06 19:07:24 +01:00
1818e64c8e Merge branch 'master' into 0.10 2014-11-06 18:56:47 +01:00
7e1095e28d Reenabled collision against entities on move 2014-11-06 12:57:17 +01:00
f1519e6d13 Improved Level->getTile() to a direct lookup instead of linear search 2014-11-06 12:34:33 +01:00
3b9a9bcd5d Use proper indexes on Living->getLineOfSight() when a max length is set 2014-11-06 12:23:45 +01:00
263bff01c8 Change RuntimeException to InvalidStateException on BlockIterator 2014-11-06 12:16:12 +01:00
987d647b76 Return proper BlockIterator index, throw more exceptions, improved blockQueue performance 2014-11-06 12:12:31 +01:00
522b75645c Merge branch 'master' into 0.10 2014-11-05 19:04:36 +01:00
9eed0a579c Fixed red sand smelting recipe 2014-11-05 17:41:12 +01:00
064976d32b Fixed ladder recipe 2014-11-05 17:38:23 +01:00
2abb577178 Fixed String -> Wool recipe 2014-11-05 17:36:44 +01:00
127855c220 Fixed Snow block recipe 2014-11-05 17:36:06 +01:00
93c7a3c170 Fixed bonemeal recipe, closes #2260 2014-11-05 17:32:28 +01:00
31903a764a Fixed unloaded chunks residing on memory and getting loaded again causing crash, fixed spawn chunks getting unloaded by players 2014-11-04 17:16:02 +01:00
79bc1d6c85 Fixed server not stopping after a special crash 2014-11-04 17:15:20 +01:00
cc7f12739d Added vertical and horizontal collision detection to Entities 2014-11-04 12:23:42 +01:00
32dae93ef9 Removed unused imports 2014-11-04 12:08:24 +01:00
8fd6582e74 Automatically set Entity / Tile entity save identifiers 2014-11-04 12:04:08 +01:00
a5369b3570 Fixed unloading chunks 2014-11-04 11:18:34 +01:00
abbd33210a Possible fix for #2245 2014-11-04 00:19:50 +01:00
6b6222c09c Allow passing a Player source as last parameter on Inventory->addItem() and Inventory->removeItem() 2014-11-04 00:16:25 +01:00
a8c997d88a ¬¬ 2014-11-03 12:54:46 +01:00
6993718a83 Added EntityDamageByChildEntityEvent 2014-11-03 12:03:37 +01:00
86afecec89 Improved inventory sending, send single slots instead of full inventory as much as possible 2014-11-03 11:48:10 +01:00
29d1fd1fc8 Fixed player viewer list including themselves 2014-11-03 11:29:01 +01:00
af4eb2ab1e Create server.log properly on non-existent directories 2014-11-02 16:15:15 +01:00
f7baf46a54 Fire PlayerInteractEvent on 0xff face 2014-11-02 16:12:51 +01:00
75c0d8324c Fixed some inventory events not firing on players 2014-11-02 13:26:58 +01:00
da4334f06b Revert Armor then Inventory instead of Inventory then Armor on failed transaction 2014-11-01 23:02:59 +01:00
413bd3c0df Use SplFixedArray for improved performance 2014-11-01 22:12:35 +01:00
1a0428654b Updated timings command, give direct link to results 2014-11-01 21:20:44 +01:00
2803a38fd1 Fixed random block updates not firing 2014-11-01 20:26:13 +01:00
95a5ca7889 Added command message to /time add 2014-11-01 20:12:55 +01:00
240f14c425 Fixed #2253 2014-11-01 19:40:15 +01:00
cb9b6ab1d1 Fixed server not using the correct provided path if it did not exist 2014-11-01 19:23:10 +01:00
8a87280566 Added /time start and /time stop 2014-11-01 17:45:11 +01:00
4d97827d44 Improved level switching for players 2014-11-01 17:39:09 +01:00
f8f1e0e9df Despawn entities correctly from clients as they move 2014-11-01 16:47:40 +01:00
bf596ebf05 Fixed Query-related crash 2014-11-01 16:20:40 +01:00
90777014b6 Fixed Stone crash 2014-11-01 16:17:47 +01:00
4a78ffd2dd Fixed FallingSand crash 2014-11-01 16:15:09 +01:00
7c361a52d2 Fixed #2252 2014-11-01 13:52:20 +01:00
13fc0df92c Fixed #2251 2014-11-01 12:40:45 +01:00
d5012f6fcf Fixed server not stopping after a fatal error 2014-11-01 03:07:47 +01:00
4569a73f3d Fixed Entity being set position after being closed 2014-10-31 23:10:29 +01:00
66acb5cdd7 Possible fix for crashing server not stopping 2014-10-31 23:10:12 +01:00
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +01:00
ae06681b60 Added packet exception handling, updated RakLib 2014-10-31 19:14:59 +01:00
01ffb14e39 Fixed #2204 2014-10-31 17:34:45 +01:00
ce989876af Improved freeing chunks 2014-10-31 16:39:32 +01:00
f8d6ebabf3 Removed some calls 2014-10-31 15:57:07 +01:00
094b600a0c Updated NBT/DataPacket reading 2014-10-31 01:02:31 +01:00
82cfe6ea9c Updated NBT/DataPacket reading 2014-10-31 00:32:50 +01:00
4fba6d7c86 Merge branch 'master' into 0.10 2014-10-30 23:20:59 +01:00
f72d7284b9 Added EncapsulatedPacket reuse on broadcast 2014-10-30 23:20:28 +01:00
8f0527832f Removed extra AxisAlignedBB generation on Door and Trapdoor 2014-10-30 22:15:19 +01:00
f66944368d Update RakLib 2014-10-30 22:06:23 +01:00
7ab3c57b00 Optimized networking code & AxisAlignedBB 2014-10-30 22:06:07 +01:00
673b867ee8 Fixed players not loading chunks when stuck on a unloaded chunk 2014-10-30 20:05:40 +01:00
2424c8a76c Update RakLib, possible fix for notifyACK 2014-10-30 19:44:05 +01:00
92eb5cb0b8 Added LE Triad methods 2014-10-30 17:56:58 +01:00
fd46c71120 Updated RakLib 2014-10-30 17:18:43 +01:00
6a4259bf24 Updated RakLib 2014-10-30 17:04:19 +01:00
9a65279c6a Added ifndef for packets Binary 2014-10-30 16:41:11 +01:00
09a01be709 Added ifndef for NBT Binary 2014-10-30 16:32:57 +01:00
57d1847c50 Updated to receive new optimizations 2014-10-30 16:02:48 +01:00
6e8e2a79dd Fixed Event name being null 2014-10-30 14:52:11 +01:00
d8f9def7f4 Added preprocessor optimizations 2014-10-30 07:58:53 +01:00
8cb9dd9a14 Fixed #2244 2014-10-29 22:58:40 +01:00
c4c374e3fa Added extra chunk sending timings 2014-10-29 21:52:27 +01:00
d57e37896d Improved Region / RakLib 2014-10-29 17:43:21 +01:00
022a978ffb Added InventoryPickupArrowEvent 2014-10-29 16:29:00 +01:00
00b282d40c Improved cache pool cleanup times 2014-10-29 16:13:47 +01:00
8a768cea33 EntityDamageEvent and children now only fire if the attack is possible, moved event trigger to Entity->attack() 2014-10-29 16:02:40 +01:00
289bc56b4b Blocks now save their bounding box, fixed entity block collision check 2014-10-29 15:43:23 +01:00
6f64af3066 Reuse even more objects! 2014-10-29 14:23:51 +01:00
72c09045d5 Fixed Zombie drops crash 2014-10-29 13:21:54 +01:00
5e55c3a8f0 Fixed Chest->unpair() 2014-10-29 13:21:14 +01:00
afaa2cf722 Fixed Double Chest behavior 2014-10-29 12:57:26 +01:00
50cfeaa393 Fixed Stonecutter recipe 2014-10-29 12:36:34 +01:00
dda8b03349 Fixed Bowl recipe 2014-10-29 12:12:54 +01:00
56e848488a Fixed Trapdoor recipe 2014-10-29 12:10:48 +01:00
7e4f862634 Fixed typo in OfflinePlayer 2014-10-29 11:42:29 +01:00
577a7a1c3d cmd files comment syntax should be like this. 2014-10-29 17:20:36 +08:00
78f8d0280d Removed unused imports 2014-10-29 01:14:09 +01:00
0680b98380 Remove chunks from advanced cache after setting 2014-10-29 01:07:30 +01:00
cbe0fe5e46 Added Entity->onGround setting when entities keep moving without checks 2014-10-29 00:41:13 +01:00
7eed92e8fb Use Player->forceMovement on MovePlayerPacket non-tick revert 2014-10-29 00:31:17 +01:00
f772391866 Fixed InventoryPickupItemEvent 2014-10-28 22:05:54 +01:00
8c4faa8622 Added extra Exceptions 2014-10-28 21:07:12 +01:00
b6f7ee20fc Added Error -> Exception handling 2014-10-28 20:43:36 +01:00
0fce83c671 Fixed #2189 2014-10-28 13:27:30 +01:00
8080643cc9 Fixed plugins crashing the server when teleporting players on an invalid event 2014-10-28 13:18:40 +01:00
5bf2174cad Fixed UseItemPacket being able to be sent before spawning 2014-10-28 13:16:20 +01:00
34ae760def New way to spawn entities/tiles using a global register table, allow overriding default entity/tile classes via classes 2014-10-28 13:09:27 +01:00
a5b85c549a Added Snowballs 2014-10-28 12:13:31 +01:00
b9f1812f61 Disallow further modification of Signs by its creator after load/unload 2014-10-28 11:05:32 +01:00
350cee3d41 Added Event allocation pool, updated SPL with Class::onClassLoaded() 2014-10-28 10:47:40 +01:00
144a871c07 Improved Vector3 and Block handling, less allocation on Positions 2014-10-28 10:03:10 +01:00
69492474e4 Improve #2238, do not crash when an invalid/corrupt RCON stop event happens 2014-10-28 02:09:36 +01:00
4299ebebcc Bump API version to 1.6.1 2014-10-28 00:55:07 +01:00
119b429ab8 RakLib update 2014-10-28 00:43:47 +01:00
8f1eb41ca5 RakLib update 2014-10-28 00:23:55 +01:00
ca92d2a0d3 Bumped API version to 1.7.0 2014-10-27 20:30:58 +01:00
db82f76c11 Improved network packets allocation 2014-10-27 20:30:33 +01:00
3f5b129cf5 Updated RakLib 2014-10-27 19:39:24 +01:00
f6aac8728b Mark chunk to be saved when removing invalid entities/tiles 2014-10-27 18:43:58 +01:00
809fc44813 Bump API version to 1.6.1 2014-10-27 16:07:00 +01:00
64f1ff066d Fixed /setworldspawn changing sender data 2014-10-27 15:57:26 +01:00
a5a3f4801a Fixed entities not getting ticks on movement 2014-10-27 15:53:14 +01:00
23d1532ff9 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-27 15:44:44 +01:00
ecbbcc2e8e Drop invalid entities / tile entities on chunk loading 2014-10-27 15:44:36 +01:00
7abf52e615 Implemented Vector3 List and AxisAlignedBB Pool to decrease object allocation 2014-10-27 15:39:20 +01:00
9e01e2ef49 Merge pull request #2235 from nno88551/patch-2
Update BaseInventory.php
2014-10-26 15:52:08 +01:00
df81b365e5 Update BaseInventory.php 2014-10-26 22:21:21 +09:00
db8ac0b9cb Merge pull request #2225 from PEMapModder/falling-sand
Update FallingBlock to new Anvil formats, possible fix for #2189
2014-10-25 17:58:47 +02:00
ee4f416d93 Fix FallingBlock.php 2014-10-25 18:15:47 +08:00
8feea721e3 Merge pull request #2223 from Falkirks/set-armour-fix
Fix various get and set armour in PlayerInventory
2014-10-25 12:13:28 +02:00
8e7077ff4b Update FallingBlock to new Anvil formats, possible fix for #2189
I don't have time to test yet, so I am not sure if it does fix it.
2014-10-25 12:26:57 +08:00
4f4a6e7446 Fixes get and set armour 2014-10-24 17:11:59 -07:00
1fc066fc37 Updated time steps from x2.5 to x1.25 2014-10-24 12:12:01 +02:00
b565844062 Merge branch 'master' into 0.10 2014-10-24 12:07:35 +02:00
be948f99cc Fixed #2207 Server crashing if players are closed before logging in 2014-10-24 12:06:55 +02:00
5cb428e5cc Updated build number 2014-10-23 17:23:59 +02:00
d2f4a14d66 Merge branch 'master' into 0.10 2014-10-23 17:21:24 +02:00
516bb37a50 Removed some direct type checks on Entity/Tile->closed 2014-10-21 19:28:29 +02:00
580ade9092 Possible fix for entities not closing correctly 2014-10-21 19:26:16 +02:00
8f7dfe0b71 Removed extra ; from if, fixes #2205 2014-10-21 18:37:29 +02:00
5310ba3ae6 Fixed crash when doing var_dump() of anything that contains the Server object 2014-10-20 13:06:53 +02:00
ef97efcd96 Added explosion death message 2014-10-20 13:00:03 +02:00
30c3718ea8 Improved Explosion item drop position 2014-10-20 12:58:05 +02:00
5437567e95 Merge branch 'master' into 0.10 2014-10-20 12:53:14 +02:00
e3e97a4205 Improved Player->onGround checking 2014-10-20 12:52:00 +02:00
fec387d2ec Fixed entities not being pushed out of blocks 2014-10-20 12:37:17 +02:00
481e2b08ee Removed debug call 2014-10-20 12:05:40 +02:00
15de0eece7 Improved inventory and window allocation, fixes #2200 2014-10-20 09:48:11 +02:00
2f8267aa1e Improved Level object deallocation 2014-10-19 20:45:03 +02:00
f2b573c32f Fixed Level->getMetadata() and similar, removed extra references 2014-10-19 19:51:36 +02:00
34946faf94 Remove errors from Utils::getRandomBytes() 2014-10-19 13:44:38 +02:00
3b47513439 Return result directly on Server->getOfflinePlayer() 2014-10-19 02:49:58 +02:00
7d9a98ec6b Updated UseItemPacket 2014-10-18 23:42:41 +02:00
92facc94b9 Added new fences and fence gates to fuel types 2014-10-18 18:02:39 +02:00
d3327f450c Added different Fence Gates, new Fence Gate crafting recipes 2014-10-18 17:56:18 +02:00
570cab9c66 Added different Fences, new Fence crafting recipes 2014-10-18 17:44:24 +02:00
582ba100b0 Bumped protocol version to 19 2014-10-18 17:01:36 +02:00
4c0daa462d Merge branch 'master' into 0.10 2014-10-18 16:54:03 +02:00
2e6366868d Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-18 16:53:42 +02:00
245e9b4f18 Fixes inventory changes getting the wrong window, closes #2187 2014-10-18 16:53:06 +02:00
68e73d4e3a Merge pull request #2188 from aodzip/patch-1
Update Skeleton.php
2014-10-18 15:36:02 +02:00
684617d370 Update Skeleton.php
fixed a little wrong
2014-10-18 21:13:35 +08:00
a879104a6f Minecraft: PE version bump 2014-10-17 14:43:10 +02:00
05f71691fc Fixed AxisAlignedBB->setBB() 2014-10-17 09:57:42 +02:00
1c03c3afcf Decreased chunk ordering times 2014-10-17 09:57:18 +02:00
94e9485be9 Improved broadcast packet encoding 2014-10-17 09:36:47 +02:00
9cb27e26ef Fixed #2183 2014-10-16 22:01:32 +02:00
7760559be1 Improved chunk loading and order refresh times 2014-10-16 20:21:06 +02:00
163a37ee23 Optimized Player->orderChunks() and chunk sending ordering algorithm 2014-10-16 14:54:55 +02:00
c73a3e53be Added extra Entity metadata 2014-10-16 12:49:45 +02:00
8637b7f5a3 Fixed Tasks deleting their Timings reports 2014-10-16 12:49:26 +02:00
747fdab389 Fixed Inventory->removeItem() 2014-10-16 12:16:23 +02:00
204915450f Do not wrap text if unknown characters are found. 2014-10-15 18:38:14 +02:00
500a690cd0 Throw CRITICAL error message on unhandled Exception on commands instead of crashing 2014-10-15 18:35:42 +02:00
d473ce13ee Throw CRITICAL error message on unhandled Exception on plugin events instead of crashing 2014-10-15 18:35:30 +02:00
1adf53a81e Fixed error_handler trace generation on higher debug levels 2014-10-15 17:58:03 +02:00
ed942100ec Do not block when killing workers 2014-10-15 17:49:08 +02:00
8abe95309c Fixed RegionLoader not creating default index on first load 2014-10-15 16:59:31 +02:00
5dc5aba42c Match Player pickup area with Minecraft 2014-10-15 14:57:12 +02:00
bda6f03e15 Added BlockUpdateEvent 2014-10-15 13:07:10 +02:00
69d132401e Fixes entities not being saved and tile entities having an incorrect field, closes #1661 2014-10-15 12:15:17 +02:00
e3a9db5d8f Implemented saving modified chunks 2014-10-15 11:42:58 +02:00
b71a4701d9 Fixed player using an invalid spawn chunk 2014-10-15 11:40:41 +02:00
9b85abd75e Micro-optimizations 2014-10-15 10:44:01 +02:00
7b7b91ea0d Fixed Entity updates not firing 2014-10-15 10:13:49 +02:00
18f6bad48d Implemented scheduled and partial entity updates 2014-10-14 22:49:35 +02:00
fbe548c611 RakLib update, PING/PONG handling 2014-10-14 16:13:32 +02:00
4e793199fa Deprecated EntityMoveEvent 2014-10-14 16:11:10 +02:00
43a97c407d New PlayerMoveEvent, improved player movement event firing 2014-10-14 16:10:50 +02:00
07dcbdb9b0 Fixed Level->getNearbyEntities(), fixes item drops not being picked up 2014-10-14 16:03:14 +02:00
60ca24fe0e Updated PluginManager event deprecation message 2014-10-14 14:11:58 +02:00
6e8144d5d9 Improved player movement event firing & corrections 2014-10-14 00:11:17 +02:00
464afb949e Increased Player->forceMovement check radius 2014-10-13 23:44:28 +02:00
823dc933b8 Improved Entity extinguish operations and packet spam 2014-10-13 23:44:11 +02:00
883f93cc8c Improved item drop spawning 2014-10-13 22:45:04 +02:00
b26ee09f76 Removed a bunch of TODO and fixed item drops on block update 2014-10-13 18:54:34 +02:00
1eec333501 Save block bounding boxes, improves block cache 2014-10-13 18:38:00 +02:00
5448a48f67 Fixed Level->getCollidingEntities() 2014-10-13 18:36:13 +02:00
a10ad42a13 Removed Generic block class 2014-10-13 18:12:34 +02:00
da23cf685d Added PlayerBucketEvent and children, improved Bucket usage and Liquid placing 2014-10-13 18:04:40 +02:00
79e4b3e3a9 Removed old Player->timeout property 2014-10-12 17:12:59 +02:00
8472349caf Improved global block cache 2014-10-12 17:02:27 +02:00
96b61fbb92 Made Wheat crops extend Crop class 2014-10-12 16:20:30 +02:00
6246ad19c4 Added global block cache 2014-10-12 16:16:19 +02:00
9b69cc4288 Removed debug code 2014-10-12 15:40:14 +02:00
114153ae97 Added EntityBlockChangeEvent 2014-10-12 13:37:45 +02:00
ebb844fa52 Removed unused code, fixed undefined variables 2014-10-11 22:22:51 +02:00
bf89ea1cf6 Added BlockGrowEvent 2014-10-11 20:19:46 +02:00
4076fb4657 Added BlockSpreadEvent 2014-10-11 19:27:43 +02:00
312f377483 Added LeavesDecayEvent 2014-10-11 19:01:27 +02:00
0af3dfedd5 Improved Living entity ticking 2014-10-11 17:35:13 +02:00
6f1f201c41 Workaround for entities glitching through the floor on the client-side 2014-10-11 17:02:41 +02:00
48f591e5ce Removed workaround on flying check due to physics calculation fix, closes #2169 2014-10-11 16:43:14 +02:00
7f85e37540 Worked on scheduler 2014-10-11 16:36:38 +02:00
341717c89d Increased Player->stepHeight to 0.6, closes #2156 2014-10-11 16:36:17 +02:00
afdf7bc2b9 Added proper TextWrap width 2014-10-11 00:17:31 +02:00
24c76acf30 Submodule update 2014-10-11 00:04:17 +02:00
baf06dc363 Revert "Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler"
This reverts commit 0dba14074a.
2014-10-11 00:03:46 +02:00
645c00b2f7 Added TextWrapper 2014-10-11 00:01:53 +02:00
0dd46c835c Made ExplosionPrimeEvent accept setting block breaking settings 2014-10-10 22:39:06 +02:00
0dba14074a Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler 2014-10-10 20:53:28 +02:00
8b585fd9f7 Deprecated Level->getSpawn() in favor of Level->getSpawnLocation() 2014-10-10 11:43:54 +02:00
9ede8177df Fixed Entity->getLineOfSight() 2014-10-10 09:53:58 +02:00
13ec046f0d Removed old OS detection code 2014-10-09 19:37:23 +02:00
5c4e7b6ee0 Added Living->getTargetBlock(), Living->getLineOfSight(), Vector3 side constants, Vector3::getOppositeSide() 2014-10-09 17:57:25 +02:00
6424934df6 Fixed EntityCombustEvent children using a different handlerList 2014-10-09 14:40:52 +02:00
b2ac959083 Added FurnaceSmeltEvent 2014-10-09 12:47:42 +02:00
c67d4dae7b Added FurnaceBurnEvent 2014-10-09 12:36:57 +02:00
22ad75c5a0 Update fuel duration to ticks 2014-10-09 12:21:14 +02:00
b45ef8928c Added Tile->getBlock() method 2014-10-09 12:14:39 +02:00
eccf7b08d2 Added PlayerDeathEvent methods for inventory keeping 2014-10-09 11:06:05 +02:00
94eb9e35e2 Improved liquid performance, update RakLib 2014-10-08 23:24:39 +02:00
79bf1f12f2 API 1.6.0 2014-10-08 17:39:43 +02:00
10b33546ef Added PlayerBedEnterEvent and PlayerBedLeaveEvent 2014-10-08 17:37:11 +02:00
c52dc58d6f Added ProjectileHitEvent 2014-10-08 17:04:35 +02:00
62af784d37 Removed unused imports 2014-10-08 17:00:23 +02:00
aa010b7dea Added ProjectileLaunchEvent 2014-10-08 16:58:17 +02:00
4a3163b4c8 Added ItemSpawnEvent 2014-10-08 16:53:13 +02:00
c750a204e6 Added ItemDespawnEvent 2014-10-08 16:51:10 +02:00
3313981d54 Fixed issues with Entity::heal() method 2014-10-08 16:46:21 +02:00
57f7d57c76 Added ExplosionPrimeEvent 2014-10-08 16:45:55 +02:00
64bf293c69 Improved EntityShootBowEvent 2014-10-08 16:36:43 +02:00
7b09edf048 Improved EntityRegainHealthEvent 2014-10-08 16:28:40 +02:00
4346773e25 Added EntityDamageByBlockEvent (child of EntityDamageEvent) 2014-10-08 16:13:18 +02:00
b0c314526d Added EntityCombustEvent and childs 2014-10-08 15:51:27 +02:00
dd140ce018 Fixed arrow damage not getting overridden by the event result 2014-10-08 15:38:58 +02:00
08aa7808cf Updated RakLib, better player join 2014-10-08 10:45:37 +02:00
582c165479 Implemented Explosion and PrimedTNT, closes #2139 2014-10-07 17:46:01 +02:00
5fb205493a Spawnable->spawnToAll() now uses the actual chunk instead of the entire level to spawn 2014-10-07 12:50:53 +02:00
e346d245e2 Merge pull request #2166 from PocketMine/query-event-implementation
Query event implementation
2014-10-07 11:46:55 +02:00
4fece32ca8 API 1.5.0 2014-10-07 11:02:22 +02:00
0b79d74a2f Implemented QueryRegenerateEvent 2014-10-07 11:02:05 +02:00
b83c6fbfa3 Added Vine blocks, closes #2162 2014-10-07 10:18:02 +02:00
dda9c598f1 Added new Tool type selection constants 2014-10-07 10:16:05 +02:00
8769d2bcd1 Unload entities from chunks, possible fix for #2157, fixes #2165 2014-10-07 09:27:18 +02:00
3b7ece3363 Do not spawn dead entities to players, fixes #2157, possible fix for #2165 2014-10-07 09:24:19 +02:00
1061 changed files with 92125 additions and 27153 deletions

6
.editorconfig Normal file
View File

@ -0,0 +1,6 @@
# http://editorconfig.org/
root = yes
[*]
indent_size = 4
indent_style = tab

1
.gitattributes vendored
View File

@ -6,6 +6,7 @@
*.properties text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
# Custom for Visual Studio
*.cs diff=csharp

47
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,47 @@
### Issue description
<!---
THIS ISSUE TRACKER IS FOR BUG REPORTING, NOT FOR HELP & SUPPORT. If you need help, use the links below.
- http://pmmp.readthedocs.io/en/rtfd/ - Documentation
- https://forums.pmmp.io - PMMP Forums
-->
<!--- Any issues requesting updates to new versions of MCPE will be treated as spam. We do not need issues to tell us that there is a new version available. -->
<!---
Write a short description about the issue
If you are reporting a regression or unexpected behaviour, please include the below information:
Expected result: What were you expecting to happen?
Actual result: What actually happened?
-->
### Steps to reproduce the issue
<!--- help us find the problem by adding steps to reproduce the issue -->
1. ...
2. ...
### OS and versions
<!--- use the 'version' command in PocketMine-MP
NOTE: LATEST is not a valid version. PocketMine version should include Jenkins build number and/or git commit hash.
NO support whatsoever will be provided for forks or spoons of PocketMine. Issues relating to non-official distributions will be closed as spam. Please send such issues to whoever is responsible for the fork or spoon you are using.
Note that 32-bit platforms are no longer supported by PocketMine-MP and issues concerning 32-bit platforms will be closed.
-->
* PocketMine-MP:
* PHP:
* Server OS:
* Game version: PE/Win10 (delete as appropriate)
### Plugins
- Test on a clean server without plugins: is the issue reproducible without any plugins loaded?
If the issue is **not** reproducible without plugins:
- Have you asked for help on our forums before creating an issue?
- Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section
- Paste your list of plugins here (use the 'plugins' command in PocketMine-MP)
### Crashdump, backtrace or other files
- Do not paste crashdumps into an issue - please use our Crash Archive at https://crash.pmmp.io for submitting crash reports to not spam the issue tracker. Add links to your reports in the Crash Archive here.
- Please use gist or anything else to add other files and add links here
* ...

36
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,36 @@
## Introduction
<!-- Explain existing problems or why this pull request is necessary -->
### Relevant issues
<!-- List relevant issues here -->
<!--
* Fixes #1
* Fixes #2
-->
## Changes
### API changes
<!-- Any additions to the API that should be documented in release notes? -->
### Behavioural changes
<!-- Any change in how the server behaves, or its performance? -->
## Backwards compatibility
<!-- Any possible backwards incompatible changes? How are they solved, or how can they be solved? -->
## Follow-up
<!-- Suggest any actions to be done before/after merging this pull request -->
<!--
Requires translations:
| Name | Value in eng.ini |
| :--: | :---: |
| `foo.bar` | `Foo bar` |
-->
## Tests
<!-- Attach scripts or actions to test this pull request, as well as the result -->

9
.gitignore vendored
View File

@ -2,14 +2,17 @@ players/*
worlds/*
plugins/*
bin/*
timings/*
*.log
*.txt
*.phar
server.properties
pocketmine.yml
/pocketmine.yml
memoryDump_*/*
resource_packs/
# Common IDEs
.idea/*
.idea/
nbproject/*
# Windows image file caches
@ -25,3 +28,5 @@ Desktop.ini
# Sphinx-doc
/docs/build/
!/docs/requirements.txt
vendor/*

20
.gitmodules vendored
View File

@ -1,11 +1,19 @@
[submodule "src/pocketmine/gui"]
path = src/pocketmine/gui
url = https://github.com/PocketMine/PocketMine-MP-GUI.git
branch = master
[submodule "src/raklib"]
path = src/raklib
url = https://github.com/PocketMine/RakLib.git
url = https://github.com/pmmp/RakLib.git
branch = master
[submodule "src/spl"]
path = src/spl
url = https://github.com/PocketMine/PocketMine-SPL.git
url = https://github.com/pmmp/PocketMine-SPL.git
[submodule "src/pocketmine/lang/locale"]
path = src/pocketmine/lang/locale
url = https://github.com/pmmp/PocketMine-Language.git
[submodule "tests/preprocessor"]
path = tests/preprocessor
url = https://github.com/pmmp/preprocessor.git
[submodule "tests/plugins/PocketMine-DevTools"]
path = tests/plugins/PocketMine-DevTools
url = https://github.com/pmmp/PocketMine-DevTools.git
[submodule "tests/plugins/PocketMine-TesterPlugin"]
path = tests/plugins/PocketMine-TesterPlugin
url = https://github.com/pmmp/PocketMine-TesterPlugin.git

View File

@ -1,5 +0,0 @@
Shoghi Cervantes <shoghicp@gmail.com>
Shoghi Cervantes <shoghicp@gmail.com> Shoghi Cervantes <shoghicp@pocketmine.net>
Brandon V <brandon15811@gmail.com>
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <michael@yoo.id.au>
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <sekjun9878@sekjun9878.info>

View File

@ -1,21 +1,24 @@
language: php
php:
- 5.6
branches:
- master
- 7.2
before_script:
- mkdir plugins
- wget -O plugins/DevTools.phar https://github.com/PocketMine/DevTools/releases/download/v1.9.0/DevTools_v1.9.0.phar
- pecl install channel://pecl.php.net/pthreads-2.0.10
- pecl install channel://pecl.php.net/weakref-0.2.4
- echo | pecl install channel://pecl.php.net/yaml-1.1.1
# - pecl install channel://pecl.php.net/pthreads-3.1.6
- echo | pecl install channel://pecl.php.net/yaml-2.0.2
- git clone https://github.com/krakjoe/pthreads.git
- cd pthreads
- git checkout 6c6b15138c923b69cfa46ee05fc2dd45da587287
- phpize
- ./configure
- make
- make install
- cd ..
- echo "extension=pthreads.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- composer install
script:
- php tests/TravisTest.php
- ./tests/travis.sh
notifications:
email: false
#webhooks: http://n.tkte.ch/h/214/wsNvmG43-ncxUVRrFPwSM-r0

View File

@ -2,63 +2,109 @@
# PocketMine-MP Contribution Guidelines
You must follow these guidelines if you wish to contribute to the PocketMine-MP code base, or participate in issue tracking.
## I have a question
* For questions, please refer to the _#pocketmine_ or _#mcpedevs_ IRC channel on Freenode. There is a [WebIRC](http://webchat.freenode.net?channels=pocketmine,mcpedevs&uio=d4) if you want.
* You can ask directly to _[@PocketMine](https://twitter.com/PocketMine)_ in Twitter, but don't expect an immediate reply.
* You may use our [Forum](http://forums.pocketmine.net) to ask questions.
* We do not accept questions or support requests in our issue tracker.
## Creating an Issue
- First, use the [Issue Search](https://github.com/PocketMine/PocketMine-MP/search?ref=cmdform&type=Issues) to check if anyone has reported it.
- If your issue is related to a plugin, you must contact their original author instead of reporting it here.
- If your issue is related to a PocketMine official plugin, or our Android application, you must create an issue on that specific repository.
- **Support requests are not bugs.** Issues such as "How do I do this" are not bugs and are closed as soon as a collaborator spots it. They are referred to our Forum to seek assistance.
- **No generic titles** such as "Question", "Help", "Crash Report" etc. If an issue has a generic title they will either be closed on the spot, or a collaborator will edit it to describe the actual symptom.
- Information must be provided in the issue body, not in the title. No tags are allowed in the title, and do not change the title if the issue has been solved.
- Similarly, no generic issue reports. It is the issue submitter's responsibility to provide us an issue that is **trackable, debuggable, reproducible, reported professionally and is an actual bug**. If you do not provide us with a summary or instructions on how to reproduce the issue, it is a support request until the actual bug has been found and therefore the issue is closed.
- If you are reporting a bug:
- **make sure that you are using the latest supported version** before opening an issue.
- **test it on a clean test server, WITHOUT PLUGINS**, to see if the issue still occurs. If not then it may be a plugin issue. Please also indicate the result of such tests.
- [Search the issue tracker](https://github.com/pmmp/PocketMine-MP/issues?utf8=%E2%9C%93&q=is%3Aissue) to check if anyone has already reported it, to avoid needlessly creating duplicate issues. Make sure you also check closed issues, as an issue you think is valid may already have been resolved.
- If your issue is related to a plugin, **do not report here, contact the plugin's original author** instead.
- **Support requests are not bugs.** Issues such as "How do I do this" are not bugs and will be closed. If you need help, please see [here](README.md#discussion) and do not misuse our issue tracker.
- **No generic titles** such as "Question", "Help", "Crash Report" etc. A good issue report provides a quick summary in the title. If you just got a crash report but you don't understand it, please look for a line starting with `Message`. It summarizes the bug.
- Information must be provided in the issue body, not in the title. No tags like `[BUG]` are allowed in the title, including `[SOLVED]` for solved issues.
- Similarly, no generic issue reports. For bugs, it is the issue author's responsibility to provide us an issue that is **trackable, debuggable, reproducible, reported professionally and is an actual bug**.
<br><br>Valid issue reports must include instructions how to reproduce the issue or a crashdump/backtrace (unless the cause of the issue is obvious).
<br><br>**If you do not provide us with a summary or instructions on how to reproduce the issue, it will be treated as spam and will therefore be closed.**
<br><br>In simple words, if the issue cannot be properly confirmed to be valid or lacks required information, the issue will be closed until further information is provided.
- To express appreciation, objection, confusion or other supported reactions on pull requests, issues or comments on them, use GitHub [reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) rather than posting an individual comment with an emoji only. This helps keeping the issue/pull request conversation clean and readable.
- If your issue is related to the PocketMine-MP website, forums, etc., please [talk to a human directly](README.md#discussion).
## Contributing Code
* Use the [Pull Request](https://github.com/PocketMine/PocketMine-MP/pull/new) system, your request will be checked and discussed.
* __Create a single branch for that pull request__
* Code using the syntax as in PocketMine-MP. See below for an example.
* The code must be clear and written in English, comments included.
* Use descriptive commit titles
* __No merge commits are allowed, or multiple features per pull request__
- To contribute code to the repository, [fork it on GitHub](https://github.com/pmmp/PocketMine-MP/fork), create a branch on your fork, and make your changes on your fork. You can then make a [pull request](https://github.com/pmmp/PocketMine-MP/pull/new) to the project to compare your branch to ours and propose your changes to our repository. We use the Pull Request system to allow members of the team to review changes before they are merged.
- By proposing a pull request to the project, you agree to your code being distributed within PocketMine-MP under the [LGPL license](LICENSE).
- At PocketMine, **we enforce a very high standard for contributions**. This is because PocketMine-MP and its related projects are used very widely in production. While this might seem like we are being mean at times, **our priority is what is best for PocketMine-MP itself**. We try to ensure that our project's codebase is as clean as possible and ensure that only top-quality material makes it through to PocketMine-MP itself. **If a contribution does not live up to our standards, changes may be requested or the pull request may be closed.**
- **Your pull request will be checked and discussed in due time.** Since the team is scattered all around the world, your PR may not receive any attention for some time.
- **Avoid using GitHub Web Editor**. The web editor lacks most useful GIT features and **should only be used for very minor changes**. It is immediately clear if the web editor has been used, and if so the PR is more likely to be rejected. If you want to make serious contributions, **please learn how to use [GIT version control](https://git-scm.com/)**.
- **Do not copy-paste code**. There are potential license issues implicit with copy-pasting, and copy-paste usually indicates a lack of understanding of the actual code. Copy-pasted code is obvious a mile off and **any PR like this is likely to be closed**. If you want to use somebody else's code from a Git repository, **use [GIT's cherry-pick feature](https://git-scm.com/docs/git-cherry-pick)** to cherry-pick the commit. **Cherry-picking is the politer way to copy somebody's changes** and retains all the original accreditation, so there is no need for copy-pasted commits with descriptions like `Some code, thanks @exampleperson`.
- In addition to the above, **make sure you can explain your changes**. If you can't provide a good explanation of changes, your PR may be rejected.
- **Create a new branch for each pull request.** Do not create a pull request with commits that exist in another pull request.
- **Code should use the same style as in PocketMine-MP.** See [below](#code-syntax) for an example.
- **The code must be clear** and written in English, comments included.
- **Use descriptive commit titles.** You can see an example [here](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
- **Try to stick to one change per commit.** This ensures that if you create a PR with several changes, we can decide which ones we wish to include and which ones not to include.
- **It is inadvisable to create pull requests with large commits** unless this has been discussed with the team beforehand. Large pull requests are difficult to review, and such pull requests may end up being closed. The only exception is when all features in the pull request are related to each other, and share the same core changes.
- **You may be asked to rebase your pull request** if the branch becomes outdated and/or if possibly conflicting changes are made to the target branch. To see how to do this, read [this page](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request).
**Thanks for contributing to PocketMine-MP!**
### Code Syntax
It is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) with a few exceptions.
* Opening braces MUST go on the same line, and MUST NOT have spaces before.
* `else if` MUST be written as `elseif`. _(It is in PSR-2, but using a SHOULD)_
* Control structure keywords or opening braces MUST NOT have one space after them.
* Code MUST use tabs for indenting.
* Long arrays MAY be split across multiple lines, where each subsequent line is indented once.
* Files MUST use only the `<?php` tag.
* Files MUST NOT have an ending `?>` tag.
* Code MUST use namespaces.
* Strings SHOULD use the double quote `"` except when the single quote is required.
* Argument lists MAY NOT be split across multiple lines, except long arrays.
- Opening braces MUST go on the same line, and MUST NOT have spaces before.
- `else if` MUST be written as `elseif`. _(It is in PSR-2, but using a SHOULD)_
- Control structure keywords or opening braces MUST NOT have one space before or after them.
- Code MUST use tabs for indenting.
- Long arrays MAY be split across multiple lines, where each subsequent line is indented once.
- Files MUST use only the `<?php` tag.
- Files MUST NOT have an ending `?>` tag.
- Code MUST use namespaces.
- Strings SHOULD use the double quote `"` except when the single quote is required.
- All code SHOULD have parameter and type declarations where possible.
- Strict types SHOULD be enabled on new files where it is sensible to do so.
```php
<?php
<?php
declare(strict_types = 1);
namespace pocketmine\example;
class ExampleClass{
const EXAMPLE_CLASS_CONSTANT = 1;
public $examplePublicVariable = "defaultValue";
private $examplePrivateVariable;
public function __construct($firstArgument, &$secondArgument = null){
if($firstArgument === "exampleValue"){ //Remember to use === instead == when possible
/**
* Creates an instance of ExampleClass
*
* @param string $firstArgument the first argument
* @param string|null $secondArgument default null
*/
public function __construct(string $firstArgument, &$secondArgument = null){
if($firstArgument === "exampleValue"){ //Remember to use === instead of == when possible
//do things
}elseif($firstArgument === "otherValue"){
$secondArgument = function(){
return [
$this->examplePrivateVariable = [
0 => "value1",
1 => "value2",
2 => "value3",
@ -66,13 +112,18 @@ class ExampleClass{
4 => "value5",
5 => "value6",
];
}
};
}
}
public function doStuff(string $stuff) : string{
return $stuff;
}
}
```
<!-- TODO: RFC and voting on the forums instead -->
### RFC and Voting
* These are big Pull Requests or contributions that change important behavior.
* RFCs will be tagged with the *PR: RFC* label
@ -82,59 +133,4 @@ class ExampleClass{
* After voting has been closed, no further votes will be counted.
* An RFC will be rejected if less than 50% + 1 (simple majority) has voted Yes.
* If the RFC is approved, Team Members have the final word on its implementation or rejection.
* RFCs with complex voting options will specify the vote percentage or other details.
## Bug Tracking for Collaborators
### Labels
To provide a concise bug tracking environment, prevent the issue tracker from over flowing and to keep support requests out of the bug tracker, PocketMine-MP uses a label scheme a bit different from the default GitHub Issues labels.
PocketMine-MP uses GitHub Issues Labels. There are a total of 12 labels.
Note: For future reference, labels must not be longer than 15 letters.
#### Categories
Category labels are prefixed by `C:`. Multiple category labels may be applied to a single issue(but try to keep this to a minimum and do not overuse category labels).
- C: Core - This label is applied when the bug results in a fatal crash, or is related to neither Gameplay nor Plugin API.
- C: Gameplay - This label is applied when the bug effects the gameplay.
- C: API - This label is applied when the bug effects the Plugin API.
#### Pull Requests
Pull Requests are prefixed by `PR:`. Only one label may be applied for a Pull Request.
- PR: Bug Fix - This label is applied when the Pull Request fixes a bug.
- PR: Contribution - This label is applied when the Pull Request contributes code to PocketMine-MP such as a new feature or an improvement.
- PR: RFC - Request for Comments
#### Status
Status labels show the status of the issue. Multiple status labels may be applied.
- Reproduced - This label is applied when the bug has been reproduced, or multiple people are reporting the same issue and symptoms in which case it is automatically assumed that the bug has been reproduced in different environments.
- Debugged - This label is applied when the cause of the bug has been found.
- Priority - This label is applied when the bug is easy to fix, or if the scale of the bug is global.
- Won't Fix - This label is applied if the bug has been decided not be fixed for some reason. e.g. when the bug benefits gameplay. *This label may only be applied to a closed issue.*
#### Miscellaneous
Miscellaneous labels are labels that show status not related to debugging that bug. The To-Do label and the Mojang label may not be applied to a single issue at the same time.
- To-Do - This label is applied when the issue is not a bug, but a feature request or a list of features to be implemented that count towards a milestone.
- Mojang - This label is applied when the issue is suspected of being caused by the Minecraft: Pocket Edition client, but has not been confirmed.
- Invalid - This label is applied when the issue is reporting a false bug that works as intended, a support request, etc. *This label may only be applied to a closed issue.*
### Closing Issues
To keep the bug tracker clear of non-related issues and to prevent it from overflowing, **issues must be closed as soon as possible** (This may sound unethical, but it is MUCH better than having the BUG TRACKER filled with SUPPORT REQUESTS and "I NEED HELP").
If an issue does not conform to the "Creating an Issue" guidelines above, the issue should be closed.
### Milestones
PocketMine-MP uses GitHub Milestones to set a goal for a new release. A milestone is set on the following occasions.
- A new Beta release
- A new Stable release
A milestone must use the following format:
```
Alpha_<version_number> [release_title][release_version]
```
For example:
```
Alpha_1.4 beta2
```
* RFCs with complex voting options will specify the vote percentage or other details.

View File

@ -1,5 +1,43 @@
# ![PocketMine-MP](http://cdn.pocketmine.net/img/PocketMine-MP-h.png)
# [![PocketMine-MP](http://cdn.pocketmine.net/img/PocketMine-MP-h.png)](https://pmmp.io)
__A highly customisable, open source server software for Minecraft: Pocket Edition written in PHP__
[![Build Status](https://travis-ci.org/pmmp/PocketMine-MP.svg?branch=master)](https://travis-ci.org/pmmp/PocketMine-MP)
### Setup, help & support, FAQs
Head over to the [documentation site](http://pmmp.readthedocs.org/).
If you don't find what you're looking for there, [talk to a human](#discussion). Please do not use our issue tracker for support requests.
### Discussion
- [Forums](https://forums.pmmp.io/)
- [#pmmp + #pocketmine channel IRC](http://webchat.freenode.net/?channels=pmmp,pocketmine)
### Plugins
There are a very wide range of already-written plugins available which you can use to customise your server. Check out [Poggit](https://poggit.pmmp.io), or just search GitHub.
### For developers
* [Latest API documentation](https://jenkins.pmmp.io/job/PocketMine-MP-doc/doxygen/) - Doxygen documentation generated from development
* [DevTools](https://github.com/pmmp/PocketMine-DevTools/) - A development tools plugin for creating plugins.
### Can I contribute?
Yes you can! Contributions are welcomed provided that they comply with our [Contributing Guidelines](CONTRIBUTING.md). Please ensure you read the relevant sections of the guidelines carefully before making a Pull Request or opening an Issue.
### Where can I get the latest .phar?
Head over to our [official Jenkins server](https://jenkins.pmmp.io/)
## Third-party Libraries/Protocols Used
* __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__
* __[PHP mbstring](http://php.net/manual/en/book.mbstring.php)__
* __[PHP BCMath](http://php.net/manual/en/book.bc.php)__
* __[PHP pthreads](http://pthreads.org/)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.
* __[PHP YAML](https://code.google.com/p/php-yaml/)__ by _Bryan Davis_: The Yaml PHP Extension provides a wrapper to the LibYAML library.
* __[LibYAML](http://pyyaml.org/wiki/LibYAML)__ by _Kirill Simonov_: A YAML 1.1 parser and emitter written in C.
* __[cURL](http://curl.haxx.se/)__: cURL is a command line tool for transferring data with URL syntax
* __[Zlib](http://www.zlib.net/)__: A Massively Spiffy Yet Delicately Unobtrusive Compression Library
* __[Source RCON Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol)__
* __[UT3 Query Protocol](http://wiki.unrealadmin.org/UT3_query_protocol)__
## Licensing information
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -14,42 +52,4 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
__PocketMine-MP is a free, open-source software that creates Minecraft: Pocket Edition servers and allows extending its functionalities__
### [Homepage](http://www.pocketmine.net/)
### [Forums](http://forums.pocketmine.net/)
### [Documentation](http://pocketmine-mp.readthedocs.org/)
### [Plugin Repository](http://plugins.pocketmine.net/)
<!--## [FAQ: Frequently Asked Questions](https://github.com/PocketMine/PocketMine-MP/wiki/Frequently-Asked-Questions)-->
### [Official Jenkins server](http://jenkins.pocketmine.net/)
### API Documentation
* [Official Doxygen-generated documentation](http://docs.pocketmine.net/)
* [Latest Doxygen generated from development](http://jenkins.pocketmine.net/job/PocketMine-MP-doc/doxygen/)
### [Twitter @PocketMine](https://twitter.com/PocketMine)
### IRC Chat #pocketmine (or #mcpedevs) @ irc.freenode.net
[#pocketmine + #mcpedevs channel WebIRC](http://webchat.freenode.net/?channels=pocketmine,mcpedevs)
### Want to contribute?
* Check the [Contributing Guidelines](CONTRIBUTING.md)
## Third-party Libraries/Protocols Used
* __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__
* __[PHP SQLite3](http://php.net/manual/en/book.sqlite3.php)__
* __[PHP BCMath](http://php.net/manual/en/book.bc.php)__
* __[PHP pthreads](http://pthreads.org/)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.
* __[PHP YAML](https://code.google.com/p/php-yaml/)__ by _Bryan Davis_: The Yaml PHP Extension provides a wrapper to the LibYAML library.
* __[LibYAML](http://pyyaml.org/wiki/LibYAML)__ by _Kirill Simonov_: A YAML 1.1 parser and emitter written in C.
* __[cURL](http://curl.haxx.se/)__: cURL is a command line tool for transferring data with URL syntax
* __[Zlib](http://www.zlib.net/)__: A Massively Spiffy Yet Delicately Unobtrusive Compression Library
* __[Source RCON Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol)__
* __[UT3 Query Protocol](http://wiki.unrealadmin.org/UT3_query_protocol)__
pmmp/PocketMine are not affiliated with Mojang. All brands and trademarks belong to their respective owners. PocketMine-MP is not a Mojang-approved software, nor is it associated with Mojang.

33
composer.json Normal file
View File

@ -0,0 +1,33 @@
{
"name": "pmmp/pocketmine-mp",
"description": "A server software for Minecraft: Pocket Edition written in PHP",
"type": "project",
"homepage": "https://pmmp.io",
"license": "LGPL-3.0",
"require": {
"php": ">=7.2",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-hash": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-pcre": "*",
"ext-phar": "*",
"ext-pthreads": ">=3.1.7dev",
"ext-reflection": "*",
"ext-sockets": "*",
"ext-spl": "*",
"ext-yaml": ">=2.0.0",
"ext-zip": "*",
"ext-zlib": ">=1.2.11"
},
"autoload": {
"exclude-from-classmap": [
"src/spl/stubs"
],
"psr-0": {
"": ["src", "src/spl"]
}
}
}

36
composer.lock generated Normal file
View File

@ -0,0 +1,36 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "d4fecad9dce5314493052c870c8cf059",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"ext-pthreads": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.2",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-hash": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-pcre": "*",
"ext-phar": "*",
"ext-pthreads": ">=3.1.7dev",
"ext-reflection": "*",
"ext-sockets": "*",
"ext-spl": "*",
"ext-yaml": ">=2.0.0",
"ext-zip": "*",
"ext-zlib": ">=1.2.11"
},
"platform-dev": []
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -14,13 +14,16 @@
* (at your option) any later version.
*
* @author PocketMine Team
*
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine;
use pocketmine\event\TranslationContainer;
use pocketmine\utils\TextFormat;
/**
@ -38,78 +41,85 @@ abstract class Achievement{
"mineWood" => [
"name" => "Getting Wood",
"requires" => [ //"openInventory",
],
]
],
"buildWorkBench" => [
"name" => "Benchmarking",
"requires" => [
"mineWood",
],
"mineWood"
]
],
"buildPickaxe" => [
"name" => "Time to Mine!",
"requires" => [
"buildWorkBench",
],
"buildWorkBench"
]
],
"buildFurnace" => [
"name" => "Hot Topic",
"requires" => [
"buildPickaxe",
],
"buildPickaxe"
]
],
"acquireIron" => [
"name" => "Acquire hardware",
"requires" => [
"buildFurnace",
],
"buildFurnace"
]
],
"buildHoe" => [
"name" => "Time to Farm!",
"requires" => [
"buildWorkBench",
],
"buildWorkBench"
]
],
"makeBread" => [
"name" => "Bake Bread",
"requires" => [
"buildHoe",
],
"buildHoe"
]
],
"bakeCake" => [
"name" => "The Lie",
"requires" => [
"buildHoe",
],
"buildHoe"
]
],
"buildBetterPickaxe" => [
"name" => "Getting an Upgrade",
"requires" => [
"buildPickaxe",
],
"buildPickaxe"
]
],
"buildSword" => [
"name" => "Time to Strike!",
"requires" => [
"buildWorkBench",
],
"buildWorkBench"
]
],
"diamonds" => [
"name" => "DIAMONDS!",
"requires" => [
"acquireIron",
],
],
"acquireIron"
]
]
];
public static function broadcast(Player $player, $achievementId){
/**
* @param Player $player
* @param string $achievementId
*
* @return bool
*/
public static function broadcast(Player $player, string $achievementId) : bool{
if(isset(Achievement::$list[$achievementId])){
if(Server::getInstance()->getConfigString("announce-player-achievements", true) === true){
Server::getInstance()->broadcastMessage($player->getDisplayName() . " has just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
$translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"] . TextFormat::RESET]);
if(Server::getInstance()->getConfigBoolean("announce-player-achievements", true) === true){
Server::getInstance()->broadcastMessage($translation);
}else{
$player->sendMessage("You have just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
$player->sendMessage($translation);
}
return true;
@ -118,11 +128,18 @@ abstract class Achievement{
return false;
}
public static function add($achievementId, $achievementName, array $requires = []){
/**
* @param string $achievementId
* @param string $achievementName
* @param array $requires
*
* @return bool
*/
public static function add(string $achievementId, string $achievementName, array $requires = []) : bool{
if(!isset(Achievement::$list[$achievementId])){
Achievement::$list[$achievementId] = [
"name" => $achievementName,
"requires" => $requires,
"requires" => $requires
];
return true;

View File

@ -0,0 +1,37 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine;
abstract class Collectable extends \Threaded{
private $isGarbage = false;
public function isGarbage() : bool{
return $this->isGarbage;
}
public function setGarbage(){
$this->isGarbage = true;
}
}

View File

@ -14,16 +14,19 @@
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine;
use pocketmine\network\protocol\Info;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\plugin\PluginBase;
use pocketmine\plugin\PluginLoadOrder;
use pocketmine\plugin\PluginManager;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
use raklib\RakLib;
@ -35,14 +38,22 @@ class CrashDump{
private $fp;
private $time;
private $data = [];
private $encodedData = null;
/** @var string */
private $encodedData = "";
/** @var string */
private $path;
public function __construct(Server $server){
$this->time = time();
$this->server = $server;
$this->path = $this->server->getDataPath() . "CrashDump_" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
$this->fp = fopen($this->path, "wb");
if(!is_dir($this->server->getDataPath() . "crashdumps")){
mkdir($this->server->getDataPath() . "crashdumps");
}
$this->path = $this->server->getDataPath() . "crashdumps/" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
$this->fp = @fopen($this->path, "wb");
if(!is_resource($this->fp)){
throw new \RuntimeException("Could not create Crash Dump");
}
$this->data["time"] = $this->time;
$this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
$this->addLine();
@ -55,7 +66,7 @@ class CrashDump{
$this->encodeData();
}
public function getPath(){
public function getPath() : string{
return $this->path;
}
@ -63,7 +74,7 @@ class CrashDump{
return $this->encodedData;
}
public function getData(){
public function getData() : array{
return $this->data;
}
@ -80,7 +91,7 @@ class CrashDump{
}
private function pluginsData(){
if(class_exists("pocketmine\\plugin\\PluginManager", false)){
if($this->server->getPluginManager() instanceof PluginManager){
$this->addLine();
$this->addLine("Loaded plugins:");
$this->data["plugins"] = [];
@ -137,7 +148,7 @@ class CrashDump{
$error = $lastExceptionError;
}else{
$error = (array) error_get_last();
$error["trace"] = getTrace(4);
$error["trace"] = getTrace(4); //Skipping CrashDump->baseCrash, CrashDump->construct, Server->crashDump
$errorConversion = [
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
@ -153,11 +164,11 @@ class CrashDump{
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED"
];
$error["fullFile"] = $error["file"];
$error["file"] = cleanPath($error["file"]);
$error["type"] = isset($errorConversion[$error["type"]]) ? $errorConversion[$error["type"]] : $error["type"];
$error["type"] = $errorConversion[$error["type"]] ?? $error["type"];
if(($pos = strpos($error["message"], "\n")) !== false){
$error["message"] = substr($error["message"], 0, $pos);
}
@ -218,9 +229,10 @@ class CrashDump{
private function generalData(){
$version = new VersionString();
$this->data["general"] = [];
$this->data["general"]["name"] = $this->server->getName();
$this->data["general"]["version"] = $version->get(false);
$this->data["general"]["build"] = $version->getBuild();
$this->data["general"]["protocol"] = Info::CURRENT_PROTOCOL;
$this->data["general"]["protocol"] = ProtocolInfo::CURRENT_PROTOCOL;
$this->data["general"]["api"] = \pocketmine\API_VERSION;
$this->data["general"]["git"] = \pocketmine\GIT_COMMIT;
$this->data["general"]["raklib"] = RakLib::VERSION;
@ -229,7 +241,7 @@ class CrashDump{
$this->data["general"]["zend"] = zend_version();
$this->data["general"]["php_os"] = PHP_OS;
$this->data["general"]["os"] = Utils::getOS();
$this->addLine("PocketMine-MP version: " . $version->get(false) . " #" . $version->getBuild() . " [Protocol " . Info::CURRENT_PROTOCOL . "; API " . API_VERSION . "]");
$this->addLine($this->server->getName() . " version: " . $version->get(false) . " #" . $version->getBuild() . " [Protocol " . ProtocolInfo::CURRENT_PROTOCOL . "; API " . API_VERSION . "]");
$this->addLine("Git commit: " . GIT_COMMIT);
$this->addLine("uname -a: " . php_uname("a"));
$this->addLine("PHP Version: " . phpversion());

View File

@ -19,6 +19,8 @@
*
*/
declare(strict_types=1);
namespace pocketmine;
use pocketmine\permission\ServerOperator;
@ -28,32 +30,32 @@ interface IPlayer extends ServerOperator{
/**
* @return bool
*/
public function isOnline();
public function isOnline() : bool;
/**
* @return string
*/
public function getName();
public function getName() : string;
/**
* @return bool
*/
public function isBanned();
public function isBanned() : bool;
/**
* @param bool $banned
*/
public function setBanned($banned);
public function setBanned(bool $banned);
/**
* @return bool
*/
public function isWhitelisted();
public function isWhitelisted() : bool;
/**
* @param bool $value
*/
public function setWhitelisted($value);
public function setWhitelisted(bool $value);
/**
* @return Player|null
@ -61,18 +63,18 @@ interface IPlayer extends ServerOperator{
public function getPlayer();
/**
* @return int|double
* @return int|null
*/
public function getFirstPlayed();
/**
* @return int|double
* @return int|null
*/
public function getLastPlayed();
/**
* @return mixed
* @return bool
*/
public function hasPlayedBefore();
public function hasPlayedBefore() : bool;
}

View File

@ -0,0 +1,475 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine;
use pocketmine\event\server\LowMemoryEvent;
use pocketmine\event\Timings;
use pocketmine\scheduler\DumpWorkerMemoryTask;
use pocketmine\scheduler\GarbageCollectionTask;
use pocketmine\utils\MainLogger;
use pocketmine\utils\Utils;
class MemoryManager{
/** @var Server */
private $server;
/** @var int */
private $memoryLimit;
/** @var int */
private $globalMemoryLimit;
/** @var int */
private $checkRate;
/** @var int */
private $checkTicker = 0;
/** @var bool */
private $lowMemory = false;
/** @var bool */
private $continuousTrigger = true;
/** @var int */
private $continuousTriggerRate;
/** @var int */
private $continuousTriggerCount = 0;
/** @var int */
private $continuousTriggerTicker = 0;
/** @var int */
private $garbageCollectionPeriod;
/** @var int */
private $garbageCollectionTicker = 0;
/** @var bool */
private $garbageCollectionTrigger;
/** @var bool */
private $garbageCollectionAsync;
/** @var int */
private $chunkRadiusOverride;
/** @var bool */
private $chunkCollect;
/** @var bool */
private $chunkTrigger;
/** @var bool */
private $chunkCache;
/** @var bool */
private $cacheTrigger;
/** @var bool */
private $dumpWorkers = true;
public function __construct(Server $server){
$this->server = $server;
$this->init();
}
private function init(){
$this->memoryLimit = ((int) $this->server->getProperty("memory.main-limit", 0)) * 1024 * 1024;
$defaultMemory = 1024;
if(preg_match("/([0-9]+)([KMGkmg])/", $this->server->getConfigString("memory-limit", ""), $matches) > 0){
$m = (int) $matches[1];
if($m <= 0){
$defaultMemory = 0;
}else{
switch(strtoupper($matches[2])){
case "K":
$defaultMemory = $m / 1024;
break;
case "M":
$defaultMemory = $m;
break;
case "G":
$defaultMemory = $m * 1024;
break;
default:
$defaultMemory = $m;
break;
}
}
}
$hardLimit = ((int) $this->server->getProperty("memory.main-hard-limit", $defaultMemory));
if($hardLimit <= 0){
ini_set("memory_limit", '-1');
}else{
ini_set("memory_limit", $hardLimit . "M");
}
$this->globalMemoryLimit = ((int) $this->server->getProperty("memory.global-limit", 0)) * 1024 * 1024;
$this->checkRate = (int) $this->server->getProperty("memory.check-rate", 20);
$this->continuousTrigger = (bool) $this->server->getProperty("memory.continuous-trigger", true);
$this->continuousTriggerRate = (int) $this->server->getProperty("memory.continuous-trigger-rate", 30);
$this->garbageCollectionPeriod = (int) $this->server->getProperty("memory.garbage-collection.period", 36000);
$this->garbageCollectionTrigger = (bool) $this->server->getProperty("memory.garbage-collection.low-memory-trigger", true);
$this->garbageCollectionAsync = (bool) $this->server->getProperty("memory.garbage-collection.collect-async-worker", true);
$this->chunkRadiusOverride = (int) $this->server->getProperty("memory.max-chunks.chunk-radius", 4);
$this->chunkCollect = (bool) $this->server->getProperty("memory.max-chunks.trigger-chunk-collect", true);
$this->chunkTrigger = (bool) $this->server->getProperty("memory.max-chunks.low-memory-trigger", true);
$this->chunkCache = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true);
$this->cacheTrigger = (bool) $this->server->getProperty("memory.world-caches.low-memory-trigger", true);
$this->dumpWorkers = (bool) $this->server->getProperty("memory.memory-dump.dump-async-worker", true);
gc_enable();
}
/**
* @return bool
*/
public function isLowMemory() : bool{
return $this->lowMemory;
}
/**
* @return bool
*/
public function canUseChunkCache() : bool{
return !($this->lowMemory and $this->chunkTrigger);
}
/**
* Returns the allowed chunk radius based on the current memory usage.
*
* @param int $distance
*
* @return int
*/
public function getViewDistance(int $distance) : int{
return $this->lowMemory ? (int) min($this->chunkRadiusOverride, $distance) : $distance;
}
/**
* Triggers garbage collection and cache cleanup to try and free memory.
*
* @param int $memory
* @param int $limit
* @param bool $global
* @param int $triggerCount
*/
public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0){
$this->server->getLogger()->debug(sprintf("[Memory Manager] %sLow memory triggered, limit %gMB, using %gMB",
$global ? "Global " : "", round(($limit / 1024) / 1024, 2), round(($memory / 1024) / 1024, 2)));
if($this->cacheTrigger){
foreach($this->server->getLevels() as $level){
$level->clearCache(true);
}
}
if($this->chunkTrigger and $this->chunkCollect){
foreach($this->server->getLevels() as $level){
$level->doChunkGarbageCollection();
}
}
$ev = new LowMemoryEvent($memory, $limit, $global, $triggerCount);
$this->server->getPluginManager()->callEvent($ev);
$cycles = 0;
if($this->garbageCollectionTrigger){
$cycles = $this->triggerGarbageCollector();
}
$this->server->getLogger()->debug(sprintf("[Memory Manager] Freed %gMB, $cycles cycles", round(($ev->getMemoryFreed() / 1024) / 1024, 2)));
}
/**
* Called every tick to update the memory manager state.
*/
public function check(){
Timings::$memoryManagerTimer->startTiming();
if(($this->memoryLimit > 0 or $this->globalMemoryLimit > 0) and ++$this->checkTicker >= $this->checkRate){
$this->checkTicker = 0;
$memory = Utils::getMemoryUsage(true);
$trigger = false;
if($this->memoryLimit > 0 and $memory[0] > $this->memoryLimit){
$trigger = 0;
}elseif($this->globalMemoryLimit > 0 and $memory[1] > $this->globalMemoryLimit){
$trigger = 1;
}
if($trigger !== false){
if($this->lowMemory and $this->continuousTrigger){
if(++$this->continuousTriggerTicker >= $this->continuousTriggerRate){
$this->continuousTriggerTicker = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0, ++$this->continuousTriggerCount);
}
}else{
$this->lowMemory = true;
$this->continuousTriggerCount = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0);
}
}else{
$this->lowMemory = false;
}
}
if($this->garbageCollectionPeriod > 0 and ++$this->garbageCollectionTicker >= $this->garbageCollectionPeriod){
$this->garbageCollectionTicker = 0;
$this->triggerGarbageCollector();
}
Timings::$memoryManagerTimer->stopTiming();
}
/**
* @return int
*/
public function triggerGarbageCollector() : int{
Timings::$garbageCollectorTimer->startTiming();
if($this->garbageCollectionAsync){
$size = $this->server->getScheduler()->getAsyncTaskPoolSize();
for($i = 0; $i < $size; ++$i){
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GarbageCollectionTask(), $i);
}
}
$cycles = gc_collect_cycles();
Timings::$garbageCollectorTimer->stopTiming();
return $cycles;
}
/**
* Dumps the server memory into the specified output folder.
*
* @param string $outputFolder
* @param int $maxNesting
* @param int $maxStringSize
*/
public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize){
MainLogger::getLogger()->notice("[Dump] After the memory dump is done, the server might crash");
self::dumpMemory($this->server, $this->server->getLoader(), $outputFolder, $maxNesting, $maxStringSize);
if($this->dumpWorkers){
$scheduler = $this->server->getScheduler();
for($i = 0, $size = $scheduler->getAsyncTaskPoolSize(); $i < $size; ++$i){
$scheduler->scheduleAsyncTaskToWorker(new DumpWorkerMemoryTask($outputFolder, $maxNesting, $maxStringSize), $i);
}
}
}
/**
* Static memory dumper accessible from any thread.
*
* @param mixed $startingObject
* @param \ClassLoader $loader
* @param string $outputFolder
* @param int $maxNesting
* @param int $maxStringSize
*/
public static function dumpMemory($startingObject, \ClassLoader $loader, string $outputFolder, int $maxNesting, int $maxStringSize){
$hardLimit = ini_get('memory_limit');
ini_set('memory_limit', '-1');
gc_disable();
if(!file_exists($outputFolder)){
mkdir($outputFolder, 0777, true);
}
$obData = fopen($outputFolder . "/objects.js", "wb+");
$data = [];
$objects = [];
$refCounts = [];
$instanceCounts = [];
$staticProperties = [];
$staticCount = 0;
foreach($loader->getClasses() as $className){
$reflection = new \ReflectionClass($className);
$staticProperties[$className] = [];
foreach($reflection->getProperties() as $property){
if(!$property->isStatic() or $property->getDeclaringClass()->getName() !== $className){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
$staticCount++;
self::continueDump($property->getValue(), $staticProperties[$className][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
if(count($staticProperties[$className]) === 0){
unset($staticProperties[$className]);
}
}
file_put_contents($outputFolder . "/staticProperties.js", json_encode($staticProperties, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
MainLogger::getLogger()->info("[Dump] Wrote $staticCount static properties");
if($GLOBALS !== null){ //This might be null if we're on a different thread
$globalVariables = [];
$globalCount = 0;
$ignoredGlobals = [
'GLOBALS' => true,
'_SERVER' => true,
'_REQUEST' => true,
'_POST' => true,
'_GET' => true,
'_FILES' => true,
'_ENV' => true,
'_COOKIE' => true,
'_SESSION' => true
];
foreach($GLOBALS as $varName => $value){
if(isset($ignoredGlobals[$varName])){
continue;
}
$globalCount++;
self::continueDump($value, $globalVariables[$varName], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
file_put_contents($outputFolder . "/globalVariables.js", json_encode($globalVariables, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
MainLogger::getLogger()->info("[Dump] Wrote $globalCount global variables");
}
self::continueDump($startingObject, $data, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
do{
$continue = false;
foreach($objects as $hash => $object){
if(!is_object($object)){
continue;
}
$continue = true;
$className = get_class($object);
if(!isset($instanceCounts[$className])){
$instanceCounts[$className] = 1;
}else{
$instanceCounts[$className]++;
}
$objects[$hash] = true;
$reflection = new \ReflectionObject($object);
$info = [
"information" => "$hash@$className",
"properties" => []
];
if($reflection->getParentClass()){
$info["parent"] = $reflection->getParentClass()->getName();
}
if(count($reflection->getInterfaceNames()) > 0){
$info["implements"] = implode(", ", $reflection->getInterfaceNames());
}
foreach($reflection->getProperties() as $property){
if($property->isStatic()){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
self::continueDump($property->getValue($object), $info["properties"][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
fwrite($obData, "$hash@$className: " . json_encode($info, JSON_UNESCAPED_SLASHES) . "\n");
}
}while($continue);
MainLogger::getLogger()->info("[Dump] Wrote " . count($objects) . " objects");
fclose($obData);
file_put_contents($outputFolder . "/serverEntry.js", json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
file_put_contents($outputFolder . "/referenceCounts.js", json_encode($refCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
arsort($instanceCounts, SORT_NUMERIC);
file_put_contents($outputFolder . "/instanceCounts.js", json_encode($instanceCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
MainLogger::getLogger()->info("[Dump] Finished!");
ini_set('memory_limit', $hardLimit);
gc_enable();
}
/**
* @param mixed $from
* @param mixed &$data
* @param object[] &$objects
* @param int[] &$refCounts
* @param int $recursion
* @param int $maxNesting
* @param int $maxStringSize
*/
private static function continueDump($from, &$data, array &$objects, array &$refCounts, int $recursion, int $maxNesting, int $maxStringSize){
if($maxNesting <= 0){
$data = "(error) NESTING LIMIT REACHED";
return;
}
--$maxNesting;
if(is_object($from)){
if(!isset($objects[$hash = spl_object_hash($from)])){
$objects[$hash] = $from;
$refCounts[$hash] = 0;
}
++$refCounts[$hash];
$data = "(object) $hash@" . get_class($from);
}elseif(is_array($from)){
if($recursion >= 5){
$data = "(error) ARRAY RECURSION LIMIT REACHED";
return;
}
$data = [];
foreach($from as $key => $value){
self::continueDump($value, $data[$key], $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize);
}
}elseif(is_string($from)){
$data = "(string) len(". strlen($from) .") " . substr(Utils::printable($from), 0, $maxStringSize);
}elseif(is_resource($from)){
$data = "(resource) " . print_r($from, true);
}else{
$data = $from;
}
}
}

View File

@ -19,24 +19,29 @@
*
*/
declare(strict_types=1);
namespace pocketmine;
use pocketmine\metadata\Metadatable;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\plugin\Plugin;
class OfflinePlayer implements IPlayer{
class OfflinePlayer implements IPlayer, Metadatable{
/** @var string */
private $name;
/** @var Server */
private $server;
/** @var CompoundTag|null */
private $namedtag;
/**
* @param Server $server
* @param string $name
*/
public function __construct(Server $server, $name){
public function __construct(Server $server, string $name){
$this->server = $server;
$this->name = $name;
if(file_exists($this->server->getDataPath() . "players/" . strtolower($this->getName()) . ".dat")){
@ -46,11 +51,11 @@ class OfflinePlayer implements IPlayer{
}
}
public function isOnline(){
public function isOnline() : bool{
return $this->getPlayer() !== null;
}
public function getName(){
public function getName() : string{
return $this->name;
}
@ -58,11 +63,11 @@ class OfflinePlayer implements IPlayer{
return $this->server;
}
public function isOp(){
public function isOp() : bool{
return $this->server->isOp(strtolower($this->getName()));
}
public function setOp($value){
public function setOp(bool $value){
if($value === $this->isOp()){
return;
}
@ -74,11 +79,11 @@ class OfflinePlayer implements IPlayer{
}
}
public function isBanned(){
public function isBanned() : bool{
return $this->server->getNameBans()->isBanned(strtolower($this->getName()));
}
public function setBanned($value){
public function setBanned(bool $value){
if($value === true){
$this->server->getNameBans()->addBan($this->getName(), null, null, null);
}else{
@ -86,11 +91,11 @@ class OfflinePlayer implements IPlayer{
}
}
public function isWhitelisted(){
public function isWhitelisted() : bool{
return $this->server->isWhitelisted(strtolower($this->getName()));
}
public function setWhitelisted($value){
public function setWhitelisted(bool $value){
if($value === true){
$this->server->addWhitelist(strtolower($this->getName()));
}else{
@ -103,31 +108,31 @@ class OfflinePlayer implements IPlayer{
}
public function getFirstPlayed(){
return $this->namedtag instanceof Compound ? $this->namedtag["firstPlayed"] : null;
return $this->namedtag instanceof CompoundTag ? $this->namedtag["firstPlayed"] : null;
}
public function getLastPlayed(){
return $this->namedtag instanceof Compound ? $this->namedtag["lastPlayed"] : null;
return $this->namedtag instanceof CompoundTag ? $this->namedtag["lastPlayed"] : null;
}
public function hasPlayedBefore(){
return $this->namedtag instanceof Compound;
public function hasPlayedBefore() : bool{
return $this->namedtag instanceof CompoundTag;
}
public function setMetadata($metadataKey, MetadataValue $metadataValue){
$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $metadataValue);
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue){
$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $newMetadataValue);
}
public function getMetadata($metadataKey){
public function getMetadata(string $metadataKey){
return $this->server->getPlayerMetadata()->getMetadata($this, $metadataKey);
}
public function hasMetadata($metadataKey){
public function hasMetadata(string $metadataKey) : bool{
return $this->server->getPlayerMetadata()->hasMetadata($this, $metadataKey);
}
public function removeMetadata($metadataKey, Plugin $plugin){
$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $plugin);
public function removeMetadata(string $metadataKey, Plugin $owningPlugin){
$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $owningPlugin);
}

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,11 +15,16 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace {
const INT32_MIN = -0x80000000;
const INT32_MAX = 0x7fffffff;
function safe_var_dump(){
static $cnt = 0;
foreach(func_get_args() as $var){
@ -27,14 +32,14 @@ namespace {
case is_array($var):
echo str_repeat(" ", $cnt) . "array(" . count($var) . ") {" . PHP_EOL;
foreach($var as $key => $value){
echo str_repeat(" ", $cnt + 1) . "[" . (is_integer($key) ? $key : '"' . $key . '"') . "]=>" . PHP_EOL;
echo str_repeat(" ", $cnt + 1) . "[" . (is_int($key) ? $key : '"' . $key . '"') . "]=>" . PHP_EOL;
++$cnt;
safe_var_dump($value);
--$cnt;
}
echo str_repeat(" ", $cnt) . "}" . PHP_EOL;
break;
case is_integer($var):
case is_int($var):
echo str_repeat(" ", $cnt) . "int(" . $var . ")" . PHP_EOL;
break;
case is_float($var):
@ -65,17 +70,18 @@ namespace {
}
namespace pocketmine {
use LogLevel;
use pocketmine\utils\Binary;
use pocketmine\utils\MainLogger;
use pocketmine\utils\ServerKiller;
use pocketmine\utils\Terminal;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
use pocketmine\wizard\SetupWizard;
use raklib\RakLib;
const VERSION = "Alpha_1.4dev";
const API_VERSION = "1.4.1";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.9.5 alpha";
const VERSION = "1.7dev";
const API_VERSION = "3.0.0-ALPHA8";
const CODENAME = "[REDACTED]";
/*
* Startup code. Do not look at it, it may harm you.
@ -84,10 +90,10 @@ namespace pocketmine {
* Enjoy it as much as I did writing it. I don't want to do it again.
*/
if(\Phar::running(true) !== ""){
@define("pocketmine\\PATH", \Phar::running(true) . "/");
}else{
@define("pocketmine\\PATH", \getcwd() . DIRECTORY_SEPARATOR);
if(version_compare("7.2", PHP_VERSION) > 0){
echo "[CRITICAL] You must use PHP >= 7.2" . PHP_EOL;
echo "[CRITICAL] Please use the installer provided on the homepage." . PHP_EOL;
exit(1);
}
if(!extension_loaded("pthreads")){
@ -96,88 +102,174 @@ namespace pocketmine {
exit(1);
}
error_reporting(-1);
set_error_handler(function($severity, $message, $file, $line){
if(error_reporting() & $severity){
throw new \ErrorException($message, 0, $severity, $file, $line);
}else{ //stfu operator
return true;
}
});
if(!extension_loaded("phar")){
echo "[CRITICAL] Unable to find the Phar extension." . PHP_EOL;
echo "[CRITICAL] Please use the installer provided on the homepage." . PHP_EOL;
exit(1);
}
if(\Phar::running(true) !== ""){
define('pocketmine\PATH', \Phar::running(true) . "/");
}else{
define('pocketmine\PATH', dirname(__FILE__, 3) . DIRECTORY_SEPARATOR);
}
$requiredSplVer = "0.0.1";
if(!is_file(\pocketmine\PATH . "src/spl/version.php")){
echo "[CRITICAL] Cannot find PocketMine-SPL or incompatible version." . PHP_EOL;
echo "[CRITICAL] Please update your submodules or use provided builds." . PHP_EOL;
exit(1);
}elseif(version_compare($requiredSplVer, require(\pocketmine\PATH . "src/spl/version.php")) > 0){
echo "[CRITICAL] Incompatible PocketMine-SPL submodule version ($requiredSplVer is required)." . PHP_EOL;
echo "[CRITICAL] Please update your submodules or use provided builds." . PHP_EOL;
exit(1);
}
if(is_file(\pocketmine\PATH . "vendor/autoload.php")){
require_once(\pocketmine\PATH . "vendor/autoload.php");
}else{
echo "[CRITICAL] Composer autoloader not found" . PHP_EOL;
echo "[CRITICAL] Please initialize composer dependencies before running." . PHP_EOL;
exit(1);
}
if(!class_exists("ClassLoader", false)){
require_once(\pocketmine\PATH . "src/spl/ClassLoader.php");
require_once(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require_once(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
$autoloader = new CompatibleClassLoader();
/*
* We now use the Composer autoloader, but this autoloader is still used by RakLib and for loading plugins.
*/
$autoloader = new \BaseClassLoader();
$autoloader->addPath(\pocketmine\PATH . "src");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "spl");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "raklib");
$autoloader->register(true);
$autoloader->register(false);
if(!class_exists(RakLib::class)){
echo "[CRITICAL] Unable to find the RakLib library." . PHP_EOL;
echo "[CRITICAL] Please use provided builds or clone the repository recursively." . PHP_EOL;
exit(1);
}
if(version_compare(RakLib::VERSION, "0.8.1") < 0){
echo "[CRITICAL] RakLib version 0.8.1 is required, while you have version " . RakLib::VERSION . "." . PHP_EOL;
echo "[CRITICAL] Please update your submodules or use provided builds." . PHP_EOL;
exit(1);
}
set_time_limit(0); //Who set it to 30 seconds?!?!
gc_enable();
error_reporting(-1);
ini_set("allow_url_fopen", 1);
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
ini_set("allow_url_fopen", '1');
ini_set("display_errors", '1');
ini_set("display_startup_errors", '1');
ini_set("default_charset", "utf-8");
ini_set("memory_limit", "256M"); //Default
define("pocketmine\\START_TIME", microtime(true));
ini_set("memory_limit", '-1');
define('pocketmine\START_TIME', microtime(true));
$opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]);
$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-profiler"]);
define("pocketmine\\DATA", isset($opts["data"]) ? realpath($opts["data"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? realpath($opts["plugins"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
define("pocketmine\\ANSI", ((strpos(strtoupper(php_uname("s")), "WIN") === false or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])));
Terminal::init();
define('pocketmine\ANSI', Terminal::hasFormattingCodes());
if(!file_exists(\pocketmine\DATA)){
mkdir(\pocketmine\DATA, 0777, true);
}
//Logger has a dependency on timezone, so we'll set it to UTC until we can get the actual timezone.
date_default_timezone_set("UTC");
$logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI);
if(!ini_get("date.timezone")){
if(($timezone = detect_system_timezone()) and date_default_timezone_set($timezone)){
//Success! Timezone has already been set and validated in the if statement.
//This here is just for redundancy just in case some stupid program wants to read timezone data from the ini.
ini_set("date.timezone", $timezone);
}else{
//If system timezone detection fails or timezone is an invalid value.
if($response = Utils::getURL("http://ip-api.com/json")
and $ip_geolocation_data = json_decode($response, true)
and $ip_geolocation_data['status'] != 'fail'
and date_default_timezone_set($ip_geolocation_data['timezone']))
{
//Again, for redundancy.
ini_set("date.timezone", $ip_geolocation_data['timezone']);
$logger = new MainLogger(\pocketmine\DATA . "server.log");
$logger->registerStatic();
do{
$timezone = ini_get("date.timezone");
if($timezone !== ""){
/*
* This is here so that people don't come to us complaining and fill up the issue tracker when they put
* an incorrect timezone abbreviation in php.ini apparently.
*/
if(strpos($timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($timezone);
if($default_timezone !== false){
ini_set("date.timezone", $default_timezone);
date_default_timezone_set($default_timezone);
break;
}else{
//Bad php.ini value, try another method to detect timezone
$logger->warning("Timezone \"$timezone\" could not be parsed as a valid timezone from php.ini, falling back to auto-detection");
}
}else{
ini_set("date.timezone", "UTC");
date_default_timezone_set("UTC");
$logger->warning("Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \"UTC\" by default. You can change it on the php.ini file.");
date_default_timezone_set($timezone);
break;
}
}
}else{
/*
* This is here so that stupid idiots don't come to us complaining and fill up the issue tracker when they put an incorrect timezone abbreviation in php.ini apparently.
*/
$default_timezone = date_default_timezone_get();
if(strpos($default_timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($default_timezone);
ini_set("date.timezone", $default_timezone);
date_default_timezone_set($default_timezone);
if(($timezone = detect_system_timezone()) and date_default_timezone_set($timezone)){
//Success! Timezone has already been set and validated in the if statement.
//This here is just for redundancy just in case some program wants to read timezone data from the ini.
ini_set("date.timezone", $timezone);
break;
}
}
if($response = Utils::getURL("http://ip-api.com/json") //If system timezone detection fails or timezone is an invalid value.
and $ip_geolocation_data = json_decode($response, true)
and $ip_geolocation_data['status'] !== 'fail'
and date_default_timezone_set($ip_geolocation_data['timezone'])
){
//Again, for redundancy.
ini_set("date.timezone", $ip_geolocation_data['timezone']);
break;
}
ini_set("date.timezone", "UTC");
date_default_timezone_set("UTC");
$logger->warning("Timezone could not be automatically determined or was set to an invalid value. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \"UTC\" by default. You can change it on the php.ini file.");
}while(false);
function detect_system_timezone(){
switch(Utils::getOS()){
case 'win':
$regex = '/(?:Time Zone:\s*\()(UTC)(\+*\-*\d*\d*\:*\d*\d*)(?:\))/';
$regex = '/(UTC)(\+*\-*\d*\d*\:*\d*\d*)/';
exec("systeminfo", $output);
/*
* wmic timezone get Caption
* Get the timezone offset
*
* Sample Output var_dump
* array(3) {
* [0] =>
* string(7) "Caption"
* [1] =>
* string(20) "(UTC+09:30) Adelaide"
* [2] =>
* string(0) ""
* }
*/
exec("wmic timezone get Caption", $output);
$string = trim(implode("\n", $output));
//Detect the Time Zone string in systeminfo
//Detect the Time Zone string
preg_match($regex, $string, $matches);
if(!isset($matches[2]))
{
if(!isset($matches[2])){
return false;
}
@ -188,7 +280,6 @@ namespace pocketmine {
}
return parse_offset($offset);
break;
case 'linux':
// Ubuntu / Debian.
if(file_exists('/etc/timezone')){
@ -215,7 +306,6 @@ namespace pocketmine {
}
return parse_offset($offset);
break;
case 'mac':
if(is_link('/etc/localtime')){
$filename = readlink('/etc/localtime');
@ -226,16 +316,15 @@ namespace pocketmine {
}
return false;
break;
default:
return false;
break;
}
}
/**
* @param string $offset In the format of +09:00, +02:00, -04:00 etc.
* @return string
*
* @return string|bool
*/
function parse_offset($offset){
//Make signed offsets unsigned for date_parse
@ -290,11 +379,33 @@ namespace pocketmine {
case "mac":
case "linux":
default:
exec("kill -9 " . ((int) $pid) . " > /dev/null 2>&1");
if(function_exists("posix_kill")){
posix_kill($pid, SIGKILL);
}else{
exec("kill -9 " . ((int) $pid) . " > /dev/null 2>&1");
}
}
}
function getTrace($start = 1, $trace = null){
/**
* @param object $value
* @param bool $includeCurrent
*
* @return int
*/
function getReferenceCount($value, $includeCurrent = true){
ob_start();
debug_zval_dump($value);
$ret = explode("\n", ob_get_contents());
ob_end_clean();
if(count($ret) >= 1 and preg_match('/^.* refcount\\(([0-9]+)\\)\\{$/', trim($ret[0]), $m) > 0){
return ((int) $m[1]) - ($includeCurrent ? 3 : 4); //$value + zval call + extra call
}
return -1;
}
function getTrace($start = 0, $trace = null){
if($trace === null){
if(function_exists("xdebug_get_function_stack")){
$trace = array_reverse(xdebug_get_function_stack());
@ -314,189 +425,151 @@ namespace pocketmine {
}else{
$args = $trace[$i]["params"];
}
foreach($args as $name => $value){
$params .= (is_object($value) ? get_class($value) . " " . (method_exists($value, "__toString") ? $value->__toString() : "object") : gettype($value) . " " . @strval($value)) . ", ";
}
$params = implode(", ", array_map(function($value){
return (is_object($value) ? get_class($value) . " object" : gettype($value) . " " . (is_array($value) ? "Array()" : Utils::printable(@strval($value))));
}, $args));
}
$messages[] = "#$j " . (isset($trace[$i]["file"]) ? cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . substr($params, 0, -2) . ")";
$messages[] = "#$j " . (isset($trace[$i]["file"]) ? cleanPath($trace[$i]["file"]) : "") . "(" . ($trace[$i]["line"] ?? "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . Utils::printable($params) . ")";
}
return $messages;
}
function cleanPath($path){
return rtrim(str_replace(["\\", ".php", "phar://", rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), "/"), rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH), "/")], ["/", "", "", "", ""], $path), "/");
return str_replace(["\\", ".php", "phar://", str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH)], ["/", "", "", "", ""], $path);
}
function error_handler($errno, $errstr, $errfile, $errline, $trace = null){
global $lastError;
if(error_reporting() === 0){ //@ error-control
return false;
$exitCode = 0;
do{
$errors = 0;
if(PHP_INT_SIZE < 8){
$logger->critical("Running PocketMine-MP with 32-bit systems/PHP is no longer supported. Please upgrade to a 64-bit system or use a 64-bit PHP binary.");
$exitCode = 1;
break;
}
$errorConversion = [
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
E_NOTICE => "E_NOTICE",
E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
];
$type = ($errno === E_ERROR or $errno === E_WARNING or $errno === E_USER_ERROR or $errno === E_USER_WARNING) ? LogLevel::ERROR : LogLevel::NOTICE;
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;
if(($pos = strpos($errstr, "\n")) !== false){
$errstr = substr($errstr, 0, $pos);
}
$logger = MainLogger::getLogger();
$oldFile = $errfile;
$errfile = cleanPath($errfile);
$logger->log($type, "An $errno error happened: \"$errstr\" in \"$errfile\" at line $errline");
foreach(($trace = getTrace($trace === null ? 3 : 0, $trace)) as $i => $line){
$logger->debug($line);
}
$lastError = [
"type" => $type,
"message" => $errstr,
"fullFile" => $oldFile,
"file" => $errfile,
"line" => $errline,
"trace" => $trace
];
return true;
}
set_error_handler("\\pocketmine\\error_handler", E_ALL);
$errors = 0;
if(version_compare("5.6.0", PHP_VERSION) > 0){
$logger->critical("You must use PHP >= 5.6");
++$errors;
}
if(php_sapi_name() !== "cli"){
$logger->critical("You must run PocketMine-MP using the CLI.");
++$errors;
}
if(!extension_loaded("sockets")){
$logger->critical("Unable to find the Socket extension.");
++$errors;
}
$pthreads_version = phpversion("pthreads");
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "2.0.8") < 0){
$logger->critical("pthreads >= 2.0.8 is required, while you have $pthreads_version.");
++$errors;
}
if(!extension_loaded("uopz")){
//$logger->notice("Couldn't find the uopz extension. Some functions may be limited");
}
if(extension_loaded("pocketmine")){
if(version_compare(phpversion("pocketmine"), "0.0.1") < 0){
$logger->critical("You have the native PocketMine extension, but your version is lower than 0.0.1.");
++$errors;
}elseif(version_compare(phpversion("pocketmine"), "0.0.4") > 0){
$logger->critical("You have the native PocketMine extension, but your version is higher than 0.0.4.");
if(php_sapi_name() !== "cli"){
$logger->critical("You must run PocketMine-MP using the CLI.");
++$errors;
}
}
if(!extension_loaded("Weakref") and !extension_loaded("weakref")){
$logger->critical("Unable to find the Weakref extension.");
++$errors;
}
$pthreads_version = phpversion("pthreads");
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "3.1.7-dev") < 0){
$logger->critical("pthreads >= 3.1.7-dev is required, while you have $pthreads_version.");
++$errors;
}
if(!extension_loaded("curl")){
$logger->critical("Unable to find the cURL extension.");
++$errors;
}
if(extension_loaded("leveldb")){
$leveldb_version = phpversion("leveldb");
if(version_compare($leveldb_version, "0.2.0") < 0){
$logger->critical("php-leveldb >= 0.2.0 is required, while you have $leveldb_version");
++$errors;
}
}
if(!extension_loaded("sqlite3")){
$logger->critical("Unable to find the SQLite3 extension.");
++$errors;
}
if(extension_loaded("pocketmine")){
if(version_compare(phpversion("pocketmine"), "0.0.1") < 0){
$logger->critical("You have the native PocketMine extension, but your version is lower than 0.0.1.");
++$errors;
}elseif(version_compare(phpversion("pocketmine"), "0.0.4") > 0){
$logger->critical("You have the native PocketMine extension, but your version is higher than 0.0.4.");
++$errors;
}
}
if(!extension_loaded("yaml")){
$logger->critical("Unable to find the YAML extension.");
++$errors;
}
if(extension_loaded("xdebug")){
$logger->warning(PHP_EOL . PHP_EOL . PHP_EOL . "\tYou are running PocketMine with xdebug enabled. This has a major impact on performance." . PHP_EOL . PHP_EOL);
}
if(!extension_loaded("zlib")){
$logger->critical("Unable to find the Zlib extension.");
++$errors;
}
$extensions = [
"bcmath" => "BC Math",
"curl" => "cURL",
"json" => "JSON",
"mbstring" => "Multibyte String",
"yaml" => "YAML",
"sockets" => "Sockets",
"zip" => "Zip",
"zlib" => "Zlib"
];
if($errors > 0){
$logger->critical("Please use the installer provided on the homepage, or recompile PHP again.");
$logger->shutdown();
$logger->join();
exit(1); //Exit with error
}
foreach($extensions as $ext => $name){
if(!extension_loaded($ext)){
$logger->critical("Unable to find the $name ($ext) extension.");
++$errors;
}
}
if(file_exists(\pocketmine\PATH . ".git/refs/heads/master")){ //Found Git information!
define("pocketmine\\GIT_COMMIT", strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
}else{ //Unknown :(
define("pocketmine\\GIT_COMMIT", str_repeat("00", 20));
}
if($errors > 0){
$logger->critical("Please use the installer provided on the homepage, or recompile PHP again.");
$exitCode = 1;
break;
}
@define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
@ini_set("opcache.mmap_base", bin2hex(Utils::getRandomBytes(8, false))); //Fix OPCache address errors
$gitHash = str_repeat("00", 20);
if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
new Installer();
}
if(substr(__FILE__, 0, 7) !== "phar://"){
$logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
}
ThreadManager::init();
$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
$logger->info("Stopping other threads");
foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
if($thread->isRunning()){
$logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
if($thread instanceof Thread){
$thread->kill();
if($thread->isRunning() or !$thread->join()){
$thread->detach();
}
}elseif($thread instanceof Worker){
$thread->kill();
sleep(1);
if($thread->isRunning() or !$thread->join()){
$thread->detach();
if(\Phar::running(true) === ""){
if(Utils::execute("git rev-parse HEAD", $out) === 0){
$gitHash = trim($out);
if(Utils::execute("git diff --quiet") === 1 or Utils::execute("git diff --cached --quiet") === 1){ //Locally-modified
$gitHash .= "-dirty";
}
}
}elseif(!$thread->isJoined()){
$logger->debug("Joining " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->join();
}else{
$phar = new \Phar(\Phar::running(false));
$meta = $phar->getMetadata();
if(isset($meta["git"])){
$gitHash = $meta["git"];
}
}
}
define('pocketmine\GIT_COMMIT', $gitHash);
@define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
@ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors
if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
$installer = new SetupWizard();
if(!$installer->run()){
$exitCode = -1;
break;
}
}
if(\Phar::running(true) === ""){
$logger->warning("Non-packaged PocketMine-MP installation detected. Consider using a phar in production for better performance.");
}
ThreadManager::init();
new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
$logger->info("Stopping other threads");
$killer = new ServerKiller(8);
$killer->start();
usleep(10000); //Fixes ServerKiller not being able to start on single-core machines
if(ThreadManager::getInstance()->stopAll() > 0){
if(\pocketmine\DEBUG > 1){
echo "Some threads could not be stopped, performing a force-kill" . PHP_EOL . PHP_EOL;
}
kill(getmypid());
}
}while(false);
$logger->shutdown();
$logger->join();
exit(0);
echo Terminal::$FORMAT_RESET . PHP_EOL;
exit($exitCode);
}

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,8 @@
*
*/
declare(strict_types=1);
namespace pocketmine;
/**
@ -26,9 +28,70 @@ namespace pocketmine;
*/
abstract class Thread extends \Thread{
public final function start($options = PTHREADS_INHERIT_ALL){
/** @var \ClassLoader */
protected $classLoader;
protected $isKilled = false;
public function getClassLoader(){
return $this->classLoader;
}
public function setClassLoader(\ClassLoader $loader = null){
if($loader === null){
$loader = Server::getInstance()->getLoader();
}
$this->classLoader = $loader;
}
/**
* Registers the class loader for this thread.
*
* WARNING: This method MUST be called from any descendent threads' run() method to make autoloading usable.
* If you do not do this, you will not be able to use new classes that were not loaded when the thread was started
* (unless you are using a custom autoloader).
*/
public function registerClassLoader(){
require(\pocketmine\PATH . "vendor/autoload.php");
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");
require(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
}
if($this->classLoader !== null){
$this->classLoader->register(false);
}
}
public function start(?int $options = \PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
return parent::start($options);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){
if($this->getClassLoader() === null){
$this->setClassLoader();
}
return parent::start($options);
}
return false;
}
}
/**
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/
public function quit(){
$this->isKilled = true;
$this->notify();
if(!$this->isJoined()){
if(!$this->isTerminated()){
$this->join();
}
}
ThreadManager::getInstance()->remove($this);
}
public function getThreadName() : string{
return (new \ReflectionClass($this))->getShortName();
}
}

View File

@ -19,9 +19,13 @@
*
*/
declare(strict_types=1);
namespace pocketmine;
class ThreadManager extends \Threaded{
use pocketmine\utils\MainLogger;
class ThreadManager extends \Volatile{
/** @var ThreadManager */
private static $instance = null;
@ -58,7 +62,7 @@ class ThreadManager extends \Threaded{
/**
* @return Worker[]|Thread[]
*/
public function getAll(){
public function getAll() : array{
$array = [];
foreach($this as $key => $thread){
$array[$key] = $thread;
@ -66,4 +70,23 @@ class ThreadManager extends \Threaded{
return $array;
}
public function stopAll() : int{
$logger = MainLogger::getLogger();
$erroredThreads = 0;
foreach($this->getAll() as $thread){
$logger->debug("Stopping " . $thread->getThreadName() . " thread");
try{
$thread->quit();
$logger->debug($thread->getThreadName() . " thread stopped successfully.");
}catch(\ThreadException $e){
++$erroredThreads;
$logger->debug("Could not stop " . $thread->getThreadName() . " thread: " . $e->getMessage());
}
}
return $erroredThreads;
}
}

View File

@ -19,6 +19,8 @@
*
*/
declare(strict_types=1);
namespace pocketmine;
/**
@ -26,9 +28,75 @@ namespace pocketmine;
*/
abstract class Worker extends \Worker{
public final function start($options = PTHREADS_INHERIT_ALL){
/** @var \ClassLoader */
protected $classLoader;
protected $isKilled = false;
public function getClassLoader(){
return $this->classLoader;
}
public function setClassLoader(\ClassLoader $loader = null){
if($loader === null){
$loader = Server::getInstance()->getLoader();
}
$this->classLoader = $loader;
}
/**
* Registers the class loader for this thread.
*
* WARNING: This method MUST be called from any descendent threads' run() method to make autoloading usable.
* If you do not do this, you will not be able to use new classes that were not loaded when the thread was started
* (unless you are using a custom autoloader).
*/
public function registerClassLoader(){
require(\pocketmine\PATH . "vendor/autoload.php");
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");
require(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
}
if($this->classLoader !== null){
$this->classLoader->register(false);
}
}
public function start(?int $options = \PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
return parent::start($options);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){
if($this->getClassLoader() === null){
$this->setClassLoader();
}
return parent::start($options);
}
return false;
}
}
/**
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/
public function quit(){
$this->isKilled = true;
$this->notify();
if($this->isRunning()){
$this->shutdown();
$this->notify();
$this->unstack();
}elseif(!$this->isJoined()){
if(!$this->isTerminated()){
$this->join();
}
}
ThreadManager::getInstance()->remove($this);
}
public function getThreadName() : string{
return (new \ReflectionClass($this))->getShortName();
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class ActivatorRail extends Rail{
protected $id = self::ACTIVATOR_RAIL;
public function getName() : string{
return "Activator Rail";
}
//TODO
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,37 +15,67 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
/**
* Air block
*/
class Air extends Transparent{
public $isActivable = false;
public $breakable = false;
public $isFlowable = true;
public $isTransparent = true;
public $isReplaceable = true;
public $isPlaceable = false;
public $hasPhysics = false;
public $isSolid = false;
public $isFullBlock = true;
protected $id = self::AIR;
protected $meta = 0;
protected $name = "Air";
protected $hardness = 0;
public function __construct(){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Air";
}
public function canPassThrough() : bool{
return true;
}
public function isBreakable(Item $item) : bool{
return false;
}
public function canBeFlowedInto() : bool{
return true;
}
public function canBeReplaced() : bool{
return true;
}
public function canBePlaced() : bool{
return false;
}
public function isSolid() : bool{
return false;
}
public function getBoundingBox(){
return null;
}
public function getHardness() : float{
return -1;
}
public function getBlastResistance() : float{
return 0;
}
}

View File

@ -0,0 +1,93 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\inventory\AnvilInventory;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Anvil extends Fallable{
const TYPE_NORMAL = 0;
const TYPE_SLIGHTLY_DAMAGED = 4;
const TYPE_VERY_DAMAGED = 8;
protected $id = self::ANVIL;
public function isSolid() : bool{
return false;
}
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness() : float{
return 5;
}
public function getBlastResistance() : float{
return 6000;
}
public function getName() : string{
static $names = [
self::TYPE_NORMAL => "Anvil",
self::TYPE_SLIGHTLY_DAMAGED => "Slightly Damaged Anvil",
self::TYPE_VERY_DAMAGED => "Very Damaged Anvil"
];
return $names[$this->meta & 0x0c] ?? "Anvil";
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function onActivate(Item $item, Player $player = null) : bool{
if($player instanceof Player){
$player->addWindow(new AnvilInventory($this));
}
return true;
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$direction = ($player !== null ? $player->getDirection() : 0) & 0x03;
$this->meta = ($this->meta & 0x0c) | $direction;
return $this->getLevel()->setBlock($blockReplace, $this, true, true);
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
ItemFactory::get($this->getItemId(), $this->getDamage() & 0x0c, 1)
];
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,27 +15,50 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\event\TranslationContainer;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\network\protocol\ChatPacket;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Bed as TileBed;
use pocketmine\tile\Tile;
use pocketmine\utils\TextFormat;
class Bed extends Transparent{
public function __construct($type = 0){
parent::__construct(self::BED_BLOCK, $type, "Bed Block");
$this->isActivable = true;
$this->isFullBlock = false;
$this->hardness = 1;
const BITFLAG_OCCUPIED = 0x04;
const BITFLAG_HEAD = 0x08;
protected $id = self::BED_BLOCK;
protected $itemId = Item::BED;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
public function getHardness() : float{
return 0.2;
}
public function getName() : string{
return "Bed Block";
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
@ -46,71 +69,135 @@ class Bed extends Transparent{
);
}
public function onActivate(Item $item, Player $player = null){
public function isHeadPart() : bool{
return ($this->meta & self::BITFLAG_HEAD) !== 0;
}
$time = $this->getLevel()->getTime() % Level::TIME_FULL;
/**
* @return bool
*/
public function isOccupied() : bool{
return ($this->meta & self::BITFLAG_OCCUPIED) !== 0;
}
$isNight = ($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE);
if($player instanceof Player and !$isNight){
$pk = new ChatPacket;
$pk->message = "You can only sleep at night";
$player->dataPacket($pk);
return true;
public function setOccupied(bool $occupied = true){
if($occupied){
$this->meta |= self::BITFLAG_OCCUPIED;
}else{
$this->meta &= ~self::BITFLAG_OCCUPIED;
}
$blockNorth = $this->getSide(2); //Gets the blocks around them
$blockSouth = $this->getSide(3);
$blockEast = $this->getSide(5);
$blockWest = $this->getSide(4);
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
$b = $this;
}else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$b = $blockNorth;
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$b = $blockSouth;
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$b = $blockEast;
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$b = $blockWest;
}else{
if($player instanceof Player){
$pk = new ChatPacket;
$pk->message = "This bed is incomplete";
$player->dataPacket($pk);
}
$this->getLevel()->setBlock($this, $this, false, false);
if(($other = $this->getOtherHalf()) !== null and !$other->isOccupied()){
$other->setOccupied($occupied);
}
}
/**
* @param int $meta
* @param bool $isHead
*
* @return int
*/
public static function getOtherHalfSide(int $meta, bool $isHead = false) : int{
$rotation = $meta & 0x03;
$side = -1;
switch($rotation){
case 0x00: //South
$side = Vector3::SIDE_SOUTH;
break;
case 0x01: //West
$side = Vector3::SIDE_WEST;
break;
case 0x02: //North
$side = Vector3::SIDE_NORTH;
break;
case 0x03: //East
$side = Vector3::SIDE_EAST;
break;
}
if($isHead){
$side = Vector3::getOppositeSide($side);
}
return $side;
}
/**
* @return Bed|null
*/
public function getOtherHalf(){
$other = $this->getSide(self::getOtherHalfSide($this->meta, $this->isHeadPart()));
if($other instanceof Bed and $other->getId() === $this->getId() and $other->isHeadPart() !== $this->isHeadPart() and (($other->getDamage() & 0x03) === ($this->getDamage() & 0x03))){
return $other;
}
return null;
}
public function onActivate(Item $item, Player $player = null) : bool{
if($player !== null){
$other = $this->getOtherHalf();
if($other === null){
$player->sendMessage(TextFormat::GRAY . "This bed is incomplete");
return true;
}elseif($player->distanceSquared($this) > 4 and $player->distanceSquared($other) > 4){
//MCPE doesn't have messages for bed too far away
return true;
}
$time = $this->getLevel()->getTime() % Level::TIME_FULL;
$isNight = ($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE);
if(!$isNight){
$player->sendMessage(new TranslationContainer(TextFormat::GRAY . "%tile.bed.noSleep"));
return true;
}
}
if($player instanceof Player and $player->sleepOn($b) === false){
$pk = new ChatPacket;
$pk->message = "This bed is occupied";
$player->dataPacket($pk);
$b = ($this->isHeadPart() ? $this : $other);
if($b->isOccupied()){
$player->sendMessage(new TranslationContainer(TextFormat::GRAY . "%tile.bed.occupied"));
return true;
}
$player->sleepOn($b);
}
return true;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->isTransparent === false){
$faces = [
0 => 3,
1 => 4,
2 => 2,
3 => 5,
];
$d = $player instanceof Player ? $player->getDirection() : 0;
$next = $this->getSide($faces[(($d + 3) % 4)]);
$downNext = $this->getSide(0);
if($next->isReplaceable === true and $downNext->isTransparent === false){
$meta = (($d + 3) % 4) & 0x03;
$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, true);
$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, true);
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if(!$down->isTransparent()){
$meta = (($player instanceof Player ? $player->getDirection() : 0) - 1) & 0x03;
$next = $this->getSide(self::getOtherHalfSide($meta));
if($next->canBeReplaced() === true and !$next->getSide(Vector3::SIDE_DOWN)->isTransparent()){
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->id, $meta), true, true);
$this->getLevel()->setBlock($next, BlockFactory::get($this->id, $meta | self::BITFLAG_HEAD), true, true);
$nbt = new CompoundTag("", [
new StringTag("id", Tile::BED),
new ByteTag("color", $item->getDamage() & 0x0f),
new IntTag("x", $blockReplace->x),
new IntTag("y", $blockReplace->y),
new IntTag("z", $blockReplace->z)
]);
$nbt2 = clone $nbt;
$nbt2["x"] = $next->x;
$nbt2["z"] = $next->z;
Tile::createTile(Tile::BED, $this->getLevel(), $nbt);
Tile::createTile(Tile::BED, $this->getLevel(), $nbt2);
return true;
}
@ -119,42 +206,30 @@ class Bed extends Transparent{
return false;
}
public function onBreak(Item $item){
$blockNorth = $this->getSide(2); //Gets the blocks around them
$blockSouth = $this->getSide(3);
$blockEast = $this->getSide(5);
$blockWest = $this->getSide(4);
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
if($blockNorth->getID() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
}else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
public function onBreak(Item $item, Player $player = null) : bool{
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true, true);
if(($other = $this->getOtherHalf()) !== null){
$this->getLevel()->useBreakOn($other, $item, $player, $player !== null); //make sure tiles get removed
}
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}
public function getDrops(Item $item){
return [
[Item::BED, 0, 1],
];
public function getDrops(Item $item) : array{
if($this->isHeadPart()){
$tile = $this->getLevel()->getTile($this);
if($tile instanceof TileBed){
return [
ItemFactory::get($this->getItemId(), $tile->getColor(), 1)
];
}else{
return [
ItemFactory::get($this->getItemId(), 14, 1) //Red
];
}
}
return [];
}
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,22 +15,37 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
class Bedrock extends Solid{
public function __construct(){
parent::__construct(self::BEDROCK, 0, "Bedrock");
$this->breakable = false;
$this->hardness = 18000000;
protected $id = self::BEDROCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function isBreakable(Item $item){
public function getName() : string{
return "Bedrock";
}
public function getHardness() : float{
return -1;
}
public function getBlastResistance() : float{
return 18000000;
}
public function isBreakable(Item $item) : bool{
return false;
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,86 +15,39 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\item\ItemFactory;
class Beetroot extends Flowable{
public function __construct($meta = 0){
parent::__construct(self::BEETROOT_BLOCK, $meta, "Beetroot Block");
$this->isActivable = true;
$this->hardness = 0;
class Beetroot extends Crops{
protected $id = self::BEETROOT_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function getName() : string{
return "Beetroot Block";
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$this->meta += mt_rand(2, 5);
if($this->meta > 7){
$this->meta = 7;
}
$this->getLevel()->setBlock($this, $this, true, true);
$item->count--;
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get(Item::BEETROOT_SEEDS, 0, 1));
$this->getLevel()->setBlock($this, new Air(), false);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->getLevel()->setBlock($this, $this, true);
return Level::BLOCK_UPDATE_RANDOM;
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function getDrops(Item $item){
$drops = [];
public function getDrops(Item $item) : array{
if($this->meta >= 0x07){
$drops[] = [Item::BEETROOT, 0, 1];
$drops[] = [Item::BEETROOT_SEEDS, 0, mt_rand(0, 3)];
}else{
$drops[] = [Item::BEETROOT_SEEDS, 0, 1];
return [
ItemFactory::get(Item::BEETROOT, 0, 1),
ItemFactory::get(Item::BEETROOT_SEEDS, 0, mt_rand(0, 3))
];
}
return $drops;
return [
ItemFactory::get(Item::BEETROOT_SEEDS, 0, 1)
];
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,417 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Position;
/**
* Manages block registration and instance creation
*/
class BlockFactory{
/** @var \SplFixedArray<Block> */
private static $list = null;
/** @var \SplFixedArray<Block> */
private static $fullList = null;
/** @var \SplFixedArray<bool> */
public static $solid = null;
/** @var \SplFixedArray<bool> */
public static $transparent = null;
/** @var \SplFixedArray<float> */
public static $hardness = null;
/** @var \SplFixedArray<int> */
public static $light = null;
/** @var \SplFixedArray<int> */
public static $lightFilter = null;
/** @var \SplFixedArray<bool> */
public static $diffusesSkyLight = null;
/** @var \SplFixedArray<float> */
public static $blastResistance = null;
/**
* Initializes the block factory. By default this is called only once on server start, however you may wish to use
* this if you need to reset the block factory back to its original defaults for whatever reason.
*
* @param bool $force
*/
public static function init(bool $force = false){
if(self::$list === null or $force){
self::$list = new \SplFixedArray(256);
self::$fullList = new \SplFixedArray(4096);
self::$light = new \SplFixedArray(256);
self::$lightFilter = new \SplFixedArray(256);
self::$solid = new \SplFixedArray(256);
self::$hardness = new \SplFixedArray(256);
self::$transparent = new \SplFixedArray(256);
self::$diffusesSkyLight = new \SplFixedArray(256);
self::$blastResistance = new \SplFixedArray(256);
self::registerBlock(new Air());
self::registerBlock(new Stone());
self::registerBlock(new Grass());
self::registerBlock(new Dirt());
self::registerBlock(new Cobblestone());
self::registerBlock(new Planks());
self::registerBlock(new Sapling());
self::registerBlock(new Bedrock());
self::registerBlock(new Water());
self::registerBlock(new StillWater());
self::registerBlock(new Lava());
self::registerBlock(new StillLava());
self::registerBlock(new Sand());
self::registerBlock(new Gravel());
self::registerBlock(new GoldOre());
self::registerBlock(new IronOre());
self::registerBlock(new CoalOre());
self::registerBlock(new Wood());
self::registerBlock(new Leaves());
self::registerBlock(new Sponge());
self::registerBlock(new Glass());
self::registerBlock(new LapisOre());
self::registerBlock(new Lapis());
//TODO: DISPENSER
self::registerBlock(new Sandstone());
self::registerBlock(new NoteBlock());
self::registerBlock(new Bed());
self::registerBlock(new PoweredRail());
self::registerBlock(new DetectorRail());
//TODO: STICKY_PISTON
self::registerBlock(new Cobweb());
self::registerBlock(new TallGrass());
self::registerBlock(new DeadBush());
//TODO: PISTON
//TODO: PISTONARMCOLLISION
self::registerBlock(new Wool());
self::registerBlock(new Dandelion());
self::registerBlock(new Flower());
self::registerBlock(new BrownMushroom());
self::registerBlock(new RedMushroom());
self::registerBlock(new Gold());
self::registerBlock(new Iron());
self::registerBlock(new DoubleStoneSlab());
self::registerBlock(new StoneSlab());
self::registerBlock(new Bricks());
self::registerBlock(new TNT());
self::registerBlock(new Bookshelf());
self::registerBlock(new MossyCobblestone());
self::registerBlock(new Obsidian());
self::registerBlock(new Torch());
self::registerBlock(new Fire());
self::registerBlock(new MonsterSpawner());
self::registerBlock(new WoodenStairs(Block::OAK_STAIRS, 0, "Oak Stairs"));
self::registerBlock(new Chest());
//TODO: REDSTONE_WIRE
self::registerBlock(new DiamondOre());
self::registerBlock(new Diamond());
self::registerBlock(new CraftingTable());
self::registerBlock(new Wheat());
self::registerBlock(new Farmland());
self::registerBlock(new Furnace());
self::registerBlock(new BurningFurnace());
self::registerBlock(new SignPost());
self::registerBlock(new WoodenDoor(Block::OAK_DOOR_BLOCK, 0, "Oak Door Block", Item::OAK_DOOR));
self::registerBlock(new Ladder());
self::registerBlock(new Rail());
self::registerBlock(new CobblestoneStairs());
self::registerBlock(new WallSign());
self::registerBlock(new Lever());
self::registerBlock(new StonePressurePlate());
self::registerBlock(new IronDoor());
self::registerBlock(new WoodenPressurePlate());
self::registerBlock(new RedstoneOre());
self::registerBlock(new GlowingRedstoneOre());
self::registerBlock(new RedstoneTorchUnlit());
self::registerBlock(new RedstoneTorch());
self::registerBlock(new StoneButton());
self::registerBlock(new SnowLayer());
self::registerBlock(new Ice());
self::registerBlock(new Snow());
self::registerBlock(new Cactus());
self::registerBlock(new Clay());
self::registerBlock(new Sugarcane());
self::registerBlock(new Fence());
self::registerBlock(new Pumpkin());
self::registerBlock(new Netherrack());
self::registerBlock(new SoulSand());
self::registerBlock(new Glowstone());
//TODO: PORTAL
self::registerBlock(new LitPumpkin());
self::registerBlock(new Cake());
//TODO: REPEATER_BLOCK
//TODO: POWERED_REPEATER
//TODO: INVISIBLEBEDROCK
self::registerBlock(new Trapdoor());
//TODO: MONSTER_EGG
self::registerBlock(new StoneBricks());
self::registerBlock(new BrownMushroomBlock());
self::registerBlock(new RedMushroomBlock());
self::registerBlock(new IronBars());
self::registerBlock(new GlassPane());
self::registerBlock(new Melon());
self::registerBlock(new PumpkinStem());
self::registerBlock(new MelonStem());
self::registerBlock(new Vine());
self::registerBlock(new FenceGate(Block::OAK_FENCE_GATE, 0, "Oak Fence Gate"));
self::registerBlock(new BrickStairs());
self::registerBlock(new StoneBrickStairs());
self::registerBlock(new Mycelium());
self::registerBlock(new WaterLily());
self::registerBlock(new NetherBrick(Block::NETHER_BRICK_BLOCK, 0, "Nether Bricks"));
self::registerBlock(new NetherBrickFence());
self::registerBlock(new NetherBrickStairs());
self::registerBlock(new NetherWartPlant());
self::registerBlock(new EnchantingTable());
self::registerBlock(new BrewingStand());
//TODO: CAULDRON_BLOCK
//TODO: END_PORTAL
self::registerBlock(new EndPortalFrame());
self::registerBlock(new EndStone());
//TODO: DRAGON_EGG
self::registerBlock(new RedstoneLamp());
self::registerBlock(new LitRedstoneLamp());
//TODO: DROPPER
self::registerBlock(new ActivatorRail());
self::registerBlock(new CocoaBlock());
self::registerBlock(new SandstoneStairs());
self::registerBlock(new EmeraldOre());
//TODO: ENDER_CHEST
self::registerBlock(new TripwireHook());
self::registerBlock(new Tripwire());
self::registerBlock(new Emerald());
self::registerBlock(new WoodenStairs(Block::SPRUCE_STAIRS, 0, "Spruce Stairs"));
self::registerBlock(new WoodenStairs(Block::BIRCH_STAIRS, 0, "Birch Stairs"));
self::registerBlock(new WoodenStairs(Block::JUNGLE_STAIRS, 0, "Jungle Stairs"));
//TODO: COMMAND_BLOCK
//TODO: BEACON
self::registerBlock(new CobblestoneWall());
self::registerBlock(new FlowerPot());
self::registerBlock(new Carrot());
self::registerBlock(new Potato());
self::registerBlock(new WoodenButton());
self::registerBlock(new Skull());
self::registerBlock(new Anvil());
self::registerBlock(new TrappedChest());
self::registerBlock(new WeightedPressurePlateLight());
self::registerBlock(new WeightedPressurePlateHeavy());
//TODO: COMPARATOR_BLOCK
//TODO: POWERED_COMPARATOR
self::registerBlock(new DaylightSensor());
self::registerBlock(new Redstone());
self::registerBlock(new NetherQuartzOre());
//TODO: HOPPER_BLOCK
self::registerBlock(new Quartz());
self::registerBlock(new QuartzStairs());
self::registerBlock(new DoubleWoodenSlab());
self::registerBlock(new WoodenSlab());
self::registerBlock(new StainedClay());
self::registerBlock(new StainedGlassPane());
self::registerBlock(new Leaves2());
self::registerBlock(new Wood2());
self::registerBlock(new WoodenStairs(Block::ACACIA_STAIRS, 0, "Acacia Stairs"));
self::registerBlock(new WoodenStairs(Block::DARK_OAK_STAIRS, 0, "Dark Oak Stairs"));
//TODO: SLIME
self::registerBlock(new IronTrapdoor());
self::registerBlock(new Prismarine());
self::registerBlock(new SeaLantern());
self::registerBlock(new HayBale());
self::registerBlock(new Carpet());
self::registerBlock(new HardenedClay());
self::registerBlock(new Coal());
self::registerBlock(new PackedIce());
self::registerBlock(new DoublePlant());
//TODO: DAYLIGHT_DETECTOR_INVERTED
//TODO: RED_SANDSTONE
//TODO: RED_SANDSTONE_STAIRS
//TODO: DOUBLE_STONE_SLAB2
//TODO: STONE_SLAB2
self::registerBlock(new FenceGate(Block::SPRUCE_FENCE_GATE, 0, "Spruce Fence Gate"));
self::registerBlock(new FenceGate(Block::BIRCH_FENCE_GATE, 0, "Birch Fence Gate"));
self::registerBlock(new FenceGate(Block::JUNGLE_FENCE_GATE, 0, "Jungle Fence Gate"));
self::registerBlock(new FenceGate(Block::DARK_OAK_FENCE_GATE, 0, "Dark Oak Fence Gate"));
self::registerBlock(new FenceGate(Block::ACACIA_FENCE_GATE, 0, "Acacia Fence Gate"));
//TODO: REPEATING_COMMAND_BLOCK
//TODO: CHAIN_COMMAND_BLOCK
self::registerBlock(new WoodenDoor(Block::SPRUCE_DOOR_BLOCK, 0, "Spruce Door Block", Item::SPRUCE_DOOR));
self::registerBlock(new WoodenDoor(Block::BIRCH_DOOR_BLOCK, 0, "Birch Door Block", Item::BIRCH_DOOR));
self::registerBlock(new WoodenDoor(Block::JUNGLE_DOOR_BLOCK, 0, "Jungle Door Block", Item::JUNGLE_DOOR));
self::registerBlock(new WoodenDoor(Block::ACACIA_DOOR_BLOCK, 0, "Acacia Door Block", Item::ACACIA_DOOR));
self::registerBlock(new WoodenDoor(Block::DARK_OAK_DOOR_BLOCK, 0, "Dark Oak Door Block", Item::DARK_OAK_DOOR));
self::registerBlock(new GrassPath());
self::registerBlock(new ItemFrame());
//TODO: CHORUS_FLOWER
//TODO: PURPUR_BLOCK
//TODO: PURPUR_STAIRS
//TODO: END_BRICKS
//TODO: FROSTED_ICE
self::registerBlock(new EndRod());
//TODO: END_GATEWAY
self::registerBlock(new Magma());
self::registerBlock(new NetherWartBlock());
self::registerBlock(new NetherBrick(Block::RED_NETHER_BRICK, 0, "Red Nether Bricks"));
self::registerBlock(new BoneBlock());
//TODO: SHULKER_BOX
self::registerBlock(new GlazedTerracotta(Block::PURPLE_GLAZED_TERRACOTTA, 0, "Purple Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::WHITE_GLAZED_TERRACOTTA, 0, "White Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::ORANGE_GLAZED_TERRACOTTA, 0, "Orange Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::MAGENTA_GLAZED_TERRACOTTA, 0, "Magenta Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::LIGHT_BLUE_GLAZED_TERRACOTTA, 0, "Light Blue Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::YELLOW_GLAZED_TERRACOTTA, 0, "Yellow Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::LIME_GLAZED_TERRACOTTA, 0, "Lime Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::PINK_GLAZED_TERRACOTTA, 0, "Pink Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::GRAY_GLAZED_TERRACOTTA, 0, "Grey Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::SILVER_GLAZED_TERRACOTTA, 0, "Light Grey Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::CYAN_GLAZED_TERRACOTTA, 0, "Cyan Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::BLUE_GLAZED_TERRACOTTA, 0, "Blue Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::BROWN_GLAZED_TERRACOTTA, 0, "Brown Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::GREEN_GLAZED_TERRACOTTA, 0, "Green Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::RED_GLAZED_TERRACOTTA, 0, "Red Glazed Terracotta"));
self::registerBlock(new GlazedTerracotta(Block::BLACK_GLAZED_TERRACOTTA, 0, "Black Glazed Terracotta"));
self::registerBlock(new Concrete());
//TODO: CONCRETEPOWDER
//TODO: CHORUS_PLANT
self::registerBlock(new StainedGlass());
self::registerBlock(new Podzol());
self::registerBlock(new Beetroot());
self::registerBlock(new Stonecutter());
self::registerBlock(new GlowingObsidian());
self::registerBlock(new NetherReactor());
//TODO: INFO_UPDATE
//TODO: INFO_UPDATE2
//TODO: MOVINGBLOCK
//TODO: OBSERVER
//TODO: RESERVED6
foreach(self::$list as $id => $block){
if($block === null){
self::registerBlock(new UnknownBlock($id));
}
}
}
}
/**
* Registers a block type into the index. Plugins may use this method to register new block types or override
* existing ones.
*
* NOTE: If you are registering a new block type, you will need to add it to the creative inventory yourself - it
* will not automatically appear there.
*
* @param Block $block
* @param bool $override Whether to override existing registrations
*
* @throws \RuntimeException if something attempted to override an already-registered block without specifying the
* $override parameter.
*/
public static function registerBlock(Block $block, bool $override = false){
$id = $block->getId();
if(!$override and self::isRegistered($id)){
throw new \RuntimeException("Trying to overwrite an already registered block");
}
self::$list[$id] = clone $block;
for($meta = 0; $meta < 16; ++$meta){
$variant = clone $block;
$variant->setDamage($meta);
self::$fullList[($id << 4) | $meta] = $variant;
}
self::$solid[$id] = $block->isSolid();
self::$transparent[$id] = $block->isTransparent();
self::$hardness[$id] = $block->getHardness();
self::$light[$id] = $block->getLightLevel();
self::$lightFilter[$id] = $block->getLightFilter() + 1; //opacity plus 1 standard light filter
self::$diffusesSkyLight[$id] = $block->diffusesSkyLight();
self::$blastResistance[$id] = $block->getBlastResistance();
}
/**
* Returns a new Block instance with the specified ID, meta and position.
*
* @param int $id
* @param int $meta
* @param Position $pos
*
* @return Block
*/
public static function get(int $id, int $meta = 0, Position $pos = null) : Block{
if($meta < 0 or $meta > 0xf){
throw new \InvalidArgumentException("Block meta value $meta is out of bounds");
}
try{
if(self::$fullList !== null){
$block = clone self::$fullList[($id << 4) | $meta];
}else{
$block = new UnknownBlock($id, $meta);
}
}catch(\RuntimeException $e){
throw new \InvalidArgumentException("Block ID $id is out of bounds");
}
if($pos !== null){
$block->x = $pos->x;
$block->y = $pos->y;
$block->z = $pos->z;
$block->level = $pos->level;
}
return $block;
}
/**
* @internal
* @return \SplFixedArray
*/
public static function getBlockStatesArray() : \SplFixedArray{
return self::$fullList;
}
/**
* Returns whether a specified block ID is already registered in the block factory.
*
* @param int $id
* @return bool
*/
public static function isRegistered(int $id) : bool{
$b = self::$list[$id];
return $b !== null and !($b instanceof UnknownBlock);
}
}

View File

@ -0,0 +1,279 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
interface BlockIds{
const AIR = 0;
const STONE = 1;
const GRASS = 2;
const DIRT = 3;
const COBBLESTONE = 4;
const PLANKS = 5, WOODEN_PLANKS = 5;
const SAPLING = 6;
const BEDROCK = 7;
const FLOWING_WATER = 8;
const STILL_WATER = 9, WATER = 9;
const FLOWING_LAVA = 10;
const LAVA = 11, STILL_LAVA = 11;
const SAND = 12;
const GRAVEL = 13;
const GOLD_ORE = 14;
const IRON_ORE = 15;
const COAL_ORE = 16;
const LOG = 17, WOOD = 17;
const LEAVES = 18;
const SPONGE = 19;
const GLASS = 20;
const LAPIS_ORE = 21;
const LAPIS_BLOCK = 22;
const DISPENSER = 23;
const SANDSTONE = 24;
const NOTEBLOCK = 25, NOTE_BLOCK = 25;
const BED_BLOCK = 26;
const GOLDEN_RAIL = 27, POWERED_RAIL = 27;
const DETECTOR_RAIL = 28;
const STICKY_PISTON = 29;
const COBWEB = 30, WEB = 30;
const TALLGRASS = 31, TALL_GRASS = 31;
const DEADBUSH = 32, DEAD_BUSH = 32;
const PISTON = 33;
const PISTONARMCOLLISION = 34, PISTON_ARM_COLLISION = 34;
const WOOL = 35;
const DANDELION = 37, YELLOW_FLOWER = 37;
const POPPY = 38, RED_FLOWER = 38;
const BROWN_MUSHROOM = 39;
const RED_MUSHROOM = 40;
const GOLD_BLOCK = 41;
const IRON_BLOCK = 42;
const DOUBLE_STONE_SLAB = 43;
const STONE_SLAB = 44;
const BRICK_BLOCK = 45;
const TNT = 46;
const BOOKSHELF = 47;
const MOSSY_COBBLESTONE = 48, MOSS_STONE = 48;
const OBSIDIAN = 49;
const TORCH = 50;
const FIRE = 51;
const MOB_SPAWNER = 52, MONSTER_SPAWNER = 52;
const OAK_STAIRS = 53, WOODEN_STAIRS = 53;
const CHEST = 54;
const REDSTONE_WIRE = 55;
const DIAMOND_ORE = 56;
const DIAMOND_BLOCK = 57;
const CRAFTING_TABLE = 58, WORKBENCH = 58;
const WHEAT_BLOCK = 59;
const FARMLAND = 60;
const FURNACE = 61;
const BURNING_FURNACE = 62, LIT_FURNACE = 62;
const SIGN_POST = 63, STANDING_SIGN = 63;
const OAK_DOOR_BLOCK = 64, WOODEN_DOOR_BLOCK = 64;
const LADDER = 65;
const RAIL = 66;
const COBBLESTONE_STAIRS = 67, STONE_STAIRS = 67;
const WALL_SIGN = 68;
const LEVER = 69;
const STONE_PRESSURE_PLATE = 70;
const IRON_DOOR_BLOCK = 71;
const WOODEN_PRESSURE_PLATE = 72;
const REDSTONE_ORE = 73;
const GLOWING_REDSTONE_ORE = 74, LIT_REDSTONE_ORE = 74;
const UNLIT_REDSTONE_TORCH = 75;
const LIT_REDSTONE_TORCH = 76, REDSTONE_TORCH = 76;
const STONE_BUTTON = 77;
const SNOW_LAYER = 78;
const ICE = 79;
const SNOW = 80, SNOW_BLOCK = 80;
const CACTUS = 81;
const CLAY_BLOCK = 82;
const REEDS_BLOCK = 83, SUGARCANE_BLOCK = 83;
const JUKEBOX = 84;
const FENCE = 85;
const PUMPKIN = 86;
const NETHERRACK = 87;
const SOUL_SAND = 88;
const GLOWSTONE = 89;
const PORTAL = 90;
const JACK_O_LANTERN = 91, LIT_PUMPKIN = 91;
const CAKE_BLOCK = 92;
const REPEATER_BLOCK = 93, UNPOWERED_REPEATER = 93;
const POWERED_REPEATER = 94;
const INVISIBLEBEDROCK = 95, INVISIBLE_BEDROCK = 95;
const TRAPDOOR = 96, WOODEN_TRAPDOOR = 96;
const MONSTER_EGG = 97;
const STONEBRICK = 98, STONE_BRICK = 98, STONE_BRICKS = 98;
const BROWN_MUSHROOM_BLOCK = 99;
const RED_MUSHROOM_BLOCK = 100;
const IRON_BARS = 101;
const GLASS_PANE = 102;
const MELON_BLOCK = 103;
const PUMPKIN_STEM = 104;
const MELON_STEM = 105;
const VINE = 106, VINES = 106;
const FENCE_GATE = 107, OAK_FENCE_GATE = 107;
const BRICK_STAIRS = 108;
const STONE_BRICK_STAIRS = 109;
const MYCELIUM = 110;
const LILY_PAD = 111, WATERLILY = 111, WATER_LILY = 111;
const NETHER_BRICK_BLOCK = 112;
const NETHER_BRICK_FENCE = 113;
const NETHER_BRICK_STAIRS = 114;
const NETHER_WART_PLANT = 115;
const ENCHANTING_TABLE = 116, ENCHANTMENT_TABLE = 116;
const BREWING_STAND_BLOCK = 117;
const CAULDRON_BLOCK = 118;
const END_PORTAL = 119;
const END_PORTAL_FRAME = 120;
const END_STONE = 121;
const DRAGON_EGG = 122;
const REDSTONE_LAMP = 123;
const LIT_REDSTONE_LAMP = 124;
const DROPPER = 125;
const ACTIVATOR_RAIL = 126;
const COCOA = 127, COCOA_BLOCK = 127;
const SANDSTONE_STAIRS = 128;
const EMERALD_ORE = 129;
const ENDER_CHEST = 130;
const TRIPWIRE_HOOK = 131;
const TRIPWIRE = 132, TRIP_WIRE = 132;
const EMERALD_BLOCK = 133;
const SPRUCE_STAIRS = 134;
const BIRCH_STAIRS = 135;
const JUNGLE_STAIRS = 136;
const COMMAND_BLOCK = 137;
const BEACON = 138;
const COBBLESTONE_WALL = 139, STONE_WALL = 139;
const FLOWER_POT_BLOCK = 140;
const CARROTS = 141, CARROT_BLOCK = 141;
const POTATOES = 142, POTATO_BLOCK = 142;
const WOODEN_BUTTON = 143;
const MOB_HEAD_BLOCK = 144, SKULL_BLOCK = 144;
const ANVIL = 145;
const TRAPPED_CHEST = 146;
const LIGHT_WEIGHTED_PRESSURE_PLATE = 147;
const HEAVY_WEIGHTED_PRESSURE_PLATE = 148;
const COMPARATOR_BLOCK = 149, UNPOWERED_COMPARATOR = 149;
const POWERED_COMPARATOR = 150;
const DAYLIGHT_DETECTOR = 151, DAYLIGHT_SENSOR = 151;
const REDSTONE_BLOCK = 152;
const NETHER_QUARTZ_ORE = 153, QUARTZ_ORE = 153;
const HOPPER_BLOCK = 154;
const QUARTZ_BLOCK = 155;
const QUARTZ_STAIRS = 156;
const DOUBLE_WOODEN_SLAB = 157;
const WOODEN_SLAB = 158;
const STAINED_CLAY = 159, STAINED_HARDENED_CLAY = 159, TERRACOTTA = 159;
const STAINED_GLASS_PANE = 160;
const LEAVES2 = 161;
const LOG2 = 162, WOOD2 = 162;
const ACACIA_STAIRS = 163;
const DARK_OAK_STAIRS = 164;
const SLIME = 165, SLIME_BLOCK = 165;
const IRON_TRAPDOOR = 167;
const PRISMARINE = 168;
const SEALANTERN = 169, SEA_LANTERN = 169;
const HAY_BALE = 170, HAY_BLOCK = 170;
const CARPET = 171;
const HARDENED_CLAY = 172;
const COAL_BLOCK = 173;
const PACKED_ICE = 174;
const DOUBLE_PLANT = 175;
const STANDING_BANNER = 176;
const WALL_BANNER = 177;
const DAYLIGHT_DETECTOR_INVERTED = 178, DAYLIGHT_SENSOR_INVERTED = 178;
const RED_SANDSTONE = 179;
const RED_SANDSTONE_STAIRS = 180;
const DOUBLE_STONE_SLAB2 = 181;
const STONE_SLAB2 = 182;
const SPRUCE_FENCE_GATE = 183;
const BIRCH_FENCE_GATE = 184;
const JUNGLE_FENCE_GATE = 185;
const DARK_OAK_FENCE_GATE = 186;
const ACACIA_FENCE_GATE = 187;
const REPEATING_COMMAND_BLOCK = 188;
const CHAIN_COMMAND_BLOCK = 189;
const SPRUCE_DOOR_BLOCK = 193;
const BIRCH_DOOR_BLOCK = 194;
const JUNGLE_DOOR_BLOCK = 195;
const ACACIA_DOOR_BLOCK = 196;
const DARK_OAK_DOOR_BLOCK = 197;
const GRASS_PATH = 198;
const FRAME_BLOCK = 199, ITEM_FRAME_BLOCK = 199;
const CHORUS_FLOWER = 200;
const PURPUR_BLOCK = 201;
const PURPUR_STAIRS = 203;
const UNDYED_SHULKER_BOX = 205;
const END_BRICKS = 206;
const FROSTED_ICE = 207;
const END_ROD = 208;
const END_GATEWAY = 209;
const MAGMA = 213;
const NETHER_WART_BLOCK = 214;
const RED_NETHER_BRICK = 215;
const BONE_BLOCK = 216;
const SHULKER_BOX = 218;
const PURPLE_GLAZED_TERRACOTTA = 219;
const WHITE_GLAZED_TERRACOTTA = 220;
const ORANGE_GLAZED_TERRACOTTA = 221;
const MAGENTA_GLAZED_TERRACOTTA = 222;
const LIGHT_BLUE_GLAZED_TERRACOTTA = 223;
const YELLOW_GLAZED_TERRACOTTA = 224;
const LIME_GLAZED_TERRACOTTA = 225;
const PINK_GLAZED_TERRACOTTA = 226;
const GRAY_GLAZED_TERRACOTTA = 227;
const SILVER_GLAZED_TERRACOTTA = 228;
const CYAN_GLAZED_TERRACOTTA = 229;
const BLUE_GLAZED_TERRACOTTA = 231;
const BROWN_GLAZED_TERRACOTTA = 232;
const GREEN_GLAZED_TERRACOTTA = 233;
const RED_GLAZED_TERRACOTTA = 234;
const BLACK_GLAZED_TERRACOTTA = 235;
const CONCRETE = 236;
const CONCRETEPOWDER = 237, CONCRETE_POWDER = 237;
const CHORUS_PLANT = 240;
const STAINED_GLASS = 241;
const PODZOL = 243;
const BEETROOT_BLOCK = 244;
const STONECUTTER = 245;
const GLOWINGOBSIDIAN = 246, GLOWING_OBSIDIAN = 246;
const NETHERREACTOR = 247, NETHER_REACTOR = 247;
const INFO_UPDATE = 248;
const INFO_UPDATE2 = 249;
const MOVINGBLOCK = 250, MOVING_BLOCK = 250;
const OBSERVER = 251;
const STRUCTURE_BLOCK = 252;
const RESERVED6 = 255;
}

View File

@ -0,0 +1,69 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotationHelper;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\Vector3;
use pocketmine\Player;
class BoneBlock extends Solid{
protected $id = Block::BONE_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Bone Block";
}
public function getHardness() : float{
return 2;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face);
return $this->getLevel()->setBlock($blockReplace, $this, true, true);
}
public function getVariantBitmask() : int{
return 0x03;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,17 +15,46 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class Bookshelf extends Solid{
public function __construct(){
parent::__construct(self::BOOKSHELF, 0, "Bookshelf");
$this->hardness = 7.5;
protected $id = self::BOOKSHELF;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Bookshelf";
}
public function getHardness() : float{
return 1.5;
}
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getDrops(Item $item) : array{
return [
ItemFactory::get(Item::BOOK, 0, 3)
];
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -0,0 +1,53 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Tool;
class BrewingStand extends Transparent{
protected $id = self::BREWING_STAND_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Brewing Stand";
}
public function getHardness() : float{
return 0.5;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getVariantBitmask() : int{
return 0;
}
//TODO
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,16 +15,38 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Tool;
class BrickStairs extends Stair{
public function __construct($meta = 0){
parent::__construct(self::BRICK_STAIRS, $meta, "Brick Stairs");
protected $id = self::BRICK_STAIRS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness() : float{
return 2;
}
public function getBlastResistance() : float{
return 30;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName() : string{
return "Brick Stairs";
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,44 +15,46 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Bricks extends Solid{
public function __construct(){
parent::__construct(self::BRICKS_BLOCK, 0, "Bricks");
$this->hardness = 30;
protected $id = self::BRICK_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
public function getHardness() : float{
return 2;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
return [
[Item::BRICKS_BLOCK, 0, 1],
];
}else{
return [];
public function getBlastResistance() : float{
return 30;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName() : string{
return "Bricks";
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,48 +15,23 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class BrownMushroom extends RedMushroom{
class BrownMushroom extends Flowable{
public function __construct(){
parent::__construct(self::BROWN_MUSHROOM, 0, "Brown Mushroom");
$this->hardness = 0;
protected $id = self::BROWN_MUSHROOM;
public function getName() : string{
return "Brown Mushroom";
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
public function getLightLevel() : int{
return 1;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->isTransparent === false){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
public function getBoundingBox(){
return null;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,22 +15,27 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
class DarkOakWoodStairs extends Stair{
public function __construct($meta = 0){
parent::__construct(self::DARK_OAK_WOOD_STAIRS, $meta, "Dark Oak Wood Stairs");
class BrownMushroomBlock extends RedMushroomBlock{
protected $id = Block::BROWN_MUSHROOM_BLOCK;
public function getName() : string{
return "Brown Mushroom Block";
}
public function getDrops(Item $item){
public function getDrops(Item $item) : array{
return [
[$this->id, 0, 1],
Item::get(Item::BROWN_MUSHROOM, 0, mt_rand(0, 2))
];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,77 +15,102 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\Vector3;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Furnace;
use pocketmine\tile\Furnace as TileFurnace;
use pocketmine\tile\Tile;
class BurningFurnace extends Solid{
public function __construct($meta = 0){
parent::__construct(self::BURNING_FURNACE, $meta, "Burning Furnace");
$this->isActivable = true;
$this->hardness = 17.5;
protected $id = self::BURNING_FURNACE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
public function getName() : string{
return "Burning Furnace";
}
public function getHardness() : float{
return 3.5;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getLightLevel() : int{
return 13;
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$faces = [
0 => 4,
1 => 2,
2 => 5,
3 => 3,
3 => 3
];
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$this->getLevel()->setBlock($blockReplace, $this, true, true);
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::FURNACE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
new Furnace($this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
if($item->hasCustomName()){
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
Tile::createTile("Furnace", $this->getLevel(), $nbt);
return true;
}
public function onBreak(Item $item){
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
if($player instanceof Player){
$t = $this->getLevel()->getTile($this);
$furnace = false;
if($t instanceof Furnace){
$furnace = $t;
}else{
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$furnace = $this->getLevel()->getTile($this);
if(!($furnace instanceof TileFurnace)){
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::FURNACE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$furnace = new Furnace($this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
$furnace = Tile::createTile("Furnace", $this->getLevel(), $nbt);
}
if(($player->getGamemode() & 0x01) === 0x01){
return true;
if(isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag){
if($furnace->namedtag->Lock->getValue() !== $item->getCustomName()){
return true;
}
}
$player->addWindow($furnace->getInventory());
@ -94,29 +119,15 @@ class BurningFurnace extends Solid{
return true;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.7;
case 4:
return 0.9;
case 3:
return 1.35;
case 2:
return 0.45;
case 1:
return 2.65;
default:
return 17.5;
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item){
$drops = [];
if($item->isPickaxe() >= 1){
$drops[] = [Item::FURNACE, 0, 1];
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return $drops;
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,74 +15,89 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\event\block\BlockGrowEvent;
use pocketmine\event\entity\EntityDamageByBlockEvent;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3 as Vector3;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\Server;
class Cactus extends Transparent{
public function __construct($meta = 0){
parent::__construct(self::CACTUS, $meta, "Cactus");
$this->isFullBlock = false;
$this->hardness = 2;
protected $id = self::CACTUS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
public function getHardness() : float{
return 0.4;
}
public function hasEntityCollision() : bool{
return true;
}
public function getName() : string{
return "Cactus";
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.0625,
$this->y,
$this->y + 0.0625,
$this->z + 0.0625,
$this->x + 0.9375,
$this->y + 1,
$this->y + 0.9375,
$this->z + 0.9375
);
}
public function onEntityCollide(Entity $entity){
$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_CONTACT, 1);
Server::getInstance()->getPluginManager()->callEvent($ev);
if(!$ev->isCancelled()){
$entity->attack($ev->getFinalDamage(), $ev);
}
public function ticksRandomly() : bool{
return true;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->getID() !== self::SAND and $down->getID() !== self::CACTUS){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false);
$this->getLevel()->dropItem($this, Item::get($this->id));
public function onEntityCollide(Entity $entity){
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_CONTACT, 1);
$entity->attack($ev);
}
return;
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){
$this->getLevel()->useBreakOn($this);
}else{
for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side);
if(!$b->isFlowable){
$this->getLevel()->setBlock($this, new Air(), false);
$this->getLevel()->dropItem($this, Item::get($this->id));
return;
if(!$b->canBeFlowedInto()){
$this->getLevel()->useBreakOn($this);
}
}
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== self::CACTUS){
if($this->meta == 0x0F){
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== self::CACTUS){
if($this->meta === 0x0f){
for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getID() === self::AIR){
$this->getLevel()->setBlock($b, new Cactus(), true);
break;
if($b->getId() === self::AIR){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, BlockFactory::get(Block::CACTUS)));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
}
}
}
$this->meta = 0;
@ -91,22 +106,20 @@ class Cactus extends Transparent{
++$this->meta;
$this->getLevel()->setBlock($this, $this);
}
return;
}
}
return false;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::SAND or $down->getID() === self::CACTUS){
$block0 = $this->getSide(2);
$block1 = $this->getSide(3);
$block2 = $this->getSide(4);
$block3 = $this->getSide(5);
if($block0->isTransparent === true and $block1->isTransparent === true and $block2->isTransparent === true and $block3->isTransparent === true){
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::SAND or $down->getId() === self::CACTUS){
$block0 = $this->getSide(Vector3::SIDE_NORTH);
$block1 = $this->getSide(Vector3::SIDE_SOUTH);
$block2 = $this->getSide(Vector3::SIDE_WEST);
$block3 = $this->getSide(Vector3::SIDE_EAST);
if($block0->isTransparent() === true and $block1->isTransparent() === true and $block2->isTransparent() === true and $block3->isTransparent() === true){
$this->getLevel()->setBlock($this, $this, true);
return true;
@ -116,9 +129,7 @@ class Cactus extends Transparent{
return false;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],
];
public function getVariantBitmask() : int{
return 0;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,31 +15,45 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\entity\Effect;
use pocketmine\event\entity\EntityEatBlockEvent;
use pocketmine\item\FoodSource;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Cake extends Transparent{
public function __construct($meta = 0){
parent::__construct(self::CAKE_BLOCK, 0, "Cake Block");
$this->isFullBlock = false;
$this->isActivable = true;
$this->meta = $meta & 0x07;
$this->hardness = 2.5;
class Cake extends Transparent implements FoodSource{
protected $id = self::CAKE_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
$f = (1 + $this->getDamage() * 2) / 16;
public function getHardness() : float{
return 0.5;
}
public function getName() : string{
return "Cake Block";
}
protected function recalculateBoundingBox(){
$f = $this->getDamage() * 0.125; //1 slice width
return new AxisAlignedBB(
$this->x + $f,
$this->x + 0.0625 + $f,
$this->y,
$this->z + 0.0625,
$this->x + 1 - 0.0625,
@ -48,10 +62,10 @@ class Cake extends Transparent{
);
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($blockReplace, $this, true, true);
return true;
}
@ -59,10 +73,10 @@ class Cake extends Transparent{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true);
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true);
return Level::BLOCK_UPDATE_NORMAL;
}
@ -71,24 +85,51 @@ class Cake extends Transparent{
return false;
}
public function getDrops(Item $item){
public function getDrops(Item $item) : array{
return [];
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player and $player->getHealth() < 20){
++$this->meta;
$player->heal(3, "cake");
if($this->meta >= 0x06){
$this->getLevel()->setBlock($this, new Air(), true);
}else{
$this->getLevel()->setBlock($this, $this, true);
}
public function onActivate(Item $item, Player $player = null) : bool{
//TODO: refactor this into generic food handling
if($player instanceof Player and $player->getFood() < $player->getMaxFood()){
$player->getServer()->getPluginManager()->callEvent($ev = new EntityEatBlockEvent($player, $this));
return true;
if(!$ev->isCancelled()){
$player->addFood($ev->getFoodRestore());
$player->addSaturation($ev->getSaturationRestore());
foreach($ev->getAdditionalEffects() as $effect){
$player->addEffect($effect);
}
$this->getLevel()->setBlock($this, $ev->getResidue());
return true;
}
}
return false;
}
}
public function getFoodRestore() : int{
return 2;
}
public function getSaturationRestore() : float{
return 0.4;
}
public function getResidue(){
$clone = clone $this;
$clone->meta++;
if($clone->meta > 0x06){
$clone = BlockFactory::get(Block::AIR);
}
return $clone;
}
/**
* @return Effect[]
*/
public function getAdditionalEffects() : array{
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,45 +15,43 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorBlockMetaHelper;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Carpet extends Flowable{
public function __construct($meta = 0){
parent::__construct(self::CARPET, $meta, "Carpet");
$names = [
0 => "White Carpet",
1 => "Orange Carpet",
2 => "Magenta Carpet",
3 => "Light Blue Carpet",
4 => "Yellow Carpet",
5 => "Lime Carpet",
6 => "Pink Carpet",
7 => "Gray Carpet",
8 => "Light Gray Carpet",
9 => "Cyan Carpet",
10 => "Purple Carpet",
11 => "Blue Carpet",
12 => "Brown Carpet",
13 => "Green Carpet",
14 => "Red Carpet",
15 => "Black Carpet",
];
$this->name = $names[$this->meta];
$this->hardness = 0;
$this->isFullBlock = false;
$this->isSolid = true;
protected $id = self::CARPET;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
public function getHardness() : float{
return 0.1;
}
public function isSolid() : bool{
return true;
}
public function getName() : string{
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Carpet";
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
@ -64,10 +62,10 @@ class Carpet extends Flowable{
);
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($blockReplace, $this, true, true);
return true;
}
@ -75,11 +73,10 @@ class Carpet extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id, $this->meta, 1));
$this->getLevel()->setBlock($this, new Air(), true);
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,87 +15,32 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\item\ItemFactory;
class Carrot extends Flowable{
public function __construct($meta = 0){
parent::__construct(self::CARROT_BLOCK, $meta, "Carrot Block");
$this->isActivable = true;
$this->hardness = 0;
class Carrot extends Crops{
protected $id = self::CARROT_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function getName() : string{
return "Carrot Block";
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$this->meta += mt_rand(2, 5);
if($this->meta > 7){
$this->meta = 7;
}
$this->getLevel()->setBlock($this, $this, true);
$item->count--;
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get(CARROT, 0, 1));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->getLevel()->setBlock($this, $this, true);
return Level::BLOCK_UPDATE_RANDOM;
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function getDrops(Item $item){
$drops = [];
if($this->meta >= 0x07){
$drops[] = [Item::CARROT, 0, mt_rand(1, 4)];
}else{
$drops[] = [Item::CARROT, 0, 1];
}
return $drops;
public function getDrops(Item $item) : array{
return [
ItemFactory::get(Item::CARROT, 0, $this->meta >= 0x07 ? mt_rand(1, 4) : 1)
];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,53 +15,67 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Chest as TileChest;
use pocketmine\tile\Tile;
class Chest extends Transparent{
const SLOTS = 27;
protected $id = self::CHEST;
public function __construct($meta = 0){
parent::__construct(self::CHEST, $meta, "Chest");
$this->isActivable = true;
$this->hardness = 15;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
public function getHardness() : float{
return 2.5;
}
public function getName() : string{
return "Chest";
}
public function getToolType() : int{
return Tool::TYPE_AXE;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.0625,
$this->y,
$this->z + 0.0625,
$this->x + 0.9375,
$this->y + 0.875,
$this->y + 0.9475,
$this->z + 0.9375
);
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$faces = [
0 => 4,
1 => 2,
2 => 5,
3 => 3,
3 => 3
];
$chest = false;
$chest = null;
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
for($side = 2; $side <= 5; ++$side){
@ -71,7 +85,7 @@ class Chest extends Transparent{
continue;
}
$c = $this->getSide($side);
if($c instanceof Chest and $c->getDamage() === $this->meta){
if($c->getId() === $this->id and $c->getDamage() === $this->meta){
$tile = $this->getLevel()->getTile($c);
if($tile instanceof TileChest and !$tile->isPaired()){
$chest = $tile;
@ -80,18 +94,29 @@ class Chest extends Transparent{
}
}
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$this->getLevel()->setBlock($blockReplace, $this, true, true);
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$tile = new TileChest($this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
if($chest instanceof TileChest){
if($item->hasCustomName()){
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
$tile = Tile::createTile("Chest", $this->getLevel(), $nbt);
if($chest instanceof TileChest and $tile instanceof TileChest){
$chest->pairWith($tile);
$tile->pairWith($chest);
}
@ -99,52 +124,54 @@ class Chest extends Transparent{
return true;
}
public function onBreak(Item $item){
public function onBreak(Item $item, Player $player = null) : bool{
$t = $this->getLevel()->getTile($this);
if($t instanceof TileChest){
$t->unpair();
}
$this->getLevel()->setBlock($this, new Air(), true, true);
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true, true);
return true;
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
if($player instanceof Player){
$top = $this->getSide(1);
if($top->isTransparent !== true){
return true;
}
$t = $this->getLevel()->getTile($this);
$chest = null;
if($t instanceof TileChest){
$chest = $t;
}else{
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$chest = new TileChest($this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
$chest = Tile::createTile("Chest", $this->getLevel(), $nbt);
}
if(($player->gamemode & 0x01) === 0x01){
if(
!$this->getSide(Vector3::SIDE_UP)->isTransparent() or
($chest->isPaired() and !$chest->getPair()->getBlock()->getSide(Vector3::SIDE_UP)->isTransparent()) or
(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag and $chest->namedtag->Lock->getValue() !== $item->getCustomName())
){
return true;
}
$player->addWindow($chest->getInventory());
}
return true;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],
];
public function getVariantBitmask() : int{
return 0;
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,23 +15,41 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class Clay extends Solid{
public function __construct(){
parent::__construct(self::CLAY_BLOCK, 0, "Clay Block");
$this->hardness = 3;
protected $id = self::CLAY_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getDrops(Item $item){
public function getHardness() : float{
return 0.6;
}
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function getName() : string{
return "Clay Block";
}
public function getDrops(Item $item) : array{
return [
[Item::CLAY, 0, 4],
ItemFactory::get(Item::CLAY_BALL, 0, 4)
];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,44 +15,46 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Coal extends Solid{
public function __construct(){
parent::__construct(self::COAL_BLOCK, 0, "Coal Block");
$this->hardness = 30;
protected $id = self::COAL_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
case 3:
return 1.9;
case 2:
return 0.65;
case 1:
return 3.75;
default:
return 25;
}
public function getHardness() : float{
return 5;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
return [
[Item::COAL_BLOCK, 0, 1],
];
}else{
return [];
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName() : string{
return "Coal Block";
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
public function getFuelTime() : int{
return 16000;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,45 +15,46 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class CoalOre extends Solid{
public function __construct(){
parent::__construct(self::COAL_ORE, 0, "Coal Ore");
$this->hardness = 15;
protected $id = self::COAL_ORE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
case 2:
return 0.4;
case 1:
return 2.25;
default:
return 15;
}
public function getHardness() : float{
return 3;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName() : string{
return "Coal Ore";
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::COAL, 0, 1],
ItemFactory::get(Item::COAL, 0, 1)
];
}else{
return [];
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,44 +15,42 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Cobblestone extends Solid{
public function __construct(){
parent::__construct(self::COBBLESTONE, 0, "Cobblestone");
$this->hardness = 30;
protected $id = self::COBBLESTONE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
return [
[Item::COBBLESTONE, 0, 1],
];
}else{
return [];
public function getName() : string{
return "Cobblestone";
}
public function getHardness() : float{
return 2;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,16 +15,34 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Tool;
class CobblestoneStairs extends Stair{
public function __construct($meta = 0){
parent::__construct(self::COBBLESTONE_STAIRS, $meta, "Cobblestone Stairs");
protected $id = self::COBBLESTONE_STAIRS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness() : float{
return 2;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName() : string{
return "Cobblestone Stairs";
}
}

View File

@ -0,0 +1,94 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
class CobblestoneWall extends Transparent{
const NONE_MOSSY_WALL = 0;
const MOSSY_WALL = 1;
protected $id = self::COBBLESTONE_WALL;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function isSolid() : bool{
return false;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness() : float{
return 2;
}
public function getName() : string{
if($this->meta === 0x01){
return "Mossy Cobblestone Wall";
}
return "Cobblestone Wall";
}
protected function recalculateBoundingBox(){
$north = $this->canConnect($this->getSide(Vector3::SIDE_NORTH));
$south = $this->canConnect($this->getSide(Vector3::SIDE_SOUTH));
$west = $this->canConnect($this->getSide(Vector3::SIDE_WEST));
$east = $this->canConnect($this->getSide(Vector3::SIDE_EAST));
$n = $north ? 0 : 0.25;
$s = $south ? 1 : 0.75;
$w = $west ? 0 : 0.25;
$e = $east ? 1 : 0.75;
if($north and $south and !$west and !$east){
$w = 0.3125;
$e = 0.6875;
}elseif(!$north and !$south and $west and $east){
$n = 0.3125;
$s = 0.6875;
}
return new AxisAlignedBB(
$this->x + $w,
$this->y,
$this->z + $n,
$this->x + $e,
$this->y + 1.5,
$this->z + $s
);
}
public function canConnect(Block $block){
return ($block->getId() !== self::COBBLESTONE_WALL and $block->getId() !== self::FENCE_GATE) ? $block->isSolid() and !$block->isTransparent() : true;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,28 +15,52 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Cobweb extends Flowable{
public function __construct(){
parent::__construct(self::COBWEB, 0, "Cobweb");
$this->isSolid = true;
$this->isFullBlock = false;
$this->hardness = 25;
protected $id = self::COBWEB;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function hasEntityCollision() : bool{
return true;
}
public function getName() : string{
return "Cobweb";
}
public function getHardness() : float{
return 4;
}
public function getToolType() : int{
return Tool::TYPE_SWORD;
}
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
$entity->resetFallDistance();
}
public function getDrops(Item $item){
public function getDrops(Item $item) : array{
//TODO: correct drops
return [];
}
public function diffusesSkyLight() : bool{
return true;
}
}

View File

@ -0,0 +1,39 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class CocoaBlock extends Solid{
protected $id = self::COCOA_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Cocoa Block";
}
//TODO
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,35 +15,44 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorBlockMetaHelper;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\item\Tool;
class Generic extends Block{
class Concrete extends Solid{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
return $this->getLevel()->setBlock($this, $this, true, true);
protected $id = Block::CONCRETE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function isBreakable(Item $item){
return $this->breakable;
public function getName() : string{
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Concrete";
}
public function onBreak(Item $item){
return $this->getLevel()->setBlock($this, new Air(), true, true);
public function getHardness() : float{
return 1.8;
}
public function onUpdate($type){
return false;
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function onActivate(Item $item, Player $player = null){
return $this->isActivable;
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -0,0 +1,63 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\inventory\BigCraftingGrid;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class CraftingTable extends Solid{
protected $id = self::CRAFTING_TABLE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness() : float{
return 2.5;
}
public function getName() : string{
return "Crafting Table";
}
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function onActivate(Item $item, Player $player = null) : bool{
if($player instanceof Player){
$player->setCraftingGrid(new BigCraftingGrid($player));
$player->craftingType = 1;
}
return true;
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -0,0 +1,98 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\event\block\BlockGrowEvent;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\Server;
abstract class Crops extends Flowable{
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
if($blockReplace->getSide(Vector3::SIDE_DOWN)->getId() === Block::FARMLAND){
$this->getLevel()->setBlock($blockReplace, $this, true, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null) : bool{
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$block = clone $this;
$block->meta += mt_rand(2, 5);
if($block->meta > 7){
$block->meta = 7;
}
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
}
$item->count--;
return true;
}
return false;
}
public function ticksRandomly() : bool{
return true;
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) === 1){
if($this->meta < 0x07){
$block = clone $this;
++$block->meta;
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}
}

View File

@ -1,62 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class CyanFlower extends Flowable{
public function __construct(){
parent::__construct(self::POPPY, 0, "Cyan Flower");
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id, 0, 1));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,31 +15,36 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Dandelion extends Flowable{
public function __construct(){
parent::__construct(self::DANDELION, 0, "Dandelion");
$this->hardness = 0;
protected $id = self::DANDELION;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function getName() : string{
return "Dandelion";
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$this->getLevel()->setBlock($block, $this, true, true);
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
$this->getLevel()->setBlock($blockReplace, $this, true, true);
return true;
}
@ -47,12 +52,10 @@ class Dandelion extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get($this->id));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -0,0 +1,47 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class DaylightSensor extends Transparent{
protected $id = self::DAYLIGHT_SENSOR;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Daylight Sensor";
}
public function getHardness() : float{
return 0.2;
}
public function getFuelTime() : int{
return 300;
}
//TODO
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,30 +15,34 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
class DeadBush extends Flowable{
public function __construct(){
parent::__construct(self::DEAD_BUSH, 0, "Dead Bush");
//$this->isReplaceable = true;
$this->hardness = 0;
protected $id = self::DEAD_BUSH;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function getName() : string{
return "Dead Bush";
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class DetectorRail extends Rail{
protected $id = self::DETECTOR_RAIL;
public function getName() : string{
return "Detector Rail";
}
//TODO
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,38 +15,42 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Diamond extends Solid{
public function __construct(){
parent::__construct(self::DIAMOND_BLOCK, 0, "Diamond Block");
$this->hardness = 30;
protected $id = self::DIAMOND_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
default:
return 25;
}
public function getHardness() : float{
return 5;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
[Item::DIAMOND_BLOCK, 0, 1],
];
}else{
return [];
public function getName() : string{
return "Diamond Block";
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_IRON){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,38 +15,45 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class DiamondOre extends Solid{
public function __construct(){
parent::__construct(self::DIAMOND_ORE, 0, "Diamond Ore");
$this->hardness = 15;
protected $id = self::DIAMOND_ORE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getHardness() : float{
return 3;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
public function getName() : string{
return "Diamond Ore";
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::DIAMOND, 0, 1],
ItemFactory::get(Item::DIAMOND, 0, 1)
];
}else{
return [];
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,31 +15,49 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class Dirt extends Solid{
public $isActivable = true;
protected $hardness = 2.5;
protected $id = self::DIRT;
protected $meta = 0;
protected $name = "Dirt";
public function __construct(){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function onActivate(Item $item, Player $player = null){
public function getHardness() : float{
return 0.5;
}
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function getName() : string{
if($this->meta === 1){
return "Coarse Dirt";
}
return "Dirt";
}
public function onActivate(Item $item, Player $player = null) : bool{
if($item->isHoe()){
$item->useOn($this);
$this->getLevel()->setBlock($this, Block::get(Item::FARMLAND, 0), true);
if($this->meta === 1){
$this->getLevel()->setBlock($this, BlockFactory::get(Block::DIRT), true);
}else{
$this->getLevel()->setBlock($this, BlockFactory::get(Block::FARMLAND), true);
}
return true;
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,44 +15,47 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\Server;
abstract class Door extends Transparent{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isSolid = false;
public function isSolid() : bool{
return false;
}
private function getFullDamage(){
$damage = $this->getDamage();
$flag = ($damage & 0x08) > 0;
$isUp = ($damage & 0x08) > 0;
if($flag){
$first = $this->getSide(0)->getDamage();
$second = $damage;
if($isUp){
$down = $this->getSide(Vector3::SIDE_DOWN)->getDamage();
$up = $damage;
}else{
$first = $damage;
$second = $this->getSide(1)->getDamage();
$down = $damage;
$up = $this->getSide(Vector3::SIDE_UP)->getDamage();
}
$flag1 = ($second & 0x01) > 0;
$isRight = ($up & 0x01) > 0;
return $first & 0x07 | ($flag ? 8 : 0) | ($flag1 ? 0x10 : 0);
return $down & 0x07 | ($isUp ? 8 : 0) | ($isRight ? 0x10 : 0);
}
public function getBoundingBox(){
protected function recalculateBoundingBox(){
$f = 0.1875;
$damage = $this->getFullDamage();
@ -66,13 +69,13 @@ abstract class Door extends Transparent{
);
$j = $damage & 0x03;
$flag = (($damage & 0x04) > 0);
$flag1 = (($damage & 0x10) > 0);
$isOpen = (($damage & 0x04) > 0);
$isRight = (($damage & 0x10) > 0);
if($j === 0){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
$this->z,
@ -81,7 +84,7 @@ abstract class Door extends Transparent{
$this->z + $f
);
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -91,7 +94,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x,
$this->y,
$this->z,
@ -101,9 +104,9 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 1){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -112,7 +115,7 @@ abstract class Door extends Transparent{
$this->z + 1
);
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x,
$this->y,
$this->z,
@ -122,7 +125,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x,
$this->y,
$this->z,
@ -132,9 +135,9 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 2){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -143,7 +146,7 @@ abstract class Door extends Transparent{
$this->z + 1
);
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x,
$this->y,
$this->z,
@ -153,7 +156,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -163,9 +166,9 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 3){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
$this->z,
@ -174,7 +177,7 @@ abstract class Door extends Transparent{
$this->z + 1
);
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -184,7 +187,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb->setBounds(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -198,12 +201,12 @@ abstract class Door extends Transparent{
return $bb;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false);
if($this->getSide(1) instanceof Door){
$this->getLevel()->setBlock($this->getSide(1), new Air(), false);
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false);
if($this->getSide(Vector3::SIDE_UP) instanceof Door){
$this->getLevel()->setBlock($this->getSide(Vector3::SIDE_UP), BlockFactory::get(Block::AIR), false);
}
return Level::BLOCK_UPDATE_NORMAL;
@ -213,91 +216,74 @@ abstract class Door extends Transparent{
return false;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if($face === 1){
$blockUp = $this->getSide(1);
$blockDown = $this->getSide(0);
if($blockUp->isReplaceable === false or $blockDown->isTransparent === true){
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
if($face === Vector3::SIDE_UP){
$blockUp = $this->getSide(Vector3::SIDE_UP);
$blockDown = $this->getSide(Vector3::SIDE_DOWN);
if($blockUp->canBeReplaced() === false or $blockDown->isTransparent() === true){
return false;
}
$direction = $player instanceof Player ? $player->getDirection() : 0;
$face = [
$faces = [
0 => 3,
1 => 4,
2 => 2,
3 => 5,
3 => 5
];
$next = $this->getSide($face[(($direction + 2) % 4)]);
$next2 = $this->getSide($face[$direction]);
$next = $this->getSide($faces[($direction + 2) % 4]);
$next2 = $this->getSide($faces[$direction]);
$metaUp = 0x08;
if($next->getID() === $this->id or ($next2->isTransparent === false and $next->isTransparent === true)){ //Door hinge
if($next->getId() === $this->getId() or ($next2->isTransparent() === false and $next->isTransparent() === true)){ //Door hinge
$metaUp |= 0x01;
}
$this->meta = $player->getDirection() & 0x03;
$this->getLevel()->setBlock($block, $this, true, true); //Bottom
$this->getLevel()->setBlock($blockUp, $b = Block::get($this->id, $metaUp), true); //Top
$this->setDamage($player->getDirection() & 0x03);
$this->getLevel()->setBlock($blockReplace, $this, true, true); //Bottom
$this->getLevel()->setBlock($blockUp, $b = BlockFactory::get($this->getId(), $metaUp), true); //Top
return true;
}
return false;
}
public function onBreak(Item $item){
if(($this->meta & 0x08) === 0x08){
$down = $this->getSide(0);
if($down->getID() === $this->id){
$this->getLevel()->setBlock($down, new Air(), true);
public function onBreak(Item $item, Player $player = null) : bool{
if(($this->getDamage() & 0x08) === 0x08){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === $this->getId()){
$this->getLevel()->setBlock($down, BlockFactory::get(Block::AIR), true);
}
}else{
$up = $this->getSide(1);
if($up->getID() === $this->id){
$this->getLevel()->setBlock($up, new Air(), true);
$up = $this->getSide(Vector3::SIDE_UP);
if($up->getId() === $this->getId()){
$this->getLevel()->setBlock($up, BlockFactory::get(Block::AIR), true);
}
}
$this->getLevel()->setBlock($this, new Air(), true);
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true);
return true;
}
public function onActivate(Item $item, Player $player = null){
if(($this->meta & 0x08) === 0x08){ //Top
$down = $this->getSide(0);
if($down->getID() === $this->id){
public function onActivate(Item $item, Player $player = null) : bool{
if(($this->getDamage() & 0x08) === 0x08){ //Top
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === $this->getId()){
$meta = $down->getDamage() ^ 0x04;
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->getID()]);
}
$pk = new LevelEventPacket;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Server::broadcastPacket($players, $pk);
$this->level->setBlock($down, BlockFactory::get($this->getId(), $meta), true);
$this->level->addSound(new DoorSound($this));
return true;
}
return false;
}else{
$this->meta ^= 0x04;
$this->getLevel()->setBlock($this, $this, true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->getID()]);
}
$pk = new LevelEventPacket;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Server::broadcastPacket($players, $pk);
$this->level->setBlock($this, $this, true);
$this->level->addSound(new DoorSound($this));
}
return true;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@ -0,0 +1,129 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
class DoublePlant extends Flowable{
const BITFLAG_TOP = 0x08;
protected $id = self::DOUBLE_PLANT;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function canBeReplaced() : bool{
return $this->meta === 2 or $this->meta === 3; //grass or fern
}
public function getName() : string{
static $names = [
0 => "Sunflower",
1 => "Lilac",
2 => "Double Tallgrass",
3 => "Large Fern",
4 => "Rose Bush",
5 => "Peony"
];
return $names[$this->meta & 0x07] ?? "";
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$id = $blockReplace->getSide(Vector3::SIDE_DOWN)->getId();
if(($id === Block::GRASS or $id === Block::DIRT) and $blockReplace->getSide(Vector3::SIDE_UP)->canBeReplaced()){
$this->getLevel()->setBlock($blockReplace, $this, false, false);
$this->getLevel()->setBlock($blockReplace->getSide(Vector3::SIDE_UP), BlockFactory::get($this->id, $this->meta | self::BITFLAG_TOP), false, false);
return true;
}
return false;
}
/**
* Returns whether this double-plant has a corresponding other half.
* @return bool
*/
public function isValidHalfPlant() : bool{
if($this->meta & self::BITFLAG_TOP){
$other = $this->getSide(Vector3::SIDE_DOWN);
}else{
$other = $this->getSide(Vector3::SIDE_UP);
}
return (
$other->getId() === $this->getId() and
($other->getDamage() & 0x07) === ($this->getDamage() & 0x07) and
($other->getDamage() & self::BITFLAG_TOP) !== ($this->getDamage() & self::BITFLAG_TOP)
);
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(Vector3::SIDE_DOWN);
if(!$this->isValidHalfPlant() or (($this->meta & self::BITFLAG_TOP) === 0 and $down->isTransparent())){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function onBreak(Item $item, Player $player = null) : bool{
if(parent::onBreak($item, $player) and $this->isValidHalfPlant()){
$this->getLevel()->useBreakOn($this->getSide(($this->meta & self::BITFLAG_TOP) !== 0 ? Vector3::SIDE_DOWN : Vector3::SIDE_UP), $item, $player, $player !== null);
}
return false;
}
public function getVariantBitmask() : int{
return 0x07;
}
public function getDrops(Item $item) : array{
if($this->meta & self::BITFLAG_TOP){
if(!$item->isShears() and ($this->meta === 2 or $this->meta === 3)){ //grass or fern
if(mt_rand(0, 24) === 0){
return [
ItemFactory::get(Item::SEEDS, 0, 1)
];
}
return [];
}
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,18 +15,36 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class DoubleSlab extends Solid{
public function __construct($meta = 0){
parent::__construct(self::DOUBLE_SLAB, $meta, "Double Slab");
$names = [
class DoubleStoneSlab extends Solid{
protected $id = self::DOUBLE_STONE_SLAB;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness() : float{
return 2;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName() : string{
static $names = [
0 => "Stone",
1 => "Sandstone",
2 => "Wooden",
@ -34,37 +52,19 @@ class DoubleSlab extends Solid{
4 => "Brick",
5 => "Stone Brick",
6 => "Quartz",
7 => "",
7 => "Nether Brick"
];
$this->name = "Double " . $names[$this->meta & 0x07] . " Slab";
$this->hardness = 30;
return "Double " . $names[$this->meta & 0x07] . " Slab";
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::SLAB, $this->meta & 0x07, 2],
ItemFactory::get(Item::STONE_SLAB, $this->getDamage() & 0x07, 2)
];
}else{
return [];
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,49 +15,49 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class DoubleWoodSlab extends Solid{
public function __construct($meta = 0){
parent::__construct(self::DOUBLE_WOOD_SLAB, $meta, "Double Wooden Slab");
$names = [
class DoubleWoodenSlab extends Solid{
protected $id = self::DOUBLE_WOODEN_SLAB;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness() : float{
return 2;
}
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getName() : string{
static $names = [
0 => "Oak",
1 => "Spruce",
2 => "Birch",
3 => "Jungle",
4 => "Acacia",
5 => "Dark Oak",
5 => "Dark Oak"
];
$this->name = "Double " . $names[$this->meta & 0x07] . " Wooden Slab";
$this->hardness = 15;
return "Double " . ($names[$this->meta & 0x07] ?? "") . " Wooden Slab";
}
public function getBreakTime(Item $item){
switch($item->isAxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 3;
}
}
public function getDrops(Item $item){
public function getDrops(Item $item) : array{
return [
[Item::WOOD_SLAB, $this->meta & 0x07, 2],
ItemFactory::get(Item::WOODEN_SLAB, $this->getDamage() & 0x07, 2)
];
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,38 +15,42 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Emerald extends Solid{
public function __construct(){
parent::__construct(self::EMERALD_BLOCK, 0, "Emerald Block");
$this->hardness = 30;
protected $id = self::EMERALD_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
default:
return 25;
}
public function getHardness() : float{
return 5;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
[Item::EMERALD_BLOCK, 0, 1],
];
}else{
return [];
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName() : string{
return "Emerald Block";
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_IRON){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,38 +15,45 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class EmeraldOre extends Solid{
public function __construct(){
parent::__construct(self::EMERALD_ORE, 0, "Emerald Ore");
$this->hardness = 15;
protected $id = self::EMERALD_ORE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getName() : string{
return "Emerald Ore";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness() : float{
return 3;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::EMERALD, 0, 1],
ItemFactory::get(Item::EMERALD, 0, 1)
];
}else{
return [];
}
return [];
}
}

View File

@ -0,0 +1,101 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\inventory\EnchantInventory;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Tile;
class EnchantingTable extends Transparent{
protected $id = self::ENCHANTING_TABLE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$this->getLevel()->setBlock($blockReplace, $this, true, true);
$nbt = new CompoundTag("", [
new StringTag("id", Tile::ENCHANT_TABLE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
if($item->hasCustomName()){
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
Tile::createTile(Tile::ENCHANT_TABLE, $this->getLevel(), $nbt);
return true;
}
public function getHardness() : float{
return 5;
}
public function getBlastResistance() : float{
return 6000;
}
public function getName() : string{
return "Enchanting Table";
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function onActivate(Item $item, Player $player = null) : bool{
if($player instanceof Player){
//TODO lock
$player->addWindow(new EnchantInventory($this));
}
return true;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -0,0 +1,68 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
class EndPortalFrame extends Solid{
protected $id = self::END_PORTAL_FRAME;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getLightLevel() : int{
return 1;
}
public function getName() : string{
return "End Portal Frame";
}
public function getHardness() : float{
return -1;
}
public function getBlastResistance() : float{
return 18000000;
}
public function isBreakable(Item $item) : bool{
return false;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + (($this->getDamage() & 0x04) > 0 ? 1 : 0.8125),
$this->z + 1
);
}
}

View File

@ -0,0 +1,104 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\Player;
class EndRod extends Flowable{
protected $id = Block::END_ROD;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "End Rod";
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
if($face === Vector3::SIDE_UP or $face === Vector3::SIDE_DOWN){
$this->meta = $face;
}else{
$this->meta = $face ^ 0x01;
}
if($blockClicked instanceof EndRod and $blockClicked->getDamage() === $this->meta){
$this->meta ^= 0x01;
}
return $this->level->setBlock($blockReplace, $this, true, true);
}
public function isSolid() : bool{
return true;
}
public function getLightLevel() : int{
return 14;
}
protected function recalculateBoundingBox(){
$m = $this->meta & ~0x01;
$width = 0.375;
switch($m){
case 0x00: //up/down
return new AxisAlignedBB(
$this->x + $width,
$this->y,
$this->z + $width,
$this->x + 1 - $width,
$this->y + 1,
$this->z + 1 - $width
);
case 0x02: //north/south
return new AxisAlignedBB(
$this->x,
$this->y + $width,
$this->z + $width,
$this->x + 1,
$this->y + 1 - $width,
$this->z + 1 - $width
);
case 0x04: //east/west
return new AxisAlignedBB(
$this->x + $width,
$this->y + $width,
$this->z,
$this->x + 1 - $width,
$this->y + 1 - $width,
$this->z + 1
);
}
return null;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,34 +15,33 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class EndStone extends Solid{
public function __construct(){
parent::__construct(self::END_STONE, 0, "End Stone");
$this->hardness = 45;
protected $id = self::END_STONE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
case 2:
return 0.4;
case 1:
return 2.25;
default:
return 15;
}
public function getName() : string{
return "End Stone";
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness() : float{
return 3;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,59 +15,52 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\Player;
use pocketmine\entity\Entity;
use pocketmine\level\Level;
use pocketmine\entity\FallingBlock;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Double;
use pocketmine\nbt\tag\Float;
use pocketmine\nbt\tag\Byte;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ListTag;
abstract class Fallable extends Solid{
public $hasPhysics = true;
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->getLevel()->setBlock($this, $this, true, true);
return $ret;
}
public function onUpdate($type){
if($this->hasPhysics === true and $type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->getID() === self::AIR or ($down instanceof Liquid)){
$fall = new FallingBlock($this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [
"Pos" => new Enum("Pos", [
new Double("", $this->x + 0.5),
new Double("", $this->y + 0.5),
new Double("", $this->z + 0.5)
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::AIR or ($down instanceof Liquid)){
$this->level->setBlock($this, BlockFactory::get(Block::AIR), true, true);
$fall = Entity::createEntity("FallingSand", $this->getLevel(), new CompoundTag("", [
new ListTag("Pos", [
new DoubleTag("", $this->x + 0.5),
new DoubleTag("", $this->y),
new DoubleTag("", $this->z + 0.5)
]),
//TODO: add random motion with physics
"Motion" => new Enum("Motion", [
new Double("", 0),
new Double("", 0),
new Double("", 0)
new ListTag("Motion", [
new DoubleTag("", 0),
new DoubleTag("", 0),
new DoubleTag("", 0)
]),
"Rotation" => new Enum("Rotation", [
new Float("", 0),
new Float("", 0)
new ListTag("Rotation", [
new FloatTag("", 0),
new FloatTag("", 0)
]),
"Tile" => new Byte("Tile", $this->getID())
new IntTag("TileID", $this->getId()),
new ByteTag("Data", $this->getDamage())
]));
$fall->spawnToAll();
}
return false;
}
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,35 +15,66 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
class Farmland extends Solid{
public function __construct($meta = 0){
parent::__construct(self::FARMLAND, $meta, "Farmland");
$this->hardness = 3;
class Farmland extends Transparent{
protected $id = self::FARMLAND;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
public function getName() : string{
return "Farmland";
}
public function getHardness() : float{
return 0.6;
}
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function ticksRandomly() : bool{
return true;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 0.9375,
$this->y + 1, //TODO: this should be 0.9375, but MCPE currently treats them as a full block (https://bugs.mojang.com/browse/MCPE-12109)
$this->z + 1
);
}
public function getDrops(Item $item){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_RANDOM){
//TODO: hydration
}
return false;
}
public function getDrops(Item $item) : array{
return [
[Item::DIRT, 0, 1],
ItemFactory::get(Item::DIRT, 0, 1)
];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,46 +15,81 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
class Fence extends Transparent{
public function __construct(){
parent::__construct(self::FENCE, 0, "Fence");
$this->isFullBlock = false;
$this->hardness = 15;
const FENCE_OAK = 0;
const FENCE_SPRUCE = 1;
const FENCE_BIRCH = 2;
const FENCE_JUNGLE = 3;
const FENCE_ACACIA = 4;
const FENCE_DARKOAK = 5;
protected $id = self::FENCE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
$flag = $this->canConnect($this->getSide(2));
$flag1 = $this->canConnect($this->getSide(3));
$flag2 = $this->canConnect($this->getSide(4));
$flag3 = $this->canConnect($this->getSide(5));
public function getHardness() : float{
return 2;
}
$f = $flag2 ? 0 : 0.375;
$f1 = $flag3 ? 1 : 0.625;
$f2 = $flag ? 0 : 0.375;
$f3 = $flag1 ? 1 : 0.625;
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getName() : string{
static $names = [
self::FENCE_OAK => "Oak Fence",
self::FENCE_SPRUCE => "Spruce Fence",
self::FENCE_BIRCH => "Birch Fence",
self::FENCE_JUNGLE => "Jungle Fence",
self::FENCE_ACACIA => "Acacia Fence",
self::FENCE_DARKOAK => "Dark Oak Fence"
];
return $names[$this->meta & 0x07] ?? "Unknown";
}
protected function recalculateBoundingBox(){
$north = $this->canConnect($this->getSide(Vector3::SIDE_NORTH));
$south = $this->canConnect($this->getSide(Vector3::SIDE_SOUTH));
$west = $this->canConnect($this->getSide(Vector3::SIDE_WEST));
$east = $this->canConnect($this->getSide(Vector3::SIDE_EAST));
$n = $north ? 0 : 0.375;
$s = $south ? 1 : 0.625;
$w = $west ? 0 : 0.375;
$e = $east ? 1 : 0.625;
return new AxisAlignedBB(
$this->x + $f,
$this->x + $w,
$this->y,
$this->z + $f2,
$this->x + $f1,
$this->y + 1, //TODO: check this, add extra bounding box
$this->z + $f3
$this->z + $n,
$this->x + $e,
$this->y + 1.5,
$this->z + $s
);
}
public function canConnect(Block $block){
return ($block->getID() !== self::FENCE and $block->getID() !== self::FENCE_GATE) ? $block->isSolid : true;
return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();
}
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,42 +15,46 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\Player;
class FenceGate extends Transparent{
public function __construct($meta = 0){
parent::__construct(self::FENCE_GATE, $meta, "Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->hardness = 15;
public function getHardness() : float{
return 2;
}
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getBoundingBox(){
protected function recalculateBoundingBox(){
if(($this->getDamage() & 0x04) > 0){
return null;
}
$i = ($this->getDamage() & 0x03);
if($i === 2 and $i === 0){
if($i === 2 or $i === 0){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z + 0.375,
$this->x + 1,
$this->y + 1,
$this->y + 1.5,
$this->z + 0.625
);
}else{
@ -59,46 +63,36 @@ class FenceGate extends Transparent{
$this->y,
$this->z,
$this->x + 0.625,
$this->y + 1,
$this->y + 1.5,
$this->z + 1
);
}
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$faces = [
0 => 3,
1 => 0,
2 => 1,
3 => 2,
];
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03;
$this->getLevel()->setBlock($block, $this, true, true);
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$this->meta = ($player instanceof Player ? ($player->getDirection() - 1) & 0x03 : 0);
$this->getLevel()->setBlock($blockReplace, $this, true, true);
return true;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],
];
public function getVariantBitmask() : int{
return 0;
}
public function onActivate(Item $item, Player $player = null){
$faces = [
0 => 3,
1 => 0,
2 => 1,
3 => 2,
];
$this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04);
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
public function onActivate(Item $item, Player $player = null) : bool{
$this->meta = (($this->meta ^ 0x04) & ~0x02);
if($player !== null){
$this->meta |= (($player->getDirection() - 1) & 0x02);
}
$this->getLevel()->setBlock($this, $this, true);
$this->getLevel()->setBlock($this, $this, true);
$this->level->addSound(new DoorSound($this));
return true;
}
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,61 +15,100 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\entity\Arrow;
use pocketmine\entity\Entity;
use pocketmine\level\Level;
use pocketmine\event\entity\EntityCombustByBlockEvent;
use pocketmine\event\entity\EntityDamageByBlockEvent;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Server;
class Fire extends Flowable{
public function __construct($meta = 0){
parent::__construct(self::FIRE, $meta, "Fire");
$this->isReplaceable = true;
$this->breakable = false;
$this->isFullBlock = true;
$this->hardness = 0;
protected $id = self::FIRE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function hasEntityCollision() : bool{
return true;
}
public function getName() : string{
return "Fire Block";
}
public function getLightLevel() : int{
return 15;
}
public function isBreakable(Item $item) : bool{
return false;
}
public function canBeReplaced() : bool{
return true;
}
public function ticksRandomly() : bool{
return true;
}
public function onEntityCollide(Entity $entity){
$entity->setOnFire(8);
$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_FIRE, 1);
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
$entity->attack($ev);
$ev = new EntityCombustByBlockEvent($this, $entity, 8);
if($entity instanceof Arrow){
$ev->setCancelled();
}
Server::getInstance()->getPluginManager()->callEvent($ev);
if(!$ev->isCancelled()){
$entity->attack($ev->getFinalDamage(), $ev);
$entity->setOnFire($ev->getDuration());
}
}
public function getDrops(Item $item){
public function getDrops(Item $item) : array{
return [];
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
for($s = 0; $s <= 5; ++$s){
$side = $this->getSide($s);
if($side->getID() !== self::AIR and !($side instanceof Liquid)){
if($side->getId() !== self::AIR and !($side instanceof Liquid)){
return false;
}
}
$this->getLevel()->setBlock($this, new Air(), true);
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true);
return Level::BLOCK_UPDATE_NORMAL;
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== self::NETHERRACK){
$this->getLevel()->setBlock($this, new Air(), true);
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== self::NETHERRACK){
if(mt_rand(0, 2) === 0){
if($this->meta === 0x0F){
$this->level->setBlock($this, BlockFactory::get(Block::AIR));
}else{
$this->meta++;
$this->level->setBlock($this, $this);
}
return Level::BLOCK_UPDATE_NORMAL;
return Level::BLOCK_UPDATE_NORMAL;
}
}
//TODO: fire spread
}
return false;

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,17 +15,33 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
namespace pocketmine\block;
declare(strict_types=1);
namespace pocketmine\block;
abstract class Flowable extends Transparent{
public $isFlowable = true;
public $isFullBlock = false;
public $isSolid = false;
public function canBeFlowedInto() : bool{
return true;
}
public function getHardness() : float{
return 0;
}
public function getBlastResistance() : float{
return 0;
}
public function isSolid() : bool{
return false;
}
protected function recalculateBoundingBox(){
return null;
}
}

View File

@ -0,0 +1,85 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Flower extends Flowable{
const TYPE_POPPY = 0;
const TYPE_BLUE_ORCHID = 1;
const TYPE_ALLIUM = 2;
const TYPE_AZURE_BLUET = 3;
const TYPE_RED_TULIP = 4;
const TYPE_ORANGE_TULIP = 5;
const TYPE_WHITE_TULIP = 6;
const TYPE_PINK_TULIP = 7;
const TYPE_OXEYE_DAISY = 8;
protected $id = self::RED_FLOWER;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
static $names = [
self::TYPE_POPPY => "Poppy",
self::TYPE_BLUE_ORCHID => "Blue Orchid",
self::TYPE_ALLIUM => "Allium",
self::TYPE_AZURE_BLUET => "Azure Bluet",
self::TYPE_RED_TULIP => "Red Tulip",
self::TYPE_ORANGE_TULIP => "Orange Tulip",
self::TYPE_WHITE_TULIP => "White Tulip",
self::TYPE_PINK_TULIP => "Pink Tulip",
self::TYPE_OXEYE_DAISY => "Oxeye Daisy"
];
return $names[$this->meta] ?? "Unknown";
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
$this->getLevel()->setBlock($blockReplace, $this, true);
return true;
}
return false;
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
}

View File

@ -0,0 +1,140 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ShortTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\FlowerPot as TileFlowerPot;
use pocketmine\tile\Tile;
class FlowerPot extends Flowable{
const STATE_EMPTY = 0;
const STATE_FULL = 1;
protected $id = self::FLOWER_POT_BLOCK;
protected $itemId = Item::FLOWER_POT;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Flower Pot Block";
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.3125,
$this->y,
$this->z + 0.3125,
$this->x + 0.6875,
$this->y + 0.375,
$this->z + 0.6875
);
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
return false;
}
$this->getLevel()->setBlock($blockReplace, $this, true, true);
$nbt = new CompoundTag("", [
new StringTag("id", Tile::FLOWER_POT),
new IntTag("x", $blockReplace->x),
new IntTag("y", $blockReplace->y),
new IntTag("z", $blockReplace->z),
new ShortTag("item", 0),
new IntTag("mData", 0)
]);
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
Tile::createTile(Tile::FLOWER_POT, $this->getLevel(), $nbt);
return true;
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function onActivate(Item $item, Player $player = null) : bool{
$pot = $this->getLevel()->getTile($this);
if(!($pot instanceof TileFlowerPot)){
return false;
}
if(!$pot->canAddItem($item)){
return true;
}
$this->setDamage(self::STATE_FULL); //specific damage value is unnecessary, it just needs to be non-zero to show an item.
$this->getLevel()->setBlock($this, $this, true, false);
$pot->setItem($item);
if($player instanceof Player){
if($player->isSurvival()){
$item->setCount($item->getCount() - 1);
$player->getInventory()->setItemInHand($item->getCount() > 0 ? $item : ItemFactory::get(Item::AIR));
}
}
return true;
}
public function getDrops(Item $item) : array{
$items = parent::getDrops($item);
$tile = $this->getLevel()->getTile($this);
if($tile instanceof TileFlowerPot){
$item = $tile->getItem();
if($item->getId() !== Item::AIR){
$items[] = $item;
}
}
return $items;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,18 +15,24 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class Furnace extends BurningFurnace{
public function __construct($meta = 0){
parent::__construct($meta);
$this->id = self::FURNACE;
$this->name = "Furnace";
$this->isActivable = true;
protected $id = self::FURNACE;
public function getName() : string{
return "Furnace";
}
public function getLightLevel() : int{
return 0;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,21 +15,33 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
class Glass extends Transparent{
public function __construct(){
parent::__construct(self::GLASS, 0, "Glass");
$this->hardness = 1.5;
protected $id = self::GLASS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getDrops(Item $item){
public function getName() : string{
return "Glass";
}
public function getHardness() : float{
return 0.3;
}
public function getDrops(Item $item) : array{
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,16 +15,33 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
class GlassPane extends Thin{
public function __construct(){
parent::__construct(self::GLASS_PANE, 0, "Glass Pane");
protected $id = self::GLASS_PANE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Glass Pane";
}
public function getHardness() : float{
return 0.3;
}
public function getDrops(Item $item) : array{
return [];
}
}

View File

@ -0,0 +1,67 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\Vector3;
use pocketmine\Player;
class GlazedTerracotta extends Solid{
public function getHardness() : float{
return 1.4;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
if($player !== null){
$faces = [
0 => 4,
1 => 3,
2 => 5,
3 => 2
];
$this->meta = $faces[(~($player->getDirection() - 1)) & 0x03];
}
return $this->getLevel()->setBlock($blockReplace, $this, true, true);
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,16 +15,36 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class GlowingObsidian extends Solid{
public function __construct($meta = 0){
parent::__construct(self::GLOWING_OBSIDIAN, $meta, "Glowing Obsidian");
protected $id = self::GLOWING_OBSIDIAN;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Glowing Obsidian";
}
public function getLightLevel() : int{
return 12;
}
public function getHardness() : float{
return 10;
}
public function getBlastResistance() : float{
return 50;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,51 +15,35 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
class GlowingRedstoneOre extends Solid{
public function __construct(){
parent::__construct(self::GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore");
$this->hardness = 15;
class GlowingRedstoneOre extends RedstoneOre{
protected $id = self::GLOWING_REDSTONE_ORE;
public function getName() : string{
return "Glowing Redstone Ore";
}
public function onUpdate($type){
public function getLightLevel() : int{
return 9;
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){
$this->getLevel()->setBlock($this, Block::get(Item::REDSTONE_ORE, $this->meta), false, false, true);
$this->getLevel()->setBlock($this, BlockFactory::get(Block::REDSTONE_ORE, $this->meta), false, false);
return Level::BLOCK_UPDATE_WEAK;
}
return false;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
];
}else{
return [];
}
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,23 +15,45 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class Glowstone extends Transparent{
public function __construct(){
parent::__construct(self::GLOWSTONE_BLOCK, 0, "Glowstone");
$this->hardness = 1.5;
protected $id = self::GLOWSTONE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getDrops(Item $item){
public function getName() : string{
return "Glowstone";
}
public function getHardness() : float{
return 0.3;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getLightLevel() : int{
return 15;
}
public function getDrops(Item $item) : array{
return [
[Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)],
ItemFactory::get(Item::GLOWSTONE_DUST, 0, mt_rand(2, 4))
];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,38 +15,42 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Gold extends Solid{
public function __construct(){
parent::__construct(self::GOLD_BLOCK, 0, "Gold Block");
$this->hardness = 30;
protected $id = self::GOLD_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getName() : string{
return "Gold Block";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
[Item::GOLD_BLOCK, 0, 1],
];
}else{
return [];
public function getHardness() : float{
return 3;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_IRON){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,38 +15,42 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class GoldOre extends Solid{
public function __construct(){
parent::__construct(self::GOLD_ORE, 0, "Gold Ore");
$this->hardness = 15;
protected $id = self::GOLD_ORE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getName() : string{
return "Gold Ore";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
[Item::GOLD_ORE, 0, 1],
];
}else{
return [];
public function getHardness() : float{
return 3;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_IRON){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,66 +15,112 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\event\block\BlockSpreadEvent;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
use pocketmine\level\generator\object\TallGrass as TallGrassObject;
use pocketmine\level\Level;
use pocketmine\level\Position;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\utils\Random;
class Grass extends Solid{
public $isActivable = true;
protected $hardness = 3;
protected $id = self::GRASS;
protected $meta = 0;
protected $name = "Grass";
public function __construct(){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getDrops(Item $item){
public function getName() : string{
return "Grass";
}
public function getHardness() : float{
return 0.6;
}
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function getDrops(Item $item) : array{
return [
[Item::DIRT, 0, 1],
ItemFactory::get(Item::DIRT, 0, 1)
];
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_RANDOM){
//TODO: light levels
$x = mt_rand($this->x - 1, $this->x + 1);
$y = mt_rand($this->y - 2, $this->y + 2);
$z = mt_rand($this->z - 1, $this->z + 1);
$block = $this->getLevel()->getBlockIdAt($x, $y, $z);
if($block === Block::DIRT){
$block = Block::get($block, $this->getLevel()->getBlockDataAt($x, $y, $z), new Position($x, $y, $z, $this->getLevel()));
if($block->getSide(1) instanceof Transparent){
$this->getLevel()->setBlock($block, new Grass());
}
}
}
public function ticksRandomly() : bool{
return true;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_RANDOM){
$lightAbove = $this->level->getFullLightAt($this->x, $this->y + 1, $this->z);
if($lightAbove < 4 and BlockFactory::$lightFilter[$this->level->getBlockIdAt($this->x, $this->y + 1, $this->z)] >= 3){ //2 plus 1 standard filter amount
//grass dies
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($this, $this, BlockFactory::get(Block::DIRT)));
if(!$ev->isCancelled()){
$this->level->setBlock($this, $ev->getNewState(), false, false);
}
return Level::BLOCK_UPDATE_RANDOM;
}elseif($lightAbove >= 9){
//try grass spread
$vector = $this->asVector3();
for($i = 0; $i < 4; ++$i){
$vector->x = mt_rand($this->x - 1, $this->x + 1);
$vector->y = mt_rand($this->y - 3, $this->y + 1);
$vector->z = mt_rand($this->z - 1, $this->z + 1);
if(
$this->level->getBlockIdAt($vector->x, $vector->y, $vector->z) !== Block::DIRT or
$this->level->getBlockDataAt($vector->x, $vector->y, $vector->z) === 1 or
$this->level->getFullLightAt($vector->x, $vector->y + 1, $vector->z) < 4 or
BlockFactory::$lightFilter[$this->level->getBlockIdAt($vector->x, $vector->y + 1, $vector->z)] >= 3
){
continue;
}
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($this->level->getBlock($vector), $this, BlockFactory::get(Block::GRASS)));
if(!$ev->isCancelled()){
$this->level->setBlock($vector, $ev->getNewState(), false, false);
}
}
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function onActivate(Item $item, Player $player = null) : bool{
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
$item->count--;
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
return true;
}elseif($item->isHoe()){
$item->useOn($this);
$this->getLevel()->setBlock($this, new Farmland());
$this->getLevel()->setBlock($this, BlockFactory::get(Block::FARMLAND));
return true;
}elseif($item->isShovel() and $this->getSide(Vector3::SIDE_UP)->getId() === Block::AIR){
$item->useOn($this);
$this->getLevel()->setBlock($this, BlockFactory::get(Block::GRASS_PATH));
return true;
}
return false;
}
}
}

View File

@ -0,0 +1,67 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
class GrassPath extends Transparent{
protected $id = self::GRASS_PATH;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Grass Path";
}
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1, //TODO: this should be 0.9375, but MCPE currently treats them as a full block (https://bugs.mojang.com/browse/MCPE-12109)
$this->z + 1
);
}
public function getHardness() : float{
return 0.6;
}
public function getDrops(Item $item) : array{
return [
ItemFactory::get(Item::DIRT, 0, 1)
];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,30 +15,46 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
class Gravel extends Fallable{
public function __construct(){
parent::__construct(self::GRAVEL, 0, "Gravel");
$this->hardness = 3;
protected $id = self::GRAVEL;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getDrops(Item $item){
public function getName() : string{
return "Gravel";
}
public function getHardness() : float{
return 0.6;
}
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function getDrops(Item $item) : array{
if(mt_rand(1, 10) === 1){
return [
[Item::FLINT, 0, 1],
ItemFactory::get(Item::FLINT, 0, 1)
];
}
return [
[Item::GRAVEL, 0, 1],
];
return parent::getDrops($item);
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,35 +15,33 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class HardenedClay extends Solid{
public function __construct(){
parent::__construct(self::HARDENED_CLAY, 0, "Hardened Clay");
$this->hardness = 30;
protected $id = self::HARDENED_CLAY;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.25;
case 4:
return 0.35;
case 3:
return 0.5;
case 2:
return 0.2;
case 1:
return 0.95;
default:
return 6.25;
}
public function getName() : string{
return "Hardened Clay";
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness() : float{
return 1.25;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,41 +15,51 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\Player;
class HayBale extends Solid{
public function __construct($meta = 0){
parent::__construct(self::HAY_BALE, $meta, "Hay Bale");
$this->hardness = 10;
protected $id = self::HAY_BALE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
public function getName() : string{
return "Hay Bale";
}
public function getHardness() : float{
return 0.5;
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$faces = [
0 => 0,
1 => 0,
2 => 0b1000,
3 => 0b1000,
4 => 0b0100,
5 => 0b0100,
5 => 0b0100
];
$this->meta = ($this->meta & 0x03) | $faces[$face];
$this->getLevel()->setBlock($block, $this, true, true);
$this->getLevel()->setBlock($blockReplace, $this, true, true);
return true;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],
];
public function getVariantBitmask() : int{
return 0x03;
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,44 +15,67 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\Player;
class Ice extends Transparent{
public function __construct(){
parent::__construct(self::ICE, 0, "Ice");
$this->hardness = 2.5;
protected $id = self::ICE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function onBreak(Item $item){
$this->getLevel()->setBlock($this, new Water(), true);
public function getName() : string{
return "Ice";
}
public function getHardness() : float{
return 0.5;
}
public function getLightFilter() : int{
return 2;
}
public function getFrictionFactor() : float{
return 0.98;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function onBreak(Item $item, Player $player = null) : bool{
return $this->getLevel()->setBlock($this, BlockFactory::get(Block::WATER), true);
}
public function ticksRandomly() : bool{
return true;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.1;
case 4:
return 0.15;
case 3:
return 0.2;
case 2:
return 0.1;
case 1:
return 0.4;
default:
return 0.75;
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_RANDOM){
if($this->level->getHighestAdjacentBlockLight($this->x, $this->y, $this->z) >= 12){
$this->level->useBreakOn($this);
return $type;
}
}
return false;
}
public function getDrops(Item $item){
public function getDrops(Item $item) : array{
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,40 +15,42 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Iron extends Solid{
public function __construct(){
parent::__construct(self::IRON_BLOCK, 0, "Iron Block");
$this->hardness = 30;
protected $id = self::IRON_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
case 3:
return 1.9;
default:
return 25;
}
public function getName() : string{
return "Iron Block";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 3){
return [
[Item::IRON_BLOCK, 0, 1],
];
}else{
return [];
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness() : float{
return 5;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_STONE){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -15,16 +15,48 @@
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronBars extends Thin{
public function __construct(){
parent::__construct(self::IRON_BARS, 0, "Iron Bars");
protected $id = self::IRON_BARS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
}
public function getName() : string{
return "Iron Bars";
}
public function getHardness() : float{
return 5;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

Some files were not shown because too many files have changed in this diff Show More