60 Commits

Author SHA1 Message Date
Dylan K. Taylor
99ff78a8a5
Updated BedrockData 2022-07-09 18:57:32 +01:00
Dylan K. Taylor
9ffee7cfc3
always the CS ... 2022-07-09 16:30:59 +01:00
Dylan K. Taylor
ccb3c3cb05
BlockStateData: use array<Tag> instead of CompoundTag to store state properties
this reduces the footprint of RuntimeBlockMapping by a further 1 MB, as well as simplifying various parts of the code, and solidifying the immutability guarantee of BlockStateData.
2022-07-09 16:03:51 +01:00
Dylan K. Taylor
68cbe46600
Exterminate legacy item IDs 2022-07-05 15:12:55 +01:00
Dylan K. Taylor
56cf59355f
Use more consistent exceptions 2022-07-04 21:38:18 +01:00
Dylan K. Taylor
9f0b32e748
Updated creative and crafting data to 1.19 2022-07-04 20:28:07 +01:00
Dylan K. Taylor
db2b523762
Item is no longer JsonSerializable
before anyone starts screaming:

1) it's easy to create your own wrapper that converts items to arrays
2) there is no longer a single standard way to encode items.
3) the way that item serialization now works requires an ItemSerializer, which, barring singleton use, must be dependency-injected. Since there's no way to inject dependencies into jsonSerialize(), this means that its behaviour cannot be customized.
2022-06-30 19:16:49 +01:00
Dylan K. Taylor
cab56b0479
fix PHPStan 2022-06-29 17:18:44 +01:00
Dylan K. Taylor
5e4e5147d9
Remove ItemFactory involvement from brewing
this involves a very nasty hack for potion container change, but for the time being it can't be helped.
2022-06-29 16:11:15 +01:00
Dylan K. Taylor
541a624d48
ItemFactory::get() now consistently throws SavedDataLoadingException on any error, including unknown items 2022-06-27 17:14:43 +01:00
Dylan K. Taylor
b61a934c9f
CraftingManagerFromDataHelper: fixed recipes with unknown items being registered without said items 2022-06-27 14:23:14 +01:00
Dylan K. Taylor
55cb68e5b5
Burn meta wildcards from Item, allow more dynamic recipe inputs
this was an obstacle for getting rid of legacy item IDs.
2022-06-27 13:33:26 +01:00
Dylan K. Taylor
1ff69136a3
Merge branch 'next-major' into modern-world-support 2022-06-07 20:01:40 +01:00
Dylan K. Taylor
aa9f8781ff
Merge branch 'next-minor' into next-major 2022-06-07 19:56:26 +01:00
Dylan K. Taylor
93124c79ea
Fixed incorrect unknown item filtering logic
this caused recipes with wildcard inputs to not show up at all.
2022-06-06 18:50:40 +01:00
Dylan K. Taylor
08fbf92d8d
Filter out recipes containing unknown items 2022-06-06 18:25:14 +01:00
Dylan K. Taylor
083a35f970
Modernize property type declarations 2022-06-04 18:16:32 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
Dylan K. Taylor
d4b7f66e15
Promote some constructors 2022-05-17 22:34:58 +01:00
ipad54
1e59679ec2
Implemented Stonecutter (#4732) 2022-05-17 16:01:03 +01:00
Dylan K. Taylor
b402df8b91
Modernize property declarations in pocketmine\crafting namespace 2022-04-25 13:15:48 +01:00
Dylan K. Taylor
ea161af4e5
Added FurnaceType->getCookSound() 2022-01-25 19:01:49 +00:00
VixikHD
e0da99a973
feat: Implement Brewing (#4413)
The following API constants have been added:
- tile\BrewingStand::BREW_TIME_TICKS
The following public API methods have been added:
- utils\BrewingStandSlot->getSlotNumber() : int
- CraftingManager->getPotionTypeRecipes() : array<string, array<string, PotionTypeRecipe>>
- CraftingManager->getPotionContainerChangeRecipes() : array<int, array<string, PotionContainerChangeRecipe>>
- CraftingManager->registerPotionTypeRecipe(PotionTypeRecipe $recipe) : void
- CraftingManager->registerPotionContainerChangeRecipe(PotionContainerChangeRecipe $recipe) : void
The following classes have been added:
- BrewingRecipe
- PotionTypeRecipe
- PotionContainerChangeRecipe
- BrewItemEvent
- BrewingFuelUseEvent
- PotionFinishBrewingSound
2022-01-22 16:54:58 +00:00
Dylan K. Taylor
3f8f5cd200
Replace disallowed operators in src/crafting/ 2022-01-20 19:18:26 +00:00
Dylan K. Taylor
75fc7a2d1f
Merge branch 'stable' into next-minor 2022-01-07 20:16:35 +00:00
Dylan K. Taylor
6d249026cc
Merge branch 'legacy/pm3' into stable 2022-01-07 20:15:15 +00:00
Dylan K. Taylor
889d048ca3
Make use of Utils::assumeNotFalse() in a bunch of places
I've stuck to only doing this in the places where I'm sure we should never get false back. Other places I'm less sure of (and I found more bugs along the way).
2021-12-08 19:39:04 +00:00
Dylan K. Taylor
ed4978c31b
Added VanillaItems::AIR()
we don't usually add VanillaItems entries for blocks since they already exist in VanillaBlocks, but air has a special use case specifically as an itemstack, so we make an exception for this case.
2021-12-07 00:41:07 +00:00
Dylan K. Taylor
45edb94607
Crafting tables now work the same way as anvils and enchanting tables
Removing almost all special-case logic for crafting tables.
2021-11-07 16:20:07 +00:00
Dylan K. Taylor
e34364412b
Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Dylan K. Taylor
dee2062b1b
CraftingManager: Reduce footprint of recipe keys
this was using json before, which is horribly inefficient.
This saved about 200 KB of memory on initial startup (which isn't much, but for more complex recipes, it might have been significantly worse.
2021-08-29 15:49:18 +01:00
Dylan K. Taylor
270ee5c085
Simplify registry method generation 2021-08-22 23:02:36 +01:00
Dylan T
27e0ecf7ee
Implemented Blast Furnace and Smoker (#4362) 2021-08-12 23:27:05 +01:00
Dylan K. Taylor
7ba573db77
Added API method Item::canStackWith() 2021-06-29 19:52:52 +01:00
Dylan K. Taylor
f909557529
Cleaned up implementations for EnderChestInventory/DoubleChestInventory
previously, these were forced to extend BaseInventory because of the amount of crap in Inventory's interface.
This meant that these inventories had their own slots storage, which would be _mostly_ unused because these inventories aren't real inventories, but rather just delegates.
This lead to a variety of bugs in the past, such as certain API methods on BaseInventory not working correctly for DoubleChestInventory in particular.

Now, BaseInventory just implements the functional part of the inventory implementation, leaving the storage system up to the implementation.
A SimpleInventory class is provided with a simple SplFixedArray storage backing, which is used by most inventories.
EnderChestInventory and DoubleChestInventory now extend BaseInventory directly, and implement custom methods for dealing with their delegates.
2021-05-09 20:51:16 +01:00
Dylan K. Taylor
7b2c6c5ceb
Avoid more $this refs on long-life closures 2021-05-06 14:27:56 +01:00
Dylan K. Taylor
c61f66d973
Removed ext-ds dependency 2021-02-11 15:40:37 +00:00
Dylan K. Taylor
0d9561c93f Removed crafting data cache from CraftingManager 2020-11-12 21:30:59 +00:00
Dylan K. Taylor
c4d35d52e8 Do not store a pre-compressed cache for crafting data
this reduces bandwidth efficiency because it can't be compressed with everything else this way. If we want to cache stuff sent during the login sequence, it's better to stuff a bunch of stuff into a batch (e.g. crafting, creative, actor ids, biome defs) and pre-compress that as one big package instead.
2020-11-11 18:20:03 +00:00
Dylan K. Taylor
e1d80f05b1 Merge branch 'stable' into master 2020-08-03 20:14:46 +01:00
Dylan K. Taylor
7e6adc41f0 Merge 1.16 support into PM4 (with changes) 2020-06-26 22:21:09 +01:00
Dylan K. Taylor
fe1b5d2d01 Merge commit '3d50aafcc'
# Conflicts:
#	resources/vanilla
#	src/crafting/ShapedRecipe.php
2020-06-13 11:30:44 +01:00
Dylan K. Taylor
017afead3b extract FurnaceRecipeManager unit from CraftingManager
I'd like to have this directly provided to Furnace, but I don't know how to short of making into a singleton. Since I want to have per-furnace recipe managers (e.g. for stuff like blast furnace vs regular furnace etc), a singleton isn't really an option.
2020-06-03 18:59:59 +01:00
Dylan K. Taylor
b7cf4f01f9 remove utils\UUID, switch to pocketmine/uuid package 2020-05-11 10:46:48 +01:00
Dylan K. Taylor
8093a94e5d do not hardcode data deserialization into CraftingManager 2020-04-28 18:56:27 +01:00
Dylan K. Taylor
f9a587d40e imports cleanup 2020-04-28 17:27:38 +01:00
Dylan K. Taylor
3be9548b1e net: compressors are now fully dynamic (or at least the potential to be)
the compressor used by RakLibInterface when opening a session is still
hardcoded, but that's because we have no way to select the correct
compressor at that point in the login sequence, since we aren't
propagating the protocol information up from RakLib right now.
2020-04-28 16:21:18 +01:00
Dylan K. Taylor
d9e4783b24 start making network compressors dynamic
this will facilitate future multi version support where compression types are different between versions
2020-04-28 14:47:01 +01:00
Dylan K. Taylor
a97cafd4f6 moving serializers into protocol namespace 2020-04-27 13:54:39 +01:00
Dylan K. Taylor
f3fed60d57 crafting: ditch MultiRecipe, it's a network-only thing
MultiRecipes are really nothing more than feature toggles at the network layer, and they don't belong in the main core code.
2020-04-23 19:45:59 +01:00