6537 Commits

Author SHA1 Message Date
Dylan K. Taylor
3e3157cbe1 fix tick diff debug spam when entities are spawned 2017-10-17 17:38:43 +01:00
Dylan K. Taylor
07abd61f73 Added a FIXME for Entity->move() 2017-10-17 17:14:45 +01:00
Dylan K. Taylor
a456b7cfca Disable movement anti-cheat by default
shit's useless and an annoyance.
2017-10-17 16:45:18 +01:00
Dylan K. Taylor
ece37d1e19 Added more methods to PlayerIllegalMoveEvent 2017-10-17 16:14:41 +01:00
Takuya Sawada
cccaade00c make Player#unloadChunk() method protected 2017-10-17 14:22:57 +01:00
Dylan K. Taylor
7f0a961526 "Creator" tag on signs may not exist 2017-10-17 13:35:31 +01:00
Dylan K. Taylor
68ac4f538f Added ContainerTrait, reduce copy-pasted code in Tile 2017-10-16 20:01:17 +01:00
Dylan K. Taylor
f14b7cbf78 Renamed BlockEventPacket fields 2017-10-16 19:55:42 +01:00
Dylan K. Taylor
f4ff5d81ea Added missing parent calls for saveNBT() in Chest and Furnace 2017-10-16 18:56:48 +01:00
Dylan K. Taylor
28a840d161 Make use of CompoundTag->hasTag() 2017-10-16 18:32:08 +01:00
Dylan K. Taylor
292e462ea0 Remove nullable return types on CompoundTag getters
this doesn't make sense because there are default value parameters for this
2017-10-16 18:22:45 +01:00
Dylan K. Taylor
c8379efbce Added expectedClass parameter to hasTag() to allow type-checking 2017-10-16 17:26:12 +01:00
Dylan K. Taylor
1b5746fd97 Use NamedTag::class for default expectedClass in CompoundTag->getTag() 2017-10-16 17:22:38 +01:00
Dylan K. Taylor
4a0ac01697 Fix PhpStorm derp
wtf?
2017-10-16 17:02:00 +01:00
Dylan K. Taylor
9bcb41fb21 Refactor misleading parameter names in CompoundTag
these are NBT tag classes, not the NBT tag type. The tag type is an integer which describes the tag on disk.
2017-10-16 17:00:57 +01:00
Dylan K. Taylor
20b86bdea8 Cleaned up tile NBT handling, use new CompoundTag API methods 2017-10-16 16:48:24 +01:00
Dylan K. Taylor
0b1a9ba062 Added more typehints to Tile namespace 2017-10-16 16:14:44 +01:00
Dylan K. Taylor
45b003ac2e Removed unnecessary return from Sign 2017-10-16 16:10:33 +01:00
Dylan K. Taylor
769a50faa5 Refactor confusing parameter names for Item->onActivate()
next: refactor the function itself
2017-10-16 13:30:36 +01:00
Dylan K. Taylor
af85659c63 Remove redundant property from Tile 2017-10-16 12:35:32 +01:00
Dylan K. Taylor
95fa1824c8 Use a trait for nameable tiles instead of repeating code 2017-10-16 12:32:10 +01:00
Dylan K. Taylor
251d5d7946 Fixed some hardcoded values in Tree 2017-10-16 12:30:46 +01:00
Dylan K. Taylor
3b5eb45ff5 More usages of Item->isNull() 2017-10-16 12:29:39 +01:00
Dylan K. Taylor
fd847f02ad Added BaseInventory->dropContents() 2017-10-16 12:18:06 +01:00
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