Skip to content

Commit

Permalink
Merge branch 'mc1.18/fabric/dev' into mc1.19/fabric/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Dec 1, 2024
2 parents e61ede5 + 6c0df5a commit 1ca9a9d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,19 @@ public boolean hasAnalogOutputSignal(BlockState p_149740_1_) {
public int getAnalogOutputSignal(BlockState pState, Level pLevel, BlockPos pPos) {
return getBlockEntityOptional(pLevel, pPos)
.filter(vte -> !Transaction.isOpen()) // fabric: hack fix for comparators updating when they shouldn't
.map(vte -> vte.getItemStorage(null))
.map(vte -> {
// fabric: fix for comparators grabbing the capability too quickly, relying on grabbing it through
// the non-controller's initCapability method isn't reliable and doesn't work properly.
// so what we end up doing is just returning the capability for the controller, and if it's
// not the controller it's own capability is returned
if (!vte.isController()) {
ItemVaultBlockEntity controllerBE = vte.getControllerBE();
if (controllerBE != null)
return controllerBE.getItemStorage(null);
}

return vte.getItemStorage(null);
})
.map(ItemHelper::calcRedstoneFromInventory)
.orElse(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import javax.annotation.Nullable;

import com.simibubi.create.AllBlockEntityTypes;
import com.simibubi.create.Create;
import com.simibubi.create.api.connectivity.ConnectivityHandler;
import com.simibubi.create.foundation.blockEntity.IMultiBlockEntityContainer;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.inventory.VersionedInventoryWrapper;
import com.simibubi.create.infrastructure.config.AllConfigs;

import io.github.fabricators_of_create.porting_lib.transfer.item.ItemStackHandler;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
Expand Down Expand Up @@ -239,7 +239,7 @@ public Storage<ItemVariant> getItemStorage(@Nullable Direction face) {
return itemCapability;
}

private void initCapability() {
protected void initCapability() {
if (itemCapability != null)
return;
if (!isController()) {
Expand Down

0 comments on commit 1ca9a9d

Please sign in to comment.