diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d13088e1..4c09c8552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Fixed upgrade destinations not being shown on upgrades. - 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. +- The Configuration Card can now also transfer the (configured) Regulator Upgrade. ## [2.0.0-milestone.4.7] - 2024-08-11 diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java index 95b3116cc..585eaa5f4 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java @@ -54,6 +54,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; @@ -207,4 +208,6 @@ EnergyStorage asBlockItemEnergyStorage( Optional getPattern(ItemStack stack, Level level); void openAutocraftingPreview(List requests, @Nullable Object parentScreen); + + ResourceLocation getCreativeModeTabId(); } diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java index cd6065445..f33b6d74b 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java @@ -54,6 +54,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; @@ -408,6 +409,11 @@ public void openAutocraftingPreview(final List requests, @Nullab ensureLoaded().openAutocraftingPreview(requests, parentScreen); } + @Override + public ResourceLocation getCreativeModeTabId() { + return ensureLoaded().getCreativeModeTabId(); + } + private RefinedStorageApi ensureLoaded() { if (delegate == null) { throw new IllegalStateException("API not loaded yet"); diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/configurationcard/ConfigurationCardTarget.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/configurationcard/ConfigurationCardTarget.java index 5d246efaf..420c85641 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/configurationcard/ConfigurationCardTarget.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/configurationcard/ConfigurationCardTarget.java @@ -5,7 +5,6 @@ import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import org.apiguardian.api.API; @@ -18,11 +17,11 @@ public interface ConfigurationCardTarget { void readConfiguration(CompoundTag tag, HolderLookup.Provider provider); - default List getUpgradeItems() { + default List getUpgrades() { return Collections.emptyList(); } - default boolean addUpgradeItem(ItemStack upgradeStack) { + default boolean addUpgrade(ItemStack upgradeStack) { return false; } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java index 71589c077..0f328fcc4 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java @@ -50,6 +50,7 @@ import com.refinedmods.refinedstorage.common.api.support.slotreference.SlotReferenceProvider; import com.refinedmods.refinedstorage.common.api.upgrade.UpgradeRegistry; import com.refinedmods.refinedstorage.common.api.wirelesstransmitter.WirelessTransmitterRangeModifier; +import com.refinedmods.refinedstorage.common.content.ContentIds; import com.refinedmods.refinedstorage.common.grid.NoopGridSynchronizer; import com.refinedmods.refinedstorage.common.grid.screen.hint.GridInsertionHintsImpl; import com.refinedmods.refinedstorage.common.grid.screen.hint.ItemGridInsertionHint; @@ -104,6 +105,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -605,4 +607,9 @@ public void openAutocraftingPreview(final List requests, @Nullab } ClientPlatformUtil.openCraftingPreview(requests, parentScreen); } + + @Override + public ResourceLocation getCreativeModeTabId() { + return ContentIds.CREATIVE_MODE_TAB; + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AutocrafterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AutocrafterBlockEntity.java index df3cadde9..a0c59c865 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AutocrafterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AutocrafterBlockEntity.java @@ -32,7 +32,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; @@ -230,12 +229,12 @@ protected boolean hasRedstoneMode() { } @Override - public List getUpgradeItems() { + public List getUpgrades() { return upgradeContainer.getUpgradeItems(); } @Override - public boolean addUpgradeItem(final ItemStack upgradeStack) { + public boolean addUpgrade(final ItemStack upgradeStack) { return upgradeContainer.addUpgradeItem(upgradeStack); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemOverrides.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemOverrides.java index 3bce9bfea..c53f3ecd5 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemOverrides.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemOverrides.java @@ -21,7 +21,7 @@ public class PatternItemOverrides extends ItemOverrides { private final BakedModel stonecutterModel; private final BakedModel smithingTableModel; - @SuppressWarnings({"DataFlowIssue"}) // null is allowed as long as we don't pass overrides + @SuppressWarnings({"DataFlowIssue", "deprecation"}) // null is allowed as long as we don't pass overrides public PatternItemOverrides(final ModelBaker modelBaker, final BakedModel emptyModel, final BakedModel craftingModel, diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardItem.java index 7b78ff02f..806000f25 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardItem.java @@ -55,7 +55,7 @@ public InteractionResult useOn(final UseOnContext ctx) { stack.set(DataComponents.INSTANCE.getConfigurationCardState(), new ConfigurationCardState( blockEntity.getType(), createConfigTag(target, ctx.getLevel().registryAccess()), - target.getUpgradeItems() + target.getUpgrades() )); sendCopiedConfigurationMessage(ctx.getPlayer(), blockEntity.getType()); return InteractionResult.CONSUME; @@ -74,7 +74,7 @@ private InteractionResult applyConfiguration( return configurationCardIsConfiguredForDifferentType(player, state.blockEntityType()); } target.readConfiguration(state.config(), provider); - tryTransferUpgrades(player, target, state.upgradeItems()); + tryTransferUpgrades(player, target, state.upgrades()); targetBlockEntity.setChanged(); player.sendSystemMessage(createTranslation("item", "configuration_card.applied_configuration")); return InteractionResult.SUCCESS; @@ -82,11 +82,10 @@ private InteractionResult applyConfiguration( private void tryTransferUpgrades(final Player player, final ConfigurationCardTarget target, - final List upgradeItems) { - for (final Item upgradeItem : upgradeItems) { - final ItemStack upgradeStack = new ItemStack(upgradeItem); - final int upgradeIndexInPlayerInventory = player.getInventory().findSlotMatchingItem(upgradeStack); - if (upgradeIndexInPlayerInventory >= 0 && target.addUpgradeItem(upgradeStack)) { + final List upgrades) { + for (final ItemStack upgrade : upgrades) { + final int upgradeIndexInPlayerInventory = player.getInventory().findSlotMatchingItem(upgrade); + if (upgradeIndexInPlayerInventory >= 0 && target.addUpgrade(upgrade)) { player.getInventory().removeItem(upgradeIndexInPlayerInventory, 1); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardState.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardState.java index 33e3bccfd..15d37b943 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardState.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/configurationcard/ConfigurationCardState.java @@ -11,27 +11,24 @@ import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntityType; -public record ConfigurationCardState(BlockEntityType blockEntityType, - CompoundTag config, - List upgradeItems) { +public record ConfigurationCardState(BlockEntityType blockEntityType, CompoundTag config, List upgrades) { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( BuiltInRegistries.BLOCK_ENTITY_TYPE.byNameCodec().fieldOf("blockEntityType") .forGetter(ConfigurationCardState::blockEntityType), CompoundTag.CODEC.fieldOf("config") .forGetter(ConfigurationCardState::config), - Codec.list(BuiltInRegistries.ITEM.byNameCodec()).fieldOf("upgradeItems") - .forGetter(ConfigurationCardState::upgradeItems) + Codec.list(ItemStack.SINGLE_ITEM_CODEC).fieldOf("upgrades") + .forGetter(ConfigurationCardState::upgrades) ).apply(instance, ConfigurationCardState::new)); public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.registry(Registries.BLOCK_ENTITY_TYPE), ConfigurationCardState::blockEntityType, ByteBufCodecs.COMPOUND_TAG, ConfigurationCardState::config, - ByteBufCodecs.collection(ArrayList::new, ByteBufCodecs.registry(Registries.ITEM)), - ConfigurationCardState::upgradeItems, + ByteBufCodecs.collection(ArrayList::new, ItemStack.STREAM_CODEC), ConfigurationCardState::upgrades, ConfigurationCardState::new ); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractConstructorBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractConstructorBlockEntity.java index 75c15737e..d30fa7823 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractConstructorBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractConstructorBlockEntity.java @@ -36,7 +36,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; @@ -84,12 +83,12 @@ void setFilters(final List filters) { } @Override - public List getUpgradeItems() { + public List getUpgrades() { return upgradeContainer.getUpgradeItems(); } @Override - public boolean addUpgradeItem(final ItemStack upgradeStack) { + public boolean addUpgrade(final ItemStack upgradeStack) { return upgradeContainer.addUpgradeItem(upgradeStack); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractDestructorBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractDestructorBlockEntity.java index d94e3709b..c1d00b756 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractDestructorBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/AbstractDestructorBlockEntity.java @@ -35,7 +35,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; @@ -75,12 +74,12 @@ protected AbstractDestructorBlockEntity(final BlockPos pos, final BlockState sta } @Override - public List getUpgradeItems() { + public List getUpgrades() { return upgradeContainer.getUpgradeItems(); } @Override - public boolean addUpgradeItem(final ItemStack upgradeStack) { + public boolean addUpgrade(final ItemStack upgradeStack) { return upgradeContainer.addUpgradeItem(upgradeStack); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java index 3d932e4e2..31f38d827 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java @@ -9,6 +9,8 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public final class ContentIds { + public static final ResourceLocation CREATIVE_MODE_TAB = createIdentifier("general"); + public static final ResourceLocation DISK_DRIVE = createIdentifier("disk_drive"); public static final ResourceLocation MACHINE_CASING = createIdentifier("machine_casing"); public static final ResourceLocation CABLE = createIdentifier("cable"); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/AbstractExporterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/AbstractExporterBlockEntity.java index 628263c20..961903cbd 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/AbstractExporterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/AbstractExporterBlockEntity.java @@ -41,7 +41,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import org.slf4j.Logger; @@ -87,12 +86,12 @@ private void schedulingModeChanged(final SchedulingMode schedulingMode) { } @Override - public List getUpgradeItems() { + public List getUpgrades() { return upgradeContainer.getUpgradeItems(); } @Override - public boolean addUpgradeItem(final ItemStack upgradeStack) { + public boolean addUpgrade(final ItemStack upgradeStack) { return upgradeContainer.addUpgradeItem(upgradeStack); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/AbstractImporterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/AbstractImporterBlockEntity.java index a19995600..6e722c5cb 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/AbstractImporterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/AbstractImporterBlockEntity.java @@ -40,7 +40,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import org.slf4j.Logger; @@ -81,12 +80,12 @@ protected AbstractImporterBlockEntity(final BlockPos pos, final BlockState state } @Override - public List getUpgradeItems() { + public List getUpgrades() { return upgradeContainer.getUpgradeItems(); } @Override - public boolean addUpgradeItem(final ItemStack upgradeStack) { + public boolean addUpgrade(final ItemStack upgradeStack) { return upgradeContainer.addUpgradeItem(upgradeStack); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlockEntity.java index 199d7649f..acd182a92 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlockEntity.java @@ -27,7 +27,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; @@ -74,12 +73,12 @@ public void loadAdditional(final CompoundTag tag, final HolderLookup.Provider pr } @Override - public List getUpgradeItems() { + public List getUpgrades() { return upgradeContainer.getUpgradeItems(); } @Override - public boolean addUpgradeItem(final ItemStack upgradeStack) { + public boolean addUpgrade(final ItemStack upgradeStack) { return upgradeContainer.addUpgradeItem(upgradeStack); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java index 792f0751a..27e78416b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java @@ -28,7 +28,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; @@ -109,12 +108,12 @@ public void writeConfiguration(final CompoundTag tag, final HolderLookup.Provide } @Override - public List getUpgradeItems() { + public List getUpgrades() { return upgradeContainer.getUpgradeItems(); } @Override - public boolean addUpgradeItem(final ItemStack upgradeStack) { + public boolean addUpgrade(final ItemStack upgradeStack) { return upgradeContainer.addUpgradeItem(upgradeStack); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/UpgradeContainer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/UpgradeContainer.java index 671a654aa..5c71dc2e6 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/UpgradeContainer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/UpgradeContainer.java @@ -39,7 +39,7 @@ public class UpgradeContainer extends SimpleContainer implements UpgradeState { private final UpgradeContainerListener listener; private final int defaultWorkTickRate; private final ThrottledNetworkNodeTicker ticker; - + public UpgradeContainer(final UpgradeDestination destination) { this(destination, null); } @@ -145,20 +145,20 @@ public long getEnergyUsage() { return usage; } - public List getUpgradeItems() { - final List upgradeItems = new ArrayList<>(); + public List getUpgradeItems() { + final List upgradeItems = new ArrayList<>(); for (int i = 0; i < getContainerSize(); ++i) { final ItemStack itemStack = getItem(i); if (itemStack.isEmpty()) { continue; } - upgradeItems.add(itemStack.getItem()); + upgradeItems.add(itemStack.copy()); } return upgradeItems; } - public boolean addUpgradeItem(final ItemStack upgradeStack) { - return addItem(upgradeStack).isEmpty(); + public boolean addUpgradeItem(final ItemStack upgradeItem) { + return addItem(upgradeItem).isEmpty(); } public NonNullList getDrops() { diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java index 37d2390c8..2eb94d057 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java @@ -400,7 +400,7 @@ public boolean allowComponentsUpdateAnimation(final Player player, private void registerCreativeModeTab() { Registry.register( BuiltInRegistries.CREATIVE_MODE_TAB, - createIdentifier("general"), + RefinedStorageApi.INSTANCE.getCreativeModeTabId(), CreativeModeTab.builder(CreativeModeTab.Row.TOP, 0) .title(ContentNames.MOD) .icon(() -> new ItemStack(Blocks.INSTANCE.getCreativeController().getDefault())) diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java index 2964aed52..fb0e8e4eb 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java @@ -528,7 +528,7 @@ public void onRegister(final RegisterEvent e) { helper -> registerLootFunctions(new DirectRegistryCallback<>(BuiltInRegistries.LOOT_FUNCTION_TYPE)) ); e.register(Registries.CREATIVE_MODE_TAB, helper -> helper.register( - createIdentifier("general"), + RefinedStorageApi.INSTANCE.getCreativeModeTabId(), CreativeModeTab.builder() .title(ContentNames.MOD) .icon(() -> new ItemStack(Blocks.INSTANCE.getCreativeController().getDefault())) diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorTest.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorTest.java index b51cb42c3..dc4850830 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorTest.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorTest.java @@ -129,7 +129,7 @@ public static void shouldDropItemWithStackUpgrade(final GameTestHelper helper) { // Act constructor.setDropItems(true); constructor.setFilters(List.of(asResource(DIRT))); - constructor.addUpgradeItem(RSITEMS.getStackUpgrade().getDefaultInstance()); + constructor.addUpgrade(RSITEMS.getStackUpgrade().getDefaultInstance()); // Assert sequence diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorTest.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorTest.java index a1eb71777..0b7d8d6cf 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorTest.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorTest.java @@ -139,7 +139,7 @@ public static void shouldBreakBlockWithSilkTouchUpgrade(final GameTestHelper hel // Act helper.setBlock(pos.east(), Blocks.DIAMOND_ORE); - destructor.addUpgradeItem(RSITEMS.getSilkTouchUpgrade().getDefaultInstance()); + destructor.addUpgrade(RSITEMS.getSilkTouchUpgrade().getDefaultInstance()); // Assert sequence diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/exporter/ExporterTest.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/exporter/ExporterTest.java index b8d3d7e7c..fa0298721 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/exporter/ExporterTest.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/exporter/ExporterTest.java @@ -80,7 +80,7 @@ public static void shouldExportItemWithStackUpgrade(final GameTestHelper helper) // Act exporter.setFilters(List.of(asResource(DIRT))); - exporter.addUpgradeItem(RSITEMS.getStackUpgrade().getDefaultInstance()); + exporter.addUpgrade(RSITEMS.getStackUpgrade().getDefaultInstance()); // Assert sequence @@ -129,7 +129,7 @@ public static void shouldExportItemWithRegulatorUpgrade(final GameTestHelper hel if (upgrade.getItem() instanceof RegulatorUpgradeItem upgradeItem) { upgradeItem.setAmount(upgrade, asResource(DIRT.getDefaultInstance()), 10); } - exporter.addUpgradeItem(upgrade); + exporter.addUpgrade(upgrade); // Assert sequence @@ -224,7 +224,7 @@ public static void shouldExportFluidWithStackUpgrade(final GameTestHelper helper // Act exporter.setFilters(List.of(asResource(WATER))); - exporter.addUpgradeItem(RSITEMS.getStackUpgrade().getDefaultInstance()); + exporter.addUpgrade(RSITEMS.getStackUpgrade().getDefaultInstance()); // Assert sequence diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/importer/ImporterTest.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/importer/ImporterTest.java index a6eefe1a1..57209f6d7 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/importer/ImporterTest.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/importer/ImporterTest.java @@ -90,7 +90,7 @@ public static void shouldImportItemWithStackUpgrade(final GameTestHelper helper) DIRT.getDefaultInstance() ); - importer.addUpgradeItem(RSITEMS.getStackUpgrade().getDefaultInstance()); + importer.addUpgrade(RSITEMS.getStackUpgrade().getDefaultInstance()); // Assert sequence @@ -140,7 +140,7 @@ public static void shouldImportItemWithRegulatorUpgrade(final GameTestHelper hel if (upgrade.getItem() instanceof RegulatorUpgradeItem upgradeItem) { upgradeItem.setAmount(upgrade, asResource(DIRT.getDefaultInstance()), 10); } - importer.addUpgradeItem(upgrade); + importer.addUpgrade(upgrade); // Assert sequence @@ -371,7 +371,7 @@ public static void shouldImportFluidWithStackUpgrade(final GameTestHelper helper new ResourceAmount(asResource(WATER), Platform.INSTANCE.getBucketAmount() * 15), new ResourceAmount(asResource(LAVA), Platform.INSTANCE.getBucketAmount()) ); - importer.addUpgradeItem(RSITEMS.getStackUpgrade().getDefaultInstance()); + importer.addUpgrade(RSITEMS.getStackUpgrade().getDefaultInstance()); // Assert sequence diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/storage/diskinterface/DiskInterfaceTest.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/storage/diskinterface/DiskInterfaceTest.java index 1b89c4589..2955d51d0 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/storage/diskinterface/DiskInterfaceTest.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/storage/diskinterface/DiskInterfaceTest.java @@ -76,7 +76,7 @@ public static void shouldInsertItemsIntoNetworkWithStackUpgrade(final GameTestHe // Act diskInterface.setTransferMode(StorageTransferMode.INSERT_INTO_NETWORK); - diskInterface.addUpgradeItem(RSITEMS.getStackUpgrade().getDefaultInstance()); + diskInterface.addUpgrade(RSITEMS.getStackUpgrade().getDefaultInstance()); // Assert sequence @@ -217,7 +217,7 @@ public static void shouldExtractItemsFromNetworkWithStackUpgrade(final GameTestH // Act diskInterface.setTransferMode(StorageTransferMode.EXTRACT_FROM_NETWORK); - diskInterface.addUpgradeItem(RSITEMS.getStackUpgrade().getDefaultInstance()); + diskInterface.addUpgrade(RSITEMS.getStackUpgrade().getDefaultInstance()); // Assert sequence