diff --git a/CHANGELOG.md b/CHANGELOG.md index 607f44f6d..1d13088e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Fixed mouse keybindings not working on NeoForge. - Fixed upgrade destinations not being shown on upgrades. -- Fixed resources with changed data format or ID causing entire storage to fail to load. +- Fixed resources with changed data format or ID causing entire storage to fail to load. +- Fixed crash when trying to export fluids from an External Storage on Fabric. ## [2.0.0-milestone.4.7] - 2024-08-11 diff --git a/README.md b/README.md index 72f6f77af..36620222b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ this mod that allow the player to set up auto-crafting, allowing the crafting of - [Javadoc](https://refinedmods.com/javadoc/refinedstorage2) - [Discord](https://discordapp.com/invite/VYzsydb) - [Twitter](https://twitter.com/refinedmods) -- [Mastodon](https://anvil.social/@refinedmods) ## Building diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/exporter/FabricStorageExporterTransferStrategyFactory.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/exporter/FabricStorageExporterTransferStrategyFactory.java index 21cdd0551..82f029de3 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/exporter/FabricStorageExporterTransferStrategyFactory.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/exporter/FabricStorageExporterTransferStrategyFactory.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage.fabric.exporter; +import com.refinedmods.refinedstorage.api.core.NullableType; import com.refinedmods.refinedstorage.api.network.impl.node.exporter.ExporterTransferStrategyImpl; import com.refinedmods.refinedstorage.api.network.node.exporter.ExporterTransferStrategy; import com.refinedmods.refinedstorage.api.resource.ResourceKey; @@ -20,11 +21,11 @@ public class FabricStorageExporterTransferStrategyFactory implements ExporterTransferStrategyFactory { private final BlockApiLookup, Direction> lookup; - private final Function toPlatformMapper; + private final Function toPlatformMapper; private final long singleAmount; public FabricStorageExporterTransferStrategyFactory(final BlockApiLookup, Direction> lookup, - final Function toPlatformMapper, + final Function toPlatformMapper, final long singleAmount) { this.lookup = lookup; this.toPlatformMapper = toPlatformMapper; diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterSource.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterSource.java index 046d711b8..9a285606c 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterSource.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterSource.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.fabric.importer; import com.refinedmods.refinedstorage.api.core.Action; +import com.refinedmods.refinedstorage.api.core.NullableType; import com.refinedmods.refinedstorage.api.network.impl.node.importer.ImporterSource; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; @@ -32,7 +33,7 @@ class FabricStorageImporterSource implements ImporterSource { FabricStorageImporterSource(final BlockApiLookup, Direction> lookup, final Function fromPlatformMapper, - final Function toPlatformMapper, + @NullableType final Function toPlatformMapper, final ServerLevel serverLevel, final BlockPos pos, final Direction direction, diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterTransferStrategyFactory.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterTransferStrategyFactory.java index b3ecf4120..1d7c86c80 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterTransferStrategyFactory.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/importer/FabricStorageImporterTransferStrategyFactory.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage.fabric.importer; +import com.refinedmods.refinedstorage.api.core.NullableType; import com.refinedmods.refinedstorage.api.network.impl.node.importer.ImporterSource; import com.refinedmods.refinedstorage.api.network.impl.node.importer.ImporterTransferStrategyImpl; import com.refinedmods.refinedstorage.api.network.node.importer.ImporterTransferStrategy; @@ -20,12 +21,12 @@ public class FabricStorageImporterTransferStrategyFactory

implements ImporterTransferStrategyFactory { private final BlockApiLookup, Direction> lookup; private final Function fromPlatformMapper; - private final Function toPlatformMapper; + private final Function toPlatformMapper; private final long singleAmount; public FabricStorageImporterTransferStrategyFactory(final BlockApiLookup, Direction> lookup, final Function fromPlatformMapper, - final Function toPlatformMapper, + final Function toPlatformMapper, final long singleAmount) { this.lookup = lookup; this.fromPlatformMapper = fromPlatformMapper; diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageExtractableStorage.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageExtractableStorage.java index 5fae1ec64..b533cb41c 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageExtractableStorage.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageExtractableStorage.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.fabric.storage; import com.refinedmods.refinedstorage.api.core.Action; +import com.refinedmods.refinedstorage.api.core.NullableType; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.ExtractableStorage; @@ -18,12 +19,12 @@ public class FabricStorageExtractableStorage

implements ExtractableStorage { private final BlockApiCache, Direction> cache; - private final Function toPlatformMapper; + private final Function toPlatformMapper; private final Direction direction; private final AmountOverride amountOverride; public FabricStorageExtractableStorage(final BlockApiLookup, Direction> lookup, - final Function toPlatformMapper, + final Function toPlatformMapper, final ServerLevel serverLevel, final BlockPos pos, final Direction direction, @@ -41,6 +42,9 @@ public long extract(final ResourceKey resource, final long amount, final Action return 0L; } final P platformResource = toPlatformMapper.apply(resource); + if (platformResource == null) { + return 0L; + } final long correctedAmount = amountOverride.overrideAmount( resource, amount, diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageInsertableStorage.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageInsertableStorage.java index 2c3aa9342..9976f3fd7 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageInsertableStorage.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/FabricStorageInsertableStorage.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.fabric.storage; import com.refinedmods.refinedstorage.api.core.Action; +import com.refinedmods.refinedstorage.api.core.NullableType; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.InsertableStorage; @@ -18,12 +19,12 @@ public class FabricStorageInsertableStorage implements InsertableStorage { private final BlockApiCache, Direction> cache; - private final Function toPlatformMapper; + private final Function toPlatformMapper; private final Direction direction; private final AmountOverride amountOverride; public FabricStorageInsertableStorage(final BlockApiLookup, Direction> lookup, - final Function toPlatformMapper, + final Function toPlatformMapper, final ServerLevel serverLevel, final BlockPos pos, final Direction direction, diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStorageExternalStorageProvider.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStorageExternalStorageProvider.java index 939ef2f40..08ba7beae 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStorageExternalStorageProvider.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStorageExternalStorageProvider.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.fabric.storage.externalstorage; import com.refinedmods.refinedstorage.api.core.Action; +import com.refinedmods.refinedstorage.api.core.NullableType; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; @@ -33,7 +34,7 @@ class FabricStorageExternalStorageProvider

implements ExternalStorageProvider FabricStorageExternalStorageProvider(final BlockApiLookup, Direction> lookup, final Function fromPlatformMapper, - final Function toPlatformMapper, + final Function toPlatformMapper, final ServerLevel serverLevel, final BlockPos pos, final Direction direction) { diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStoragePlatformExternalStorageProviderFactory.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStoragePlatformExternalStorageProviderFactory.java index 825cbdec2..5d2f82e4c 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStoragePlatformExternalStorageProviderFactory.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/externalstorage/FabricStoragePlatformExternalStorageProviderFactory.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage.fabric.storage.externalstorage; +import com.refinedmods.refinedstorage.api.core.NullableType; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.external.ExternalStorageProvider; import com.refinedmods.refinedstorage.common.api.storage.externalstorage.PlatformExternalStorageProviderFactory; @@ -17,11 +18,12 @@ public class FabricStoragePlatformExternalStorageProviderFactory implements PlatformExternalStorageProviderFactory { private final BlockApiLookup, Direction> lookup; private final Function fromPlatformMapper; - private final Function toPlatformMapper; + private final Function toPlatformMapper; public FabricStoragePlatformExternalStorageProviderFactory(final BlockApiLookup, Direction> lookup, final Function fromPlatformMapper, - final Function toPlatformMapper) { + @NullableType final Function + toPlatformMapper) { this.lookup = lookup; this.fromPlatformMapper = fromPlatformMapper; this.toPlatformMapper = toPlatformMapper;