feat: possible second implementation of the new structure system - #24
feat: possible second implementation of the new structure system#24noone-075 wants to merge 2 commits into
Conversation
- the old API is fully usable in api.structure.* but deprecated and mark for removal - the new API is located in api.structures.* and it would be the new way to create structures - the new API works with 2 types of structures: LocatedStructure and RelativeStructure - LocatedStructure is a structure that is generated at a specific location and it can be placed without specifying a location, it is already located - RelativeStructure is a structure that is generated relative to a location and it can be placed to any location, it is not located - each of them uses a PlacebleStructure (either LocatedPlacebleStructure or RelativePlacebleStructure) to build the structure and place it. - to make a new Structure, you need to extend either of them, and implement the build() method to return the correct type of PlacebleStructure - they use custom placeble blocks (LocatedBlock, RelativeBlock), they can also override the place function for custom behavior - then implementing the GenerableStructure interface is optional, it allows the structure to have the function needed to be generated in the world, if used by a chunk generator. THIS IS NOT A FINAL IMPLEMENTATION, IT IS STILL IN DEVELOPMENT AND MAY CHANGE IN THE FUTURE.
colbster937
left a comment
There was a problem hiding this comment.
i have requested all the changes i want (i'll fix what i can). i would also like to keep the package the same as the old api as to keep it consistent (singular words, not plural).
| public class LocatedBlock extends Block { | ||
| private final Location loc; | ||
|
|
||
| LocatedBlock(final Location loc, final XMaterial mat, final String dataModern, final byte dataLegacy) { |
There was a problem hiding this comment.
should have an access modifier
| private final int y; | ||
| private final int z; | ||
|
|
||
| RelativeBlock(final int x, final int y, final int z, final XMaterial mat, final String dataModern, |
There was a problem hiding this comment.
should have an access modifier
| } | ||
| } | ||
| } | ||
| } catch (IOException | ParsingException exception) { |
There was a problem hiding this comment.
should be final, and all exceptions should be named "ex"
| } | ||
| } | ||
| } catch (IOException | ParsingException exception) { | ||
| throw new SchemLoadingError("Failed to load schematic"); |
There was a problem hiding this comment.
could simply be
throw new SchemLoadingError();| @Override | ||
| public String getName() { | ||
| return "Rick QR Code Test Structure"; | ||
| } |
There was a problem hiding this comment.
unnecessary, the class name is good enough
| <groupId>xyz.webmc</groupId> | ||
| <artifactId>wlib</artifactId> | ||
| <version>1.2.9-SNAPSHOT</version> | ||
| <version>1.3.1-SNAPSHOT</version> |
There was a problem hiding this comment.
it'd be better to not bump the version yet, as to prevent more merge conflicts with 1.3.0. this is the least of my concerns and is okay though.
There was a problem hiding this comment.
"Placeable" is spelled incorrectly, aswell as the package name
There was a problem hiding this comment.
"Placeable" is spelled incorrectly, aswell as the package name
There was a problem hiding this comment.
"Placeable" is spelled incorrectly, aswell as the package name
There was a problem hiding this comment.
internal packages as such do not need to be kept intact across refactors and intern do not need to be deprecated like this and can just be deleted
There was a problem hiding this comment.
internal packages as such do not need to be kept intact across refactors and intern do not need to be deprecated like this and can just be deleted
|
it would also be a good idea to rename some classes (e.g. "Block") to not be the same as a bukkit class name, so they can be used in classes that already import bukkit classes |
THIS IS NOT A FINAL IMPLEMENTATION, IT IS STILL IN DEVELOPMENT AND MAY CHANGE IN THE FUTURE.