Skip to content

feat: possible second implementation of the new structure system - #24

Open
noone-075 wants to merge 2 commits into
WebMCDevelopment:mainfrom
noone-075:wait-for-it
Open

feat: possible second implementation of the new structure system#24
noone-075 wants to merge 2 commits into
WebMCDevelopment:mainfrom
noone-075:wait-for-it

Conversation

@noone-075

Copy link
Copy Markdown
Contributor
  • 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.

- 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.
@noone-075
noone-075 marked this pull request as ready for review September 5, 2026 17:30
@noone-075 noone-075 mentioned this pull request Sep 5, 2026
@colbster937 colbster937 self-assigned this Sep 5, 2026
@colbster937
colbster937 self-requested a review September 5, 2026 19:09

@colbster937 colbster937 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should have an access modifier

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

incorrect indentation

}
}
}
} catch (IOException | ParsingException exception) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should be final, and all exceptions should be named "ex"

}
}
} catch (IOException | ParsingException exception) {
throw new SchemLoadingError("Failed to load schematic");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could simply be

throw new SchemLoadingError();

Comment on lines +27 to +30
@Override
public String getName() {
return "Rick QR Code Test Structure";
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unnecessary, the class name is good enough

Comment thread pom.xml
<groupId>xyz.webmc</groupId>
<artifactId>wlib</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.1-SNAPSHOT</version>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Placeable" is spelled incorrectly, aswell as the package name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Placeable" is spelled incorrectly, aswell as the package name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Placeable" is spelled incorrectly, aswell as the package name

@colbster937
colbster937 self-requested a review September 5, 2026 19:33

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@colbster937

Copy link
Copy Markdown
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants