Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented smithing table functionality #6202

Open
wants to merge 27 commits into
base: minor-next
Choose a base branch
from

Conversation

HimmelKreis4865
Copy link
Contributor

Introduction

This PR adds working smithing tables to pocketmine.
There are no known issues or problems

Changes

API changes

Amor->setTrim(ArmorTrim)
Armor->getTrim() : ?ArmorTrim
Armor->clearTrim()

SmithingTableInventory->getInput() : Item
SmithingTableInventory->getAddition() : Item
SmithingTableInventory->getTemplate() : Item

The new enums: ArmorTrimPattern & ArmorTrimMaterial (required to construct ArmorTrim)

Tests

Tested ingame with the smithing table several times:
image

Tested the code

$player->getInventory()->addItem(VanillaItems::LEATHER_CAP()->setTrim(new ArmorTrim(ArmorTrimMaterial::QUARTZ, ArmorTrimPattern::EYE)));

@ShockedPlot7560 ShockedPlot7560 added Category: API Related to the plugin API Category: Core Related to internal functionality Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Dec 20, 2023
src/block/inventory/SmithingTableInventory.php Outdated Show resolved Hide resolved
src/block/inventory/SmithingTableInventory.php Outdated Show resolved Hide resolved
src/crafting/SmithingRecipe.php Outdated Show resolved Hide resolved
src/crafting/SmithingRecipe.php Outdated Show resolved Hide resolved
src/inventory/transaction/SmithingTransaction.php Outdated Show resolved Hide resolved
src/item/ArmorTrimPattern.php Outdated Show resolved Hide resolved
src/network/mcpe/handler/PreSpawnPacketHandler.php Outdated Show resolved Hide resolved
src/network/mcpe/cache/CraftingDataCache.php Outdated Show resolved Hide resolved
src/network/mcpe/handler/ItemStackRequestExecutor.php Outdated Show resolved Hide resolved
src/crafting/CraftingManager.php Outdated Show resolved Hide resolved
@HimmelKreis4865
Copy link
Contributor Author

There's not much more I can do at this point, everthing is fixed except for save ids.

Copy link
Contributor

@jasonw4331 jasonw4331 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me, one comment.

src/item/Armor.php Outdated Show resolved Hide resolved
@fractalllll

This comment was marked as off-topic.

@pandaaaBE
Copy link
Contributor

pandaaaBE commented Mar 22, 2024

image
Looks finished now :)

@HimmelKreis4865
Copy link
Contributor Author

yeah, ready to be reviewed again.

src/block/SmithingTable.php Outdated Show resolved Hide resolved
src/crafting/SmithingTransformRecipe.php Show resolved Hide resolved
src/crafting/SmithingTrimRecipe.php Show resolved Hide resolved
src/crafting/SmithingTransformRecipe.php Outdated Show resolved Hide resolved
src/item/ArmorTrim.php Show resolved Hide resolved
src/item/Armor.php Outdated Show resolved Hide resolved
src/item/SmithingTemplate.php Outdated Show resolved Hide resolved
src/utils/TextFormat.php Show resolved Hide resolved
@HimmelKreis4865
Copy link
Contributor Author

what is still missing?

@pandaaaBE
Copy link
Contributor

what is still missing?

nothing. just reviews 😭

Copy link
Contributor

@jasonw4331 jasonw4331 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some micro-optimizations which I believe may help the API

src/crafting/SmithingTrimRecipe.php Outdated Show resolved Hide resolved
src/item/ArmorTrimPattern.php Outdated Show resolved Hide resolved
src/item/ArmorTrimMaterial.php Outdated Show resolved Hide resolved
@ipad54 ipad54 requested a review from a team as a code owner November 30, 2024 20:22
Copy link
Member

@dktapps dktapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

src/crafting/CraftingManager.php Outdated Show resolved Hide resolved
src/block/inventory/SmithingTableInventory.php Outdated Show resolved Hide resolved
src/inventory/transaction/SmithingTransaction.php Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: API Related to the plugin API Category: Core Related to internal functionality Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants