Skip to content

Implement anvil #6418

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

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

Implement anvil #6418

wants to merge 21 commits into from

Conversation

ShockedPlot7560
Copy link
Member

Introduction

As the title suggests, this PR implements the anvils

Relevant issues

Changes

API changes

  • Introduce a new Durable::isValidRepairMaterial enabling everyone to implement their own verification logic
  • Add repairMaterials to ArmorMaterial and ToolTier
  • Add repairCost functions in Item

Behavioural changes

  • Anvil works

Tests

I tested this PR by doing the following (tick all that apply):

  • Writing PHPUnit tests (commit these in the tests/phpunit folder)
  • Playtesting using a Minecraft client (provide screenshots or a video)
  • Writing a test plugin (provide the code and sample output)
  • Other (provide details)

https://youtu.be/d3vcwi_45DY

@ShockedPlot7560 ShockedPlot7560 added Category: Gameplay Related to Minecraft gameplay experience Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Aug 10, 2024
Copy link
Member

@IvanCraft623 IvanCraft623 left a comment

Choose a reason for hiding this comment

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

Just a quick overview

github-actions[bot]
github-actions bot previously approved these changes Aug 19, 2024
github-actions[bot]
github-actions bot previously approved these changes Aug 19, 2024
github-actions[bot]
github-actions bot previously approved these changes Aug 19, 2024
@ShockedPlot7560 ShockedPlot7560 requested a review from a team as a code owner November 18, 2024 13:52
pmmp-admin-bot[bot]
pmmp-admin-bot bot previously approved these changes Nov 18, 2024
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.

My gut reaction to this is: I don't like the code.

I don't think we should be using custom actions for this since the actions are only usable with specific types of transactions. By the way other stuff has been done, different AnvilTransaction classes should be implemented.

I'm also not liking the logic of some of the item comparisons being limited to checking type IDs. Plugins will likely want to implement more complex logic, like using tags or NBT checking.

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.

I think it would also probably be preferable to have more events, e.g. PlayerItemRenameEvent, PlayerItemRepairEvent, PlayerItemCombineEvent (not sure about this last one). (That being said, if there were transaction types for this instead of actions, it would be a good amount nicer).

Doesn't make much sense to make plugins do complex logic to figure out the action type when we can just tell them directly.

Copy link

github-actions bot commented Dec 6, 2024

This PR has been marked as "Waiting on Author", but we haven't seen any activity in 7 days.

If there is no further activity, it will be closed in 28 days.

Note for maintainers: Adding an assignee to the PR will prevent it from being marked as stale.

@github-actions github-actions bot added the Stale label Dec 6, 2024
pmmp-admin-bot[bot]
pmmp-admin-bot bot previously approved these changes Mar 9, 2025
pmmp-admin-bot[bot]
pmmp-admin-bot bot previously approved these changes Mar 22, 2025
pmmp-admin-bot[bot]
pmmp-admin-bot bot previously approved these changes Mar 22, 2025
pmmp-admin-bot[bot]
pmmp-admin-bot bot previously approved these changes Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Gameplay Related to Minecraft gameplay experience Stale Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants