6763 Commits

Author SHA1 Message Date
Dylan K. Taylor
18d3a97466 Anvil result slot is not a real inventory slot
like the crafting grid result slot, this doesn't actually exist, it's
just somewhere you get the result item from.
2017-10-16 12:00:43 +01:00
Dylan K. Taylor
04668d534d Oops, these fields need to be filled 2017-10-16 11:50:34 +01:00
Dylan K. Taylor
092cc2750f Added entity unique ID for Entity containers
minecart with chest for example
2017-10-16 11:49:34 +01:00
Dylan K. Taylor
68809d992b Added BaseInventory->removeAllViewers() 2017-10-16 11:15:03 +01:00
Dylan K. Taylor
1641183674 added some typehints to Item 2017-10-16 10:29:44 +01:00
Dylan K. Taylor
72531209bf Added some constants for frequently-accessed item NBT tags 2017-10-16 10:24:32 +01:00
Dylan K. Taylor
8c6ab3e634 Some cleanup to item NBT handling 2017-10-16 10:15:41 +01:00
Dylan K. Taylor
97e2d64592 "Fixed" shift-clicking recipe book, close #1401
this is not an optimal solution because you'll still only get 1 crafting
event when the user actually crafted a lot of items, so this isn't very
nice for plugins to work with. However, for gameplay purposes it works,
so it'll do for now.
2017-10-15 18:08:32 +01:00
Dylan K. Taylor
a547e2cca8 Fixed sub-optimal code in WritableBook 2017-10-15 10:14:02 +01:00
Dylan K. Taylor
cdebb62c35 added typecast for forceLanguage property read 2017-10-14 23:26:00 +01:00
Dylan K. Taylor
2e73fd7f8c Add missing setValue() override to LongTag
why did this take two commits ;-;
2017-10-14 22:24:17 +01:00
Dylan K. Taylor
51906daad0 Add typehints and PhpDoc to NBT API 2017-10-14 22:07:25 +01:00
Dylan K. Taylor
ce67bc620a add Travis Test data directory to gitignore 2017-10-14 22:06:07 +01:00
Dylan K. Taylor
bcefc3a54b Flag expectedType as nullable 2017-10-14 20:45:37 +01:00
Dylan K. Taylor
f5378ab604 Fixed assertion failure when using getTag() without specifying an expected type 2017-10-14 20:45:32 +01:00
Dylan K. Taylor
dab7cfde1c Added new API methods in CompoundTag to allow developers to stay sane (#1469)
Added getters and setters to CompoundTag with type safety
we need generics so badly here it hurts

This is fully backwards compatible, however the following API methods have been added to the `CompoundTag` class:

- getTag(string $name, string $expectedType = null) : ?NamedTag
- getListTag(string $name) : ?ListTag
- getCompoundTag(string $name) : ?CompoundTag
- setTag(NamedTag $tag) : void
- removeTag(string ...$names) : void
- hasTag(string $name) : bool

- getTagValue(string $name, string $expectedType, $default = null)
- getByte(string $name, ?int $default = null) : ?int
- getShort(string $name, ?int $default = null) : ?int
- getInt(string $name, ?int $default = null) : ?int
- getLong(string $name, ?int $default = null) : ?int
- getFloat(string $name, ?float $default = null) : ?float
- getDouble(string $name, ?float $default = null) : ?float
- getByteArray(string $name, ?string $default = null) : ?string
- getString(string $name, ?string $default = null) : ?string
- getIntArray(string $name, ?array $default = null) : ?array

- setTagValue(string $name, string $tagType, $value) : void
- setByte(string $name, int $value) : void
- setShort(string $name, int $value) : void
- setInt(string $name, int $value) : void
- setLong(string $name, int $value) : void
- setFloat(string $name, float $value) : void
- setDouble(string $name, float $value) : void
- setByteArray(string $name, string $value) : void
- setString(string $name, string $value) : void
- setIntArray(string $name, array $value) : void
2017-10-14 18:36:02 +01:00
Dylan K. Taylor
6e1318b522 Push minimum requirement to PHP 7.2.0RC3
there are needed ZTS bugfixes included in RC3. I didn't move this earlier because Travis didn't have an RC3 build.
2017-10-14 14:26:21 +01:00
Dylan K. Taylor
cd8006e242 Use constructor parameter for ListTags instead of setTagType() and removed some unnecessary type setting 2017-10-14 13:49:24 +01:00
Dylan K. Taylor
f5abed95ec added missing type doc to ListTag 2017-10-14 12:48:38 +01:00
Dylan K. Taylor
489b9fc29b Added missing getter override for LongTag
adds a return typehint
2017-10-14 11:34:41 +01:00
Dylan K. Taylor
b524b841c5 Reduced duplicated code in AxisAlignedBB->calculateIntercept() 2017-10-14 11:01:00 +01:00
Dylan K. Taylor
41f292d995 BlockUpdateEvent doesn't allow changing the target block anyway 2017-10-14 10:10:19 +01:00
Dylan K. Taylor
fd8a562e02 Fixed collision bugs caused by not clearing pre-computed outdated AABBs for blocks
take fences as an example: say you have fence1 and fence2 next to each other, like this:
|==|
and they are joined together
then delete the fence on the right
the left fence will then look like this
|
but the server would still think its collision boxes were like this:
|=
so you wouldn't be able to shoot arrows through that space.

This commit clears pre-computed bounding boxes when a block is set using Level->setBlock() (in case the block was previously already set and has pre-calculated outdated AABB). However, because of weird blocks like fences, glass and walls, they must also be cleared on neighbour block update (since connection state isn't shown in the block data).
2017-10-14 10:07:17 +01:00
Dylan K. Taylor
cc553a157d Clean up BlockEventPacket handling for Chests and fix wrong data for chest open 2017-10-13 20:07:33 +01:00
JackNoordhuis
a6d1cc27ec Fix for explosions not removing tiles, close #1450 (#1463) 2017-10-13 13:57:50 +01:00
Dylan K. Taylor
d8c90be5b8 Make on-ground checking less fussy 2017-10-13 13:19:20 +01:00
JackNoordhuis
060426ff12 Add ability to unregister a command completely, close #1229 (#1464) 2017-10-13 11:55:36 +01:00
Dylan K. Taylor
eeea4fa06a Added some new blocks 2017-10-13 11:51:38 +01:00
Dylan K. Taylor
401e33dd85 fix anvil bounding box 2017-10-13 11:18:19 +01:00
Dylan K. Taylor
2893aac3ac ... 2017-10-13 11:06:10 +01:00
Dylan K. Taylor
c5c74c1898 fixing glass & bars collision detection
so much duplicated code, it would be nice if Fence could inherit from Thin, but that causes too many issues with block connections.
2017-10-13 11:04:51 +01:00
Dylan K. Taylor
423bea4b57 Fixed a couple of blocks incorrectly descending from Solid 2017-10-13 10:37:48 +01:00
Dylan K. Taylor
e3567faa94 Anvils aren't non-solid, they are transparent
solid and transparent are not mutually exclusive!
2017-10-13 10:22:22 +01:00
Dylan K. Taylor
4b5040dcc7 Blocks extending Thin ARE solid 2017-10-13 09:52:08 +01:00
Dylan K. Taylor
21c79b0645 Use up to 2 AABBs for fence collision checks instead of 5
overlapping cuboids do fine
2017-10-13 09:40:29 +01:00
Dylan K. Taylor
7b5df10b6a Reset position properly when reverting movement 2017-10-12 20:33:26 +01:00
Dylan K. Taylor
c4fe9ad32d Remove pointless API method from PlayerMoveEvent 2017-10-12 19:59:32 +01:00
Dylan K. Taylor
60b62a4890 fixed wall collision detection
walls have to be weird...
2017-10-12 19:36:06 +01:00
Dylan K. Taylor
061a9444cc implemented multi AABB collision checks for fences and walls
fixes anti-cheat getting triggered when falling down between a square of fences
fixes not being able to shoot arrows between a square of fences
2017-10-12 18:33:26 +01:00
Dylan K. Taylor
3eb73ab468 Abstracted Fence code away from wooden fences 2017-10-12 17:04:49 +01:00
Dylan K. Taylor
15d6fd86e2 Added basic support for blocks with multiple AABBs, fixed stairs (#1303) 2017-10-12 16:29:24 +01:00
Dylan K. Taylor
0c092a7ceb reduced size of arrow bounding box
as per MCPE addon data
2017-10-12 16:21:23 +01:00
Dylan K. Taylor
b9501ef415 Remove unnecessary duplicated ray-trace code from Block
this isn't actually used anywhere, but "backwards compatibility"
2017-10-12 13:40:12 +01:00
Dylan K. Taylor
5afe4fdb5b Use Vector3 constants instead of hardcoded integers 2017-10-12 13:32:17 +01:00
Dylan K. Taylor
cc7ed7a28f Added some documentation to AxisAlignedBB 2017-10-12 12:22:13 +01:00
Dylan K. Taylor
7e9b89e48a Make Entity->checkObstruction() less confusing 2017-10-12 11:59:02 +01:00
Dylan K. Taylor
63fccd4682 farmland and grass path should die when a solid block is above them 2017-10-12 11:11:33 +01:00
Dylan K. Taylor
35e7aca88f refactor some more stupid variable names 2017-10-12 10:45:22 +01:00
Dylan K. Taylor
9413f155ce implement updating properly for multi-face vines 2017-10-12 10:21:08 +01:00
Dylan K. Taylor
6569fdbe04 Refactor some variable names in Vine 2017-10-11 20:12:12 +01:00