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

fix: canPlaceOn and canDestroy will be passed on conversion #6461

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from

Conversation

Nerahikada
Copy link
Contributor

Introduction

TypeConverter now also uses canPlaceOn and canDestroy parameters for item conversions.

Relevant issues

Changes

API changes

Behavioural changes

Backwards compatibility

Follow-up

This is enough to fix #6460, but still has the following issues:

  • Crashes when using new IDs such as minecraft:grass_block
  • ItemStack extra data contains unnecessary NBT data:
    • Minecraft vanilla: //8BCgAAAwYARGFtYWdlAAAAAAAAAAAAAQAAABUAbWluZWNyYWZ0OmdyYXNzX2Jsb2Nr
    • pmmp: //8BCgAACQoAQ2FuRGVzdHJveQgBAAAAFQBtaW5lY3JhZnQ6Z3Jhc3NfYmxvY2sAAAAAAAEAAAAVAG1pbmVjcmFmdDpncmFzc19ibG9jaw==

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)
$item = VanillaItems::IRON_HOE();
$item->setCanDestroy(["grass"]);  // minecraft:grass_block or grass_block will crash
$player->getInventory()->addItem($item);

@dries-c
Copy link
Member

dries-c commented Oct 26, 2024

Would be nice if we could validate whatever is set in setCanDestroy.

@jasonw4331 jasonw4331 added Category: API Related to the plugin API Category: Gameplay Related to Minecraft gameplay experience Type: Fix Bug fix, typo fix, or any other fix Category: Protocol Related to (changes in) the Minecraft network protocol Status: Waiting on Author labels Nov 4, 2024
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: Gameplay Related to Minecraft gameplay experience Category: Protocol Related to (changes in) the Minecraft network protocol Status: Waiting on Author Type: Fix Bug fix, typo fix, or any other fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

canPlaceOn, canDestroy have no effect on clients
3 participants