Compare commits

...

492 Commits

Author SHA1 Message Date
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
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
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
499 changed files with 15840 additions and 7222 deletions

3
.gitmodules vendored
View File

@ -12,3 +12,6 @@
[submodule "tests/TesterPlugin"]
path = tests/TesterPlugin
url = https://github.com/PocketMine/TesterPlugin.git
[submodule "src/pocketmine/lang/locale"]
path = src/pocketmine/lang/locale
url = https://github.com/PocketMine/PocketMine-Language.git

View File

@ -34,14 +34,13 @@ You must follow these guidelines if you wish to contribute to the PocketMine-MP
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.
* 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.
* Argument lists MAY NOT be split across multiple lines, except long arrays.
```php
<?php

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,14 @@
* (at your option) any later version.
*
* @author PocketMine Team
*
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\event\TranslationContainer;
use pocketmine\utils\TextFormat;
/**
@ -106,10 +107,11 @@ abstract class Achievement{
public static function broadcast(Player $player, $achievementId){
if(isset(Achievement::$list[$achievementId])){
$translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"]]);
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"]);
Server::getInstance()->broadcastMessage($translation);
}else{
$player->sendMessage("You have just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
$player->sendMessage($translation);
}
return true;

View File

@ -14,7 +14,7 @@
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/

View File

@ -0,0 +1,422 @@
<?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;
use pocketmine\event\server\LowMemoryEvent;
use pocketmine\event\Timings;
use pocketmine\scheduler\GarbageCollectionTask;
use pocketmine\utils\Utils;
use pocketmine\utils\UUID;
class MemoryManager{
/** @var Server */
private $server;
private $memoryLimit;
private $globalMemoryLimit;
private $checkRate;
private $checkTicker = 0;
private $lowMemory = false;
private $continuousTrigger = true;
private $continuousTriggerRate;
private $continuousTriggerCount = 0;
private $continuousTriggerTicker = 0;
private $garbageCollectionPeriod;
private $garbageCollectionTicker = 0;
private $garbageCollectionTrigger;
private $garbageCollectionAsync;
private $chunkLimit;
private $chunkCollect;
private $chunkTrigger;
private $chunkCache;
private $cacheTrigger;
/** @var \WeakRef[] */
private $leakWatch = [];
private $leakInfo = [];
private $leakSeed = 0;
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->chunkLimit = (int) $this->server->getProperty("memory.max-chunks.trigger-limit", 96);
$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);
gc_enable();
}
public function isLowMemory(){
return $this->lowMemory;
}
public function canUseChunkCache(){
return !($this->lowMemory and $this->chunkTrigger);
}
public function getViewDistance($distance){
return $this->lowMemory ? min($this->chunkLimit, $distance) : $distance;
}
public function trigger($memory, $limit, $global = false, $triggerCount = 0){
$this->server->getLogger()->debug("[Memory Manager] ".($global ? "Global " : "") ."Low memory triggered, limit ". round(($limit / 1024) / 1024, 2)."MB, using ". round(($memory / 1024) / 1024, 2)."MB");
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("[Memory Manager] Freed " . round(($ev->getMemoryFreed() / 1024) / 1024, 2)."MB, $cycles cycles");
}
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();
}
public function triggerGarbageCollector(){
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;
}
/**
* @param object $object
*
* @return string Object identifier for future checks
*/
public function addObjectWatcher($object){
if(!is_object($object)){
throw new \InvalidArgumentException("Not an object!");
}
$identifier = spl_object_hash($object) . ":" . get_class($object);
if(isset($this->leakInfo[$identifier])){
return $this->leakInfo["id"];
}
$this->leakInfo[$identifier] = [
"id" => $id = md5($identifier . ":" . $this->leakSeed++),
"class" => get_class($object),
"hash" => $identifier
];
$this->leakInfo[$id] = $this->leakInfo[$identifier];
$this->leakWatch[$id] = new \WeakRef($object);
return $id;
}
public function isObjectAlive($id){
if(isset($this->leakWatch[$id])){
return $this->leakWatch[$id]->valid();
}
return false;
}
public function removeObjectWatch($id){
if(!isset($this->leakWatch[$id])){
return;
}
unset($this->leakInfo[$this->leakInfo[$id]["hash"]]);
unset($this->leakInfo[$id]);
unset($this->leakWatch[$id]);
}
public function doObjectCleanup(){
foreach($this->leakWatch as $id => $w){
if(!$w->valid()){
$this->removeObjectWatch($id);
}
}
}
public function getObjectInformation($id, $includeObject = false){
if(!isset($this->leakWatch[$id])){
return null;
}
$valid = false;
$references = 0;
$object = null;
if($this->leakWatch[$id]->acquire()){
$object = $this->leakWatch[$id]->get();
$this->leakWatch[$id]->release();
$valid = true;
$references = getReferenceCount($object, false);
}
return [
"id" => $id,
"class" => $this->leakInfo[$id]["class"],
"hash" => $this->leakInfo[$id]["hash"],
"valid" => $valid,
"references" => $references,
"object" => $includeObject ? $object : null
];
}
public function dumpServerMemory($outputFolder, $maxNesting, $maxStringSize){
gc_disable();
if(!file_exists($outputFolder)){
mkdir($outputFolder, 0777, true);
}
$this->server->getLogger()->notice("[Dump] After the memory dump is done, the server might crash");
$obData = fopen($outputFolder . "/objects.js", "wb+");
$staticProperties = [];
$data = [];
$objects = [];
$refCounts = [];
$this->continueDump($this->server, $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);
$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);
}
$this->continueDump($property->getValue($object), $info["properties"][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
fwrite($obData, "$hash@$className: ". json_encode($info, JSON_UNESCAPED_SLASHES) . "\n");
if(!isset($objects["staticProperties"][$className])){
$staticProperties[$className] = [];
foreach($reflection->getProperties() as $property){
if(!$property->isStatic() or $property->getDeclaringClass()->getName() !== $className){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
$this->continueDump($property->getValue($object), $staticProperties[$className][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
}
}
echo "[Dump] Wrote " . count($objects) . " objects\n";
}while($continue);
file_put_contents($outputFolder . "/staticProperties.js", json_encode($staticProperties, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
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));
echo "[Dump] Finished!\n";
gc_enable();
$this->server->forceShutdown();
}
private function continueDump($from, &$data, &$objects, &$refCounts, $recursion, $maxNesting, $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){
$this->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;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ namespace {
}
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):
@ -67,13 +67,16 @@ namespace {
namespace pocketmine {
use pocketmine\utils\Binary;
use pocketmine\utils\MainLogger;
use pocketmine\utils\ServerKiller;
use pocketmine\utils\Terminal;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
const VERSION = "1.4.1dev";
const API_VERSION = "1.11.0";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.10.4 alpha";
const VERSION = "1.5dev";
const API_VERSION = "1.12.0";
const CODENAME = "活発(Kappatsu)フグ(Fugu)";
const MINECRAFT_VERSION = "v0.11.0 alpha";
const MINECRAFT_VERSION_NETWORK = "0.11.0";
/*
* Startup code. Do not look at it, it may harm you.
@ -95,6 +98,7 @@ namespace pocketmine {
}
if(!class_exists("ClassLoader", false)){
require_once(\pocketmine\PATH . "src/spl/ThreadedFactory.php");
require_once(\pocketmine\PATH . "src/spl/ClassLoader.php");
require_once(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require_once(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
@ -103,7 +107,6 @@ namespace pocketmine {
$autoloader = new CompatibleClassLoader();
$autoloader->addPath(\pocketmine\PATH . "src");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "spl");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "raklib");
$autoloader->register(true);
@ -116,16 +119,17 @@ namespace pocketmine {
ini_set("display_startup_errors", 1);
ini_set("default_charset", "utf-8");
ini_set("memory_limit", "256M"); //Default
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"]) ? $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", (Utils::getOS() !== "win" 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);
@ -312,6 +316,24 @@ namespace pocketmine {
}
}
/**
* @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 = 1, $trace = null){
if($trace === null){
if(function_exists("xdebug_get_function_stack")){
@ -333,10 +355,10 @@ namespace pocketmine {
$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) . " " . (is_array($value) ? "Array()" : @strval($value))) . ", ";
$params .= (is_object($value) ? get_class($value) . " " . (method_exists($value, "__toString") ? $value->__toString() : "object") : gettype($value) . " " . (is_array($value) ? "Array()" : Utils::printable(@strval($value)))) . ", ";
}
}
$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"]) : "") . "(" . (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"] . "(" . Utils::printable(substr($params, 0, -2)) . ")";
}
return $messages;
@ -444,30 +466,19 @@ namespace pocketmine {
$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();
sleep(1);
if($thread->isRunning()){
$thread->detach();
}
}elseif($thread instanceof Worker){
$thread->kill();
sleep(1);
if($thread->isRunning()){
$thread->detach();
}
}
}elseif(!$thread->isJoined()){
$logger->debug("Joining " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->join();
}
$logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->quit();
}
$killer = new ServerKiller(8);
$killer->start();
$killer->detach();
$logger->shutdown();
$logger->join();
echo Terminal::$FORMAT_RESET . "\n";
exit(0);
}

File diff suppressed because it is too large Load Diff

View File

@ -26,13 +26,66 @@ namespace pocketmine;
*/
abstract class Thread extends \Thread{
/** @var \ClassLoader */
protected $classLoader;
public function getClassLoader(){
return $this->classLoader;
}
public function setClassLoader(\ClassLoader $loader = null){
if($loader === null){
$loader = Server::getInstance()->getLoader();
}
$this->classLoader = $loader;
}
public function registerClassLoader(){
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");
require(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
if($this->classLoader !== null){
$this->classLoader->register(true);
}
}
public function start($options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
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(){
if($this->isRunning()){
$this->kill();
$this->detach();
}elseif(!$this->isJoined()){
if(!$this->isTerminated()){
$this->join();
}else{
$this->kill();
$this->detach();
}
}else{
$this->detach();
}
ThreadManager::getInstance()->remove($this);
}
public function getThreadName(){
return (new \ReflectionClass($this))->getShortName();
}
}

View File

@ -26,13 +26,67 @@ namespace pocketmine;
*/
abstract class Worker extends \Worker{
/** @var \ClassLoader */
protected $classLoader;
public function getClassLoader(){
return $this->classLoader;
}
public function setClassLoader(\ClassLoader $loader = null){
if($loader === null){
$loader = Server::getInstance()->getLoader();
}
$this->classLoader = $loader;
}
public function registerClassLoader(){
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");
require(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
if($this->classLoader !== null){
$this->classLoader->register(true);
}
}
public function start($options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated() and !$this->isShutdown()){
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(){
if($this->isRunning()){
$this->unstack();
$this->kill();
$this->detach();
}elseif(!$this->isJoined()){
if(!$this->isTerminated()){
$this->join();
}else{
$this->kill();
$this->detach();
}
}else{
$this->detach();
}
ThreadManager::getInstance()->remove($this);
}
public function getThreadName(){
return (new \ReflectionClass($this))->getShortName();
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class AcaciaWoodStairs extends Stair{
@ -40,4 +41,16 @@ class AcaciaWoodStairs extends Stair{
[$this->id, 0, 1],
];
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 15;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
}

View File

@ -40,6 +40,10 @@ class Air extends Transparent{
return "Air";
}
public function canPassThrough(){
return true;
}
public function isBreakable(Item $item){
return false;
}
@ -64,4 +68,12 @@ class Air extends Transparent{
return null;
}
public function getHardness(){
return -1;
}
public function getResistance(){
return 0;
}
}

View File

@ -24,8 +24,8 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\network\protocol\ChatPacket;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class Bed extends Transparent{
@ -40,7 +40,7 @@ class Bed extends Transparent{
}
public function getHardness(){
return 1;
return 0.2;
}
public function getName(){
@ -65,10 +65,7 @@ class Bed extends Transparent{
$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);
$player->sendMessage(TextFormat::GRAY . "You can only sleep at night");
return true;
}
@ -89,9 +86,7 @@ class Bed extends Transparent{
$b = $blockWest;
}else{
if($player instanceof Player){
$pk = new ChatPacket();
$pk->message = "This bed is incomplete";
$player->dataPacket($pk);
$player->sendMessage(TextFormat::GRAY . "This bed is incomplete");
}
return true;
@ -99,9 +94,7 @@ class Bed extends Transparent{
}
if($player instanceof Player and $player->sleepOn($b) === false){
$pk = new ChatPacket();
$pk->message = "This bed is occupied";
$player->dataPacket($pk);
$player->sendMessage(TextFormat::GRAY . "This bed is occupied");
}
return true;

View File

@ -36,6 +36,10 @@ class Bedrock extends Solid{
}
public function getHardness(){
return -1;
}
public function getResistance(){
return 18000000;
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class BirchWoodStairs extends Stair{
@ -40,4 +41,16 @@ class BirchWoodStairs extends Stair{
[$this->id, 0, 1],
];
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 15;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
}

View File

@ -25,9 +25,11 @@
namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\entity\Squid;
use pocketmine\entity\Villager;
use pocketmine\entity\Zombie;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\level\MovingObjectPosition;
use pocketmine\level\Position;
@ -85,6 +87,7 @@ class Block extends Position implements Metadatable{
const DANDELION = 37;
const ROSE = 38;
const POPPY = 38;
const RED_FLOWER = 38;
const BROWN_MUSHROOM = 39;
const RED_MUSHROOM = 40;
const GOLD_BLOCK = 41;
@ -144,7 +147,6 @@ class Block extends Position implements Metadatable{
const SUGARCANE_BLOCK = 83;
const FENCE = 85;
const FENCE_OAK = 85;
const PUMPKIN = 86;
const NETHERRACK = 87;
const SOUL_SAND = 88;
@ -157,6 +159,8 @@ class Block extends Position implements Metadatable{
const CAKE_BLOCK = 92;
const TRAPDOOR = 96;
const WOODEN_TRAPDOOR = 96;
const WOOD_TRAPDOOR = 96;
const STONE_BRICKS = 98;
const STONE_BRICK = 98;
@ -174,7 +178,8 @@ class Block extends Position implements Metadatable{
const BRICK_STAIRS = 108;
const STONE_BRICK_STAIRS = 109;
const MYCELIUM = 110;
const WATER_LILY = 111;
const LILY_PAD = 111;
const NETHER_BRICKS = 112;
const NETHER_BRICK_BLOCK = 112;
@ -201,6 +206,8 @@ class Block extends Position implements Metadatable{
const CARROT_BLOCK = 141;
const POTATO_BLOCK = 142;
const REDSTONE_BLOCK = 152;
const QUARTZ_BLOCK = 155;
const QUARTZ_STAIRS = 156;
const DOUBLE_WOOD_SLAB = 157;
@ -236,11 +243,8 @@ class Block extends Position implements Metadatable{
const FENCE_GATE_JUNGLE = 185;
const FENCE_GATE_DARK_OAK = 186;
const FENCE_GATE_ACACIA = 187;
const FENCE_SPRUCE = 188;
const FENCE_BIRCH = 189;
const FENCE_JUNGLE = 190;
const FENCE_DARK_OAK = 191;
const FENCE_ACACIA = 192;
const GRASS_PATH = 198;
const PODZOL = 243;
const BEETROOT_BLOCK = 244;
@ -248,286 +252,6 @@ class Block extends Position implements Metadatable{
const GLOWING_OBSIDIAN = 246;
const NETHER_REACTOR = 247;
public static $creative = [
//Building
[Item::COBBLESTONE, 0],
[Item::STONE_BRICKS, 0],
[Item::STONE_BRICKS, 1],
[Item::STONE_BRICKS, 2],
[Item::STONE_BRICKS, 3],
[Item::MOSS_STONE, 0],
[Item::WOODEN_PLANKS, 0],
[Item::WOODEN_PLANKS, 1],
[Item::WOODEN_PLANKS, 2],
[Item::WOODEN_PLANKS, 3],
[Item::WOODEN_PLANKS, 4],
[Item::WOODEN_PLANKS, 5],
[Item::BRICKS, 0],
[Item::STONE, 0],
[Item::STONE, 1],
[Item::STONE, 2],
[Item::STONE, 3],
[Item::STONE, 4],
[Item::STONE, 5],
[Item::STONE, 6],
[Item::DIRT, 0],
[Item::PODZOL, 0],
[Item::GRASS, 0],
[Item::MYCELIUM, 0],
[Item::CLAY_BLOCK, 0],
[Item::HARDENED_CLAY, 0],
[Item::STAINED_CLAY, 0],
[Item::STAINED_CLAY, 7],
[Item::STAINED_CLAY, 6],
[Item::STAINED_CLAY, 5],
[Item::STAINED_CLAY, 4],
[Item::STAINED_CLAY, 3],
[Item::STAINED_CLAY, 2],
[Item::STAINED_CLAY, 1],
[Item::STAINED_CLAY, 15],
[Item::STAINED_CLAY, 14],
[Item::STAINED_CLAY, 13],
[Item::STAINED_CLAY, 12],
[Item::STAINED_CLAY, 11],
[Item::STAINED_CLAY, 10],
[Item::STAINED_CLAY, 9],
[Item::STAINED_CLAY, 8],
[Item::SANDSTONE, 0],
[Item::SANDSTONE, 1],
[Item::SANDSTONE, 2],
[Item::SAND, 0],
[Item::SAND, 1],
[Item::GRAVEL, 0],
[Item::TRUNK, 0],
[Item::TRUNK, 1],
[Item::TRUNK, 2],
[Item::TRUNK, 3],
[Item::TRUNK2, 0],
[Item::TRUNK2, 1],
[Item::NETHER_BRICKS, 0],
[Item::NETHERRACK, 0],
[Item::BEDROCK, 0],
[Item::COBBLESTONE_STAIRS, 0],
[Item::OAK_WOODEN_STAIRS, 0],
[Item::SPRUCE_WOODEN_STAIRS, 0],
[Item::BIRCH_WOODEN_STAIRS, 0],
[Item::JUNGLE_WOODEN_STAIRS, 0],
[Item::ACACIA_WOODEN_STAIRS, 0],
[Item::DARK_OAK_WOODEN_STAIRS, 0],
[Item::BRICK_STAIRS, 0],
[Item::SANDSTONE_STAIRS, 0],
[Item::STONE_BRICK_STAIRS, 0],
[Item::NETHER_BRICKS_STAIRS, 0],
[Item::QUARTZ_STAIRS, 0],
[Item::SLAB, 0],
[Item::SLAB, 1],
[Item::WOODEN_SLAB, 0],
[Item::WOODEN_SLAB, 1],
[Item::WOODEN_SLAB, 2],
[Item::WOODEN_SLAB, 3],
[Item::WOODEN_SLAB, 4],
[Item::WOODEN_SLAB, 5],
[Item::SLAB, 3],
[Item::SLAB, 4],
[Item::SLAB, 5],
[Item::SLAB, 6],
[Item::QUARTZ_BLOCK, 0],
[Item::QUARTZ_BLOCK, 1],
[Item::QUARTZ_BLOCK, 2],
[Item::COAL_ORE, 0],
[Item::IRON_ORE, 0],
[Item::GOLD_ORE, 0],
[Item::DIAMOND_ORE, 0],
[Item::LAPIS_ORE, 0],
[Item::REDSTONE_ORE, 0],
[Item::EMERALD_ORE, 0],
[Item::OBSIDIAN, 0],
[Item::ICE, 0],
[Item::SNOW_BLOCK, 0],
[Item::END_STONE, 0],
//Decoration
[Item::COBBLESTONE_WALL, 0],
[Item::COBBLESTONE_WALL, 1],
//TODO: Lilly Pad
[Item::GOLD_BLOCK, 0],
[Item::IRON_BLOCK, 0],
[Item::DIAMOND_BLOCK, 0],
[Item::LAPIS_BLOCK, 0],
[Item::COAL_BLOCK, 0],
[Item::EMERALD_BLOCK, 0],
[Item::SNOW_LAYER, 0],
[Item::GLASS, 0],
[Item::GLOWSTONE_BLOCK, 0],
[Item::VINES, 0],
[Item::NETHER_REACTOR, 0],
[Item::LADDER, 0],
[Item::SPONGE, 0],
[Item::GLASS_PANE, 0],
[Item::WOODEN_DOOR, 0],
[Item::TRAPDOOR, 0],
[Item::FENCE, 0],
[Item::FENCE_SPRUCE, 0],
[Item::FENCE_BIRCH, 0],
[Item::FENCE_DARK_OAK, 0],
[Item::FENCE_JUNGLE, 0],
[Item::FENCE_GATE, 0],
[Item::FENCE_GATE_BIRCH, 0],
[Item::FENCE_GATE_SPRUCE, 0],
[Item::FENCE_GATE_DARK_OAK, 0],
[Item::FENCE_GATE_JUNGLE, 0],
[Item::FENCE_GATE_ACACIA, 0],
[Item::IRON_BARS, 0],
[Item::BED, 0],
[Item::BOOKSHELF, 0],
[Item::PAINTING, 0],
[Item::WORKBENCH, 0],
[Item::STONECUTTER, 0],
[Item::CHEST, 0],
[Item::FURNACE, 0],
[Item::END_PORTAL, 0],
[Item::DANDELION, 0],
[Item::POPPY, 0],
//TODO: blue orchid
//TODO: Allium
//TODO: Azure Bluet
//TODO: Red Tulip
//TODO: Orange Tulip
//TODO: White Tulip
//TODO: Pink Tulip
//TODO: Oxeye Daisy
//TODO: Lilac
//TODO: Double Tallgrass
//TODO: Large Fern
//TODO: Rose Bush
//TODO: Peony
[Item::BROWN_MUSHROOM, 0],
[Item::RED_MUSHROOM, 0],
//TODO: Mushroom block (brown, cover)
//TODO: Mushroom block (red, cover)
//TODO: Mushroom block (brown, stem)
//TODO: Mushroom block (red, stem)
[Item::CACTUS, 0],
[Item::MELON_BLOCK, 0],
[Item::PUMPKIN, 0],
[Item::LIT_PUMPKIN, 0],
[Item::COBWEB, 0],
[Item::HAY_BALE, 0],
[Item::TALL_GRASS, 1],
[Item::TALL_GRASS, 2],
[Item::DEAD_BUSH, 0],
[Item::SAPLING, 0],
[Item::SAPLING, 1],
[Item::SAPLING, 2],
[Item::SAPLING, 3],
[Item::SAPLING, 4],
[Item::SAPLING, 5],
[Item::LEAVES, 0],
[Item::LEAVES, 1],
[Item::LEAVES, 2],
[Item::LEAVES, 3],
[Item::LEAVES, 3],
[Item::LEAVES2, 0],
[Item::LEAVES2, 1],
[Item::CAKE, 0],
[Item::SIGN, 0],
[Item::MONSTER_SPAWNER, 0],
[Item::WOOL, 0],
[Item::WOOL, 7],
[Item::WOOL, 6],
[Item::WOOL, 5],
[Item::WOOL, 4],
[Item::WOOL, 3],
[Item::WOOL, 2],
[Item::WOOL, 1],
[Item::WOOL, 15],
[Item::WOOL, 14],
[Item::WOOL, 13],
[Item::WOOL, 12],
[Item::WOOL, 11],
[Item::WOOL, 10],
[Item::WOOL, 9],
[Item::WOOL, 8],
[Item::CARPET, 0],
[Item::CARPET, 7],
[Item::CARPET, 6],
[Item::CARPET, 5],
[Item::CARPET, 4],
[Item::CARPET, 3],
[Item::CARPET, 2],
[Item::CARPET, 1],
[Item::CARPET, 15],
[Item::CARPET, 14],
[Item::CARPET, 13],
[Item::CARPET, 12],
[Item::CARPET, 11],
[Item::CARPET, 10],
[Item::CARPET, 9],
[Item::CARPET, 8],
//Tools
//TODO [Item::RAILS, 0],
//TODO [Item::POWERED_RAILS, 0],
[Item::TORCH, 0],
[Item::BUCKET, 0],
[Item::BUCKET, 8],
[Item::BUCKET, 10],
[Item::TNT, 0],
[Item::IRON_HOE, 0],
[Item::IRON_SWORD, 0],
[Item::BOW, 0],
[Item::SHEARS, 0],
[Item::FLINT_AND_STEEL, 0],
[Item::CLOCK, 0],
[Item::COMPASS, 0],
[Item::MINECART, 0],
[Item::SPAWN_EGG, Villager::NETWORK_ID],
//[Item::SPAWN_EGG, 10], //Chicken
//[Item::SPAWN_EGG, 11], //Cow
//[Item::SPAWN_EGG, 12], //Pig
//[Item::SPAWN_EGG, 13], //Sheep
//TODO: Wolf
//TODO: Mooshroom
//TODO: Creeper
//TODO: Enderman
//TODO: Silverfish
//TODO: Skeleton
//TODO: Slime
[Item::SPAWN_EGG, Zombie::NETWORK_ID],
//TODO: PigZombie
//TODO: Replace with Entity constants
//Seeds
[Item::SUGARCANE, 0],
[Item::WHEAT, 0],
[Item::SEEDS, 0],
[Item::MELON_SEEDS, 0],
[Item::PUMPKIN_SEEDS, 0],
[Item::CARROT, 0],
[Item::POTATO, 0],
[Item::BEETROOT_SEEDS, 0],
[Item::EGG, 0],
[Item::DYE, 0],
[Item::DYE, 7],
[Item::DYE, 6],
[Item::DYE, 5],
[Item::DYE, 4],
[Item::DYE, 3],
[Item::DYE, 2],
[Item::DYE, 1],
[Item::DYE, 15],
[Item::DYE, 14],
[Item::DYE, 13],
[Item::DYE, 12],
[Item::DYE, 11],
[Item::DYE, 10],
[Item::DYE, 9],
[Item::DYE, 8],
];
/** @var \SplFixedArray */
public static $list = null;
/** @var \SplFixedArray */
@ -548,7 +272,7 @@ class Block extends Position implements Metadatable{
protected $meta = 0;
/** @var AxisAlignedBB */
protected $boundingBox = null;
public $boundingBox = null;
/**
* Backwards-compatibility with old way to define block properties
@ -615,7 +339,7 @@ class Block extends Position implements Metadatable{
self::$list[self::DEAD_BUSH] = DeadBush::class;
self::$list[self::WOOL] = Wool::class;
self::$list[self::DANDELION] = Dandelion::class;
self::$list[self::POPPY] = Poppy::class;
self::$list[self::RED_FLOWER] = Flower::class;
self::$list[self::BROWN_MUSHROOM] = BrownMushroom::class;
self::$list[self::RED_MUSHROOM] = RedMushroom::class;
self::$list[self::GOLD_BLOCK] = Gold::class;
@ -682,6 +406,7 @@ class Block extends Position implements Metadatable{
self::$list[self::STONE_BRICK_STAIRS] = StoneBrickStairs::class;
self::$list[self::MYCELIUM] = Mycelium::class;
self::$list[self::WATER_LILY] = WaterLily::class;
self::$list[self::NETHER_BRICKS] = NetherBrick::class;
self::$list[self::NETHER_BRICKS_STAIRS] = NetherBrickStairs::class;
@ -700,6 +425,8 @@ class Block extends Position implements Metadatable{
self::$list[self::CARROT_BLOCK] = Carrot::class;
self::$list[self::POTATO_BLOCK] = Potato::class;
self::$list[self::REDSTONE_BLOCK] = Redstone::class;
self::$list[self::QUARTZ_BLOCK] = Quartz::class;
self::$list[self::QUARTZ_STAIRS] = QuartzStairs::class;
self::$list[self::DOUBLE_WOOD_SLAB] = DoubleWoodSlab::class;
@ -723,11 +450,8 @@ class Block extends Position implements Metadatable{
self::$list[self::FENCE_GATE_JUNGLE] = FenceGateJungle::class;
self::$list[self::FENCE_GATE_DARK_OAK] = FenceGateDarkOak::class;
self::$list[self::FENCE_GATE_ACACIA] = FenceGateAcacia::class;
self::$list[self::FENCE_SPRUCE] = FenceSpruce::class;
self::$list[self::FENCE_BIRCH] = FenceBirch::class;
self::$list[self::FENCE_DARK_OAK] = FenceDarkOak::class;
self::$list[self::FENCE_JUNGLE] = FenceJungle::class;
self::$list[self::FENCE_ACACIA] = FenceAcacia::class;
self::$list[self::GRASS_PATH] = GrassPath::class;
self::$list[self::PODZOL] = Podzol::class;
self::$list[self::BEETROOT_BLOCK] = Beetroot::class;
@ -880,6 +604,20 @@ class Block extends Position implements Metadatable{
return 10;
}
/**
* @return int
*/
public function getResistance(){
return $this->getHardness() * 5;
}
/**
* @return int
*/
public function getToolType(){
return Tool::TYPE_NONE;
}
/**
* @return float
*/
@ -945,6 +683,10 @@ class Block extends Position implements Metadatable{
return false;
}
public function canPassThrough(){
return false;
}
/**
* @return string
*/
@ -998,11 +740,11 @@ class Block extends Position implements Metadatable{
* @return array
*/
public function getDrops(Item $item){
if(!isset(self::$list[$this->id])){ //Unknown blocks
if(!isset(self::$list[$this->getId()])){ //Unknown blocks
return [];
}else{
return [
[$this->id, $this->meta, 1],
[$this->getId(), $this->getDamage(), 1],
];
}
}
@ -1015,7 +757,42 @@ class Block extends Position implements Metadatable{
* @return float
*/
public function getBreakTime(Item $item){
return 0.20;
$base = $this->getHardness() * 1.5;
if($this->canBeBrokenWith($item)){
if($this->getToolType() === Tool::TYPE_SHEARS and $item->isShears()){
$base /= 15;
}elseif(
($this->getToolType() === Tool::TYPE_PICKAXE and ($tier = $item->isPickaxe()) !== false) or
($this->getToolType() === Tool::TYPE_AXE and ($tier = $item->isAxe()) !== false) or
($this->getToolType() === Tool::TYPE_SHOVEL and ($tier = $item->isShovel()) !== false)
){
switch($tier){
case Tool::TIER_WOODEN:
$base /= 2;
break;
case Tool::TIER_STONE:
$base /= 4;
break;
case Tool::TIER_IRON:
$base /= 6;
break;
case Tool::TIER_DIAMOND:
$base /= 8;
break;
case Tool::TIER_GOLD:
$base /= 12;
break;
}
}
}else{
$base *= 3.33;
}
return $base;
}
public function canBeBrokenWith(Item $item){
return $this->getHardness() !== -1;
}
/**
@ -1038,20 +815,20 @@ class Block extends Position implements Metadatable{
* @return string
*/
public function __toString(){
return "Block[" . $this->getName() . "] (" . $this->id . ":" . $this->meta . ")";
return "Block[" . $this->getName() . "] (" . $this->getId() . ":" . $this->getDamage() . ")";
}
/**
* Checks for collision against an AxisAlignedBB
*
* @param AxisAlignedBB $bb
* @param Block[] $list
*
* @return bool
*/
public function collidesWithBB(AxisAlignedBB $bb, &$list = []){
public function collidesWithBB(AxisAlignedBB $bb){
$bb2 = $this->getBoundingBox();
if($bb2 !== null and $bb2->intersectsWith($bb)){
$list[] = $bb2;
}
return $bb2 !== null and $bb->intersectsWith($bb2);
}
/**
@ -1065,11 +842,10 @@ class Block extends Position implements Metadatable{
* @return AxisAlignedBB
*/
public function getBoundingBox(){
if($this->boundingBox !== null){
return $this->boundingBox;
}else{
return ($this->boundingBox = $this->recalculateBoundingBox());
if($this->boundingBox === null){
$this->boundingBox = $this->recalculateBoundingBox();
}
return $this->boundingBox;
}
/**
@ -1086,6 +862,12 @@ class Block extends Position implements Metadatable{
);
}
/**
* @param Vector3 $pos1
* @param Vector3 $pos2
*
* @return MovingObjectPosition
*/
public function calculateIntercept(Vector3 $pos1, Vector3 $pos2){
$bb = $this->getBoundingBox();
if($bb === null){
@ -1176,8 +958,10 @@ class Block extends Position implements Metadatable{
public function getMetadata($metadataKey){
if($this->getLevel() instanceof Level){
$this->getLevel()->getBlockMetadata()->getMetadata($this, $metadataKey);
return $this->getLevel()->getBlockMetadata()->getMetadata($this, $metadataKey);
}
return null;
}
public function hasMetadata($metadataKey){
@ -1191,4 +975,4 @@ class Block extends Position implements Metadatable{
$this->getLevel()->getBlockMetadata()->removeMetadata($this, $metadataKey, $plugin);
}
}
}
}

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class Bookshelf extends Solid{
protected $id = self::BOOKSHELF;
@ -35,7 +37,11 @@ class Bookshelf extends Solid{
}
public function getHardness(){
return 7.5;
return 1.5;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
}

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class BrickStairs extends Stair{
protected $id = self::BRICK_STAIRS;
@ -30,6 +32,18 @@ class BrickStairs extends Stair{
$this->meta = $meta;
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 30;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Brick Stairs";
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Bricks extends Solid{
@ -32,30 +33,21 @@ class Bricks extends Solid{
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 30;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Bricks";
}
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){
return [

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
@ -48,7 +49,11 @@ class BurningFurnace extends Solid{
}
public function getHardness(){
return 17.5;
return 3.5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){
@ -64,7 +69,7 @@ class BurningFurnace extends Solid{
];
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound(false, [
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
@ -90,7 +95,7 @@ class BurningFurnace extends Solid{
if($t instanceof Furnace){
$furnace = $t;
}else{
$nbt = new Compound(false, [
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
@ -101,7 +106,7 @@ class BurningFurnace extends Solid{
$furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if(($player->getGamemode() & 0x01) === 0x01){
if($player->isCreative()){
return true;
}
@ -111,23 +116,6 @@ 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 getDrops(Item $item){
$drops = [];
if($item->isPickaxe() >= 1){

View File

@ -41,7 +41,7 @@ class Cactus extends Transparent{
}
public function getHardness(){
return 2;
return 0.4;
}
public function hasEntityCollision(){
@ -56,10 +56,10 @@ class Cactus extends Transparent{
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
);
}

View File

@ -41,7 +41,7 @@ class Cake extends Transparent{
}
public function getHardness(){
return 2.5;
return 0.5;
}
public function getName(){
@ -90,12 +90,12 @@ class Cake extends Transparent{
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player and $player->getHealth() < 20){
if($player instanceof Player and $player->getHealth() < $player->getMaxHealth()){
++$this->meta;
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityRegainHealthEvent($player, 3, EntityRegainHealthEvent::CAUSE_EATING));
if(!$ev->isCancelled()){
$player->heal($ev->getAmount(), $ev);
}
$ev = new EntityRegainHealthEvent($player, 3, EntityRegainHealthEvent::CAUSE_EATING);
$player->heal($ev->getAmount(), $ev);
if($this->meta >= 0x06){
$this->getLevel()->setBlock($this, new Air(), true);
}else{

View File

@ -34,6 +34,10 @@ class Carpet extends Flowable{
$this->meta = $meta;
}
public function getHardness(){
return 0.1;
}
public function isSolid(){
return true;
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
@ -45,13 +46,17 @@ class Chest extends Transparent{
}
public function getHardness(){
return 15;
return 2.5;
}
public function getName(){
return "Chest";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.0625,
@ -91,7 +96,7 @@ class Chest extends Transparent{
}
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound(false, [
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
@ -131,7 +136,7 @@ class Chest extends Transparent{
if($t instanceof TileChest){
$chest = $t;
}else{
$nbt = new Compound(false, [
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Clay extends Solid{
@ -32,7 +33,11 @@ class Clay extends Solid{
}
public function getHardness(){
return 3;
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getName(){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Coal extends Solid{
@ -32,30 +33,17 @@ class Coal extends Solid{
}
public function getHardness(){
return 30;
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Coal Block";
}
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 getDrops(Item $item){
if($item->isPickaxe() >= 1){
return [

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class CoalOre extends Solid{
@ -32,30 +33,17 @@ class CoalOre extends Solid{
}
public function getHardness(){
return 15;
return 3;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Coal Ore";
}
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 getDrops(Item $item){
if($item->isPickaxe() >= 1){
return [

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Cobblestone extends Solid{
@ -31,29 +32,16 @@ class Cobblestone extends Solid{
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Cobblestone";
}
public function getHardness(){
return 30;
}
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;
}
return 2;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class CobblestoneStairs extends Stair{
protected $id = self::COBBLESTONE_STAIRS;
@ -30,6 +32,14 @@ class CobblestoneStairs extends Stair{
$this->meta = $meta;
}
public function getHardness(){
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Cobblestone Stairs";
}

View File

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Cobweb extends Flowable{
@ -41,11 +42,15 @@ class Cobweb extends Flowable{
}
public function getHardness(){
return 25;
return 4;
}
public function getToolType(){
return Tool::TYPE_SWORD;
}
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
$entity->resetFallDistance();
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class DarkOakWoodStairs extends Stair{
@ -35,6 +36,10 @@ class DarkOakWoodStairs extends Stair{
return "Dark Oak Wood Stairs";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Diamond extends Solid{
@ -32,22 +33,15 @@ class Diamond extends Solid{
}
public function getHardness(){
return 30;
return 5;
}
public function getName(){
return "Diamond Block";
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
default:
return 25;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class DiamondOre extends Solid{
@ -32,22 +33,15 @@ class DiamondOre extends Solid{
}
public function getHardness(){
return 15;
return 3;
}
public function getName(){
return "Diamond Ore";
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class Dirt extends Solid{
@ -37,7 +38,11 @@ class Dirt extends Solid{
}
public function getHardness(){
return 2.5;
return 0.5;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getName(){

View File

@ -23,7 +23,9 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\Player;
use pocketmine\Server;
@ -41,19 +43,19 @@ abstract class Door extends Transparent{
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);
}
protected function recalculateBoundingBox(){
@ -71,12 +73,12 @@ 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){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -106,8 +108,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 1){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
@ -137,8 +139,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 2){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -168,8 +170,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 3){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -235,13 +237,13 @@ abstract class Door extends Transparent{
$next = $this->getSide($face[(($direction + 2) % 4)]);
$next2 = $this->getSide($face[$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->setDamage($player->getDirection() & 0x03);
$this->getLevel()->setBlock($block, $this, true, true); //Bottom
$this->getLevel()->setBlock($blockUp, $b = Block::get($this->id, $metaUp), true); //Top
$this->getLevel()->setBlock($blockUp, $b = Block::get($this->getId(), $metaUp), true); //Top
return true;
}
@ -249,14 +251,14 @@ abstract class Door extends Transparent{
}
public function onBreak(Item $item){
if(($this->meta & 0x08) === 0x08){
if(($this->getDamage() & 0x08) === 0x08){
$down = $this->getSide(0);
if($down->getId() === $this->id){
if($down->getId() === $this->getId()){
$this->getLevel()->setBlock($down, new Air(), true);
}
}else{
$up = $this->getSide(1);
if($up->getId() === $this->id){
if($up->getId() === $this->getId()){
$this->getLevel()->setBlock($up, new Air(), true);
}
}
@ -266,23 +268,17 @@ abstract class Door extends Transparent{
}
public function onActivate(Item $item, Player $player = null){
if(($this->meta & 0x08) === 0x08){ //Top
if(($this->getDamage() & 0x08) === 0x08){ //Top
$down = $this->getSide(0);
if($down->getId() === $this->id){
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);
$this->getLevel()->setBlock($down, Block::get($this->getId(), $meta), true);
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->getId()]);
unset($players[$player->getLoaderId()]);
}
$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->addSound(new DoorSound($this));
return true;
}
@ -290,17 +286,11 @@ abstract class Door extends Transparent{
}else{
$this->meta ^= 0x04;
$this->getLevel()->setBlock($this, $this, true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->getId()]);
unset($players[$player->getLoaderId()]);
}
$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->addSound(new DoorSound($this));
}
return true;

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class DoubleSlab extends Solid{
@ -32,7 +33,11 @@ class DoubleSlab extends Solid{
}
public function getHardness(){
return 30;
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
@ -49,23 +54,6 @@ class DoubleSlab extends Solid{
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){
return [

View File

@ -32,7 +32,11 @@ class DoubleWoodSlab extends Solid{
}
public function getHardness(){
return 15;
return 2;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getName(){
@ -49,23 +53,6 @@ class DoubleWoodSlab extends Solid{
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){
return [
[Item::WOOD_SLAB, $this->meta & 0x07, 2],

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Emerald extends Solid{
@ -32,24 +33,17 @@ class Emerald extends Solid{
}
public function getHardness(){
return 30;
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Emerald Block";
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
default:
return 25;
}
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class EmeraldOre extends Solid{
@ -35,19 +36,12 @@ class EmeraldOre extends Solid{
return "Emerald Ore";
}
public function getHardness(){
return 15;
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getHardness(){
return 3;
}
public function getDrops(Item $item){

View File

@ -41,6 +41,10 @@ class EndPortalFrame extends Solid{
}
public function getHardness(){
return -1;
}
public function getResistance(){
return 18000000;
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class EndStone extends Solid{
@ -35,24 +36,11 @@ class EndStone extends Solid{
return "End Stone";
}
public function getHardness(){
return 45;
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
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(){
return 3;
}
}

View File

@ -24,6 +24,7 @@ namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Double;
@ -42,7 +43,7 @@ abstract class Fallable extends Solid{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::AIR or ($down instanceof Liquid)){
$fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [
"Pos" => new Enum("Pos", [

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
class Farmland extends Solid{
@ -37,7 +38,11 @@ class Farmland extends Solid{
}
public function getHardness(){
return 3;
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
protected function recalculateBoundingBox(){

View File

@ -21,48 +21,65 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
class Fence extends Transparent{
protected $id = self::FENCE;
public function __construct(){
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getHardness(){
return 15;
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Oak Fence";
static $names = [
0 => "Oak Fence",
1 => "Spruce Fence",
2 => "Birch Fence",
3 => "Jungle Fence",
4 => "Acacia Fence",
5 => "Dark Oak Fence",
"",
""
];
return $names[$this->meta & 0x07];
}
protected function recalculateBoundingBox(){
$flag = $this->canConnect($this->getSide(2));
$flag1 = $this->canConnect($this->getSide(3));
$flag2 = $this->canConnect($this->getSide(4));
$flag3 = $this->canConnect($this->getSide(5));
$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));
$f = $flag2 ? 0 : 0.375;
$f1 = $flag3 ? 1 : 0.625;
$f2 = $flag ? 0 : 0.375;
$f3 = $flag1 ? 1 : 0.625;
$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->z + $n,
$this->x + $e,
$this->y + 1.5,
$this->z + $f3
$this->z + $s
);
}
public function canConnect(Block $block){
return (!($block instanceof Fence) and !($block instanceof FenceGate)) ? $block->isSolid() : true;
return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();
}
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
@ -38,13 +39,17 @@ class FenceGate extends Transparent{
}
public function getHardness(){
return 15;
return 2;
}
public function canBeActivated(){
return true;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
protected function recalculateBoundingBox(){

View File

@ -1,31 +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;
class FenceSpruce extends Fence{
protected $id = self::FENCE_SPRUCE;
public function getName(){
return "Spruce Fence";
}
}

View File

@ -21,6 +21,7 @@
namespace pocketmine\block;
use pocketmine\entity\Effect;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityCombustByBlockEvent;
use pocketmine\event\entity\EntityDamageByBlockEvent;
@ -58,8 +59,10 @@ class Fire extends Flowable{
}
public function onEntityCollide(Entity $entity){
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
$entity->attack($ev->getFinalDamage(), $ev);
if(!$entity->hasEffect(Effect::FIRE_RESISTANCE)){
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
$entity->attack($ev->getFinalDamage(), $ev);
}
$ev = new EntityCombustByBlockEvent($this, $entity, 8);
Server::getInstance()->getPluginManager()->callEvent($ev);

View File

@ -22,12 +22,22 @@
namespace pocketmine\block;
use pocketmine\item\Item;
abstract class Flowable extends Transparent{
public function canBeFlowedInto(){
return true;
}
public function getHardness(){
return 0;
}
public function getResistance(){
return 0;
}
public function isSolid(){
return false;
}
@ -35,8 +45,4 @@ abstract class Flowable extends Transparent{
public function getBoundingBox(){
return null;
}
public function getHardness(){
return 0;
}
}

View File

@ -0,0 +1,91 @@
<?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\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($meta = 0){
$this->meta = $meta;
}
public function getName(){
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",
9 => "Unknown",
10 => "Unknown",
11 => "Unknown",
12 => "Unknown",
13 => "Unknown",
14 => "Unknown",
15 => "Unknown"
];
return $names[$this->meta];
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
$this->getLevel()->setBlock($block, $this, true);
return true;
}
return false;
}
public function onUpdate($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

@ -36,7 +36,7 @@ class Glass extends Transparent{
}
public function getHardness(){
return 1.5;
return 0.3;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Item;
class GlassPane extends Thin{
protected $id = self::GLASS_PANE;
@ -35,7 +37,10 @@ class GlassPane extends Thin{
}
public function getHardness(){
return 1.5;
return 0.3;
}
public function getDrops(Item $item){
return [];
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
class GlowingRedstoneOre extends Solid{
@ -40,6 +41,10 @@ class GlowingRedstoneOre extends Solid{
return "Glowing Redstone Ore";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){
return 9;
}
@ -54,18 +59,6 @@ class GlowingRedstoneOre extends Solid{
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 [

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Glowstone extends Transparent{
@ -36,7 +37,11 @@ class Glowstone extends Transparent{
}
public function getHardness(){
return 1.5;
return 0.3;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Gold extends Solid{
@ -36,18 +37,11 @@ class Gold extends Solid{
}
public function getHardness(){
return 30;
return 3;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class GoldOre extends Solid{
@ -36,18 +37,11 @@ class GoldOre extends Solid{
}
public function getHardness(){
return 15;
return 3;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\event\block\BlockSpreadEvent;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\generator\object\TallGrass as TallGrassObject;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
@ -47,7 +48,11 @@ class Grass extends Solid{
}
public function getHardness(){
return 3;
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getDrops(Item $item){
@ -84,6 +89,11 @@ class Grass extends Solid{
$item->useOn($this);
$this->getLevel()->setBlock($this, new Farmland());
return true;
}elseif($item->isShovel() and $this->getSide(1)->getId() === Block::AIR){
$item->useOn($this);
$this->getLevel()->setBlock($this, new GrassPath());
return true;
}

View File

@ -0,0 +1,71 @@
<?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\event\block\BlockSpreadEvent;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\generator\object\TallGrass as TallGrassObject;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\Server;
use pocketmine\utils\Random;
class GrassPath extends Transparent{
protected $id = self::GRASS_PATH;
public function __construct(){
}
public function getName(){
return "Grass Path";
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 0.9375,
$this->z + 1
);
}
public function getHardness(){
return 0.6;
}
public function getDrops(Item $item){
return [
[Item::DIRT, 0, 1],
];
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Gravel extends Fallable{
@ -36,7 +37,11 @@ class Gravel extends Fallable{
}
public function getHardness(){
return 3;
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class HardenedClay extends Solid{
@ -35,25 +36,11 @@ class HardenedClay extends Solid{
return "Hardened Clay";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 30;
return 1.25;
}
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;
}
}
}

View File

@ -37,7 +37,7 @@ class HayBale extends Solid{
}
public function getHardness(){
return 10;
return 0.5;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Ice extends Transparent{
@ -36,7 +37,11 @@ class Ice extends Transparent{
}
public function getHardness(){
return 2.5;
return 0.5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function onBreak(Item $item){
@ -45,23 +50,6 @@ class Ice extends Transparent{
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 getDrops(Item $item){
return [];
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Iron extends Solid{
@ -35,21 +36,12 @@ class Iron extends Solid{
return "Iron Block";
}
public function getHardness(){
return 30;
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
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 getHardness(){
return 5;
}
public function getDrops(Item $item){

View File

@ -21,6 +21,8 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronBars extends Thin{
@ -34,4 +36,23 @@ class IronBars extends Thin{
return "Iron Bars";
}
}
public function getHardness(){
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
return [
[Item::IRON_BARS, 0, 1],
];
}else{
return [];
}
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronDoor extends Door{
@ -35,25 +36,12 @@ class IronDoor extends Door{
return "Iron Door Block";
}
public function getHardness(){
return 25;
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
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(){
return 5;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronOre extends Solid{
@ -35,21 +36,12 @@ class IronOre extends Solid{
return "Iron Ore";
}
public function getHardness(){
return 15;
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
default:
return 15;
}
public function getHardness(){
return 3;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class JungleWoodStairs extends Stair{
@ -35,6 +36,10 @@ class JungleWoodStairs extends Stair{
return "Jungle Wood Stairs";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],

View File

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
@ -48,11 +49,11 @@ class Ladder extends Transparent{
}
public function getHardness(){
return 2;
return 0.4;
}
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
$entity->resetFallDistance();
$entity->onGround = true;
}
@ -133,6 +134,10 @@ class Ladder extends Transparent{
return false;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Lapis extends Solid{
@ -32,24 +33,15 @@ class Lapis extends Solid{
}
public function getName(){
return "Lapis Block";
return "Lapis Lazuli Block";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 15;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
default:
return 15;
}
return 3;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class LapisOre extends Solid{
@ -32,25 +33,15 @@ class LapisOre extends Solid{
}
public function getHardness(){
return 15;
return 3;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Lapis Ore";
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
default:
return 15;
}
return "Lapis Lazuli Ore";
}
public function getDrops(Item $item){

View File

@ -21,6 +21,7 @@
namespace pocketmine\block;
use pocketmine\entity\Effect;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityCombustByBlockEvent;
use pocketmine\event\entity\EntityDamageByBlockEvent;
@ -45,14 +46,12 @@ class Lava extends Liquid{
return "Lava";
}
public function getHardness(){
return 0;
}
public function onEntityCollide(Entity $entity){
$entity->fallDistance *= 0.5;
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_LAVA, 4);
$entity->attack($ev->getFinalDamage(), $ev);
if(!$entity->hasEffect(Effect::FIRE_RESISTANCE)){
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_LAVA, 4);
$entity->attack($ev->getFinalDamage(), $ev);
}
$ev = new EntityCombustByBlockEvent($this, $entity, 15);
Server::getInstance()->getPluginManager()->callEvent($ev);
@ -60,9 +59,7 @@ class Lava extends Liquid{
$entity->setOnFire($ev->getDuration());
}
if($entity instanceof Player){
$entity->onGround = true;
}
$entity->resetFallDistance();
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){

View File

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\event\block\LeavesDecayEvent;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\Server;
@ -42,7 +43,11 @@ class Leaves extends Transparent{
}
public function getHardness(){
return 1;
return 0.2;
}
public function getToolType(){
return Tool::TYPE_SHEARS;
}
public function getName(){

View File

@ -310,7 +310,7 @@ abstract class Liquid extends Transparent{
$this->getLevel()->useBreakOn($block);
}
$this->getLevel()->setBlock($block, Block::get($this->id, $newFlowDecay), true);
$this->getLevel()->setBlock($block, Block::get($this->getId(), $newFlowDecay), true);
$this->getLevel()->scheduleUpdate($block, $this->tickRate());
}
}
@ -363,6 +363,10 @@ abstract class Liquid extends Transparent{
return $cost;
}
public function getHardness(){
return 100;
}
private function getOptimalFlowDirections(){
if($this->temporalVector === null){
$this->temporalVector = new Vector3(0, 0, 0);
@ -446,4 +450,8 @@ abstract class Liquid extends Transparent{
public function getBoundingBox(){
return null;
}
public function getDrops(Item $item){
return [];
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class LitPumpkin extends Solid{
@ -33,7 +34,11 @@ class LitPumpkin extends Solid{
}
public function getHardness(){
return 5;
return 1;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getName(){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Melon extends Transparent{
@ -36,7 +37,11 @@ class Melon extends Transparent{
}
public function getHardness(){
return 5;
return 1;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class MonsterSpawner extends Solid{
@ -32,30 +33,17 @@ class MonsterSpawner extends Solid{
}
public function getHardness(){
return 25;
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Monster Spawner";
}
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 getDrops(Item $item){
return [];
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class MossStone extends Solid{
@ -36,25 +37,11 @@ class MossStone extends Solid{
}
public function getHardness(){
return 30;
return 2;
}
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(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\event\block\BlockSpreadEvent;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Server;
@ -39,8 +40,12 @@ class Mycelium extends Solid{
return "Mycelium";
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getHardness(){
return 2.5;
return 0.6;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class NetherBrick extends Solid{
@ -31,30 +32,16 @@ class NetherBrick extends Solid{
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Nether Bricks";
}
public function getHardness(){
return 30;
}
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;
}
return 2;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class NetherBrickStairs extends Stair{
protected $id = self::NETHER_BRICKS_STAIRS;
@ -30,6 +32,14 @@ class NetherBrickStairs extends Stair{
return "Nether Bricks Stairs";
}
public function getHardness(){
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function __construct($meta = 0){
$this->meta = $meta;
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Netherrack extends Solid{
@ -39,22 +40,8 @@ class Netherrack extends Solid{
return 2;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.1;
case 4:
return 0.1;
case 3:
return 0.15;
case 2:
return 0.05;
case 1:
return 0.3;
default:
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Obsidian extends Solid{
@ -35,17 +36,12 @@ class Obsidian extends Solid{
return "Obsidian";
}
public function getHardness(){
return 6000;
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getBreakTime(Item $item){
if($item->isPickaxe() >= 5){
return 9.4;
}else{
return 250;
}
public function getHardness(){
return 50;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class Planks extends Solid{
const OAK = 0;
const SPRUCE = 1;
@ -37,7 +39,11 @@ class Planks extends Solid{
}
public function getHardness(){
return 15;
return 2;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getName(){

View File

@ -21,6 +21,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class Podzol extends Solid{
protected $id = self::PODZOL;
@ -29,6 +31,10 @@ class Podzol extends Solid{
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getName(){
return "Podzol";
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class Pumpkin extends Solid{
@ -33,7 +34,11 @@ class Pumpkin extends Solid{
}
public function getHardness(){
return 5;
return 1;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getName(){

View File

@ -40,7 +40,7 @@ class PumpkinStem extends Crops{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent() === true){
if($this->getSide(0)->isTransparent()){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Quartz extends Solid{
@ -31,6 +32,10 @@ class Quartz extends Solid{
$this->meta = $meta;
}
public function getHardness(){
return 0.8;
}
public function getName(){
static $names = [
0 => "Quartz Block",
@ -41,22 +46,8 @@ class Quartz extends Solid{
return $names[$this->meta & 0x03];
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.15;
case 4:
return 0.2;
case 3:
return 0.3;
case 2:
return 0.1;
case 1:
return 0.6;
default:
return 4;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class QuartzStairs extends Stair{
protected $id = self::QUARTZ_STAIRS;
@ -30,6 +32,14 @@ class QuartzStairs extends Stair{
$this->meta = $meta;
}
public function getHardness(){
return 0.8;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Quartz Stairs";
}

View File

@ -0,0 +1,56 @@
<?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\item\Tool;
class Redstone extends Solid{
protected $id = self::REDSTONE_BLOCK;
public function __construct(){
}
public function getHardness(){
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Redstone Block";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
return [
[Item::REDSTONE_BLOCK, 0, 1],
];
}else{
return [];
}
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
class RedstoneOre extends Solid{
@ -37,12 +38,12 @@ class RedstoneOre extends Solid{
}
public function getHardness(){
return 15;
return 3;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL or $type === Level::BLOCK_UPDATE_TOUCH){
$this->getLevel()->setBlock($this, Block::get(Item::GLOWING_REDSTONE_ORE, $this->meta), false, false, true);
$this->getLevel()->setBlock($this, Block::get(Item::GLOWING_REDSTONE_ORE, $this->meta), false, true);
return Level::BLOCK_UPDATE_WEAK;
}
@ -50,6 +51,12 @@ class RedstoneOre extends Solid{
return false;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 2){
return [

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class Sand extends Fallable{
protected $id = self::SAND;
@ -31,7 +33,11 @@ class Sand extends Fallable{
}
public function getHardness(){
return 2.5;
return 0.5;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getName(){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Sandstone extends Solid{
@ -32,7 +33,7 @@ class Sandstone extends Solid{
}
public function getHardness(){
return 4;
return 0.8;
}
public function getName(){
@ -45,22 +46,8 @@ class Sandstone extends Solid{
return $names[$this->meta & 0x03];
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.15;
case 4:
return 0.2;
case 3:
return 0.3;
case 2:
return 0.1;
case 1:
return 0.6;
default:
return 4;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class SandstoneStairs extends Stair{
protected $id = self::SANDSTONE_STAIRS;
@ -30,6 +32,14 @@ class SandstoneStairs extends Stair{
$this->meta = $meta;
}
public function getHardness(){
return 0.8;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Sandstone Stairs";
}

View File

@ -38,7 +38,7 @@ class Sapling extends Flowable{
protected $id = self::SAPLING;
public function __construct($meta = 0){
$this->meta = 0;
$this->meta = $meta;
}
public function canBeActivated(){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\Player;
@ -34,7 +35,7 @@ class SignPost extends Transparent{
}
public function getHardness(){
return 5;
return 1;
}
public function isSolid(){
@ -97,4 +98,8 @@ class SignPost extends Transparent{
[Item::SIGN, 0, 1],
];
}
public function getToolType(){
return Tool::TYPE_AXE;
}
}

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
@ -34,7 +35,7 @@ class Slab extends Transparent{
}
public function getHardness(){
return 30;
return 2;
}
public function getName(){
@ -48,7 +49,7 @@ class Slab extends Transparent{
6 => "Quartz",
7 => "",
];
return (($this->meta & 0x08) === 0x08 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab";
return (($this->meta & 0x08) > 0 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab";
}
protected function recalculateBoundingBox(){
@ -123,24 +124,6 @@ class Slab extends Transparent{
return true;
}
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){
return [
@ -150,4 +133,10 @@ class Slab extends Transparent{
return [];
}
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
}

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class Snow extends Solid{
protected $id = self::SNOW_BLOCK;
@ -31,7 +33,11 @@ class Snow extends Solid{
}
public function getHardness(){
return 1;
return 0.2;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getName(){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\Player;
@ -42,13 +43,17 @@ class SnowLayer extends Flowable{
}
public function getHardness(){
return 0.5;
return 0.1;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down instanceof Solid){
if($down->isSolid()){
$this->getLevel()->setBlock($block, $this, true);
return true;

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
class SoulSand extends Solid{
@ -37,7 +38,11 @@ class SoulSand extends Solid{
}
public function getHardness(){
return 2.5;
return 0.5;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
protected function recalculateBoundingBox(){

View File

@ -31,7 +31,7 @@ class Sponge extends Solid{
}
public function getHardness(){
return 3;
return 0.6;
}
public function getName(){

View File

@ -22,6 +22,7 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class SpruceWoodStairs extends Stair{
@ -35,6 +36,10 @@ class SpruceWoodStairs extends Stair{
return "Spruce Wood Stairs";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],

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