File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
src/main/java/com/simibubi/create/content/logistics/vault Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,19 @@ public boolean hasAnalogOutputSignal(BlockState p_149740_1_) {
167
167
public int getAnalogOutputSignal (BlockState pState , Level pLevel , BlockPos pPos ) {
168
168
return getBlockEntityOptional (pLevel , pPos )
169
169
.filter (vte -> !Transaction .isOpen ()) // fabric: hack fix for comparators updating when they shouldn't
170
- .map (vte -> vte .getItemStorage (null ))
170
+ .map (vte -> {
171
+ // fabric: fix for comparators grabbing the capability too quickly, relying on grabbing it through
172
+ // the non-controller's initCapability method isn't reliable and doesn't work properly.
173
+ // so what we end up doing is just returning the capability for the controller, and if it's
174
+ // not the controller it's own capability is returned
175
+ if (!vte .isController ()) {
176
+ ItemVaultBlockEntity controllerBE = vte .getControllerBE ();
177
+ if (controllerBE != null )
178
+ return controllerBE .getItemStorage (null );
179
+ }
180
+
181
+ return vte .getItemStorage (null );
182
+ })
171
183
.map (ItemHelper ::calcRedstoneFromInventory )
172
184
.orElse (0 );
173
185
}
Original file line number Diff line number Diff line change 5
5
import javax .annotation .Nullable ;
6
6
7
7
import com .simibubi .create .AllBlockEntityTypes ;
8
- import com .simibubi .create .Create ;
9
8
import com .simibubi .create .api .connectivity .ConnectivityHandler ;
10
9
import com .simibubi .create .foundation .blockEntity .IMultiBlockEntityContainer ;
11
10
import com .simibubi .create .foundation .blockEntity .SmartBlockEntity ;
12
11
import com .simibubi .create .foundation .blockEntity .behaviour .BlockEntityBehaviour ;
13
12
import com .simibubi .create .foundation .blockEntity .behaviour .inventory .VersionedInventoryWrapper ;
14
13
import com .simibubi .create .infrastructure .config .AllConfigs ;
14
+
15
15
import io .github .fabricators_of_create .porting_lib .transfer .item .ItemStackHandler ;
16
16
import net .fabricmc .fabric .api .transfer .v1 .item .ItemVariant ;
17
17
import net .fabricmc .fabric .api .transfer .v1 .storage .Storage ;
18
- import net .fabricmc .fabric .api .transfer .v1 .storage .base .CombinedSlottedStorage ;
19
18
import net .fabricmc .fabric .api .transfer .v1 .storage .base .CombinedStorage ;
20
19
import net .fabricmc .fabric .api .transfer .v1 .storage .base .SidedStorageBlockEntity ;
21
20
import net .minecraft .core .BlockPos ;
@@ -240,7 +239,7 @@ public Storage<ItemVariant> getItemStorage(@Nullable Direction face) {
240
239
return itemCapability ;
241
240
}
242
241
243
- private void initCapability () {
242
+ protected void initCapability () {
244
243
if (itemCapability != null )
245
244
return ;
246
245
if (!isController ()) {
You can’t perform that action at this time.
0 commit comments