First look at block hardness & blast resistance autogen #6629
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements block hardness & blast resistance autogeneration from BedrockData block properties table to make sure the values are always up to date because of Mojang frequent changes.
Changes
Added
build\generate-block-break-info.php
tool which producesBlockHardnessValues
andBlockBlastResistanceValues
classes in\pocketmine\data\bedrock\block
.VanillaBlocks now always refers to hardness & blast resistance constant values in these classes when registering a block. However, if a block is indestructible in the game, I don't use the hardness value and only the blast resistance one. I did this because some obvious indestructible blocks (like water and lava) have positive hardness which can be exploited by hackers to destroy them in survival.
Tests
This has been briefly tested in the game. I didn't notice any behaviour changes with block breaking and explosions.