Implemented smithing table functionality#6202
Implemented smithing table functionality#6202HimmelKreis4865 wants to merge 38 commits intopmmp:minor-nextfrom
Conversation
|
There's not much more I can do at this point, everthing is fixed except for save ids. |
This comment was marked as off-topic.
This comment was marked as off-topic.
3999602 to
5360b77
Compare
|
yeah, ready to be reviewed again. |
This reverts commit 30a4edb.
dktapps
left a comment
There was a problem hiding this comment.
Looks mostly OK.
I'm a bit uneasy about allowing custom armor trim patterns because they'll generate confusing errors if the objects are duplicated. The ArmorTrimPattern and ArmorTrimMaterial classes should use the NotCloneable and NotSerializable traits.
…to smithing-table
…to smithing-table
…to smithing-table
|
|
For posterity: I think this got stalled because I wasn't happy about using Will revisit this soon ™️ |
|
So, the issue with the registries makes more sense to me now. When we use enums, it's easy to guarantee that all enum cases are saveable since there's never going to be others that weren't defined at compile time. This is not true when using registries, which makes the API here a series of footguns which will lead to confusing crashes. This is linked to a broader issue described in #6654 |
| } | ||
| if($input !== null && $addition !== null && $template !== null){ | ||
| $material = ArmorTrimMaterialTypeIdMap::getInstance()->fromItem($addition); | ||
| $pattern = ArmorTrimPatternTypeIdMap::getInstance()->fromItem($template); |
There was a problem hiding this comment.
Really don't like this. pocketmine\data namespace is explicitly internal.
Type ID mapping is part of an internal package because plugins aren't supposed to deal with that stuff, but plugins should be able to get the trim color of an item without using internal namespaces.
Likewise, the pattern should be obtainable without using internal namespaces.


Introduction
This PR adds working smithing tables to pocketmine.
There are no known issues or problems
Changes
API changes
Amor->setTrim(ArmorTrim)Armor->getTrim() : ?ArmorTrimArmor->clearTrim()SmithingTableInventory->getInput() : ItemSmithingTableInventory->getAddition() : ItemSmithingTableInventory->getTemplate() : ItemThe new enums:
ArmorTrimPattern&ArmorTrimMaterial(required to constructArmorTrim)Tests
Tested ingame with the smithing table several times:

Tested the code