Skip to content

[1.21.3] Add GatherValidBlocksEvent #10152

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

Draft
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from

Conversation

RealMangorage
Copy link
Contributor

Adds an event where modders can add blocks that are considered valid for block entity types

@autoforge autoforge bot added Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. LTS This issue/PR is related to the current LTS version. 1.21 Feature This request implements a new feature. New Event This request implements a new event. labels Oct 29, 2024
@autoforge autoforge bot requested a review from a team October 29, 2024 08:31
public static final BlockEntityType<VaultBlockEntity> VAULT = register("vault", VaultBlockEntity::new, Blocks.VAULT);
private final BlockEntityType.BlockEntitySupplier<? extends T> factory;
- private final Set<Block> validBlocks;
+ private final net.minecraftforge.common.util.ValidBlocksSet validBlocks;
Copy link
Member

Choose a reason for hiding this comment

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

This is heavily reflected/edited by mods so its not good to change this field type.

this.original = original;
}

public boolean contains(Block block, BlockEntityType<?> type) {
Copy link
Member

Choose a reason for hiding this comment

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

As i said on discord, I think it would be better to fire this event at a known time, during post registration, instead of on first use. Theoretically it'd be fine as this method should only be used when the entries are loaded into world which is far after registration. But its a race and i'd rather just be clear on when its fired.

}

public boolean isSame(BlockEntityType<?> type) {
return type == blockEntityType;
Copy link
Member

Choose a reason for hiding this comment

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

Why not just have getType()?

}

public void addBlock(Block block) {
if (original.contains(block) || modded.contains(block)) return;
Copy link
Member

Choose a reason for hiding this comment

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

its a set.. no need for modded.contains

@PaintNinja PaintNinja added the Needs Update This request requires an update from the author to confirm whether the request is relevant. label Jan 4, 2025
@PaintNinja PaintNinja marked this pull request as draft January 4, 2025 15:36
@Jonathing
Copy link
Member

This PR is getting stale, but I think it can be easily cleaned up. It's not a priority but if you want to resume work on this, I'd recommend exactly what Lex said in comments, which is to keep it as a set but fire an event at a known time for all block entities. Common setup would be a good place for this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21 Feature This request implements a new feature. LTS This issue/PR is related to the current LTS version. Needs Update This request requires an update from the author to confirm whether the request is relevant. New Event This request implements a new event. Triage This request requires the active attention of the Triage Team. Requires labelling or reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants