Skip to content

Commit

Permalink
Lots of small changes (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
CommandrMoose authored May 4, 2024
1 parent 45ca52b commit 32de1dc
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level lev
}


@Override
public void onRemove(BlockState blockState, Level level, BlockPos blockPos, BlockState blockState2, boolean bl) {

if (level.getBlockEntity(blockPos) instanceof GlobalConsoleBlockEntity globalConsoleBlock) {
globalConsoleBlock.killControls();
}

super.onRemove(blockState, level, blockPos, blockState2, bl);
}

@Override
public void destroy(LevelAccessor levelAccessor, BlockPos blockPos, BlockState blockState) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;
import whocraft.tardis_refined.client.TardisClientData;
import whocraft.tardis_refined.common.capability.TardisLevelOperator;
import whocraft.tardis_refined.common.entity.ControlEntity;
import whocraft.tardis_refined.common.util.PlayerUtil;
import whocraft.tardis_refined.constants.ModMessages;
Expand All @@ -32,6 +33,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

public class KeyItem extends Item {

Expand Down Expand Up @@ -125,7 +127,21 @@ public boolean interactMonitor(ItemStack itemStack, Player player, ControlEntity
if (control.level() instanceof ServerLevel serverLevel) {
ResourceKey<Level> tardis = serverLevel.dimension();
if (control.controlSpecification().control() != null) {
if (control.controlSpecification().control() == TRControlRegistry.MONITOR.get() && !keychainContains(itemStack, tardis)) {
if (control.controlSpecification().control() == TRControlRegistry.MONITOR.get()) {


AtomicBoolean canTARDISTakeItem = new AtomicBoolean(false);
TardisLevelOperator.get(serverLevel).ifPresent((operator) -> {
if (operator.getTardisState() != TardisLevelOperator.STATE_EYE_OF_HARMONY || operator.getPilotingManager().isOutOfFuel()) {
PlayerUtil.sendMessage(player, ModMessages.HARDWARE_OFFLINE, true);
canTARDISTakeItem.set(false);
} else {
canTARDISTakeItem.set(true);
}
});

if (!keychainContains(itemStack, tardis) || !canTARDISTakeItem.get()) {return false;}

player.setItemInHand(interactionHand, addTardis(itemStack, tardis));
PlayerUtil.sendMessage(player, Component.translatable(ModMessages.MSG_KEY_BOUND, tardis.location().getPath()), true);
player.playSound(SoundEvents.PLAYER_LEVELUP, 1, 0.5F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public ProtectedZone[] unbreakableZones() {

if (!hasGeneratedCorridors || corridorAirlockCenter == null) return new ProtectedZone[]{};

ProtectedZone ctrlRoomAirlck = new ProtectedZone(corridorAirlockCenter.below(2).north(2).west(3), corridorAirlockCenter.south(3).east(3).above(6), "control_room_airlock");
ProtectedZone ctrlRoomAirlck = new ProtectedZone(corridorAirlockCenter.below(2).north(2).west(3), corridorAirlockCenter.south(3).east(3).above(5), "control_room_airlock");
ProtectedZone hubAirlck = new ProtectedZone(STATIC_CORRIDOR_POSITION.below(2).north(2).west(3), STATIC_CORRIDOR_POSITION.south(3).east(3).above(6), "hub_airlock");
ProtectedZone arsRoom = new ProtectedZone(new BlockPos(1051, 97, 6), new BlockPos(1023, 118, 36), "ars_room");

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected void addTranslations() {
addSound(TRSoundRegistry.SCREWDRIVER_SHORT.get(), "Screwdriver used");
addSound(TRSoundRegistry.INTERIOR_CREAKS.get(), "Creaks");
addSound(TRSoundRegistry.SCREWDRIVER_DISCARD.get(), "Screwdriver discard data");
addSound(TRSoundRegistry.GRAVITY_TUNNEL.get(), "Gravity tunnel winds");

/*Block*/
add(TRBlockRegistry.ARS_EGG.get(), "ARS Egg");
Expand Down

0 comments on commit 32de1dc

Please sign in to comment.