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

Add FabricStructureProcessor to allow processing of the StructureEntityInfo #2884

Open
wants to merge 4 commits into
base: 1.19.3
Choose a base branch
from

Conversation

modmuss50
Copy link
Member

@modmuss50 modmuss50 commented Feb 3, 2023

Javadoc's likely needs improving.

Most of the changes in this PR are just adding a structure to the testmods.

@modmuss50 modmuss50 added the enhancement New feature or request label Feb 3, 2023
@modmuss50 modmuss50 requested a review from a team February 3, 2023 15:13
Copy link
Member

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

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

This should really go into a new module (fabric-structure-api-v1?) to avoid adding more structure extensions to the biome API in the future. Remember the registry sync mess...

Comment on lines 60 to 67
if (entityId.equals("minecraft:item_frame")) {
final NbtCompound nbt = entityInfo.nbt.copy();
nbt.getCompound("Item").putString("id", item.getKey().get().getValue().toString());
return new StructureTemplate.StructureEntityInfo(entityInfo.pos, entityInfo.blockPos, nbt);
} else if (entityId.equals("minecraft:armor_stand")) {
// Don't spawn armor stands
return null;
}
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we possibly validate this behavior using a game test? 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Not easily, game test structure loading is seprate from this. and then they can spawn basically anywhere when placed using the command.

@modmuss50
Copy link
Member Author

This should really go into a new module (fabric-structure-api-v1?) to avoid adding more structure extensions to the biome API in the future.

Done 👍 I went with -v1 but started the version at 4.0.0 as we previously had a module with this name released as 3.x.x

@modmuss50 modmuss50 requested review from Technici4n and a team February 24, 2023 14:40
@modmuss50 modmuss50 added the next? Likely candidate for upcoming releases label Feb 24, 2023
StructureTemplate.StructureEntityInfo entityInfo = instance.next();

for (final StructureProcessor processor : context.placementData().getProcessors()) {
entityInfo = processor.process(
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi, thanks for taking a look. What is the use case for this? The vanilla StructureProcessor does not pass it, hence why I didnt. Im quite happy to add it, just a little curious about the use case.

Copy link

@yungnickyoung yungnickyoung Feb 28, 2023

Choose a reason for hiding this comment

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

Maybe it's useful for accessing the StructureTemplate's entityInfoList? E.g. to constrain the number of a specific entity that spawns within a structure. Or perhaps its size field could be useful for conditionally processing entities.

Copy link
Member

Choose a reason for hiding this comment

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

@AlphaMode so, why is this useful?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Hello there, is there anything that can be done? This is such a good feature to have for mod compatibility.

Choose a reason for hiding this comment

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

@Technici4n Btw AlphaMode said on Discord they are actually not sure about use cases for the StructureTemplate. And considering no one else has chimed in about this, I think it's safe to say we don't need to include the StructureTemplate as a parameter. That, or we could just include it anyway in case someone needs it. Regardless, it would be nice to see some activity on this PR, as the feature would be really useful!

Copy link
Member Author

Choose a reason for hiding this comment

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

Ill get this PR updated, worse case we can always add an overload passing it later.

@Technici4n Technici4n added waiting for feedback and removed next? Likely candidate for upcoming releases labels Jul 8, 2023
@modmuss50 modmuss50 self-assigned this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants