-
Notifications
You must be signed in to change notification settings - Fork 102
Airlock overhaul using new machine lib api #505
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
base: main
Are you sure you want to change the base?
Conversation
src/main/java/dev/galacticraft/mod/content/block/entity/AirlockControllerBlockEntity.java
Outdated
Show resolved
Hide resolved
…n tab are present
… feature/airlock-overhaul # Conflicts: # src/main/generated/assets/galacticraft/lang/en_us.json
src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/AirlockControllerScreen.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/AirlockControllerScreen.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/AirlockControllerScreen.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/AirlockControllerScreen.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/content/block/machine/airlock/AirlockFrameScanner.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/content/block/machine/airlock/AirlockFrameScanner.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/content/block/entity/AirlockControllerBlockEntity.java
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/content/block/entity/AirlockControllerBlockEntity.java
Show resolved
Hide resolved
src/main/java/dev/galacticraft/mod/content/block/entity/AirlockControllerBlockEntity.java
Show resolved
Hide resolved
… resistance, hard to break etc.
| public static final MapCodec<AirlockSealBlock> CODEC = simpleCodec(AirlockSealBlock::new); | ||
| public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; | ||
|
|
||
| public static final DirectionProperty FACING = BlockStateProperties.FACING; |
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.
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) { |
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 method wouldn't need overriding with the AXIS block state property.
| 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); |
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 is going to give me nightmares!
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.
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 |
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.
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"; |
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.
All the other translation keys are ui.galacticraft.airlock.something.
| String AIRLOCK_PROXIMITY_LABEL = "ui.galacticraft.airlock_proximity_label"; | |
| String AIRLOCK_PROXIMITY_LABEL = "ui.galacticraft.airlock.proximity_label"; |
| data.registerInt(() -> this.be.getDisplayState().ordinal(), i -> this.state = AirlockState.values()[i]); | ||
| data.registerInt(() -> this.be.getAccess().ordinal(), i -> this.access = ProximityAccess.values()[i]); |
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.
What's the point of the extra spaces if they don't even line 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.
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) |
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.
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) |
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.
Add import dev.galacticraft.machinelib.api.block.entity.MachineBlockEntity; at the top, please.
Airlocks are new and improved