Commit Graph

438 Commits

Author SHA1 Message Date
95be571481 Fixed Item->equals() not working for no-NBT items since 9bb3c93285 2018-10-29 12:45:39 +00:00
e1795dfd49 Fixed wtf in Durable->setDamage() exception throw 2018-10-27 21:50:14 +01:00
9bb3c93285 Remove network-serialized item NBT from API layer, item NBT is now retained for the lifetime of the stack 2018-10-27 15:26:01 +01:00
0ef81e701a ItemFactory: Use a simple hashmap for item types
this is slower but yields less complicated code. Since this isn't in a hot path it's acceptable for this to slow down a little for the sake of sanity.
2018-10-26 18:38:24 +01:00
93131b4d92 Rename some meta usages to variant 2018-10-26 18:20:37 +01:00
7dd3b5b996 Durable: fixed leftover wtf from damage refactor 2018-10-26 18:17:34 +01:00
327c8361bd Remove variant parameters from TieredTool 2018-10-26 18:16:31 +01:00
f438736af5 Make some item constructor variant parameters mandatory 2018-10-26 16:51:02 +01:00
51e13104dc oops, missed one 2018-10-26 16:49:25 +01:00
712cafa0cc Item: remove redundant meta constructor params
these ctor params should only be used for variants in the ItemFactory registration, but all of these items have no non-zero variants anyway.
2018-10-26 16:29:14 +01:00
011b9ae159 Update to latest NBT lib version 2018-10-23 16:47:00 +01:00
90482e79bc Merge branch 'release/3.4' 2018-10-21 18:23:54 +01:00
6dd2597934 Merge branch 'release/3.3' into release/3.4 2018-10-21 18:17:07 +01:00
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
a2a6286e1c ItemFactory: clean up some unnecessary code
this try/catch isn't needed because the list offset derivation function will deal with invalid IDs anyway.
2018-10-19 15:29:01 +01:00
e7494fff96 - the fix didn't fix
this is a mess

it would be nice not to have to start the server to find these kinds of bugs >.<
2018-10-19 15:29:01 +01:00
f81849e550 ItemFactory: fix special case handling for durable items, close #2483 2018-10-19 15:29:01 +01:00
139aaa5577 Protect Item->count 2018-10-07 14:34:04 +01:00
82c718cff0 Split Bucket into multiple classes 2018-10-07 14:03:13 +01:00
36548a335c Fixed some items disappeared after 5fb7825485 2018-10-06 21:30:21 +01:00
5fb7825485 Flatten Item variants, remove Item->setDamage() 2018-10-06 20:09:11 +01:00
495a0b1dc2 Merge branch 'release/3.3' 2018-10-05 18:11:33 +01:00
1dd6591ac1 Migrate a bunch of PluginManager->callEvent() usages to Event->call
This has the triple bonus effect of a) making a lot of code easier to read, b) reducing Server::getInstance() usages, and c) removing a whole bunch of Server dependencies.

The network and block namespaces are untouched by this commit due to potential for merge conflicts. These should be dealt with separately on master.
2018-10-05 17:30:06 +01:00
5344c0a627 Merge branch 'release/3.3' 2018-09-29 15:39:40 +01:00
5b511f6d06 Merge branch 'release/3.1' into release/3.2 2018-09-29 15:39:27 +01:00
426dee04a6 Potion: remove unnecessary exception throw in getPotionEffectsById()
this is only used by Potion and SplashPotion, and simply causes errors when trying to use potions with unknown IDs.
2018-09-29 15:39:20 +01:00
75f364fcf2 Level: Remove obsolete \$direct parameter from setBlock()
this parameter was previously used to send blocks with a different set of flags, immediately, to players. However, the flags have been demonstrated useless and the direct sending is pointless now since packets are buffered now per session, so we might as well take advantage of the batched block update sending.
2018-09-27 16:15:07 +01:00
896ecb52f4 Merge branch 'release/3.3' 2018-09-24 18:27:26 -04:00
f6a8ec83a1 Merge branch 'release/3.1' into release/3.2 2018-09-24 18:26:39 -04:00
28137efb53 Fixed server freezing when using chorus fruit from large Y coordinates 2018-09-24 18:26:20 -04:00
8873efc303 Duplicate block IDs into ItemIds to allow for split
this will be necessary to deal with negative IDs (if I choose to do that), and it'll also be necessary if I decide to do any shift hacks to merge ID/variant for block IDs, because we don't want such things to affect items before we're ready to deal with that.
2018-09-23 15:53:16 +01:00
ed1c511c3c Hacks for dealing with negative item IDs... 2018-09-23 14:14:58 +01:00
56d9943b0d Nuke Block->meta, split into variant and state properties, lots of cleanup
This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together.

The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
2018-09-21 19:28:10 +01:00
a55ab54ddb Merge branch 'release/3.3' 2018-09-20 19:02:48 +01:00
8db1ccc1ae Merge branch 'release/3.1' into release/3.2 2018-09-20 19:02:09 +01:00
5d56030afa Item: make nbtDeserialize() return AIR when reading an unknown PC item
This is scummy, but it's better than crashing the whole server just because a chest contained an unknown item.
2018-09-20 19:00:44 +01:00
7da51ae97e Fixed ItemBlocks passing the wrong block name to their constructors 2018-09-19 17:51:28 +01:00
3bd224ae1a Merge branch 'release/3.3' 2018-09-06 19:31:11 +01:00
d8e27e6081 Bow: fix wrong arithmetic for Flame fire ticks, closes #2420 2018-09-06 19:30:55 +01:00
bd091eb744 Merge branch 'release/3.3' 2018-09-06 19:15:53 +01:00
14a2ffa51b Merge branch 'release/3.1' into release/3.2 2018-09-06 18:43:28 +01:00
c447d51e3f Bucket: use ItemFactory instead of self-clone
in the future Item->setDamage() will be removed.
2018-09-06 18:42:09 +01:00
f218868338 Separate facing/bearing handling from Vector3, deobfusticate a ton of @shoghicp old code 2018-09-05 19:56:14 +01:00
d419d4308f Add a couple of item constants, register Scute item
leaving out turtle helmet for now because of complications relating to the effect application - I REALLY don't want to tick armour if I can avoid it, due to the performance concerns.
2018-08-21 19:54:24 +01:00
b480c63060 Fixed ItemFactory::fromString() meta handling bug introduced by 71c3c34976 2018-07-17 14:46:08 +01:00
71c3c34976 ItemFactory: prepare for handling items with negative IDs 2018-07-16 13:24:12 +01:00
16c253d7a9 Item: allow negative IDs
this will be needed in the future for extended blocks support.
2018-07-16 12:46:16 +01:00
32574118ea Implemented Mending enchantment (#2257) 2018-07-06 13:28:33 +01:00
8c672cb7c8 Implemented Sharpness, Fire Aspect and Knockback enchantments 2018-06-24 12:13:54 +01:00
97c267c70c Implemented Punch enchantment 2018-06-23 17:40:01 +01:00