-
Notifications
You must be signed in to change notification settings - Fork 433
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
base: 1.19.3
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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...
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; | ||
} |
There was a problem hiding this comment.
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? 😉
There was a problem hiding this comment.
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.
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 |
StructureTemplate.StructureEntityInfo entityInfo = instance.next(); | ||
|
||
for (final StructureProcessor processor : context.placementData().getProcessors()) { | ||
entityInfo = processor.process( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/Fabricators-of-Create/Porting-Lib/blob/f86f1ac1f5d7407dafb6eaadc7934da566cf29a2/extensions/src/main/java/io/github/fabricators_of_create/porting_lib/extensions/extensions/StructureProcessorExtensions.java#L9 (mojmap) This doesn't pass the StructureTemplate like StructureProcessorExtensions does meaning I can't even use this
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlphaMode up?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
Javadoc's likely needs improving.
Most of the changes in this PR are just adding a structure to the testmods.