Airlock overhaul using new machine lib api#505
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.
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.
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.
This is going to give me nightmares!
There was a problem hiding this comment.
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.
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.
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.
What's the point of the extra spaces if they don't even line up...
There was a problem hiding this comment.
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.
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.
Add import dev.galacticraft.machinelib.api.block.entity.MachineBlockEntity; at the top, please.
Redstone control is unimplemented and the airlock overhaul PR (TeamGalacticraft#505) removes CheckboxButton anyway
Airlocks are new and improved