Skip to content

Conversation

@maxryan008
Copy link
Contributor

Airlocks are new and improved

@maxryan008 maxryan008 marked this pull request as draft August 12, 2025 12:18
public static final MapCodec<AirlockSealBlock> CODEC = simpleCodec(AirlockSealBlock::new);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

public static final DirectionProperty FACING = BlockStateProperties.FACING;
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are treating opposite directions in the same way (which seems to be the case), using BlockStateProperties.AXIS would probably be a more appropriate choice.

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(FACING);
public BlockState mirror(BlockState state, Mirror mirror) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method wouldn't need overriding with the AXIS block state property.

Comment on lines +129 to +132
if (enabled.equals(AirlockState.ALL)) { label = Component.translatable(Translations.Ui.AIRLOCK_ENABLED); color = ChatFormatting.DARK_GREEN.getColor(); }
else if (enabled.equals(AirlockState.PARTIAL)) { label = Component.translatable(Translations.Ui.AIRLOCK_PARTIAL); color = ChatFormatting.DARK_PURPLE.getColor(); }
else { label = Component.translatable(Translations.Ui.AIRLOCK_DISABLED); color = ChatFormatting.RED.getColor(); }
drawCenteredString(g, this.font, label, this.leftPos + 90, this.topPos + 18, color, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going to give me nightmares!

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a lot of duplicated code between AirlockControllerScreen and BubbleAirlockControllerScreen, which is a good sign that abstraction is needed.

GCBlocks.FOOD_CANNER,
GCBlocks.ROCKET_WORKBENCH
GCBlocks.ROCKET_WORKBENCH,
GCBlocks.BUBBLE_AIR_LOCK_CONTROLLER
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why GCBlocks.AIR_LOCK_CONTROLLER and GCBlocks.REINFORCED_AIR_LOCK_CONTROLLER are not included here as well?


String AIRLOCK_REDSTONE_SIGNAL = "ui.galacticraft.airlock.redstone_signal";
String AIRLOCK_OWNER = "ui.galacticraft.airlock.owner";
String AIRLOCK_PROXIMITY_LABEL = "ui.galacticraft.airlock_proximity_label";
Copy link
Contributor

Choose a reason for hiding this comment

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

All the other translation keys are ui.galacticraft.airlock.something.

Suggested change
String AIRLOCK_PROXIMITY_LABEL = "ui.galacticraft.airlock_proximity_label";
String AIRLOCK_PROXIMITY_LABEL = "ui.galacticraft.airlock.proximity_label";

Comment on lines +29 to +30
data.registerInt(() -> this.be.getDisplayState().ordinal(), i -> this.state = AirlockState.values()[i]);
data.registerInt(() -> this.be.getAccess().ordinal(), i -> this.access = ProximityAccess.values()[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of the extra spaces if they don't even line up...

Copy link
Contributor

Choose a reason for hiding this comment

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

This file doesn't have a license header, so it looks like you need to quickly run ./gradlew spotlessApply.

if (context.player().containerMenu instanceof AirlockControllerMenu menu) {
AirlockControllerBlockEntity be = menu.be;
if (be != null && be.getLevel() != null && be.getLevel().isLoaded(be.getBlockPos())) {
if (!(be instanceof dev.galacticraft.machinelib.api.block.entity.MachineBlockEntity mb)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add import dev.galacticraft.machinelib.api.block.entity.MachineBlockEntity; at the top, please.

if (context.player().containerMenu instanceof AirlockControllerMenu menu) {
AirlockControllerBlockEntity be = menu.be;
if (be != null && be.getLevel() != null && be.getLevel().isLoaded(be.getBlockPos())) {
if (!(be instanceof dev.galacticraft.machinelib.api.block.entity.MachineBlockEntity mb)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add import dev.galacticraft.machinelib.api.block.entity.MachineBlockEntity; at the top, please.

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.

4 participants