diff --git a/CHANGELOG.md b/CHANGELOG.md index e41581516..b0f459f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Configuration Card. It copies device configurations and can transfer upgrades. - Network Receiver +- Network Card ## [2.0.0-milestone.3.1] - 2023-10-30 diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java index 8fefa1e76..0d26b3a58 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java @@ -50,6 +50,7 @@ import com.refinedmods.refinedstorage2.platform.common.importer.ImporterContainerMenu; import com.refinedmods.refinedstorage2.platform.common.misc.ProcessorItem; import com.refinedmods.refinedstorage2.platform.common.misc.WrenchItem; +import com.refinedmods.refinedstorage2.platform.common.networking.NetworkCardItem; import com.refinedmods.refinedstorage2.platform.common.storage.FluidStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.ItemStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.StorageTypes; @@ -330,6 +331,7 @@ private void registerSimpleItems(final RegistryCallback callback) { ContentIds.CONFIGURATION_CARD, ConfigurationCardItem::new )); + Items.INSTANCE.setNetworkCard(callback.register(ContentIds.NETWORK_CARD, NetworkCardItem::new)); } private void registerProcessor(final RegistryCallback callback, final ProcessorItem.Type type) { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/ContainedFluid.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/ContainedFluid.java deleted file mode 100644 index 8844f28b7..000000000 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/ContainedFluid.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.refinedmods.refinedstorage2.platform.common; - -import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; -import com.refinedmods.refinedstorage2.platform.api.support.resource.FluidResource; - -import net.minecraft.world.item.ItemStack; - -public record ContainedFluid(ItemStack remainderContainer, ResourceAmount fluid) { -} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Platform.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Platform.java index 2a26f87b5..63efa0135 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Platform.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Platform.java @@ -3,6 +3,7 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.grid.view.GridResourceFactory; import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; +import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.platform.api.grid.strategy.GridInsertionStrategyFactory; import com.refinedmods.refinedstorage2.platform.api.support.resource.FluidResource; import com.refinedmods.refinedstorage2.platform.api.support.resource.ItemResource; @@ -119,4 +120,7 @@ List processTooltipComponents( void renderTooltip(GuiGraphics graphics, List components, int x, int y); Optional getEnergyStorage(ItemStack stack); + + record ContainedFluid(ItemStack remainderContainer, ResourceAmount fluid) { + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java index e8d5c4f34..62a42f9dc 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java @@ -72,7 +72,7 @@ import com.refinedmods.refinedstorage2.platform.common.upgrade.BuiltinUpgradeDestinationsImpl; import com.refinedmods.refinedstorage2.platform.common.upgrade.UpgradeRegistryImpl; import com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil; -import com.refinedmods.refinedstorage2.platform.common.util.TickHandler; +import com.refinedmods.refinedstorage2.platform.common.util.ServerEventQueue; import com.refinedmods.refinedstorage2.platform.common.wirelesstransmitter.CompositeWirelessTransmitterRangeModifier; import java.util.ArrayList; @@ -292,7 +292,7 @@ public void requestNetworkNodeInitialization(final NetworkNodeContainer containe final Level level, final Runnable callback) { final LevelConnectionProvider connectionProvider = new LevelConnectionProvider(level); - TickHandler.runWhenReady(() -> { + ServerEventQueue.queue(() -> { networkBuilder.initialize(container, connectionProvider); callback.run(); }); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/AbstractItemConstructorStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/AbstractItemConstructorStrategy.java index 9764fad8b..fe58bd497 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/AbstractItemConstructorStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/AbstractItemConstructorStrategy.java @@ -15,12 +15,12 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -public abstract class AbstractItemConstructorStrategy implements ConstructorStrategy { +abstract class AbstractItemConstructorStrategy implements ConstructorStrategy { protected final ServerLevel level; protected final BlockPos pos; protected final Direction direction; - protected AbstractItemConstructorStrategy(final ServerLevel level, final BlockPos pos, final Direction direction) { + AbstractItemConstructorStrategy(final ServerLevel level, final BlockPos pos, final Direction direction) { this.level = level; this.pos = pos; this.direction = direction; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/BlockBreakDestructorStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/BlockBreakDestructorStrategy.java index efd701758..b5c9d79c2 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/BlockBreakDestructorStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/BlockBreakDestructorStrategy.java @@ -24,13 +24,13 @@ import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; -public class BlockBreakDestructorStrategy implements DestructorStrategy { +class BlockBreakDestructorStrategy implements DestructorStrategy { private final ServerLevel level; private final BlockPos pos; private final Direction direction; private final ItemStack tool; - public BlockBreakDestructorStrategy( + BlockBreakDestructorStrategy( final ServerLevel level, final BlockPos pos, final Direction direction, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeConstructorStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeConstructorStrategy.java index a0b19c148..0b6ef3b36 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeConstructorStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeConstructorStrategy.java @@ -9,10 +9,10 @@ import net.minecraft.world.entity.player.Player; -public class CompositeConstructorStrategy implements ConstructorStrategy { +class CompositeConstructorStrategy implements ConstructorStrategy { private final List strategies; - public CompositeConstructorStrategy(final List strategies) { + CompositeConstructorStrategy(final List strategies) { this.strategies = Collections.unmodifiableList(strategies); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeDestructorStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeDestructorStrategy.java index 448725d9a..1bc13264c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeDestructorStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/CompositeDestructorStrategy.java @@ -11,10 +11,10 @@ import net.minecraft.world.entity.player.Player; -public class CompositeDestructorStrategy implements DestructorStrategy { +class CompositeDestructorStrategy implements DestructorStrategy { private final List strategies; - public CompositeDestructorStrategy(final List strategies) { + CompositeDestructorStrategy(final List strategies) { this.strategies = Collections.unmodifiableList(strategies); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorContainerMenu.java index 5c353e667..6239e1679 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorContainerMenu.java @@ -4,7 +4,6 @@ import com.refinedmods.refinedstorage2.platform.common.content.Menus; import com.refinedmods.refinedstorage2.platform.common.support.containermenu.AbstractSchedulingContainerMenu; import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ClientProperty; -import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyTypes; import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ServerProperty; import com.refinedmods.refinedstorage2.platform.common.upgrade.UpgradeContainer; import com.refinedmods.refinedstorage2.platform.common.upgrade.UpgradeDestinations; @@ -49,14 +48,14 @@ public ConstructorContainerMenu(final int syncId, @Override protected void registerClientProperties() { super.registerClientProperties(); - registerProperty(new ClientProperty<>(PropertyTypes.CONSTRUCTOR_DROP_ITEMS, false)); + registerProperty(new ClientProperty<>(ConstructorDestructorPropertyTypes.DROP_ITEMS, false)); } @Override protected void registerServerProperties(final ConstructorBlockEntity blockEntity) { super.registerServerProperties(blockEntity); registerProperty(new ServerProperty<>( - PropertyTypes.CONSTRUCTOR_DROP_ITEMS, + ConstructorDestructorPropertyTypes.DROP_ITEMS, blockEntity::isDropItems, blockEntity::setDropItems )); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorDestructorPropertyTypes.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorDestructorPropertyTypes.java new file mode 100644 index 000000000..916ddb1bc --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorDestructorPropertyTypes.java @@ -0,0 +1,18 @@ +package com.refinedmods.refinedstorage2.platform.common.constructordestructor; + +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyType; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyTypes; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; + +final class ConstructorDestructorPropertyTypes { + static final PropertyType PICKUP_ITEMS = PropertyTypes.createBooleanProperty( + createIdentifier("pickup_items") + ); + static final PropertyType DROP_ITEMS = PropertyTypes.createBooleanProperty( + createIdentifier("drop_items") + ); + + private ConstructorDestructorPropertyTypes() { + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java index bb0351593..7efb78943 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java @@ -5,8 +5,8 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class ConstructorDropItemsSideButtonWidget extends AbstractYesNoSideButtonWidget { - public ConstructorDropItemsSideButtonWidget(final ClientProperty property) { +class ConstructorDropItemsSideButtonWidget extends AbstractYesNoSideButtonWidget { + ConstructorDropItemsSideButtonWidget(final ClientProperty property) { super(property, createTranslation("gui", "constructor.drop_items")); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorScreen.java index 7929d28b5..ece31fd5d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorScreen.java @@ -24,7 +24,7 @@ protected void init() { )); addSideButton(new SchedulingModeSideButtonWidget(getMenu().getProperty(PropertyTypes.SCHEDULING_MODE))); addSideButton(new ConstructorDropItemsSideButtonWidget( - getMenu().getProperty(PropertyTypes.CONSTRUCTOR_DROP_ITEMS) + getMenu().getProperty(ConstructorDestructorPropertyTypes.DROP_ITEMS) )); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorContainerMenu.java index 6ea56146f..b478ee670 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorContainerMenu.java @@ -52,7 +52,7 @@ public DestructorContainerMenu(final int syncId, protected void registerClientProperties() { registerProperty(new ClientProperty<>(PropertyTypes.REDSTONE_MODE, RedstoneMode.IGNORE)); registerProperty(new ClientProperty<>(PropertyTypes.FILTER_MODE, FilterMode.BLOCK)); - registerProperty(new ClientProperty<>(PropertyTypes.DESTRUCTOR_PICKUP_ITEMS, false)); + registerProperty(new ClientProperty<>(ConstructorDestructorPropertyTypes.PICKUP_ITEMS, false)); } @Override @@ -68,7 +68,7 @@ protected void registerServerProperties(final DestructorBlockEntity blockEntity) blockEntity::setFilterMode )); registerProperty(new ServerProperty<>( - PropertyTypes.DESTRUCTOR_PICKUP_ITEMS, + ConstructorDestructorPropertyTypes.PICKUP_ITEMS, blockEntity::isPickupItems, blockEntity::setPickupItems )); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java index 56fd53f66..e46532f87 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java @@ -5,8 +5,8 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class DestructorPickupItemsSideButtonWidget extends AbstractYesNoSideButtonWidget { - public DestructorPickupItemsSideButtonWidget(final ClientProperty property) { +class DestructorPickupItemsSideButtonWidget extends AbstractYesNoSideButtonWidget { + DestructorPickupItemsSideButtonWidget(final ClientProperty property) { super(property, createTranslation("gui", "destructor.pickup_items")); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorScreen.java index de4b64039..c2accdb21 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorScreen.java @@ -23,7 +23,7 @@ protected void init() { createTranslation("gui", "destructor.filter_mode.block.help") )); addSideButton(new DestructorPickupItemsSideButtonWidget( - getMenu().getProperty(PropertyTypes.DESTRUCTOR_PICKUP_ITEMS) + getMenu().getProperty(ConstructorDestructorPropertyTypes.PICKUP_ITEMS) )); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/FluidBreakDestructorStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/FluidBreakDestructorStrategy.java index 5db002d5e..5472817f0 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/FluidBreakDestructorStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/FluidBreakDestructorStrategy.java @@ -23,11 +23,11 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.Fluid; -public class FluidBreakDestructorStrategy implements DestructorStrategy { +class FluidBreakDestructorStrategy implements DestructorStrategy { private final ServerLevel level; private final BlockPos pos; - public FluidBreakDestructorStrategy(final ServerLevel level, final BlockPos pos) { + FluidBreakDestructorStrategy(final ServerLevel level, final BlockPos pos) { this.level = level; this.pos = pos; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemDropConstructorStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemDropConstructorStrategy.java index e2a855891..d80763679 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemDropConstructorStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemDropConstructorStrategy.java @@ -11,10 +11,10 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -public class ItemDropConstructorStrategy extends AbstractItemConstructorStrategy { +class ItemDropConstructorStrategy extends AbstractItemConstructorStrategy { private final long amount; - public ItemDropConstructorStrategy( + ItemDropConstructorStrategy( final ServerLevel level, final BlockPos pos, final Direction direction, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemPickupDestructorStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemPickupDestructorStrategy.java index aedccbee2..5eb87f603 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemPickupDestructorStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ItemPickupDestructorStrategy.java @@ -20,11 +20,11 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.AABB; -public class ItemPickupDestructorStrategy implements DestructorStrategy { +class ItemPickupDestructorStrategy implements DestructorStrategy { private final ServerLevel level; private final BlockPos pos; - public ItemPickupDestructorStrategy(final ServerLevel level, final BlockPos pos) { + ItemPickupDestructorStrategy(final ServerLevel level, final BlockPos pos) { this.level = level; this.pos = pos; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java index 22f82f038..291f8bf78 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java @@ -50,6 +50,7 @@ public final class ContentIds { public static final ResourceLocation STORAGE_MONITOR = createIdentifier("storage_monitor"); public static final ResourceLocation CONFIGURATION_CARD = createIdentifier("configuration_card"); public static final ResourceLocation NETWORK_RECEIVER = createIdentifier("network_receiver"); + public static final ResourceLocation NETWORK_CARD = createIdentifier("network_card"); private ContentIds() { } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java index cde4fde76..52ca3656b 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java @@ -97,5 +97,6 @@ private static void appendItems(final Consumer consumer) { consumer.accept(Items.INSTANCE.getWirelessGrid().createAtEnergyCapacity()); itemConsumer.accept(Items.INSTANCE.getCreativeWirelessGrid()); itemConsumer.accept(Items.INSTANCE.getConfigurationCard()); + itemConsumer.accept(Items.INSTANCE.getNetworkCard()); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java index 608cd7e32..13fca80df 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java @@ -81,6 +81,8 @@ public final class Items { private Supplier creativeWirelessGrid; @Nullable private Supplier configurationCard; + @Nullable + private Supplier networkCard; private Items() { } @@ -372,4 +374,12 @@ public void addNetworkReceiver(final Supplier supplier) { public List> getNetworkReceivers() { return Collections.unmodifiableList(allNetworkReceivers); } + + public Item getNetworkCard() { + return Objects.requireNonNull(networkCard).get(); + } + + public void setNetworkCard(final Supplier supplier) { + this.networkCard = supplier; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/CreativeControllerBlockItem.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/CreativeControllerBlockItem.java index 20ba2efea..6315648cf 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/CreativeControllerBlockItem.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/CreativeControllerBlockItem.java @@ -8,8 +8,8 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class CreativeControllerBlockItem extends NamedBlockItem { - public CreativeControllerBlockItem(final Block block, final Component name) { +class CreativeControllerBlockItem extends NamedBlockItem { + CreativeControllerBlockItem(final Block block, final Component name) { super(block, new Item.Properties().stacksTo(1), name, createTranslation("item", "creative_controller.help")); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorAmount.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorAmount.java deleted file mode 100644 index 2860f141a..000000000 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorAmount.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.refinedmods.refinedstorage2.platform.common.detector; - -public interface DetectorAmount { - long getAmount(); - - void setAmount(long amount); - - void changeAmount(long amount); -} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorContainerMenu.java index 550068f5d..e360e6b4d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorContainerMenu.java @@ -26,7 +26,7 @@ public class DetectorContainerMenu extends AbstractSingleAmountContainerMenu { public DetectorContainerMenu(final int syncId, final Inventory playerInventory, final FriendlyByteBuf buf) { super(Menus.INSTANCE.getDetector(), syncId, playerInventory, buf, FILTER_HELP); registerProperty(new ClientProperty<>(PropertyTypes.FUZZY_MODE, false)); - registerProperty(new ClientProperty<>(PropertyTypes.DETECTOR_MODE, DetectorMode.EQUAL)); + registerProperty(new ClientProperty<>(DetectorPropertyTypes.MODE, DetectorMode.EQUAL)); } public DetectorContainerMenu(final int syncId, @@ -41,7 +41,7 @@ public DetectorContainerMenu(final int syncId, detector::setFuzzyMode )); registerProperty(new ServerProperty<>( - PropertyTypes.DETECTOR_MODE, + DetectorPropertyTypes.MODE, detector::getMode, detector::setMode )); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSettings.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSettings.java index 7a3f72c5a..158a0e55c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSettings.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSettings.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.detector.DetectorMode; -public final class DetectorModeSettings { +final class DetectorModeSettings { private static final int UNDER = 0; private static final int EQUAL = 1; private static final int ABOVE = 2; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSideButtonWidget.java index 78b1cd534..d2dd7292f 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorModeSideButtonWidget.java @@ -8,7 +8,7 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class DetectorModeSideButtonWidget extends AbstractSideButtonWidget { +class DetectorModeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "detector.mode"); private static final MutableComponent SUBTEXT_EQUAL = createTranslation("gui", "detector.mode.equal"); private static final MutableComponent SUBTEXT_ABOVE = createTranslation("gui", "detector.mode.above"); @@ -16,7 +16,7 @@ public class DetectorModeSideButtonWidget extends AbstractSideButtonWidget { private final ClientProperty property; - public DetectorModeSideButtonWidget(final ClientProperty property) { + DetectorModeSideButtonWidget(final ClientProperty property) { super(createPressAction(property)); this.property = property; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorPropertyTypes.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorPropertyTypes.java new file mode 100644 index 000000000..e38d66f83 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorPropertyTypes.java @@ -0,0 +1,17 @@ +package com.refinedmods.refinedstorage2.platform.common.detector; + +import com.refinedmods.refinedstorage2.api.network.impl.node.detector.DetectorMode; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyType; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; + +final class DetectorPropertyTypes { + static final PropertyType MODE = new PropertyType<>( + createIdentifier("detector_mode"), + DetectorModeSettings::getDetectorMode, + DetectorModeSettings::getDetectorMode + ); + + private DetectorPropertyTypes() { + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorScreen.java index 1861821ec..b58ac5c46 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorScreen.java @@ -19,6 +19,6 @@ protected void init() { getMenu().getProperty(PropertyTypes.FUZZY_MODE), FuzzyModeSideButtonWidget.Type.GENERIC )); - addSideButton(new DetectorModeSideButtonWidget(getMenu().getProperty(PropertyTypes.DETECTOR_MODE))); + addSideButton(new DetectorModeSideButtonWidget(getMenu().getProperty(DetectorPropertyTypes.MODE))); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/FuzzyDetectorAmountStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/FuzzyDetectorAmountStrategy.java index 0b404b412..9372be618 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/FuzzyDetectorAmountStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/FuzzyDetectorAmountStrategy.java @@ -8,10 +8,10 @@ import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.platform.api.storage.channel.FuzzyStorageChannel; -public class FuzzyDetectorAmountStrategy extends AbstractDetectorAmountStrategy { +class FuzzyDetectorAmountStrategy extends AbstractDetectorAmountStrategy { private final DetectorAmountStrategy fallback; - public FuzzyDetectorAmountStrategy(final DetectorAmountStrategy fallback) { + FuzzyDetectorAmountStrategy(final DetectorAmountStrategy fallback) { this.fallback = fallback; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/ClientCraftingGridSource.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/ClientCraftingGridSource.java index 10029c993..00e270207 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/ClientCraftingGridSource.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/ClientCraftingGridSource.java @@ -10,11 +10,11 @@ import net.minecraft.world.inventory.ResultContainer; import net.minecraft.world.item.ItemStack; -public class ClientCraftingGridSource implements CraftingGridSource { +class ClientCraftingGridSource implements CraftingGridSource { private final CraftingMatrix craftingMatrix; private final ResultContainer craftingResult; - public ClientCraftingGridSource() { + ClientCraftingGridSource() { this.craftingMatrix = new CraftingMatrix(null); this.craftingResult = new ResultContainer(); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContext.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContext.java index b9243666a..58cf18369 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContext.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContext.java @@ -4,7 +4,7 @@ import net.minecraft.world.entity.player.Player; -public interface CraftingGridRefillContext extends AutoCloseable { +interface CraftingGridRefillContext extends AutoCloseable { boolean extract(ItemResource resource, Player player); @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContextImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContextImpl.java index c35aef55f..5a4f68993 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContextImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridRefillContextImpl.java @@ -4,10 +4,10 @@ import net.minecraft.world.entity.player.Player; -public class CraftingGridRefillContextImpl implements CraftingGridRefillContext { +class CraftingGridRefillContextImpl implements CraftingGridRefillContext { private final CraftingGridBlockEntity blockEntity; - public CraftingGridRefillContextImpl(final CraftingGridBlockEntity blockEntity) { + CraftingGridRefillContextImpl(final CraftingGridBlockEntity blockEntity) { this.blockEntity = blockEntity; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSource.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSource.java index d801f4c7b..9b463fa97 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSource.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSource.java @@ -9,7 +9,7 @@ import net.minecraft.world.inventory.ResultContainer; import net.minecraft.world.item.ItemStack; -public interface CraftingGridSource { +interface CraftingGridSource { CraftingMatrix getCraftingMatrix(); ResultContainer getCraftingResult(); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSourceImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSourceImpl.java index 28da566e9..ce82ffa5d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSourceImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridSourceImpl.java @@ -15,10 +15,10 @@ import net.minecraft.world.inventory.ResultContainer; import net.minecraft.world.item.ItemStack; -public class CraftingGridSourceImpl implements CraftingGridSource { +class CraftingGridSourceImpl implements CraftingGridSource { private final CraftingGridBlockEntity blockEntity; - public CraftingGridSourceImpl(final CraftingGridBlockEntity blockEntity) { + CraftingGridSourceImpl(final CraftingGridBlockEntity blockEntity) { this.blockEntity = blockEntity; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/GridExtendedMenuProvider.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/GridExtendedMenuProvider.java index d4d1d9bc3..c29c3e4d0 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/GridExtendedMenuProvider.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/GridExtendedMenuProvider.java @@ -20,14 +20,14 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -public class GridExtendedMenuProvider implements ExtendedMenuProvider { +class GridExtendedMenuProvider implements ExtendedMenuProvider { private final Grid grid; private final PlatformRegistry> storageChannelTypeRegistry; private final MenuProvider menuProvider; - public GridExtendedMenuProvider(final Grid grid, - final PlatformRegistry> storageChannelTypeRegistry, - final MenuProvider menuProvider) { + GridExtendedMenuProvider(final Grid grid, + final PlatformRegistry> storageChannelTypeRegistry, + final MenuProvider menuProvider) { this.grid = grid; this.storageChannelTypeRegistry = storageChannelTypeRegistry; this.menuProvider = menuProvider; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/SnapshotCraftingGridRefillContext.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/SnapshotCraftingGridRefillContext.java index 11bfb33bc..63a260e41 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/SnapshotCraftingGridRefillContext.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/SnapshotCraftingGridRefillContext.java @@ -10,13 +10,13 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -public class SnapshotCraftingGridRefillContext implements CraftingGridRefillContext { +class SnapshotCraftingGridRefillContext implements CraftingGridRefillContext { private final PlayerActor playerActor; private final CraftingGridBlockEntity blockEntity; private final ResourceList available = new ResourceListImpl<>(); private final ResourceList used = new ResourceListImpl<>(); - public SnapshotCraftingGridRefillContext( + SnapshotCraftingGridRefillContext( final Player player, final CraftingGridBlockEntity blockEntity, final CraftingMatrix craftingMatrix diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGrid.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGrid.java index 844609ef9..900ca43c3 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGrid.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGrid.java @@ -27,11 +27,11 @@ import java.util.List; import java.util.Optional; -public class WirelessGrid implements Grid { +class WirelessGrid implements Grid { private final NetworkBoundItemSession session; private final GridWatchers watchers; - public WirelessGrid(final NetworkBoundItemSession session) { + WirelessGrid(final NetworkBoundItemSession session) { this.session = session; this.watchers = new GridWatchers(PlatformApi.INSTANCE.getStorageChannelTypeRegistry().getAll()); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridExtendedMenuProvider.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridExtendedMenuProvider.java index b9879eb82..f963bb0e1 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridExtendedMenuProvider.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridExtendedMenuProvider.java @@ -15,13 +15,13 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -public class WirelessGridExtendedMenuProvider extends GridExtendedMenuProvider { +class WirelessGridExtendedMenuProvider extends GridExtendedMenuProvider { private final SlotReference slotReference; - public WirelessGridExtendedMenuProvider(final Grid grid, - final PlatformRegistry> - storageChannelTypeRegistry, - final SlotReference slotReference) { + WirelessGridExtendedMenuProvider(final Grid grid, + final PlatformRegistry> + storageChannelTypeRegistry, + final SlotReference slotReference) { super(grid, storageChannelTypeRegistry, new MenuProvider() { @Override public Component getDisplayName() { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridOperations.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridOperations.java index 72a53107e..614d55002 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridOperations.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/WirelessGridOperations.java @@ -9,14 +9,14 @@ import com.refinedmods.refinedstorage2.platform.api.support.networkbounditem.NetworkBoundItemSession; import com.refinedmods.refinedstorage2.platform.common.Platform; -public class WirelessGridOperations implements GridOperations { +class WirelessGridOperations implements GridOperations { private final GridOperations delegate; private final NetworkBoundItemSession session; private final GridWatchers watchers; - public WirelessGridOperations(final GridOperations delegate, - final NetworkBoundItemSession session, - final GridWatchers watchers) { + WirelessGridOperations(final GridOperations delegate, + final NetworkBoundItemSession session, + final GridWatchers watchers) { this.delegate = delegate; this.session = session; this.watchers = watchers; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AutoSelectedSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AutoSelectedSideButtonWidget.java index 294fa9653..22111201f 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AutoSelectedSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AutoSelectedSideButtonWidget.java @@ -10,13 +10,13 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.YES; import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class AutoSelectedSideButtonWidget extends AbstractSideButtonWidget { +class AutoSelectedSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "grid.auto_selected"); private static final Component HELP = createTranslation("gui", "grid.auto_selected.help"); private final AbstractGridContainerMenu menu; - public AutoSelectedSideButtonWidget(final AbstractGridContainerMenu menu) { + AutoSelectedSideButtonWidget(final AbstractGridContainerMenu menu) { super(createPressAction(menu)); this.menu = menu; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/LastModified.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/LastModified.java index 4d3f3fc45..21f7f5e54 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/LastModified.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/LastModified.java @@ -8,7 +8,7 @@ record LastModified(Type type, long amount) { private static final long WEEK = DAY * 7; private static final long YEAR = DAY * 365; - public enum Type { + enum Type { SECOND, MINUTE, HOUR, @@ -17,7 +17,7 @@ public enum Type { YEAR } - public static LastModified calculate(final long time, final long now) { + static LastModified calculate(final long time, final long now) { final long diff = now - time; final LastModified lastModified; if (diff < MINUTE) { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SizeSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SizeSideButtonWidget.java index c69a792bd..957c0b467 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SizeSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SizeSideButtonWidget.java @@ -7,7 +7,7 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class SizeSideButtonWidget extends AbstractSideButtonWidget { +class SizeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "grid.size"); private static final MutableComponent SUBTEXT_STRETCH = createTranslation("gui", "grid.size.stretch"); @@ -18,7 +18,7 @@ public class SizeSideButtonWidget extends AbstractSideButtonWidget { private final AbstractGridContainerMenu menu; - public SizeSideButtonWidget(final AbstractGridContainerMenu menu) { + SizeSideButtonWidget(final AbstractGridContainerMenu menu) { super(createPressAction(menu)); this.menu = menu; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingDirectionSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingDirectionSideButtonWidget.java index 1ef307191..64f266587 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingDirectionSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingDirectionSideButtonWidget.java @@ -8,7 +8,7 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class SortingDirectionSideButtonWidget extends AbstractSideButtonWidget { +class SortingDirectionSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "grid.sorting.direction"); private static final MutableComponent SUBTEXT_ASCENDING = createTranslation("gui", "grid.sorting.direction.ascending"); @@ -17,7 +17,7 @@ public class SortingDirectionSideButtonWidget extends AbstractSideButtonWidget { private final AbstractGridContainerMenu menu; - public SortingDirectionSideButtonWidget(final AbstractGridContainerMenu menu) { + SortingDirectionSideButtonWidget(final AbstractGridContainerMenu menu) { super(createPressAction(menu)); this.menu = menu; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingTypeSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingTypeSideButtonWidget.java index 92ea334e6..6a033271a 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingTypeSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SortingTypeSideButtonWidget.java @@ -8,7 +8,7 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class SortingTypeSideButtonWidget extends AbstractSideButtonWidget { +class SortingTypeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "grid.sorting.type"); private static final MutableComponent SUBTEXT_QUANTITY = createTranslation("gui", "grid.sorting.type.quantity"); private static final MutableComponent SUBTEXT_NAME = createTranslation("gui", "grid.sorting.type.name"); @@ -18,7 +18,7 @@ public class SortingTypeSideButtonWidget extends AbstractSideButtonWidget { private final AbstractGridContainerMenu menu; - public SortingTypeSideButtonWidget(final AbstractGridContainerMenu menu) { + SortingTypeSideButtonWidget(final AbstractGridContainerMenu menu) { super(createPressAction(menu)); this.menu = menu; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/StorageChannelTypeSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/StorageChannelTypeSideButtonWidget.java index 68f89df4e..9b07d055f 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/StorageChannelTypeSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/StorageChannelTypeSideButtonWidget.java @@ -11,14 +11,14 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class StorageChannelTypeSideButtonWidget extends AbstractSideButtonWidget { +class StorageChannelTypeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "grid.storage_channel_type"); private static final MutableComponent SUBTEXT_ALL = createTranslation("gui", "grid.storage_channel_type.all"); private static final Component HELP = createTranslation("gui", "grid.storage_channel_type.help"); private final AbstractGridContainerMenu menu; - public StorageChannelTypeSideButtonWidget(final AbstractGridContainerMenu menu) { + StorageChannelTypeSideButtonWidget(final AbstractGridContainerMenu menu) { super(createPressAction(menu)); this.menu = menu; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SynchronizationSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SynchronizationSideButtonWidget.java index b4517f120..08fb36f9b 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SynchronizationSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/SynchronizationSideButtonWidget.java @@ -9,12 +9,12 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class SynchronizationSideButtonWidget extends AbstractSideButtonWidget { +class SynchronizationSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "grid.synchronizer"); private final AbstractGridContainerMenu menu; - public SynchronizationSideButtonWidget(final AbstractGridContainerMenu menu) { + SynchronizationSideButtonWidget(final AbstractGridContainerMenu menu) { super(createPressAction(menu)); this.menu = menu; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/hint/FluidGridInsertionHint.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/hint/FluidGridInsertionHint.java index 9b512c7ec..c679eb6c2 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/hint/FluidGridInsertionHint.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/hint/FluidGridInsertionHint.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.grid.screen.hint; import com.refinedmods.refinedstorage2.platform.api.grid.GridInsertionHint; -import com.refinedmods.refinedstorage2.platform.common.ContainedFluid; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.support.tooltip.MouseWithIconClientTooltipComponent; @@ -16,7 +15,7 @@ public Optional getHint(final ItemStack carried) { return Platform.INSTANCE.getContainedFluid(carried).map(this::createComponent); } - private MouseWithIconClientTooltipComponent createComponent(final ContainedFluid result) { + private MouseWithIconClientTooltipComponent createComponent(final Platform.ContainedFluid result) { return new MouseWithIconClientTooltipComponent( MouseWithIconClientTooltipComponent.Type.RIGHT, (graphics, x, y) -> Platform.INSTANCE.getFluidRenderer().render( diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/ExportedResourcesContainer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/ExportedResourcesContainer.java index 2953ae747..ef5f8f323 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/ExportedResourcesContainer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/ExportedResourcesContainer.java @@ -18,10 +18,10 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; -public class ExportedResourcesContainer extends ResourceContainerImpl implements InterfaceExportState { +class ExportedResourcesContainer extends ResourceContainerImpl implements InterfaceExportState { private final FilterWithFuzzyMode filter; - public ExportedResourcesContainer(final int size, final FilterWithFuzzyMode filter) { + ExportedResourcesContainer(final int size, final FilterWithFuzzyMode filter) { super( size, ResourceContainerType.CONTAINER, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java index c7b5cb50e..afcb72f4c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java @@ -16,14 +16,14 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; -public class InterfaceProxyExternalStorageProvider implements InterfaceExternalStorageProvider { +class InterfaceProxyExternalStorageProvider implements InterfaceExternalStorageProvider { private final Level level; private final BlockPos pos; private final StorageChannelType storageChannelType; - public InterfaceProxyExternalStorageProvider(final Level level, - final BlockPos pos, - final StorageChannelType storageChannelType) { + InterfaceProxyExternalStorageProvider(final Level level, + final BlockPos pos, + final StorageChannelType storageChannelType) { this.level = level; this.pos = pos; this.storageChannelType = storageChannelType; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java index 73a7ece1c..12aba856e 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java @@ -10,6 +10,7 @@ import com.refinedmods.refinedstorage2.platform.common.support.AbstractColoredBlock; import com.refinedmods.refinedstorage2.platform.common.support.BlockItemProvider; import com.refinedmods.refinedstorage2.platform.common.support.CableBlockSupport; +import com.refinedmods.refinedstorage2.platform.common.support.CableShapeCacheKey; import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; import com.refinedmods.refinedstorage2.platform.common.support.NetworkNodeBlockEntityTicker; import com.refinedmods.refinedstorage2.platform.common.support.NetworkNodeContainerBlockEntityImpl; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkCardItem.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkCardItem.java new file mode 100644 index 000000000..ae97516bd --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkCardItem.java @@ -0,0 +1,117 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.api.support.HelpTooltipComponent; + +import java.util.List; +import java.util.Optional; +import javax.annotation.Nullable; + +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; + +// TODO: better active texture. +public class NetworkCardItem extends Item { + private static final MutableComponent UNBOUND_HELP = createTranslation("item", "network_card.unbound_help"); + private static final MutableComponent BOUND_HELP = createTranslation("item", "network_card.bound_help"); + + private static final MutableComponent UNBOUND = createTranslation("item", "network_card.unbound") + .withStyle(ChatFormatting.RED); + + private static final String TAG_POS = "pos"; + private static final String TAG_DIMENSION = "dim"; + + public NetworkCardItem() { + super(new Item.Properties().stacksTo(1)); + } + + @Override + public InteractionResult useOn(final UseOnContext ctx) { + if (ctx.getLevel().isClientSide() || ctx.getPlayer() == null) { + return InteractionResult.CONSUME; + } + final BlockPos pos = ctx.getClickedPos(); + final BlockState blockState = ctx.getLevel().getBlockState(pos); + if (!(blockState.getBlock() instanceof NetworkReceiverBlock)) { + return InteractionResult.CONSUME; + } + final CompoundTag tag = new CompoundTag(); + tag.putLong(TAG_POS, pos.asLong()); + tag.putString(TAG_DIMENSION, ctx.getLevel().dimension().location().toString()); + ctx.getItemInHand().setTag(tag); + ctx.getPlayer().sendSystemMessage(createTranslation( + "item", + "network_card.bound", + pos.getX(), + pos.getY(), + pos.getZ() + )); + return InteractionResult.SUCCESS; + } + + @Override + public InteractionResultHolder use(final Level level, final Player player, final InteractionHand hand) { + if (player.isCrouching()) { + if (!level.isClientSide()) { + player.sendSystemMessage(createTranslation("item", "network_card.unbound")); + } + return new InteractionResultHolder<>(InteractionResult.CONSUME, new ItemStack(this)); + } + return super.use(level, player, hand); + } + + @Override + public void appendHoverText(final ItemStack stack, + @Nullable final Level level, + final List lines, + final TooltipFlag flag) { + super.appendHoverText(stack, level, lines, flag); + if (!isActive(stack)) { + lines.add(UNBOUND); + return; + } + final BlockPos pos = getPosition(stack); + if (pos == null) { + return; + } + lines.add(createTranslation( + "item", + "network_card.bound", + pos.getX(), + pos.getY(), + pos.getZ() + ).withStyle(ChatFormatting.GRAY)); + } + + @Nullable + public BlockPos getPosition(final ItemStack stack) { + if (stack.getTag() == null) { + return null; + } + return BlockPos.of(stack.getTag().getLong(TAG_POS)); + } + + @Override + public Optional getTooltipImage(final ItemStack stack) { + return Optional.of(new HelpTooltipComponent(isActive(stack) ? BOUND_HELP : UNBOUND_HELP)); + } + + public boolean isActive(final ItemStack stack) { + return stack.getTag() != null && stack.getTag().contains(TAG_POS) && stack.getTag().contains(TAG_DIMENSION); + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkCardItemPropertyFunction.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkCardItemPropertyFunction.java new file mode 100644 index 000000000..f807af445 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkCardItemPropertyFunction.java @@ -0,0 +1,24 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import javax.annotation.Nullable; + +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; + +public class NetworkCardItemPropertyFunction implements ClampedItemPropertyFunction { + public static final ResourceLocation NAME = new ResourceLocation("active"); + + @Override + public float unclampedCall(final ItemStack itemStack, + @Nullable final ClientLevel clientLevel, + @Nullable final LivingEntity livingEntity, + final int i) { + if (itemStack.getItem() instanceof NetworkCardItem cardItem) { + return cardItem.isActive(itemStack) ? 1 : 0; + } + return 0; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ClickableIngredient.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ClickableIngredient.java index 0515e2f36..b686450c9 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ClickableIngredient.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ClickableIngredient.java @@ -4,11 +4,11 @@ import mezz.jei.api.runtime.IClickableIngredient; import net.minecraft.client.renderer.Rect2i; -public class ClickableIngredient implements IClickableIngredient { +class ClickableIngredient implements IClickableIngredient { private final ITypedIngredient ingredient; private final Rect2i area; - public ClickableIngredient(final ITypedIngredient ingredient, final int x, final int y) { + ClickableIngredient(final ITypedIngredient ingredient, final int x, final int y) { this.ingredient = ingredient; area = new Rect2i(x, y, 16, 16); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/CraftingGridRecipeTransferHandler.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/CraftingGridRecipeTransferHandler.java index 7e8c7ae80..90fba8272 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/CraftingGridRecipeTransferHandler.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/CraftingGridRecipeTransferHandler.java @@ -22,8 +22,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; -public class CraftingGridRecipeTransferHandler - implements IRecipeTransferHandler { +class CraftingGridRecipeTransferHandler implements IRecipeTransferHandler { @Override public Class getContainerClass() { return CraftingGridContainerMenu.class; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ExclusionZonesGuiContainerHandler.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ExclusionZonesGuiContainerHandler.java index d2028311a..4f16d153a 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ExclusionZonesGuiContainerHandler.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ExclusionZonesGuiContainerHandler.java @@ -7,7 +7,7 @@ import mezz.jei.api.gui.handlers.IGuiContainerHandler; import net.minecraft.client.renderer.Rect2i; -public class ExclusionZonesGuiContainerHandler implements IGuiContainerHandler> { +class ExclusionZonesGuiContainerHandler implements IGuiContainerHandler> { @Override public List getGuiExtraAreas(final AbstractBaseScreen screen) { return screen.getExclusionZones(); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GhostIngredientHandler.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GhostIngredientHandler.java index 9f38ce57f..3fc979898 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GhostIngredientHandler.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GhostIngredientHandler.java @@ -17,10 +17,10 @@ import net.minecraft.client.renderer.Rect2i; @SuppressWarnings("rawtypes") -public class GhostIngredientHandler implements IGhostIngredientHandler { +class GhostIngredientHandler implements IGhostIngredientHandler { private final IngredientConverter ingredientConverter; - public GhostIngredientHandler(final IngredientConverter ingredientConverter) { + GhostIngredientHandler(final IngredientConverter ingredientConverter) { this.ingredientConverter = ingredientConverter; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridGuiContainerHandler.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridGuiContainerHandler.java index cd6bc3f46..8c7963508 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridGuiContainerHandler.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridGuiContainerHandler.java @@ -12,11 +12,11 @@ import mezz.jei.api.runtime.IClickableIngredient; import mezz.jei.api.runtime.IIngredientManager; -public class GridGuiContainerHandler implements IGuiContainerHandler> { +class GridGuiContainerHandler implements IGuiContainerHandler> { private final IngredientConverter converter; private final IIngredientManager ingredientManager; - public GridGuiContainerHandler(final IngredientConverter converter, final IIngredientManager ingredientManager) { + GridGuiContainerHandler(final IngredientConverter converter, final IIngredientManager ingredientManager) { this.converter = converter; this.ingredientManager = ingredientManager; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridResourceIngredientConverter.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridResourceIngredientConverter.java index 11a44d600..3cde9afa4 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridResourceIngredientConverter.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/GridResourceIngredientConverter.java @@ -9,10 +9,10 @@ import mezz.jei.api.helpers.IPlatformFluidHelper; -public class GridResourceIngredientConverter implements IngredientConverter { +class GridResourceIngredientConverter implements IngredientConverter { private final IPlatformFluidHelper fluidHelper; - public GridResourceIngredientConverter(final IPlatformFluidHelper fluidHelper) { + GridResourceIngredientConverter(final IPlatformFluidHelper fluidHelper) { this.fluidHelper = fluidHelper; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/JeiGridSynchronizer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/JeiGridSynchronizer.java index d34c68f3b..828bf95a6 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/JeiGridSynchronizer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/JeiGridSynchronizer.java @@ -9,7 +9,7 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class JeiGridSynchronizer extends AbstractGridSynchronizer { +class JeiGridSynchronizer extends AbstractGridSynchronizer { private static final MutableComponent TITLE = createTranslation("gui", "grid.synchronizer.jei"); private static final MutableComponent TITLE_TWO_WAY = createTranslation("gui", "grid.synchronizer.jei.two_way"); private static final Component HELP = createTranslation("gui", "grid.synchronizer.jei.help"); @@ -18,7 +18,7 @@ public class JeiGridSynchronizer extends AbstractGridSynchronizer { private final JeiProxy jeiProxy; private final boolean twoWay; - public JeiGridSynchronizer(final JeiProxy jeiProxy, final boolean twoWay) { + JeiGridSynchronizer(final JeiProxy jeiProxy, final boolean twoWay) { this.jeiProxy = jeiProxy; this.twoWay = twoWay; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/MissingItemRecipeTransferError.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/MissingItemRecipeTransferError.java index ffa54ae69..698f0a00e 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/MissingItemRecipeTransferError.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/MissingItemRecipeTransferError.java @@ -14,7 +14,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.util.FormattedCharSequence; -public class MissingItemRecipeTransferError implements IRecipeTransferError { +class MissingItemRecipeTransferError implements IRecipeTransferError { private static final Color COLOR = new Color(1.0f, 0.0f, 0.0f, 0.4f); private static final List MISSING_MESSAGE = List.of( Component.translatable("jei.tooltip.transfer").getVisualOrderText(), @@ -24,7 +24,7 @@ public class MissingItemRecipeTransferError implements IRecipeTransferError { private final List slotsWithMissingItems; - public MissingItemRecipeTransferError(final List slotsWithMissingItems) { + MissingItemRecipeTransferError(final List slotsWithMissingItems) { this.slotsWithMissingItems = slotsWithMissingItems; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceGuiContainerHandler.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceGuiContainerHandler.java index 6ffe564cd..5a45963ce 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceGuiContainerHandler.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceGuiContainerHandler.java @@ -13,12 +13,12 @@ import mezz.jei.api.runtime.IClickableIngredient; import mezz.jei.api.runtime.IIngredientManager; -public class ResourceGuiContainerHandler implements IGuiContainerHandler> { +class ResourceGuiContainerHandler implements IGuiContainerHandler> { private final IngredientConverter converter; private final IIngredientManager ingredientManager; - public ResourceGuiContainerHandler(final IngredientConverter converter, - final IIngredientManager ingredientManager) { + ResourceGuiContainerHandler(final IngredientConverter converter, + final IIngredientManager ingredientManager) { this.converter = converter; this.ingredientManager = ingredientManager; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceIngredientConverter.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceIngredientConverter.java index cc39906b1..c4b6fd31d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceIngredientConverter.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/recipemod/jei/ResourceIngredientConverter.java @@ -12,10 +12,10 @@ import mezz.jei.api.helpers.IPlatformFluidHelper; import net.minecraft.world.item.ItemStack; -public class ResourceIngredientConverter implements IngredientConverter { +class ResourceIngredientConverter implements IngredientConverter { private final IPlatformFluidHelper fluidHelper; - public ResourceIngredientConverter(final IPlatformFluidHelper fluidHelper) { + ResourceIngredientConverter(final IPlatformFluidHelper fluidHelper) { this.fluidHelper = fluidHelper; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageContainerMenu.java index b8384a624..e6950e8c3 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageContainerMenu.java @@ -14,10 +14,10 @@ public abstract class AbstractStorageContainerMenu extends AbstractResourceContainerMenu { protected AbstractStorageContainerMenu(final MenuType type, final int syncId) { super(type, syncId); - registerProperty(new ClientProperty<>(PropertyTypes.PRIORITY, 0)); + registerProperty(new ClientProperty<>(StoragePropertyTypes.PRIORITY, 0)); registerProperty(new ClientProperty<>(PropertyTypes.FILTER_MODE, FilterMode.BLOCK)); registerProperty(new ClientProperty<>(PropertyTypes.FUZZY_MODE, false)); - registerProperty(new ClientProperty<>(PropertyTypes.ACCESS_MODE, AccessMode.INSERT_EXTRACT)); + registerProperty(new ClientProperty<>(StoragePropertyTypes.ACCESS_MODE, AccessMode.INSERT_EXTRACT)); registerProperty(new ClientProperty<>(PropertyTypes.REDSTONE_MODE, RedstoneMode.IGNORE)); } @@ -27,7 +27,7 @@ protected AbstractStorageContainerMenu(final MenuType type, final StorageConfigurationContainer configContainer) { super(type, syncId, player); registerProperty(new ServerProperty<>( - PropertyTypes.PRIORITY, + StoragePropertyTypes.PRIORITY, configContainer::getPriority, configContainer::setPriority )); @@ -42,7 +42,7 @@ protected AbstractStorageContainerMenu(final MenuType type, configContainer::setFuzzyMode )); registerProperty(new ServerProperty<>( - PropertyTypes.ACCESS_MODE, + StoragePropertyTypes.ACCESS_MODE, configContainer::getAccessMode, configContainer::setAccessMode )); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageScreen.java index 9d626c462..63a6e7a76 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AbstractStorageScreen.java @@ -70,9 +70,9 @@ protected void init() { getMenu().getProperty(PropertyTypes.FUZZY_MODE), FuzzyModeSideButtonWidget.Type.STORAGE )); - addSideButton(new AccessModeSideButtonWidget(getMenu().getProperty(PropertyTypes.ACCESS_MODE))); + addSideButton(new AccessModeSideButtonWidget(getMenu().getProperty(StoragePropertyTypes.ACCESS_MODE))); addSideButton(new PrioritySideButtonWidget( - getMenu().getProperty(PropertyTypes.PRIORITY), + getMenu().getProperty(StoragePropertyTypes.PRIORITY), playerInventory, this )); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java index 200ffa503..1672f1fe7 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage2.api.storage.AccessMode; -public class AccessModeSettings { +class AccessModeSettings { private static final int INSERT_EXTRACT = 0; private static final int INSERT = 1; private static final int EXTRACT = 2; @@ -10,7 +10,7 @@ public class AccessModeSettings { private AccessModeSettings() { } - public static AccessMode getAccessMode(final int accessMode) { + static AccessMode getAccessMode(final int accessMode) { return switch (accessMode) { case INSERT_EXTRACT -> AccessMode.INSERT_EXTRACT; case INSERT -> AccessMode.INSERT; @@ -19,7 +19,7 @@ public static AccessMode getAccessMode(final int accessMode) { }; } - public static int getAccessMode(final AccessMode accessMode) { + static int getAccessMode(final AccessMode accessMode) { return switch (accessMode) { case INSERT_EXTRACT -> INSERT_EXTRACT; case INSERT -> INSERT; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/LimitedPlatformStorage.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/LimitedPlatformStorage.java index b058703b5..763883d98 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/LimitedPlatformStorage.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/LimitedPlatformStorage.java @@ -5,13 +5,13 @@ import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageRepository; import com.refinedmods.refinedstorage2.platform.api.storage.StorageType; -public class LimitedPlatformStorage extends PlatformStorage implements LimitedStorage { +class LimitedPlatformStorage extends PlatformStorage implements LimitedStorage { private final LimitedStorageImpl limitedStorage; - public LimitedPlatformStorage(final LimitedStorageImpl delegate, - final StorageType type, - final TrackedStorageRepository trackingRepository, - final Runnable listener) { + LimitedPlatformStorage(final LimitedStorageImpl delegate, + final StorageType type, + final TrackedStorageRepository trackingRepository, + final Runnable listener) { super(delegate, type, trackingRepository, listener); this.limitedStorage = delegate; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/PlatformStorage.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/PlatformStorage.java index 218213516..13fe5a0c2 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/PlatformStorage.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/PlatformStorage.java @@ -15,15 +15,15 @@ import java.util.Optional; import javax.annotation.Nullable; -public class PlatformStorage extends AbstractProxyStorage implements SerializableStorage, TrackedStorage { +class PlatformStorage extends AbstractProxyStorage implements SerializableStorage, TrackedStorage { private final StorageType type; private final TrackedStorageRepository trackingRepository; private final Runnable listener; - public PlatformStorage(final Storage delegate, - final StorageType type, - final TrackedStorageRepository trackingRepository, - final Runnable listener) { + PlatformStorage(final Storage delegate, + final StorageType type, + final TrackedStorageRepository trackingRepository, + final Runnable listener) { super(delegate); this.type = type; this.trackingRepository = trackingRepository; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StoragePropertyTypes.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StoragePropertyTypes.java new file mode 100644 index 000000000..b083228b5 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StoragePropertyTypes.java @@ -0,0 +1,21 @@ +package com.refinedmods.refinedstorage2.platform.common.storage; + +import com.refinedmods.refinedstorage2.api.storage.AccessMode; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyType; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyTypes; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; + +public final class StoragePropertyTypes { + public static final PropertyType PRIORITY = PropertyTypes.createIntegerProperty( + createIdentifier("priority") + ); + public static final PropertyType ACCESS_MODE = new PropertyType<>( + createIdentifier("access_mode"), + AccessModeSettings::getAccessMode, + AccessModeSettings::getAccessMode + ); + + private StoragePropertyTypes() { + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTooltipHelper.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTooltipHelper.java index c725062c6..8b7334c2b 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTooltipHelper.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTooltipHelper.java @@ -8,13 +8,13 @@ import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; -public final class StorageTooltipHelper { +final class StorageTooltipHelper { private StorageTooltipHelper() { } - public static void addAmountStoredWithoutCapacity(final List tooltip, - final long stored, - final LongFunction quantityFormatter) { + static void addAmountStoredWithoutCapacity(final List tooltip, + final long stored, + final LongFunction quantityFormatter) { tooltip.add(PlatformApi.INSTANCE.createTranslation( "misc", "stored", @@ -22,10 +22,10 @@ public static void addAmountStoredWithoutCapacity(final List tooltip, ).withStyle(ChatFormatting.GRAY)); } - public static void addAmountStoredWithCapacity(final List tooltip, - final long stored, - final long capacity, - final LongFunction quantityFormatter) { + static void addAmountStoredWithCapacity(final List tooltip, + final long stored, + final long capacity, + final LongFunction quantityFormatter) { if (capacity <= 0) { addAmountStoredWithoutCapacity(tooltip, stored, quantityFormatter); return; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTypes.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTypes.java index 8e8f4791c..98cf8a896 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTypes.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageTypes.java @@ -1,8 +1,12 @@ package com.refinedmods.refinedstorage2.platform.common.storage; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageType; +import com.refinedmods.refinedstorage2.platform.api.support.resource.FluidResource; +import com.refinedmods.refinedstorage2.platform.api.support.resource.ItemResource; + public final class StorageTypes { - public static final ItemStorageType ITEM = new ItemStorageType(); - public static final FluidStorageType FLUID = new FluidStorageType(); + public static final StorageType ITEM = new ItemStorageType(); + public static final StorageType FLUID = new FluidStorageType(); private StorageTypes() { } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java index bcd434e8a..290bcd5a7 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java @@ -15,7 +15,6 @@ import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ExtendedMenuProvider; import com.refinedmods.refinedstorage2.platform.common.support.resource.ResourceContainerImpl; import com.refinedmods.refinedstorage2.platform.common.util.ContainerUtil; -import com.refinedmods.refinedstorage2.platform.common.util.LevelUtil; import javax.annotation.Nullable; @@ -147,7 +146,7 @@ public void activenessChanged(final BlockState state, final boolean newActive, @Nullable final BooleanProperty activenessProperty) { super.activenessChanged(state, newActive, activenessProperty); - LevelUtil.updateBlock(level, worldPosition, getBlockState()); + updateBlock(); } @Override @@ -185,7 +184,7 @@ public SimpleContainer getDiskInventory() { void onDiskChanged(final int slot) { getNode().onStorageChanged(slot); - LevelUtil.updateBlock(level, worldPosition, this.getBlockState()); + updateBlock(); setChanged(); } @@ -199,16 +198,14 @@ protected void onNetworkInNodeInitialized() { super.onNetworkInNodeInitialized(); // It's important to sync here as the initial update packet might have failed as the network // could possibly be not initialized yet. - LevelUtil.updateBlock(level, worldPosition, this.getBlockState()); + updateBlock(); } private void fromClientTag(final CompoundTag tag) { if (!tag.contains(TAG_STATES)) { return; } - final ListTag statesList = tag.getList(TAG_STATES, Tag.TAG_BYTE); - driveState = MultiStorageState.of( statesList.size(), idx -> { @@ -220,12 +217,11 @@ private void fromClientTag(final CompoundTag tag) { return values[ordinal]; } ); - onDriveStateUpdated(); } protected void onDriveStateUpdated() { - LevelUtil.updateBlock(level, worldPosition, getBlockState()); + updateBlock(); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveBlockEntityTicker.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveBlockEntityTicker.java index 3f51d4099..1b1ee6d54 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveBlockEntityTicker.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveBlockEntityTicker.java @@ -9,11 +9,11 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -public class DiskDriveBlockEntityTicker +class DiskDriveBlockEntityTicker extends NetworkNodeBlockEntityTicker { @SuppressWarnings("unchecked") - public DiskDriveBlockEntityTicker() { + DiskDriveBlockEntityTicker() { super(() -> (BlockEntityType) BlockEntities.INSTANCE.getDiskDrive()); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveInventory.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveInventory.java index c75713926..e92a26296 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveInventory.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveInventory.java @@ -11,12 +11,12 @@ import net.minecraft.world.SimpleContainer; import net.minecraft.world.item.ItemStack; -public class DiskDriveInventory extends SimpleContainer implements MultiStorageProvider { +class DiskDriveInventory extends SimpleContainer implements MultiStorageProvider { private final AbstractDiskDriveBlockEntity diskDrive; @Nullable private StorageRepository storageRepository; - public DiskDriveInventory(final AbstractDiskDriveBlockEntity diskDrive, final int diskCount) { + DiskDriveInventory(final AbstractDiskDriveBlockEntity diskDrive, final int diskCount) { super(diskCount); this.diskDrive = diskDrive; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java index 233d885c7..b43cde2a9 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java @@ -6,7 +6,7 @@ import net.minecraft.world.item.ItemStack; -public class EmptyStorageDiskInfoAccessor implements StorageDiskInfoAccessor { +class EmptyStorageDiskInfoAccessor implements StorageDiskInfoAccessor { @Override public Optional getInfo(final ItemStack stack) { return Optional.empty(); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java index 757508dbd..8e0c09bc4 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java @@ -6,6 +6,6 @@ import net.minecraft.world.item.ItemStack; -public interface StorageDiskInfoAccessor { +interface StorageDiskInfoAccessor { Optional getInfo(ItemStack stack); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java index 0d658bd0c..b7b49b413 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java @@ -8,10 +8,10 @@ import net.minecraft.world.item.ItemStack; -public class StorageDiskInfoAccessorImpl implements StorageDiskInfoAccessor { +class StorageDiskInfoAccessorImpl implements StorageDiskInfoAccessor { private final StorageRepository storageRepository; - public StorageDiskInfoAccessorImpl(final StorageRepository storageRepository) { + StorageDiskInfoAccessorImpl(final StorageRepository storageRepository) { this.storageRepository = storageRepository; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageScreen.java index 2e7af6c22..8409b7575 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageScreen.java @@ -3,6 +3,7 @@ import com.refinedmods.refinedstorage2.platform.common.storage.AbstractStorageScreen; import com.refinedmods.refinedstorage2.platform.common.storage.AccessModeSideButtonWidget; import com.refinedmods.refinedstorage2.platform.common.storage.PrioritySideButtonWidget; +import com.refinedmods.refinedstorage2.platform.common.storage.StoragePropertyTypes; import com.refinedmods.refinedstorage2.platform.common.support.AbstractFilterScreen; import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyTypes; import com.refinedmods.refinedstorage2.platform.common.support.widget.FilterModeSideButtonWidget; @@ -33,9 +34,9 @@ protected void init() { getMenu().getProperty(PropertyTypes.FUZZY_MODE), FuzzyModeSideButtonWidget.Type.STORAGE )); - addSideButton(new AccessModeSideButtonWidget(getMenu().getProperty(PropertyTypes.ACCESS_MODE))); + addSideButton(new AccessModeSideButtonWidget(getMenu().getProperty(StoragePropertyTypes.ACCESS_MODE))); addSideButton(new PrioritySideButtonWidget( - getMenu().getProperty(PropertyTypes.PRIORITY), + getMenu().getProperty(StoragePropertyTypes.PRIORITY), playerInventory, this )); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlock.java index dc4ce5c33..517bad963 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlock.java @@ -12,7 +12,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -public abstract class AbstractStorageBlock> extends AbstractBaseBlock +abstract class AbstractStorageBlock> extends AbstractBaseBlock implements EntityBlock { private final AbstractBlockEntityTicker ticker; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java index 86e969796..14b6994a0 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java @@ -26,7 +26,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class AbstractStorageBlockBlockEntity +abstract class AbstractStorageBlockBlockEntity extends AbstractRedstoneModeNetworkNodeContainerBlockEntity> implements ExtendedMenuProvider { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractStorageBlockBlockEntity.class); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockScreen.java index 601f328ff..e27f88ae4 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockScreen.java @@ -8,7 +8,7 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; -public abstract class AbstractStorageBlockScreen extends AbstractStorageScreen { +abstract class AbstractStorageBlockScreen extends AbstractStorageScreen { private static final ResourceLocation TEXTURE = createIdentifier("textures/gui/storage.png"); protected AbstractStorageBlockScreen(final AbstractStorageBlockContainerMenu menu, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/StorageBlockLootItemFunction.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/StorageBlockLootItemFunction.java index 61c494ad0..ad13e1200 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/StorageBlockLootItemFunction.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/StorageBlockLootItemFunction.java @@ -14,7 +14,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class StorageBlockLootItemFunction implements LootItemFunction { +class StorageBlockLootItemFunction implements LootItemFunction { private static final Logger LOGGER = LoggerFactory.getLogger(StorageBlockLootItemFunction.class); @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/FluidStorageMonitorInsertionStrategy.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/FluidStorageMonitorInsertionStrategy.java index 95d0a164c..3f7319673 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/FluidStorageMonitorInsertionStrategy.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/FluidStorageMonitorInsertionStrategy.java @@ -8,7 +8,6 @@ import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.platform.api.storagemonitor.StorageMonitorInsertionStrategy; import com.refinedmods.refinedstorage2.platform.api.support.resource.FluidResource; -import com.refinedmods.refinedstorage2.platform.common.ContainedFluid; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.storage.channel.StorageChannelTypes; @@ -36,10 +35,10 @@ public Optional insert( } @Nullable - private ContainedFluid tryInsert(final Actor actor, - final FluidResource configuredResource, - final ContainedFluid result, - final StorageChannel storageChannel) { + private Platform.ContainedFluid tryInsert(final Actor actor, + final FluidResource configuredResource, + final Platform.ContainedFluid result, + final StorageChannel storageChannel) { final ResourceAmount fluid = result.fluid(); if (!fluid.getResource().equals(configuredResource)) { return null; @@ -55,7 +54,7 @@ private ContainedFluid tryInsert(final Actor actor, } private ItemStack doInsert(final Actor actor, - final ContainedFluid extracted, + final Platform.ContainedFluid extracted, final StorageChannel storageChannel) { final ResourceAmount fluid = extracted.fluid(); storageChannel.insert( diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java index a4da093fe..314996d70 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support; import com.refinedmods.refinedstorage2.platform.common.content.BlockConstants; -import com.refinedmods.refinedstorage2.platform.common.networking.CableShapeCacheKey; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionTypeImpl; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java index 09bd61a98..542cf7735 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support; import com.refinedmods.refinedstorage2.platform.api.support.PlatformNetworkNodeContainer; -import com.refinedmods.refinedstorage2.platform.common.networking.CableShapeCacheKey; import java.util.HashMap; import java.util.Map; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableShapeCacheKey.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableShapeCacheKey.java similarity index 94% rename from refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableShapeCacheKey.java rename to refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableShapeCacheKey.java index 890108d10..10408a62c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableShapeCacheKey.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableShapeCacheKey.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.common.networking; +package com.refinedmods.refinedstorage2.platform.common.support; import net.minecraft.world.level.block.state.BlockState; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/NetworkNodeContainerBlockEntityImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/NetworkNodeContainerBlockEntityImpl.java index 271dba1cf..02bb2234e 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/NetworkNodeContainerBlockEntityImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/NetworkNodeContainerBlockEntityImpl.java @@ -9,6 +9,7 @@ import com.google.common.util.concurrent.RateLimiter; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BooleanProperty; @@ -123,4 +124,11 @@ protected final Direction getDirection() { } return directionalBlock.extractDirection(blockState); } + + protected final void updateBlock() { + if (level == null) { + return; + } + level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), Block.UPDATE_ALL); + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/amount/LongAmountOperations.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/amount/LongAmountOperations.java index fc134f6a9..ce89ca131 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/amount/LongAmountOperations.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/amount/LongAmountOperations.java @@ -1,11 +1,12 @@ package com.refinedmods.refinedstorage2.platform.common.support.amount; -import com.refinedmods.refinedstorage2.platform.common.util.MathHelper; +import com.refinedmods.refinedstorage2.platform.common.util.MathUtil; -import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; +import static java.util.Objects.requireNonNullElse; + public class LongAmountOperations implements AmountOperations { public static final AmountOperations INSTANCE = new LongAmountOperations(); @@ -40,10 +41,10 @@ public Long changeAmount(final Long current, final int delta, @Nullable final Long minAmount, @Nullable final Long maxAmount) { - return MathHelper.clamp( + return MathUtil.clamp( current + delta, - Objects.requireNonNullElse(minAmount, Long.MIN_VALUE), - Objects.requireNonNullElse(maxAmount, Long.MAX_VALUE) + requireNonNullElse(minAmount, Long.MIN_VALUE), + requireNonNullElse(maxAmount, Long.MAX_VALUE) ); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/PropertyTypes.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/PropertyTypes.java index cb377f3d0..11c6f1aad 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/PropertyTypes.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/PropertyTypes.java @@ -1,10 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support.containermenu; import com.refinedmods.refinedstorage2.api.core.filter.FilterMode; -import com.refinedmods.refinedstorage2.api.network.impl.node.detector.DetectorMode; -import com.refinedmods.refinedstorage2.api.storage.AccessMode; -import com.refinedmods.refinedstorage2.platform.common.detector.DetectorModeSettings; -import com.refinedmods.refinedstorage2.platform.common.storage.AccessModeSettings; import com.refinedmods.refinedstorage2.platform.common.support.FilterModeSettings; import com.refinedmods.refinedstorage2.platform.common.support.RedstoneMode; import com.refinedmods.refinedstorage2.platform.common.support.RedstoneModeSettings; @@ -27,35 +23,18 @@ public final class PropertyTypes { FilterModeSettings::getFilterMode ); - public static final PropertyType PRIORITY = integer(createIdentifier("priority")); - - public static final PropertyType ACCESS_MODE = new PropertyType<>( - createIdentifier("access_mode"), - AccessModeSettings::getAccessMode, - AccessModeSettings::getAccessMode - ); - public static final PropertyType SCHEDULING_MODE = new PropertyType<>( createIdentifier("scheduling_mode"), SchedulingModeType::getId, SchedulingModeType::getById ); - public static final PropertyType FUZZY_MODE = bool(createIdentifier("fuzzy_mode")); - - public static final PropertyType DETECTOR_MODE = new PropertyType<>( - createIdentifier("detector_mode"), - DetectorModeSettings::getDetectorMode, - DetectorModeSettings::getDetectorMode - ); - - public static final PropertyType DESTRUCTOR_PICKUP_ITEMS = bool(createIdentifier("pickup_items")); - public static final PropertyType CONSTRUCTOR_DROP_ITEMS = bool(createIdentifier("drop_items")); + public static final PropertyType FUZZY_MODE = createBooleanProperty(createIdentifier("fuzzy_mode")); private PropertyTypes() { } - private static PropertyType bool(final ResourceLocation id) { + public static PropertyType createBooleanProperty(final ResourceLocation id) { return new PropertyType<>( id, value -> Boolean.TRUE.equals(value) ? 1 : 0, @@ -63,7 +42,7 @@ private static PropertyType bool(final ResourceLocation id) { ); } - private static PropertyType integer(final ResourceLocation id) { + public static PropertyType createIntegerProperty(final ResourceLocation id) { return new PropertyType<>( id, value -> value, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/resource/ResourceContainerImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/resource/ResourceContainerImpl.java index 6e052c991..1c2113b26 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/resource/ResourceContainerImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/resource/ResourceContainerImpl.java @@ -10,7 +10,7 @@ import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceContainer; import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceContainerType; import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceFactory; -import com.refinedmods.refinedstorage2.platform.common.util.MathHelper; +import com.refinedmods.refinedstorage2.platform.common.util.MathUtil; import java.util.ArrayList; import java.util.Collections; @@ -125,7 +125,7 @@ public void setAmount(final int index, final long amount) { if (resourceAmount == null) { return; } - final long newAmount = MathHelper.clamp(amount, 0, getMaxAmount(resourceAmount)); + final long newAmount = MathUtil.clamp(amount, 0, getMaxAmount(resourceAmount)); if (newAmount == 0) { remove(index); } else { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/upgrade/UpgradeWithEnchantedBookRecipe.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/upgrade/UpgradeWithEnchantedBookRecipe.java index 474541556..1a8779bd5 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/upgrade/UpgradeWithEnchantedBookRecipe.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/upgrade/UpgradeWithEnchantedBookRecipe.java @@ -22,14 +22,14 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; -public class UpgradeWithEnchantedBookRecipe extends ShapedRecipe { +class UpgradeWithEnchantedBookRecipe extends ShapedRecipe { private final EnchantmentInstance enchantment; private final ItemStack theResult; - public UpgradeWithEnchantedBookRecipe(final ResourceLocation recipeId, - final Enchantment enchantment, - final int enchantmentLevel, - final ItemStack theResult) { + UpgradeWithEnchantedBookRecipe(final ResourceLocation recipeId, + final Enchantment enchantment, + final int enchantmentLevel, + final ItemStack theResult) { super(recipeId, "", CraftingBookCategory.MISC, 3, 3, NonNullList.of( Ingredient.EMPTY, Ingredient.of(new ItemStack(Items.INSTANCE.getQuartzEnrichedIron())), diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/LevelUtil.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/LevelUtil.java deleted file mode 100644 index eb819c831..000000000 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/LevelUtil.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.refinedmods.refinedstorage2.platform.common.util; - -import javax.annotation.Nullable; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; - -public final class LevelUtil { - private LevelUtil() { - } - - public static void updateBlock(@Nullable final Level level, final BlockPos pos, final BlockState state) { - if (level == null) { - return; - } - level.sendBlockUpdated(pos, state, state, Block.UPDATE_ALL); - } -} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/MathHelper.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/MathUtil.java similarity index 78% rename from refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/MathHelper.java rename to refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/MathUtil.java index 74a925167..86094c3b6 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/MathHelper.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/MathUtil.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.common.util; -public final class MathHelper { - private MathHelper() { +public final class MathUtil { + private MathUtil() { } public static long clamp(final long value, final long min, final long max) { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/TickHandler.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/ServerEventQueue.java similarity index 79% rename from refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/TickHandler.java rename to refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/ServerEventQueue.java index 260504fa2..bcee12c97 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/TickHandler.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/util/ServerEventQueue.java @@ -3,10 +3,10 @@ import java.util.ArrayDeque; import java.util.Deque; -public final class TickHandler { +public final class ServerEventQueue { private static final Deque ACTIONS = new ArrayDeque<>(); - private TickHandler() { + private ServerEventQueue() { } public static void runQueuedActions() { @@ -18,7 +18,7 @@ public static void runQueuedActions() { } } - public static void runWhenReady(final Runnable runnable) { + public static void queue(final Runnable runnable) { synchronized (ACTIONS) { ACTIONS.add(runnable); } diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json index f5a4215a3..b90e3d6b4 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json @@ -204,6 +204,11 @@ "item.refinedstorage2.configuration_card.applied_configuration": "Applied configuration.", "item.refinedstorage2.configuration_card.empty_help": "Use on a storage network device while crouching to copy its configuration and upgrades to the card.", "item.refinedstorage2.configuration_card.configured_help": "Use on the destination storage network device while crouching to transfer the configuration and upgrades. Use while crouching to clear.", + "item.refinedstorage2.network_card": "Network Card", + "item.refinedstorage2.network_card.unbound_help": "Use while crouching on a Network Receiver.", + "item.refinedstorage2.network_card.unbound": "Unbound.", + "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", + "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card.json new file mode 100644 index 000000000..9138e7731 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card.json @@ -0,0 +1,17 @@ +{ + "parent": "item/generated", + "overrides": [ + { + "predicate": { + "active": 0 + }, + "model": "refinedstorage2:item/network_card/inactive" + }, + { + "predicate": { + "active": 1 + }, + "model": "refinedstorage2:item/network_card/active" + } + ] +} diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card/active.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card/active.json new file mode 100644 index 000000000..b13105f56 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card/active.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "refinedstorage2:item/network_card/active" + } +} diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card/inactive.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card/inactive.json new file mode 100644 index 000000000..0468d834e --- /dev/null +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/models/item/network_card/inactive.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "refinedstorage2:item/network_card/inactive" + } +} diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/item/network_card/active.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/item/network_card/active.png new file mode 100644 index 000000000..02edcd362 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/item/network_card/active.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/item/network_card/inactive.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/item/network_card/inactive.png new file mode 100644 index 000000000..1f23b8d5a Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/item/network_card/inactive.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/recipes/network_card.json b/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/recipes/network_card.json new file mode 100644 index 000000000..05980b01d --- /dev/null +++ b/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/recipes/network_card.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "EEE", + "PAP", + "EEE" + ], + "key": { + "E": { + "item": "refinedstorage2:quartz_enriched_iron" + }, + "P": { + "item": "minecraft:paper" + }, + "A": { + "item": "refinedstorage2:advanced_processor" + } + }, + "result": { + "item": "refinedstorage2:network_card" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/FluidStorageTypeTest.java b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/FluidStorageTypeTest.java index 364691703..88a44c6bf 100644 --- a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/FluidStorageTypeTest.java +++ b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/FluidStorageTypeTest.java @@ -12,6 +12,7 @@ import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorage; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage2.platform.api.storage.PlayerActor; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageType; import com.refinedmods.refinedstorage2.platform.api.support.resource.FluidResource; import com.refinedmods.refinedstorage2.platform.common.SimpleListener; import com.refinedmods.refinedstorage2.platform.test.SetupMinecraft; @@ -26,7 +27,7 @@ @SetupMinecraft class FluidStorageTypeTest { - FluidStorageType sut = StorageTypes.FLUID; + StorageType sut = StorageTypes.FLUID; SimpleListener listener; @BeforeEach diff --git a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ItemStorageTypeTest.java b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ItemStorageTypeTest.java index 666f00a7e..79fcf3529 100644 --- a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ItemStorageTypeTest.java +++ b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ItemStorageTypeTest.java @@ -12,6 +12,7 @@ import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorage; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage2.platform.api.storage.PlayerActor; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageType; import com.refinedmods.refinedstorage2.platform.api.support.resource.ItemResource; import com.refinedmods.refinedstorage2.platform.common.SimpleListener; import com.refinedmods.refinedstorage2.platform.test.SetupMinecraft; @@ -26,7 +27,7 @@ @SetupMinecraft class ItemStorageTypeTest { - ItemStorageType sut = StorageTypes.ITEM; + StorageType sut = StorageTypes.ITEM; SimpleListener listener; @BeforeEach diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java index 046858026..74e4a06b7 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java @@ -12,6 +12,7 @@ import com.refinedmods.refinedstorage2.platform.common.content.Items; import com.refinedmods.refinedstorage2.platform.common.content.KeyMappings; import com.refinedmods.refinedstorage2.platform.common.controller.ControllerModelPredicateProvider; +import com.refinedmods.refinedstorage2.platform.common.networking.NetworkCardItemPropertyFunction; import com.refinedmods.refinedstorage2.platform.common.storagemonitor.StorageMonitorBlockEntityRenderer; import com.refinedmods.refinedstorage2.platform.common.support.networkbounditem.NetworkBoundItemItemPropertyFunction; import com.refinedmods.refinedstorage2.platform.common.support.tooltip.CompositeClientTooltipComponent; @@ -33,7 +34,7 @@ import com.refinedmods.refinedstorage2.platform.fabric.recipemod.rei.ReiProxy; import com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive.DiskDriveBlockEntityRendererImpl; import com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive.DiskDriveUnbakedModel; -import com.refinedmods.refinedstorage2.platform.fabric.support.render.model.EmissiveModelRegistry; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.EmissiveModelRegistry; import java.util.List; @@ -367,5 +368,10 @@ private void registerItemProperties() { ConfigurationCardItemPropertyFunction.NAME, new ConfigurationCardItemPropertyFunction() ); + ItemProperties.register( + Items.INSTANCE.getNetworkCard(), + NetworkCardItemPropertyFunction.NAME, + new NetworkCardItemPropertyFunction() + ); } } diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java index 9ac6a48fe..871e00be9 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java @@ -19,7 +19,7 @@ import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseBlock; import com.refinedmods.refinedstorage2.platform.common.upgrade.RegulatorUpgradeItem; -import com.refinedmods.refinedstorage2.platform.common.util.TickHandler; +import com.refinedmods.refinedstorage2.platform.common.util.ServerEventQueue; import com.refinedmods.refinedstorage2.platform.fabric.exporter.StorageExporterTransferStrategyFactory; import com.refinedmods.refinedstorage2.platform.fabric.grid.strategy.FluidGridExtractionStrategy; import com.refinedmods.refinedstorage2.platform.fabric.grid.strategy.FluidGridInsertionStrategy; @@ -357,7 +357,7 @@ public EnergyStorage find(final ItemStack itemStack, final ContainerItemContext } private void registerTickHandler() { - ServerTickEvents.START_SERVER_TICK.register(server -> TickHandler.runQueuedActions()); + ServerTickEvents.START_SERVER_TICK.register(server -> ServerEventQueue.runQueuedActions()); } private void registerSlotReferenceProviders() { diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/PlatformImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/PlatformImpl.java index 4f7355c7a..346c2dfba 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/PlatformImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/PlatformImpl.java @@ -8,7 +8,6 @@ import com.refinedmods.refinedstorage2.platform.api.support.resource.ItemResource; import com.refinedmods.refinedstorage2.platform.common.AbstractPlatform; import com.refinedmods.refinedstorage2.platform.common.Config; -import com.refinedmods.refinedstorage2.platform.common.ContainedFluid; import com.refinedmods.refinedstorage2.platform.common.support.containermenu.TransferManager; import com.refinedmods.refinedstorage2.platform.common.util.BucketAmountFormatting; import com.refinedmods.refinedstorage2.platform.common.util.CustomBlockPlaceContext; @@ -23,7 +22,7 @@ import com.refinedmods.refinedstorage2.platform.fabric.support.containermenu.MenuOpenerImpl; import com.refinedmods.refinedstorage2.platform.fabric.support.energy.EnergyStorageAdapter; import com.refinedmods.refinedstorage2.platform.fabric.support.render.FluidVariantFluidRenderer; -import com.refinedmods.refinedstorage2.platform.fabric.util.SingleStackStorageImpl; +import com.refinedmods.refinedstorage2.platform.fabric.util.SimpleSingleStackStorage; import java.util.List; import java.util.Optional; @@ -152,7 +151,7 @@ public Optional getContainedFluid(final ItemStack stack) { if (stack.isEmpty()) { return Optional.empty(); } - final SingleStackStorageImpl interceptingStorage = new SingleStackStorageImpl(stack); + final SimpleSingleStackStorage interceptingStorage = new SimpleSingleStackStorage(stack); final Storage storage = FluidStorage.ITEM.find(stack, ContainerItemContext.ofSingleSlot( interceptingStorage )); @@ -181,7 +180,7 @@ public Optional convertJeiIngredientToFluid(final Object ingredie @Override public Optional convertToBucket(final FluidResource fluidResource) { - final SingleStackStorageImpl interceptingStorage = SingleStackStorageImpl.forEmptyBucket(); + final SimpleSingleStackStorage interceptingStorage = SimpleSingleStackStorage.forEmptyBucket(); final Storage destination = FluidStorage.ITEM.find( interceptingStorage.getStack(), ContainerItemContext.ofSingleSlot(interceptingStorage) diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/grid/strategy/FluidGridExtractionStrategy.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/grid/strategy/FluidGridExtractionStrategy.java index 858cfcbe6..1537bfc34 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/grid/strategy/FluidGridExtractionStrategy.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/grid/strategy/FluidGridExtractionStrategy.java @@ -12,7 +12,7 @@ import com.refinedmods.refinedstorage2.platform.api.support.resource.FluidResource; import com.refinedmods.refinedstorage2.platform.api.support.resource.ItemResource; import com.refinedmods.refinedstorage2.platform.common.storage.channel.StorageChannelTypes; -import com.refinedmods.refinedstorage2.platform.fabric.util.SingleStackStorageImpl; +import com.refinedmods.refinedstorage2.platform.fabric.util.SimpleSingleStackStorage; import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage; @@ -65,7 +65,7 @@ public boolean onExtract(final PlatformStorageChannelType storageChannelT private void extractWithBucketInStorage(final FluidResource fluidResource, final GridExtractMode mode, final boolean cursor) { - final SingleStackStorageImpl interceptingStorage = SingleStackStorageImpl.forEmptyBucket(); + final SimpleSingleStackStorage interceptingStorage = SimpleSingleStackStorage.forEmptyBucket(); final net.fabricmc.fabric.api.transfer.v1.storage.Storage destination = FluidStorage.ITEM.find( interceptingStorage.getStack(), ContainerItemContext.ofSingleSlot(interceptingStorage) @@ -94,7 +94,7 @@ private void extractWithBucketInInventory(final FluidResource fluidResource, final boolean cursor) { try (Transaction tx = Transaction.openOuter()) { playerInventoryStorage.extract(BUCKET_ITEM_VARIANT, 1, tx); - final SingleStackStorageImpl interceptingStorage = SingleStackStorageImpl.forEmptyBucket(); + final SimpleSingleStackStorage interceptingStorage = SimpleSingleStackStorage.forEmptyBucket(); final net.fabricmc.fabric.api.transfer.v1.storage.Storage dest = FluidStorage.ITEM.find( interceptingStorage.getStack(), ContainerItemContext.ofSingleSlot(interceptingStorage) @@ -123,7 +123,7 @@ private void extractWithBucketInInventory(final FluidResource fluidResource, } } - private boolean insertResultingBucketIntoInventory(final SingleStackStorageImpl interceptingStorage, + private boolean insertResultingBucketIntoInventory(final SimpleSingleStackStorage interceptingStorage, final boolean cursor, final Transaction innerTx) { final net.fabricmc.fabric.api.transfer.v1.storage.Storage relevantStorage = cursor diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/mixin/AbstractModelBakerImplMixin.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/mixin/AbstractModelBakerImplMixin.java index 8176bfb04..4755550c0 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/mixin/AbstractModelBakerImplMixin.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/mixin/AbstractModelBakerImplMixin.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.fabric.mixin; import com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil; -import com.refinedmods.refinedstorage2.platform.fabric.support.render.model.EmissiveModelRegistry; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.EmissiveModelRegistry; import java.util.Map; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java index 7370f26e7..c1e7c8609 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java @@ -5,8 +5,8 @@ import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; -import com.refinedmods.refinedstorage2.platform.fabric.support.render.model.QuadRotator; -import com.refinedmods.refinedstorage2.platform.fabric.support.render.model.QuadTranslator; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadRotator; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadTranslator; import java.util.EnumMap; import java.util.Map; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveBakedModel.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveBakedModel.java similarity index 90% rename from refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveBakedModel.java rename to refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveBakedModel.java index a8643f9c0..c7049d6a4 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveBakedModel.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveBakedModel.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.render.model; +package com.refinedmods.refinedstorage2.platform.fabric.support.render; import java.util.function.Supplier; @@ -12,10 +12,10 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; -public class EmissiveBakedModel extends ForwardingBakedModel { +class EmissiveBakedModel extends ForwardingBakedModel { private final EmissiveTransform transform; - public EmissiveBakedModel(final BakedModel wrapped, final ResourceLocation emissiveSprite) { + EmissiveBakedModel(final BakedModel wrapped, final ResourceLocation emissiveSprite) { this.wrapped = wrapped; this.transform = new EmissiveTransform(emissiveSprite); } diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveModelRegistry.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveModelRegistry.java similarity index 99% rename from refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveModelRegistry.java rename to refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveModelRegistry.java index 9d4767b85..1087b13ae 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveModelRegistry.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveModelRegistry.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.render.model; +package com.refinedmods.refinedstorage2.platform.fabric.support.render; import java.util.HashMap; import java.util.Map; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveTransform.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveTransform.java similarity index 91% rename from refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveTransform.java rename to refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveTransform.java index 7d8db916e..69a7cad1e 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/EmissiveTransform.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveTransform.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.render.model; +package com.refinedmods.refinedstorage2.platform.fabric.support.render; import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView; import net.fabricmc.fabric.api.renderer.v1.model.SpriteFinder; @@ -9,10 +9,10 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; -public class EmissiveTransform implements RenderContext.QuadTransform { +class EmissiveTransform implements RenderContext.QuadTransform { private final ResourceLocation emissiveSprite; - public EmissiveTransform(final ResourceLocation emissiveSprite) { + EmissiveTransform(final ResourceLocation emissiveSprite) { this.emissiveSprite = emissiveSprite; } diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/QuadRotator.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/QuadRotator.java similarity index 99% rename from refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/QuadRotator.java rename to refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/QuadRotator.java index aa31a48d5..ddad39f6b 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/QuadRotator.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/QuadRotator.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.render.model; +package com.refinedmods.refinedstorage2.platform.fabric.support.render; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/QuadTranslator.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/QuadTranslator.java similarity index 98% rename from refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/QuadTranslator.java rename to refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/QuadTranslator.java index f920a597b..92731a2ec 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/QuadTranslator.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/QuadTranslator.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.render.model; +package com.refinedmods.refinedstorage2.platform.fabric.support.render; import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView; import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/package-info.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/package-info.java deleted file mode 100644 index 68ceeffaa..000000000 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/model/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -@ParametersAreNonnullByDefault -@FieldsAndMethodsAreNonnullByDefault -package com.refinedmods.refinedstorage2.platform.fabric.support.render.model; - -import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/util/SingleStackStorageImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/util/SimpleSingleStackStorage.java similarity index 63% rename from refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/util/SingleStackStorageImpl.java rename to refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/util/SimpleSingleStackStorage.java index 34289db78..b0a59cd71 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/util/SingleStackStorageImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/util/SimpleSingleStackStorage.java @@ -4,15 +4,15 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -public final class SingleStackStorageImpl extends SingleStackStorage { +public final class SimpleSingleStackStorage extends SingleStackStorage { private ItemStack stack; - public SingleStackStorageImpl(final ItemStack stack) { + public SimpleSingleStackStorage(final ItemStack stack) { this.stack = stack; } - public static SingleStackStorageImpl forEmptyBucket() { - return new SingleStackStorageImpl(new ItemStack(Items.BUCKET)); + public static SimpleSingleStackStorage forEmptyBucket() { + return new SimpleSingleStackStorage(new ItemStack(Items.BUCKET)); } @Override diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java index 3901fbe7b..32ce072c9 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java @@ -10,6 +10,7 @@ import com.refinedmods.refinedstorage2.platform.common.content.Items; import com.refinedmods.refinedstorage2.platform.common.content.KeyMappings; import com.refinedmods.refinedstorage2.platform.common.controller.ControllerModelPredicateProvider; +import com.refinedmods.refinedstorage2.platform.common.networking.NetworkCardItemPropertyFunction; import com.refinedmods.refinedstorage2.platform.common.storagemonitor.StorageMonitorBlockEntityRenderer; import com.refinedmods.refinedstorage2.platform.common.support.networkbounditem.NetworkBoundItemItemPropertyFunction; import com.refinedmods.refinedstorage2.platform.common.support.tooltip.CompositeClientTooltipComponent; @@ -21,7 +22,7 @@ import com.refinedmods.refinedstorage2.platform.forge.recipemod.rei.ReiGridSynchronizer; import com.refinedmods.refinedstorage2.platform.forge.recipemod.rei.ReiProxy; import com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive.DiskDriveBlockEntityRendererImpl; -import com.refinedmods.refinedstorage2.platform.forge.support.render.model.DiskDriveGeometryLoader; +import com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive.DiskDriveGeometryLoader; import java.util.List; @@ -222,5 +223,10 @@ private static void registerItemProperties() { ConfigurationCardItemPropertyFunction.NAME, new ConfigurationCardItemPropertyFunction() ); + ItemProperties.register( + Items.INSTANCE.getNetworkCard(), + NetworkCardItemPropertyFunction.NAME, + new NetworkCardItemPropertyFunction() + ); } } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java index 5e81c2fa3..c37d3f532 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java @@ -18,7 +18,7 @@ import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseBlock; import com.refinedmods.refinedstorage2.platform.common.upgrade.RegulatorUpgradeItem; import com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil; -import com.refinedmods.refinedstorage2.platform.common.util.TickHandler; +import com.refinedmods.refinedstorage2.platform.common.util.ServerEventQueue; import com.refinedmods.refinedstorage2.platform.forge.exporter.FluidHandlerExporterTransferStrategyFactory; import com.refinedmods.refinedstorage2.platform.forge.exporter.ItemHandlerExporterTransferStrategyFactory; import com.refinedmods.refinedstorage2.platform.forge.externalstorage.FluidHandlerPlatformExternalStorageProviderFactory; @@ -398,7 +398,7 @@ public LazyOptional getCapability(final Capability cap, @SubscribeEvent public void onServerTick(final TickEvent.ServerTickEvent e) { if (e.phase == TickEvent.Phase.START) { - TickHandler.runQueuedActions(); + ServerEventQueue.runQueuedActions(); } } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/PlatformImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/PlatformImpl.java index 207d223e2..460801ed6 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/PlatformImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/PlatformImpl.java @@ -8,7 +8,6 @@ import com.refinedmods.refinedstorage2.platform.api.support.resource.ItemResource; import com.refinedmods.refinedstorage2.platform.common.AbstractPlatform; import com.refinedmods.refinedstorage2.platform.common.Config; -import com.refinedmods.refinedstorage2.platform.common.ContainedFluid; import com.refinedmods.refinedstorage2.platform.common.support.containermenu.TransferManager; import com.refinedmods.refinedstorage2.platform.common.util.BucketAmountFormatting; import com.refinedmods.refinedstorage2.platform.common.util.CustomBlockPlaceContext; diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveBakedModel.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java similarity index 98% rename from refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveBakedModel.java rename to refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java index 37e25515f..039761731 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveBakedModel.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java @@ -1,11 +1,10 @@ -package com.refinedmods.refinedstorage2.platform.forge.support.render.model; +package com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive; import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageState; import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageStorageState; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; -import com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive.ForgeDiskDriveBlockEntity; import java.util.ArrayList; import java.util.Arrays; diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveGeometryLoader.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveGeometryLoader.java similarity index 86% rename from refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveGeometryLoader.java rename to refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveGeometryLoader.java index 19427f196..dd6b3cfd4 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveGeometryLoader.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveGeometryLoader.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.forge.support.render.model; +package com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveItemBakedModel.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveItemBakedModel.java similarity index 97% rename from refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveItemBakedModel.java rename to refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveItemBakedModel.java index 81f542709..f77461e2f 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveItemBakedModel.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveItemBakedModel.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.forge.support.render.model; +package com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive; import java.util.ArrayList; import java.util.EnumMap; diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveUnbakedGeometry.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveUnbakedGeometry.java similarity index 98% rename from refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveUnbakedGeometry.java rename to refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveUnbakedGeometry.java index 6ba531032..9e9b65f3b 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/DiskDriveUnbakedGeometry.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveUnbakedGeometry.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.platform.forge.support.render.model; +package com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/package-info.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/package-info.java deleted file mode 100644 index bc506577a..000000000 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/render/model/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -@ParametersAreNonnullByDefault -@FieldsAndMethodsAreNonnullByDefault -package com.refinedmods.refinedstorage2.platform.forge.support.render.model; - -import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault;