Skip to content

Commit

Permalink
chore: improve crafting matrix sync #3
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Jun 13, 2023
1 parent 70404ba commit acbc2c1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package com.github.klikli_dev.occultism.common.block.storage;

import com.github.klikli_dev.occultism.common.blockentity.StableWormholeBlockEntity;
import com.github.klikli_dev.occultism.common.container.storage.StorageControllerContainerBase;
import com.github.klikli_dev.occultism.registry.OccultismTiles;
import com.github.klikli_dev.occultism.util.BlockEntityUtil;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -219,10 +220,12 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player
InteractionHand handIn, BlockHitResult rayTraceResult) {
if (!level.isClientSide) {
BlockEntity blockEntity = level.getBlockEntity(pos);
if (blockEntity instanceof StableWormholeBlockEntity wormhole) {
if (wormhole.getLinkedStorageController() != null)

if (blockEntity instanceof StableWormholeBlockEntity wormhole && StorageControllerContainerBase.canOpen(player, pos)) {
if (wormhole.getLinkedStorageController() != null) {
NetworkHooks.openScreen((ServerPlayer) player, wormhole, pos);
else {
StorageControllerContainerBase.reserve(player, pos);
} else {
level.setBlock(pos, state.setValue(LINKED, false), 2);
}
}
Expand Down

0 comments on commit acbc2c1

Please sign in to comment.