Skip to content

Commit 178ba41

Browse files
committed
Fix rescan proxy not respecting if a field is currently crafting
1 parent 0a7b33e commit 178ba41

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/main/java/dev/compactmods/crafting/proxies/block/RescanFieldProxyBlock.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package dev.compactmods.crafting.proxies.block;
22

33
import javax.annotation.Nullable;
4+
import dev.compactmods.crafting.api.EnumCraftingState;
45
import dev.compactmods.crafting.field.capability.CapabilityMiniaturizationField;
56
import dev.compactmods.crafting.proxies.data.BaseFieldProxyEntity;
67
import dev.compactmods.crafting.proxies.data.RescanFieldProxyEntity;
7-
import dev.compactmods.crafting.api.field.IMiniaturizationField;
88
import net.minecraft.block.Block;
99
import net.minecraft.block.BlockState;
1010
import net.minecraft.tileentity.TileEntity;
@@ -31,20 +31,19 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) {
3131

3232
@Override
3333
public void neighborChanged(BlockState thisState, World level, BlockPos thisPos, Block changedBlock, BlockPos changedPos, boolean _b) {
34-
if (!level.isClientSide) {
35-
BaseFieldProxyEntity tile = (BaseFieldProxyEntity) level.getBlockEntity(thisPos);
36-
37-
doRescanRedstone(level, thisPos, tile);
34+
if (level.isClientSide) {
35+
return;
3836
}
39-
}
37+
BaseFieldProxyEntity tile = (BaseFieldProxyEntity) level.getBlockEntity(thisPos);
4038

41-
private void doRescanRedstone(World level, BlockPos thisPos, BaseFieldProxyEntity tile) {
4239
if (level.hasNeighborSignal(thisPos)) {
4340
// call recipe scan
44-
4541
if (tile != null) {
4642
tile.getCapability(CapabilityMiniaturizationField.MINIATURIZATION_FIELD)
47-
.ifPresent(IMiniaturizationField::fieldContentsChanged);
43+
.ifPresent(field -> {
44+
if(field.getCraftingState() != EnumCraftingState.CRAFTING)
45+
field.fieldContentsChanged();
46+
});
4847
}
4948
}
5049
}

0 commit comments

Comments
 (0)