Re-add the External Storage
This commit is contained in:
@@ -120,6 +120,7 @@ public class ClientSetup {
|
|||||||
ScreenManager.registerFactory(RSContainers.GRID, new GridScreenFactory());
|
ScreenManager.registerFactory(RSContainers.GRID, new GridScreenFactory());
|
||||||
ScreenManager.registerFactory(RSContainers.STORAGE_BLOCK, StorageBlockScreen::new);
|
ScreenManager.registerFactory(RSContainers.STORAGE_BLOCK, StorageBlockScreen::new);
|
||||||
ScreenManager.registerFactory(RSContainers.FLUID_STORAGE_BLOCK, FluidStorageBlockScreen::new);
|
ScreenManager.registerFactory(RSContainers.FLUID_STORAGE_BLOCK, FluidStorageBlockScreen::new);
|
||||||
|
ScreenManager.registerFactory(RSContainers.EXTERNAL_STORAGE, ExternalStorageScreen::new);
|
||||||
|
|
||||||
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
|
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
|
||||||
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);
|
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package com.raoulvdberge.refinedstorage;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.StorageType;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.GridBlockGridFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.GridBlockGridFactory;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CableNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CableNetworkNode;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.ExternalStorageNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
|
||||||
@@ -15,6 +17,8 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.factory.FluidStorageDiskFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.factory.FluidStorageDiskFactory;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.factory.ItemStorageDiskFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.factory.ItemStorageDiskFactory;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage.FluidExternalStorageProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorageProvider;
|
||||||
import com.raoulvdberge.refinedstorage.block.*;
|
import com.raoulvdberge.refinedstorage.block.*;
|
||||||
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
|
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
|
||||||
import com.raoulvdberge.refinedstorage.config.ClientConfig;
|
import com.raoulvdberge.refinedstorage.config.ClientConfig;
|
||||||
@@ -111,8 +115,13 @@ public final class RS {
|
|||||||
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K)));
|
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K)));
|
||||||
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.CREATIVE_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.CREATIVE)));
|
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.CREATIVE_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.CREATIVE)));
|
||||||
|
|
||||||
|
API.instance().getNetworkNodeRegistry().add(ExternalStorageNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new ExternalStorageNetworkNode(world, pos)));
|
||||||
|
|
||||||
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
||||||
|
|
||||||
|
API.instance().addExternalStorageProvider(StorageType.ITEM, new ItemExternalStorageProvider());
|
||||||
|
API.instance().addExternalStorageProvider(StorageType.FLUID, new FluidExternalStorageProvider());
|
||||||
|
|
||||||
LootFunctionManager.registerFunction(new StorageBlockLootFunctionSerializer());
|
LootFunctionManager.registerFunction(new StorageBlockLootFunctionSerializer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +156,8 @@ public final class RS {
|
|||||||
for (FluidStorageType type : FluidStorageType.values()) {
|
for (FluidStorageType type : FluidStorageType.values()) {
|
||||||
e.getRegistry().register(new FluidStorageBlock(type));
|
e.getRegistry().register(new FluidStorageBlock(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.getRegistry().register(new ExternalStorageBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -171,6 +182,8 @@ public final class RS {
|
|||||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.THOUSAND_TWENTY_FOUR_K), RSBlocks.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "1024k_fluid_storage_block")));
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.THOUSAND_TWENTY_FOUR_K), RSBlocks.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "1024k_fluid_storage_block")));
|
||||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K), RSBlocks.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "4096k_fluid_storage_block")));
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K), RSBlocks.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "4096k_fluid_storage_block")));
|
||||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.CREATIVE), RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "creative_fluid_storage_block")));
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.CREATIVE), RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "creative_fluid_storage_block")));
|
||||||
|
|
||||||
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExternalStorageTile::new, RSBlocks.EXTERNAL_STORAGE).build(null).setRegistryName(RS.ID, "external_storage")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
|
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
|
||||||
@@ -189,6 +202,7 @@ public final class RS {
|
|||||||
e.getRegistry().register(IForgeContainerType.create(new GridContainerFactory()).setRegistryName(RS.ID, "grid"));
|
e.getRegistry().register(IForgeContainerType.create(new GridContainerFactory()).setRegistryName(RS.ID, "grid"));
|
||||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<StorageContainer, StorageTile>((windowId, inv, tile) -> new StorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "storage_block"));
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<StorageContainer, StorageTile>((windowId, inv, tile) -> new StorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "storage_block"));
|
||||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<FluidStorageContainer, FluidStorageTile>((windowId, inv, tile) -> new FluidStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_storage_block"));
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<FluidStorageContainer, FluidStorageTile>((windowId, inv, tile) -> new FluidStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_storage_block"));
|
||||||
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<ExternalStorageContainer, ExternalStorageTile>((windowId, inv, tile) -> new ExternalStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "external_storage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -255,6 +269,8 @@ public final class RS {
|
|||||||
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK));
|
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK));
|
||||||
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK));
|
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK));
|
||||||
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK));
|
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK));
|
||||||
|
|
||||||
|
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.EXTERNAL_STORAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.raoulvdberge.refinedstorage.block.*;
|
|||||||
import net.minecraftforge.registries.ObjectHolder;
|
import net.minecraftforge.registries.ObjectHolder;
|
||||||
|
|
||||||
public final class RSBlocks {
|
public final class RSBlocks {
|
||||||
public static final ExternalStorageBlock EXTERNAL_STORAGE = new ExternalStorageBlock();
|
|
||||||
public static final BlockImporter IMPORTER = new BlockImporter();
|
public static final BlockImporter IMPORTER = new BlockImporter();
|
||||||
public static final BlockExporter EXPORTER = new BlockExporter();
|
public static final BlockExporter EXPORTER = new BlockExporter();
|
||||||
public static final BlockDetector DETECTOR = new BlockDetector();
|
public static final BlockDetector DETECTOR = new BlockDetector();
|
||||||
@@ -71,6 +70,9 @@ public final class RSBlocks {
|
|||||||
@ObjectHolder(RS.ID + ":creative_fluid_storage_block")
|
@ObjectHolder(RS.ID + ":creative_fluid_storage_block")
|
||||||
public static final FluidStorageBlock CREATIVE_FLUID_STORAGE_BLOCK = null;
|
public static final FluidStorageBlock CREATIVE_FLUID_STORAGE_BLOCK = null;
|
||||||
|
|
||||||
|
@ObjectHolder(RS.ID + ":external_storage")
|
||||||
|
public static final ExternalStorageBlock EXTERNAL_STORAGE = null;
|
||||||
|
|
||||||
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
|
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
|
||||||
public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
|
public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
|
||||||
public static final BlockCrafterManager CRAFTER_MANAGER = new BlockCrafterManager();
|
public static final BlockCrafterManager CRAFTER_MANAGER = new BlockCrafterManager();
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public final class RSContainers {
|
|||||||
public static final ContainerType<DiskManipulatorContainer> DISK_MANIPULATOR = null;
|
public static final ContainerType<DiskManipulatorContainer> DISK_MANIPULATOR = null;
|
||||||
//@ObjectHolder(RS.ID + ":exporter")
|
//@ObjectHolder(RS.ID + ":exporter")
|
||||||
public static final ContainerType<ExporterContainer> EXPORTER = null;
|
public static final ContainerType<ExporterContainer> EXPORTER = null;
|
||||||
//@ObjectHolder(RS.ID + ":external_storage")
|
|
||||||
|
@ObjectHolder(RS.ID + ":external_storage")
|
||||||
public static final ContainerType<ExternalStorageContainer> EXTERNAL_STORAGE = null;
|
public static final ContainerType<ExternalStorageContainer> EXTERNAL_STORAGE = null;
|
||||||
|
|
||||||
@ObjectHolder(RS.ID + ":filter")
|
@ObjectHolder(RS.ID + ":filter")
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ public class RSOldConfig {
|
|||||||
public int crafterManagerUsage;
|
public int crafterManagerUsage;
|
||||||
public int destructorUsage;
|
public int destructorUsage;
|
||||||
public int detectorUsage;
|
public int detectorUsage;
|
||||||
public int externalStorageUsage;
|
|
||||||
public int externalStoragePerStorageUsage;
|
|
||||||
public int exporterUsage;
|
public int exporterUsage;
|
||||||
public int importerUsage;
|
public int importerUsage;
|
||||||
public int interfaceUsage;
|
public int interfaceUsage;
|
||||||
@@ -91,8 +89,6 @@ public class RSOldConfig {
|
|||||||
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
||||||
destructorUsage = config.getInt("destructor", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Destructors");
|
destructorUsage = config.getInt("destructor", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Destructors");
|
||||||
detectorUsage = config.getInt("detector", ENERGY, 2, 0, Integer.MAX_VALUE, "The energy used by Detectors");
|
detectorUsage = config.getInt("detector", ENERGY, 2, 0, Integer.MAX_VALUE, "The energy used by Detectors");
|
||||||
externalStorageUsage = config.getInt("externalStorage", ENERGY, 0, 0, Integer.MAX_VALUE, "The base energy used by External Storages");
|
|
||||||
externalStoragePerStorageUsage = config.getInt("externalStoragePerStorage", ENERGY, 1, 0, Integer.MAX_VALUE, "The additional energy used per connected storage to an External Storage");
|
|
||||||
exporterUsage = config.getInt("exporter", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Exporters");
|
exporterUsage = config.getInt("exporter", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Exporters");
|
||||||
importerUsage = config.getInt("importer", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Importers");
|
importerUsage = config.getInt("importer", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Importers");
|
||||||
interfaceUsage = config.getInt("interface", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Interfaces");
|
interfaceUsage = config.getInt("interface", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Interfaces");
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ public class RSTiles {
|
|||||||
public static final TileEntityType<TileDiskManipulator> DISK_MANIPULATOR = null;
|
public static final TileEntityType<TileDiskManipulator> DISK_MANIPULATOR = null;
|
||||||
//@ObjectHolder(RS.ID + ":exporter")
|
//@ObjectHolder(RS.ID + ":exporter")
|
||||||
public static final TileEntityType<TileExporter> EXPORTER = null;
|
public static final TileEntityType<TileExporter> EXPORTER = null;
|
||||||
//@ObjectHolder(RS.ID + ":external_storage")
|
|
||||||
public static final TileEntityType<TileExternalStorage> EXTERNAL_STORAGE = null;
|
@ObjectHolder(RS.ID + ":external_storage")
|
||||||
|
public static final TileEntityType<ExternalStorageTile> EXTERNAL_STORAGE = null;
|
||||||
|
|
||||||
//@ObjectHolder(RS.ID + ":fluid_interface")
|
//@ObjectHolder(RS.ID + ":fluid_interface")
|
||||||
public static final TileEntityType<TileFluidInterface> FLUID_INTERFACE = null;
|
public static final TileEntityType<TileFluidInterface> FLUID_INTERFACE = null;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCache;
|
|||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public interface IStorageExternal<T> extends IStorage<T> {
|
public interface IExternalStorage<T> extends IStorage<T> {
|
||||||
/**
|
/**
|
||||||
* For storage disks and blocks, the network detects changes and updates the {@link IStorageCache} accordingly.
|
* For storage disks and blocks, the network detects changes and updates the {@link IStorageCache} accordingly.
|
||||||
* However, for blocks connected to an external storage the external storage itself is responsible for bookkeeping the changes
|
* However, for blocks connected to an external storage the external storage itself is responsible for bookkeeping the changes
|
||||||
@@ -26,7 +26,7 @@ public interface IExternalStorageProvider<T> {
|
|||||||
* @return the external storage handler
|
* @return the external storage handler
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
IStorageExternal<T> provide(IExternalStorageContext context, Supplier<TileEntity> tile, Direction direction);
|
IExternalStorage<T> provide(IExternalStorageContext context, Supplier<TileEntity> tile, Direction direction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the priority of this external storage provider.
|
* Returns the priority of this external storage provider.
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
|||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageProvider;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageProvider;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.StorageType;
|
import com.raoulvdberge.refinedstorage.api.storage.StorageType;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IStorageExternal;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.FluidStorageCache;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.FluidStorageCache;
|
||||||
@@ -16,7 +16,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.ItemStorageCache;
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileExternalStorage;
|
import com.raoulvdberge.refinedstorage.tile.ExternalStorageTile;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.*;
|
import com.raoulvdberge.refinedstorage.tile.config.*;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
||||||
@@ -24,6 +24,7 @@ import com.raoulvdberge.refinedstorage.util.StackUtils;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
@@ -35,7 +36,7 @@ import net.minecraftforge.items.IItemHandlerModifiable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
public class NetworkNodeExternalStorage extends NetworkNode implements IStorageProvider, IStorageScreen, IComparable, IWhitelistBlacklist, IPrioritizable, IType, IAccessType, IExternalStorageContext {
|
public class ExternalStorageNetworkNode extends NetworkNode implements IStorageProvider, IStorageScreen, IComparable, IWhitelistBlacklist, IPrioritizable, IType, IAccessType, IExternalStorageContext {
|
||||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "external_storage");
|
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "external_storage");
|
||||||
|
|
||||||
private static final String NBT_PRIORITY = "Priority";
|
private static final String NBT_PRIORITY = "Priority";
|
||||||
@@ -54,16 +55,16 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
private AccessType accessType = AccessType.INSERT_EXTRACT;
|
private AccessType accessType = AccessType.INSERT_EXTRACT;
|
||||||
private int networkTicks;
|
private int networkTicks;
|
||||||
|
|
||||||
private List<IStorageExternal<ItemStack>> itemStorages = new CopyOnWriteArrayList<>();
|
private List<IExternalStorage<ItemStack>> itemStorages = new CopyOnWriteArrayList<>();
|
||||||
private List<IStorageExternal<FluidStack>> fluidStorages = new CopyOnWriteArrayList<>();
|
private List<IExternalStorage<FluidStack>> fluidStorages = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
public NetworkNodeExternalStorage(World world, BlockPos pos) {
|
public ExternalStorageNetworkNode(World world, BlockPos pos) {
|
||||||
super(world, pos);
|
super(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
return RS.INSTANCE.config.externalStorageUsage + ((itemStorages.size() + fluidStorages.size()) * RS.INSTANCE.config.externalStoragePerStorageUsage);
|
return RS.SERVER_CONFIG.getExternalStorage().getUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,19 +85,19 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IStorageExternal<ItemStack> storage : itemStorages) {
|
for (IExternalStorage<ItemStack> storage : itemStorages) {
|
||||||
storage.update(network);
|
storage.update(network);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IStorageExternal<FluidStack> storage : fluidStorages) {
|
for (IExternalStorage<FluidStack> storage : fluidStorages) {
|
||||||
storage.update(network);
|
storage.update(network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO @Override
|
@Override
|
||||||
protected void onDirectionChanged() {
|
public void onDirectionChanged(Direction direction) {
|
||||||
// super.onDirectionChanged();
|
super.onDirectionChanged(direction);
|
||||||
|
|
||||||
if (network != null) {
|
if (network != null) {
|
||||||
updateStorage(network);
|
updateStorage(network);
|
||||||
@@ -243,37 +244,37 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileDataParameter<Integer, ?> getRedstoneModeParameter() {
|
public TileDataParameter<Integer, ?> getRedstoneModeParameter() {
|
||||||
return TileExternalStorage.REDSTONE_MODE;
|
return ExternalStorageTile.REDSTONE_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileDataParameter<Integer, ?> getCompareParameter() {
|
public TileDataParameter<Integer, ?> getCompareParameter() {
|
||||||
return TileExternalStorage.COMPARE;
|
return ExternalStorageTile.COMPARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileDataParameter<Integer, ?> getWhitelistBlacklistParameter() {
|
public TileDataParameter<Integer, ?> getWhitelistBlacklistParameter() {
|
||||||
return TileExternalStorage.WHITELIST_BLACKLIST;
|
return ExternalStorageTile.WHITELIST_BLACKLIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileDataParameter<Integer, ?> getPriorityParameter() {
|
public TileDataParameter<Integer, ?> getPriorityParameter() {
|
||||||
return TileExternalStorage.PRIORITY;
|
return ExternalStorageTile.PRIORITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileDataParameter<AccessType, ?> getAccessTypeParameter() {
|
public TileDataParameter<AccessType, ?> getAccessTypeParameter() {
|
||||||
return TileExternalStorage.ACCESS_TYPE;
|
return ExternalStorageTile.ACCESS_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getStored() {
|
public long getStored() {
|
||||||
return TileExternalStorage.STORED.getValue();
|
return ExternalStorageTile.STORED.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getCapacity() {
|
public long getCapacity() {
|
||||||
return TileExternalStorage.CAPACITY.getValue();
|
return ExternalStorageTile.CAPACITY.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -305,12 +306,12 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileDataParameter<Integer, ?> getTypeParameter() {
|
public TileDataParameter<Integer, ?> getTypeParameter() {
|
||||||
return TileExternalStorage.TYPE;
|
return ExternalStorageTile.TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return world.isRemote ? TileExternalStorage.TYPE.getValue() : type;
|
return world.isRemote ? ExternalStorageTile.TYPE.getValue() : type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -334,11 +335,11 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
return fluidFilters;
|
return fluidFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IStorageExternal<ItemStack>> getItemStorages() {
|
public List<IExternalStorage<ItemStack>> getItemStorages() {
|
||||||
return itemStorages;
|
return itemStorages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IStorageExternal<FluidStack>> getFluidStorages() {
|
public List<IExternalStorage<FluidStack>> getFluidStorages() {
|
||||||
return fluidStorages;
|
return fluidStorages;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
|
|||||||
protected UUID owner;
|
protected UUID owner;
|
||||||
protected String version;
|
protected String version;
|
||||||
|
|
||||||
private Direction direction = Direction.NORTH;
|
private Direction direction;
|
||||||
|
|
||||||
// Disable throttling for the first tick.
|
// Disable throttling for the first tick.
|
||||||
// This is to make sure couldUpdate is going to be correctly set.
|
// This is to make sure couldUpdate is going to be correctly set.
|
||||||
@@ -242,6 +242,10 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
|
|||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDirectionChanged(Direction direction) {
|
||||||
|
this.direction = direction;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public IItemHandler getDrops() {
|
public IItemHandler getDrops() {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage.StorageExternalFluid;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage.FluidExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.fluid.ProxyFluidHandler;
|
import com.raoulvdberge.refinedstorage.inventory.fluid.ProxyFluidHandler;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||||
@@ -123,7 +123,7 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
|||||||
|
|
||||||
// If we are an interface acting as a storage, we don't want to extract from other interfaces to
|
// If we are an interface acting as a storage, we don't want to extract from other interfaces to
|
||||||
// avoid stealing from each other.
|
// avoid stealing from each other.
|
||||||
return !(s instanceof StorageExternalFluid) || !((StorageExternalFluid) s).isConnectedToInterface();
|
return !(s instanceof FluidExternalStorage) || !((FluidExternalStorage) s).isConnectedToInterface();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
@@ -162,10 +162,10 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
|||||||
for (Direction facing : Direction.values()) {
|
for (Direction facing : Direction.values()) {
|
||||||
INetworkNode facingNode = API.instance().getNetworkNodeManager((ServerWorld) world).getNode(pos.offset(facing));
|
INetworkNode facingNode = API.instance().getNetworkNodeManager((ServerWorld) world).getNode(pos.offset(facing));
|
||||||
|
|
||||||
if (facingNode instanceof NetworkNodeExternalStorage &&
|
if (facingNode instanceof ExternalStorageNetworkNode &&
|
||||||
facingNode.canUpdate() &&
|
facingNode.canUpdate() &&
|
||||||
((NetworkNodeExternalStorage) facingNode).getDirection() == facing.getOpposite() &&
|
((ExternalStorageNetworkNode) facingNode).getDirection() == facing.getOpposite() &&
|
||||||
((NetworkNodeExternalStorage) facingNode).getType() == IType.FLUIDS) {
|
((ExternalStorageNetworkNode) facingNode).getType() == IType.FLUIDS) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage.StorageExternalItem;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.ProxyItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.ProxyItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
||||||
@@ -105,7 +105,7 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
|||||||
|
|
||||||
// If we are an interface acting as a storage, we don't want to extract from other interfaces to
|
// If we are an interface acting as a storage, we don't want to extract from other interfaces to
|
||||||
// avoid stealing from each other.
|
// avoid stealing from each other.
|
||||||
return !(s instanceof StorageExternalItem) || !((StorageExternalItem) s).isConnectedToInterface();
|
return !(s instanceof ItemExternalStorage) || !((ItemExternalStorage) s).isConnectedToInterface();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
@@ -140,10 +140,10 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
|||||||
for (Direction facing : Direction.values()) {
|
for (Direction facing : Direction.values()) {
|
||||||
INetworkNode facingNode = API.instance().getNetworkNodeManager((ServerWorld) world).getNode(pos.offset(facing));
|
INetworkNode facingNode = API.instance().getNetworkNodeManager((ServerWorld) world).getNode(pos.offset(facing));
|
||||||
|
|
||||||
if (facingNode instanceof NetworkNodeExternalStorage &&
|
if (facingNode instanceof ExternalStorageNetworkNode &&
|
||||||
facingNode.canUpdate() &&
|
facingNode.canUpdate() &&
|
||||||
((NetworkNodeExternalStorage) facingNode).getDirection() == facing.getOpposite() &&
|
((ExternalStorageNetworkNode) facingNode).getDirection() == facing.getOpposite() &&
|
||||||
((NetworkNodeExternalStorage) facingNode).getType() == IType.ITEMS) {
|
((ExternalStorageNetworkNode) facingNode).getType() == IType.ITEMS) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IStorageExternal;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@@ -17,13 +17,13 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class StorageExternalFluid implements IStorageExternal<FluidStack> {
|
public class FluidExternalStorage implements IExternalStorage<FluidStack> {
|
||||||
private IExternalStorageContext context;
|
private IExternalStorageContext context;
|
||||||
private Supplier<IFluidHandler> handlerSupplier;
|
private Supplier<IFluidHandler> handlerSupplier;
|
||||||
private boolean connectedToInterface;
|
private boolean connectedToInterface;
|
||||||
private ExternalStorageCacheFluid cache = new ExternalStorageCacheFluid();
|
private FluidExternalStorageCache cache = new FluidExternalStorageCache();
|
||||||
|
|
||||||
public StorageExternalFluid(IExternalStorageContext context, Supplier<IFluidHandler> handlerSupplier, boolean connectedToInterface) {
|
public FluidExternalStorage(IExternalStorageContext context, Supplier<IFluidHandler> handlerSupplier, boolean connectedToInterface) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.handlerSupplier = handlerSupplier;
|
this.handlerSupplier = handlerSupplier;
|
||||||
this.connectedToInterface = connectedToInterface;
|
this.connectedToInterface = connectedToInterface;
|
||||||
@@ -10,7 +10,7 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ExternalStorageCacheFluid {
|
public class FluidExternalStorageCache {
|
||||||
private List<FluidStack> cache;
|
private List<FluidStack> cache;
|
||||||
|
|
||||||
public void update(INetwork network, @Nullable IFluidHandler handler) {
|
public void update(INetwork network, @Nullable IFluidHandler handler) {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage;
|
package com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IStorageExternal;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@@ -12,7 +12,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ExternalStorageProviderFluid implements IExternalStorageProvider<FluidStack> {
|
public class FluidExternalStorageProvider implements IExternalStorageProvider<FluidStack> {
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvide(TileEntity tile, Direction direction) {
|
public boolean canProvide(TileEntity tile, Direction direction) {
|
||||||
return WorldUtils.getFluidHandler(tile, direction.getOpposite()) != null;
|
return WorldUtils.getFluidHandler(tile, direction.getOpposite()) != null;
|
||||||
@@ -20,8 +20,8 @@ public class ExternalStorageProviderFluid implements IExternalStorageProvider<Fl
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IStorageExternal<FluidStack> provide(IExternalStorageContext context, Supplier<TileEntity> tile, Direction direction) {
|
public IExternalStorage<FluidStack> provide(IExternalStorageContext context, Supplier<TileEntity> tile, Direction direction) {
|
||||||
return new StorageExternalFluid(context, () -> WorldUtils.getFluidHandler(tile.get(), direction.getOpposite()), tile.get() instanceof TileFluidInterface);
|
return new FluidExternalStorage(context, () -> WorldUtils.getFluidHandler(tile.get(), direction.getOpposite()), tile.get() instanceof TileFluidInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2,8 +2,8 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IStorageExternal;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
@@ -19,13 +19,13 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class StorageExternalItem implements IStorageExternal<ItemStack> {
|
public class ItemExternalStorage implements IExternalStorage<ItemStack> {
|
||||||
private IExternalStorageContext context;
|
private IExternalStorageContext context;
|
||||||
private Supplier<IItemHandler> handlerSupplier;
|
private Supplier<IItemHandler> handlerSupplier;
|
||||||
private boolean connectedToInterface;
|
private boolean connectedToInterface;
|
||||||
private ExternalStorageCacheItem cache = new ExternalStorageCacheItem();
|
private ItemExternalStorageCache cache = new ItemExternalStorageCache();
|
||||||
|
|
||||||
public StorageExternalItem(IExternalStorageContext context, Supplier<IItemHandler> handlerSupplier, boolean connectedToInterface) {
|
public ItemExternalStorage(IExternalStorageContext context, Supplier<IItemHandler> handlerSupplier, boolean connectedToInterface) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.handlerSupplier = handlerSupplier;
|
this.handlerSupplier = handlerSupplier;
|
||||||
this.connectedToInterface = connectedToInterface;
|
this.connectedToInterface = connectedToInterface;
|
||||||
@@ -9,7 +9,7 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ExternalStorageCacheItem {
|
public class ItemExternalStorageCache {
|
||||||
private List<ItemStack> cache;
|
private List<ItemStack> cache;
|
||||||
|
|
||||||
public void update(INetwork network, @Nullable IItemHandler handler) {
|
public void update(INetwork network, @Nullable IItemHandler handler) {
|
||||||
@@ -2,9 +2,9 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageProvider;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IStorageExternal;
|
|
||||||
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
|
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
||||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
@@ -15,22 +15,22 @@ import net.minecraft.util.Direction;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ExternalStorageProviderItem implements IExternalStorageProvider<ItemStack> {
|
public class ItemExternalStorageProvider implements IExternalStorageProvider<ItemStack> {
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvide(TileEntity tile, Direction direction) {
|
public boolean canProvide(TileEntity tile, Direction direction) {
|
||||||
INetworkNodeProxy nodeProxy = tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY, direction.getOpposite()).orElse(null);
|
INetworkNodeProxy nodeProxy = tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY, direction.getOpposite()).orElse(null);
|
||||||
|
|
||||||
if (!(nodeProxy != null && nodeProxy.getNode() instanceof IStorageProvider)) { // TODO: Correct if still?
|
if (nodeProxy != null && nodeProxy.getNode() instanceof IStorageProvider) {
|
||||||
return WorldUtils.getItemHandler(tile, direction.getOpposite()) != null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return WorldUtils.getItemHandler(tile, direction.getOpposite()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IStorageExternal<ItemStack> provide(IExternalStorageContext context, Supplier<TileEntity> tile, Direction direction) {
|
public IExternalStorage<ItemStack> provide(IExternalStorageContext context, Supplier<TileEntity> tile, Direction direction) {
|
||||||
return new StorageExternalItem(context, () -> WorldUtils.getItemHandler(tile.get(), direction.getOpposite()), tile.get() instanceof TileInterface);
|
return new ItemExternalStorage(context, () -> WorldUtils.getItemHandler(tile.get(), direction.getOpposite()), tile.get() instanceof TileInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -4,7 +4,10 @@ import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.state.StateContainer;
|
import net.minecraft.state.StateContainer;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class BaseBlock extends Block {
|
public abstract class BaseBlock extends Block {
|
||||||
public BaseBlock(Properties properties) {
|
public BaseBlock(Properties properties) {
|
||||||
@@ -20,12 +23,29 @@ public abstract class BaseBlock extends Block {
|
|||||||
public BlockState rotate(BlockState state, Rotation rot) {
|
public BlockState rotate(BlockState state, Rotation rot) {
|
||||||
BlockDirection dir = getDirection();
|
BlockDirection dir = getDirection();
|
||||||
if (dir != BlockDirection.NONE) {
|
if (dir != BlockDirection.NONE) {
|
||||||
return state.with(dir.getProperty(), dir.cycle(state.get(dir.getProperty())));
|
Direction newDirection = dir.cycle(state.get(dir.getProperty()));
|
||||||
|
|
||||||
|
return state.with(dir.getProperty(), newDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.rotate(state, rot);
|
return super.rotate(state, rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onDirectionChanged(World world, BlockPos pos, Direction newDirection) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||||
|
super.onReplaced(state, world, pos, newState, isMoving);
|
||||||
|
|
||||||
|
if (getDirection() != BlockDirection.NONE &&
|
||||||
|
state.getBlock() == newState.getBlock() &&
|
||||||
|
state.get(getDirection().getProperty()) != newState.get(getDirection().getProperty())) {
|
||||||
|
onDirectionChanged(world, pos, newState.get(getDirection().getProperty()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||||
super.fillStateContainer(builder);
|
super.fillStateContainer(builder);
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ import net.minecraft.world.World;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class CableBlock extends NodeBlock {
|
public class CableBlock extends NodeBlock {
|
||||||
protected static final BooleanProperty NORTH = BooleanProperty.create("north");
|
private static final BooleanProperty NORTH = BooleanProperty.create("north");
|
||||||
protected static final BooleanProperty EAST = BooleanProperty.create("east");
|
private static final BooleanProperty EAST = BooleanProperty.create("east");
|
||||||
protected static final BooleanProperty SOUTH = BooleanProperty.create("south");
|
private static final BooleanProperty SOUTH = BooleanProperty.create("south");
|
||||||
protected static final BooleanProperty WEST = BooleanProperty.create("west");
|
private static final BooleanProperty WEST = BooleanProperty.create("west");
|
||||||
protected static final BooleanProperty UP = BooleanProperty.create("up");
|
private static final BooleanProperty UP = BooleanProperty.create("up");
|
||||||
protected static final BooleanProperty DOWN = BooleanProperty.create("down");
|
private static final BooleanProperty DOWN = BooleanProperty.create("down");
|
||||||
|
|
||||||
private static final VoxelShape SHAPE_CORE = makeCuboidShape(6, 6, 6, 10, 10, 10);
|
private static final VoxelShape SHAPE_CORE = makeCuboidShape(6, 6, 6, 10, 10, 10);
|
||||||
private static final VoxelShape SHAPE_NORTH = makeCuboidShape(6, 6, 0, 10, 10, 6);
|
private static final VoxelShape SHAPE_NORTH = makeCuboidShape(6, 6, 0, 10, 10, 6);
|
||||||
@@ -53,7 +53,7 @@ public class CableBlock extends NodeBlock {
|
|||||||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
|
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
|
||||||
super.neighborChanged(state, world, pos, block, fromPos, isMoving);
|
super.neighborChanged(state, world, pos, block, fromPos, isMoving);
|
||||||
|
|
||||||
world.setBlockState(pos, getState(world, pos));
|
world.setBlockState(pos, getState(state, world, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,7 +91,7 @@ public class CableBlock extends NodeBlock {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext ctx) {
|
public BlockState getStateForPlacement(BlockItemUseContext ctx) {
|
||||||
return getState(ctx.getWorld(), ctx.getPos());
|
return getState(getDefaultState(), ctx.getWorld(), ctx.getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasNode(World world, BlockPos pos, Direction direction) {
|
private static boolean hasNode(World world, BlockPos pos, Direction direction) {
|
||||||
@@ -103,7 +103,7 @@ public class CableBlock extends NodeBlock {
|
|||||||
return tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY, direction).isPresent();
|
return tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY, direction).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockState getState(World world, BlockPos pos) {
|
private BlockState getState(BlockState currentState, World world, BlockPos pos) {
|
||||||
boolean north = hasNode(world, pos.offset(Direction.NORTH), Direction.SOUTH);
|
boolean north = hasNode(world, pos.offset(Direction.NORTH), Direction.SOUTH);
|
||||||
boolean east = hasNode(world, pos.offset(Direction.EAST), Direction.WEST);
|
boolean east = hasNode(world, pos.offset(Direction.EAST), Direction.WEST);
|
||||||
boolean south = hasNode(world, pos.offset(Direction.SOUTH), Direction.NORTH);
|
boolean south = hasNode(world, pos.offset(Direction.SOUTH), Direction.NORTH);
|
||||||
@@ -111,7 +111,7 @@ public class CableBlock extends NodeBlock {
|
|||||||
boolean up = hasNode(world, pos.offset(Direction.UP), Direction.DOWN);
|
boolean up = hasNode(world, pos.offset(Direction.UP), Direction.DOWN);
|
||||||
boolean down = hasNode(world, pos.offset(Direction.DOWN), Direction.UP);
|
boolean down = hasNode(world, pos.offset(Direction.DOWN), Direction.UP);
|
||||||
|
|
||||||
return getDefaultState()
|
return currentState
|
||||||
.with(NORTH, north)
|
.with(NORTH, north)
|
||||||
.with(EAST, east)
|
.with(EAST, east)
|
||||||
.with(SOUTH, south)
|
.with(SOUTH, south)
|
||||||
|
|||||||
@@ -2,13 +2,28 @@ package com.raoulvdberge.refinedstorage.block;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
|
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.ExternalStorageContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.ExternalStorageTile;
|
||||||
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.network.NetworkHooks;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ExternalStorageBlock extends CableBlock {
|
public class ExternalStorageBlock extends CableBlock {
|
||||||
private static final VoxelShape HEAD_NORTH = makeCuboidShape(3, 3, 0, 13, 13, 2);
|
private static final VoxelShape HEAD_NORTH = makeCuboidShape(3, 3, 0, 13, 13, 2);
|
||||||
@@ -33,33 +48,59 @@ public class ExternalStorageBlock extends CableBlock {
|
|||||||
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) {
|
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) {
|
||||||
VoxelShape shape = super.getShape(state, world, pos, ctx);
|
VoxelShape shape = super.getShape(state, world, pos, ctx);
|
||||||
|
|
||||||
if (state.get(NORTH)) {
|
Direction direction = state.get(getDirection().getProperty());
|
||||||
|
|
||||||
|
if (direction == Direction.NORTH) {
|
||||||
shape = VoxelShapes.or(shape, HEAD_NORTH);
|
shape = VoxelShapes.or(shape, HEAD_NORTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.get(EAST)) {
|
if (direction == Direction.EAST) {
|
||||||
shape = VoxelShapes.or(shape, HEAD_EAST);
|
shape = VoxelShapes.or(shape, HEAD_EAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.get(SOUTH)) {
|
if (direction == Direction.SOUTH) {
|
||||||
shape = VoxelShapes.or(shape, HEAD_SOUTH);
|
shape = VoxelShapes.or(shape, HEAD_SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.get(WEST)) {
|
if (direction == Direction.WEST) {
|
||||||
shape = VoxelShapes.or(shape, HEAD_WEST);
|
shape = VoxelShapes.or(shape, HEAD_WEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.get(UP)) {
|
if (direction == Direction.UP) {
|
||||||
shape = VoxelShapes.or(shape, HEAD_UP);
|
shape = VoxelShapes.or(shape, HEAD_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.get(DOWN)) {
|
if (direction == Direction.DOWN) {
|
||||||
shape = VoxelShapes.or(shape, HEAD_DOWN);
|
shape = VoxelShapes.or(shape, HEAD_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
return new ExternalStorageTile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||||
|
if (!world.isRemote) {
|
||||||
|
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
|
||||||
|
(ServerPlayerEntity) player,
|
||||||
|
new PositionalTileContainerProvider<ExternalStorageTile>(
|
||||||
|
new TranslationTextComponent("gui.refinedstorage.external_storage"),
|
||||||
|
(tile, windowId, inventory, p) -> new ExternalStorageContainer(tile, player, windowId),
|
||||||
|
pos
|
||||||
|
),
|
||||||
|
pos
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.tile.NetworkNodeTile;
|
import com.raoulvdberge.refinedstorage.tile.NetworkNodeTile;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
@@ -8,6 +11,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.state.BooleanProperty;
|
import net.minecraft.state.BooleanProperty;
|
||||||
import net.minecraft.state.StateContainer;
|
import net.minecraft.state.StateContainer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -27,6 +31,8 @@ public abstract class NodeBlock extends BaseBlock {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||||
|
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||||
|
|
||||||
if (state.getBlock() != newState.getBlock()) {
|
if (state.getBlock() != newState.getBlock()) {
|
||||||
TileEntity tile = worldIn.getTileEntity(pos);
|
TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
|
|
||||||
@@ -43,8 +49,20 @@ public abstract class NodeBlock extends BaseBlock {
|
|||||||
InventoryHelper.dropItems(worldIn, pos, drops);
|
InventoryHelper.dropItems(worldIn, pos, drops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
@Override
|
||||||
|
protected void onDirectionChanged(World world, BlockPos pos, Direction newDirection) {
|
||||||
|
super.onDirectionChanged(world, pos, newDirection);
|
||||||
|
|
||||||
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if (tile instanceof INetworkNodeProxy) {
|
||||||
|
INetworkNode node = ((INetworkNodeProxy) tile).getNode();
|
||||||
|
|
||||||
|
if (node instanceof NetworkNode) {
|
||||||
|
((NetworkNode) node).onDirectionChanged(newDirection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class ServerConfig {
|
|||||||
private DiskDrive diskDrive;
|
private DiskDrive diskDrive;
|
||||||
private StorageBlock storageBlock;
|
private StorageBlock storageBlock;
|
||||||
private FluidStorageBlock fluidStorageBlock;
|
private FluidStorageBlock fluidStorageBlock;
|
||||||
|
private ExternalStorage externalStorage;
|
||||||
private Upgrades upgrades;
|
private Upgrades upgrades;
|
||||||
|
|
||||||
public ServerConfig() {
|
public ServerConfig() {
|
||||||
@@ -21,6 +22,7 @@ public class ServerConfig {
|
|||||||
diskDrive = new DiskDrive();
|
diskDrive = new DiskDrive();
|
||||||
storageBlock = new StorageBlock();
|
storageBlock = new StorageBlock();
|
||||||
fluidStorageBlock = new FluidStorageBlock();
|
fluidStorageBlock = new FluidStorageBlock();
|
||||||
|
externalStorage = new ExternalStorage();
|
||||||
upgrades = new Upgrades();
|
upgrades = new Upgrades();
|
||||||
|
|
||||||
spec = builder.build();
|
spec = builder.build();
|
||||||
@@ -54,6 +56,10 @@ public class ServerConfig {
|
|||||||
return fluidStorageBlock;
|
return fluidStorageBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExternalStorage getExternalStorage() {
|
||||||
|
return externalStorage;
|
||||||
|
}
|
||||||
|
|
||||||
public ForgeConfigSpec getSpec() {
|
public ForgeConfigSpec getSpec() {
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
@@ -301,4 +307,20 @@ public class ServerConfig {
|
|||||||
return creativeUsage.get();
|
return creativeUsage.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ExternalStorage {
|
||||||
|
private final ForgeConfigSpec.IntValue usage;
|
||||||
|
|
||||||
|
public ExternalStorage() {
|
||||||
|
builder.push("externalStorage");
|
||||||
|
|
||||||
|
usage = builder.comment("The energy used by the External Storage").defineInRange("usage", 6, 0, Integer.MAX_VALUE);
|
||||||
|
|
||||||
|
builder.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUsage() {
|
||||||
|
return usage.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package com.raoulvdberge.refinedstorage.container;
|
|||||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileExternalStorage;
|
import com.raoulvdberge.refinedstorage.tile.ExternalStorageTile;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
public class ExternalStorageContainer extends BaseContainer {
|
public class ExternalStorageContainer extends BaseContainer {
|
||||||
public ExternalStorageContainer(TileExternalStorage externalStorage, PlayerEntity player, int windowId) {
|
public ExternalStorageContainer(ExternalStorageTile externalStorage, PlayerEntity player, int windowId) {
|
||||||
super(RSContainers.EXTERNAL_STORAGE, externalStorage, player, windowId);
|
super(RSContainers.EXTERNAL_STORAGE, externalStorage, player, windowId);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
|
|||||||
@@ -55,22 +55,11 @@ public class ProxyClient extends ProxyCommon implements IModelRegistration {
|
|||||||
public void preInit(FMLPreInitializationEvent e) {
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
super.preInit(e);
|
super.preInit(e);
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(new BlockHighlightListener());
|
|
||||||
MinecraftForge.EVENT_BUS.register(new KeyInputListener());
|
MinecraftForge.EVENT_BUS.register(new KeyInputListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addModelLoader(Supplier<ICustomModelLoader> modelLoader) {
|
|
||||||
ModelLoaderRegistry.registerLoader(modelLoader.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTesr(Class<? extends TileEntity> tile, TileEntitySpecialRenderer tesr) {
|
public void setTesr(Class<? extends TileEntity> tile, TileEntitySpecialRenderer tesr) {
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(tile, tesr);
|
ClientRegistry.bindTileEntitySpecialRenderer(tile, tesr);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addItemColor(Item item, IItemColor itemColor) {
|
|
||||||
itemColors.add(Pair.of(item, itemColor)); // ItemColors is only available in init.
|
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ public class ProxyCommon {
|
|||||||
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerRedstone.ID, tag -> new ReaderWriterHandlerRedstone());
|
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerRedstone.ID, tag -> new ReaderWriterHandlerRedstone());
|
||||||
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerForgeEnergy.ID, ReaderWriterHandlerForgeEnergy::new);
|
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerForgeEnergy.ID, ReaderWriterHandlerForgeEnergy::new);
|
||||||
|
|
||||||
API.instance().addExternalStorageProvider(StorageType.ITEM, new ExternalStorageProviderItem());
|
|
||||||
API.instance().addExternalStorageProvider(StorageType.FLUID, new ExternalStorageProviderFluid());
|
|
||||||
|
|
||||||
IntegrationInventorySorter.register();
|
IntegrationInventorySorter.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.screen;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.container.ExternalStorageContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.ExternalStorageTile;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
|
public class ExternalStorageScreen extends StorageScreen<ExternalStorageContainer> {
|
||||||
|
public ExternalStorageScreen(ExternalStorageContainer container, PlayerInventory inventory, ITextComponent title) {
|
||||||
|
super(
|
||||||
|
container,
|
||||||
|
inventory,
|
||||||
|
title,
|
||||||
|
"gui/storage.png",
|
||||||
|
ExternalStorageTile.TYPE,
|
||||||
|
ExternalStorageTile.REDSTONE_MODE,
|
||||||
|
ExternalStorageTile.COMPARE,
|
||||||
|
ExternalStorageTile.WHITELIST_BLACKLIST,
|
||||||
|
ExternalStorageTile.PRIORITY,
|
||||||
|
ExternalStorageTile.ACCESS_TYPE,
|
||||||
|
ExternalStorageTile.STORED::getValue,
|
||||||
|
ExternalStorageTile.CAPACITY::getValue
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ import com.raoulvdberge.refinedstorage.api.network.security.ISecurityManager;
|
|||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCache;
|
import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCache;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IStorageExternal;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.tracker.IStorageTracker;
|
import com.raoulvdberge.refinedstorage.api.storage.tracker.IStorageTracker;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingManager;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingManager;
|
||||||
@@ -317,8 +317,8 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
|||||||
|
|
||||||
if (remainder == null) {
|
if (remainder == null) {
|
||||||
// The external storage is responsible for sending changes, we don't need to anymore
|
// The external storage is responsible for sending changes, we don't need to anymore
|
||||||
if (storage instanceof IStorageExternal && action == Action.PERFORM) {
|
if (storage instanceof IExternalStorage && action == Action.PERFORM) {
|
||||||
((IStorageExternal) storage).update(this);
|
((IExternalStorage) storage).update(this);
|
||||||
|
|
||||||
insertedExternally += size;
|
insertedExternally += size;
|
||||||
}
|
}
|
||||||
@@ -326,8 +326,8 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// The external storage is responsible for sending changes, we don't need to anymore
|
// The external storage is responsible for sending changes, we don't need to anymore
|
||||||
if (size != remainder.getCount() && storage instanceof IStorageExternal && action == Action.PERFORM) {
|
if (size != remainder.getCount() && storage instanceof IExternalStorage && action == Action.PERFORM) {
|
||||||
((IStorageExternal) storage).update(this);
|
((IExternalStorage) storage).update(this);
|
||||||
|
|
||||||
insertedExternally += size - remainder.getCount();
|
insertedExternally += size - remainder.getCount();
|
||||||
}
|
}
|
||||||
@@ -361,8 +361,8 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
|||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
// The external storage is responsible for sending changes, we don't need to anymore
|
// The external storage is responsible for sending changes, we don't need to anymore
|
||||||
if (storage instanceof IStorageExternal && action == Action.PERFORM) {
|
if (storage instanceof IExternalStorage && action == Action.PERFORM) {
|
||||||
((IStorageExternal) storage).update(this);
|
((IExternalStorage) storage).update(this);
|
||||||
|
|
||||||
extractedExternally += took.getCount();
|
extractedExternally += took.getCount();
|
||||||
}
|
}
|
||||||
@@ -415,8 +415,8 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
|||||||
|
|
||||||
if (remainder == null) {
|
if (remainder == null) {
|
||||||
// The external storage is responsible for sending changes, we don't need to anymore
|
// The external storage is responsible for sending changes, we don't need to anymore
|
||||||
if (storage instanceof IStorageExternal && action == Action.PERFORM) {
|
if (storage instanceof IExternalStorage && action == Action.PERFORM) {
|
||||||
((IStorageExternal) storage).update(this);
|
((IExternalStorage) storage).update(this);
|
||||||
|
|
||||||
insertedExternally += size;
|
insertedExternally += size;
|
||||||
}
|
}
|
||||||
@@ -424,8 +424,8 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// The external storage is responsible for sending changes, we don't need to anymore
|
// The external storage is responsible for sending changes, we don't need to anymore
|
||||||
if (size != remainder.getAmount() && storage instanceof IStorageExternal && action == Action.PERFORM) {
|
if (size != remainder.getAmount() && storage instanceof IExternalStorage && action == Action.PERFORM) {
|
||||||
((IStorageExternal) storage).update(this);
|
((IExternalStorage) storage).update(this);
|
||||||
|
|
||||||
insertedExternally += size - remainder.getAmount();
|
insertedExternally += size - remainder.getAmount();
|
||||||
}
|
}
|
||||||
@@ -459,8 +459,8 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
|||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
// The external storage is responsible for sending changes, we don't need to anymore
|
// The external storage is responsible for sending changes, we don't need to anymore
|
||||||
if (storage instanceof IStorageExternal && action == Action.PERFORM) {
|
if (storage instanceof IExternalStorage && action == Action.PERFORM) {
|
||||||
((IStorageExternal) storage).update(this);
|
((IExternalStorage) storage).update(this);
|
||||||
|
|
||||||
extractedExternally += took.getAmount();
|
extractedExternally += took.getAmount();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.raoulvdberge.refinedstorage.tile;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IStorageExternal;
|
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeExternalStorage;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.ExternalStorageNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.*;
|
import com.raoulvdberge.refinedstorage.tile.config.*;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
|
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
@@ -14,40 +14,40 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class TileExternalStorage extends NetworkNodeTile<NetworkNodeExternalStorage> {
|
public class ExternalStorageTile extends NetworkNodeTile<ExternalStorageNetworkNode> {
|
||||||
public static final TileDataParameter<Integer, TileExternalStorage> PRIORITY = IPrioritizable.createParameter();
|
public static final TileDataParameter<Integer, ExternalStorageTile> PRIORITY = IPrioritizable.createParameter();
|
||||||
public static final TileDataParameter<Integer, TileExternalStorage> COMPARE = IComparable.createParameter();
|
public static final TileDataParameter<Integer, ExternalStorageTile> COMPARE = IComparable.createParameter();
|
||||||
public static final TileDataParameter<Integer, TileExternalStorage> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
|
public static final TileDataParameter<Integer, ExternalStorageTile> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
|
||||||
public static final TileDataParameter<Integer, TileExternalStorage> TYPE = IType.createParameter();
|
public static final TileDataParameter<Integer, ExternalStorageTile> TYPE = IType.createParameter();
|
||||||
public static final TileDataParameter<AccessType, TileExternalStorage> ACCESS_TYPE = IAccessType.createParameter();
|
public static final TileDataParameter<AccessType, ExternalStorageTile> ACCESS_TYPE = IAccessType.createParameter();
|
||||||
public static final TileDataParameter<Long, TileExternalStorage> STORED = new TileDataParameter<>(RSSerializers.LONG_SERIALIZER, 0L, t -> {
|
public static final TileDataParameter<Long, ExternalStorageTile> STORED = new TileDataParameter<>(RSSerializers.LONG_SERIALIZER, 0L, t -> {
|
||||||
long stored = 0;
|
long stored = 0;
|
||||||
|
|
||||||
for (IStorageExternal<ItemStack> storage : t.getNode().getItemStorages()) {
|
for (IExternalStorage<ItemStack> storage : t.getNode().getItemStorages()) {
|
||||||
stored += storage.getStored();
|
stored += storage.getStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IStorageExternal<FluidStack> storage : t.getNode().getFluidStorages()) {
|
for (IExternalStorage<FluidStack> storage : t.getNode().getFluidStorages()) {
|
||||||
stored += storage.getStored();
|
stored += storage.getStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
return stored;
|
return stored;
|
||||||
});
|
});
|
||||||
public static final TileDataParameter<Long, TileExternalStorage> CAPACITY = new TileDataParameter<>(RSSerializers.LONG_SERIALIZER, 0L, t -> {
|
public static final TileDataParameter<Long, ExternalStorageTile> CAPACITY = new TileDataParameter<>(RSSerializers.LONG_SERIALIZER, 0L, t -> {
|
||||||
long capacity = 0;
|
long capacity = 0;
|
||||||
|
|
||||||
for (IStorageExternal<ItemStack> storage : t.getNode().getItemStorages()) {
|
for (IExternalStorage<ItemStack> storage : t.getNode().getItemStorages()) {
|
||||||
capacity += storage.getCapacity();
|
capacity += storage.getCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IStorageExternal<FluidStack> storage : t.getNode().getFluidStorages()) {
|
for (IExternalStorage<FluidStack> storage : t.getNode().getFluidStorages()) {
|
||||||
capacity += storage.getCapacity();
|
capacity += storage.getCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
return capacity;
|
return capacity;
|
||||||
});
|
});
|
||||||
|
|
||||||
public TileExternalStorage() {
|
public ExternalStorageTile() {
|
||||||
super(RSTiles.EXTERNAL_STORAGE);
|
super(RSTiles.EXTERNAL_STORAGE);
|
||||||
|
|
||||||
dataManager.addWatchedParameter(PRIORITY);
|
dataManager.addWatchedParameter(PRIORITY);
|
||||||
@@ -61,7 +61,7 @@ public class TileExternalStorage extends NetworkNodeTile<NetworkNodeExternalStor
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public NetworkNodeExternalStorage createNode(World world, BlockPos pos) {
|
public ExternalStorageNetworkNode createNode(World world, BlockPos pos) {
|
||||||
return new NetworkNodeExternalStorage(world, pos);
|
return new ExternalStorageNetworkNode(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,93 +1,115 @@
|
|||||||
{
|
{
|
||||||
"forge_marker": 1,
|
"multipart": [
|
||||||
"defaults": {
|
|
||||||
"textures": {
|
|
||||||
"cable": "refinedstorage:blocks/cable",
|
|
||||||
"particle": "refinedstorage:blocks/cable",
|
|
||||||
"border": "refinedstorage:blocks/cable_part_border"
|
|
||||||
},
|
|
||||||
"model": "refinedstorage:cable_core",
|
|
||||||
"uvlock": false,
|
|
||||||
"transform": "forge:default-block"
|
|
||||||
},
|
|
||||||
"variants": {
|
|
||||||
"inventory": [
|
|
||||||
{
|
{
|
||||||
"model": "refinedstorage:external_storage_item",
|
"apply": {
|
||||||
"transform": "forge:default-block"
|
"model": "refinedstorage:block/cable_core"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"direction": {
|
|
||||||
"north": {
|
|
||||||
"submodel": "refinedstorage:external_storage"
|
|
||||||
},
|
},
|
||||||
"east": {
|
{
|
||||||
"submodel": "refinedstorage:external_storage",
|
"when": {
|
||||||
|
"north": true
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/cable_extension"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"east": true
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/cable_extension",
|
||||||
"y": 90
|
"y": 90
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"south": {
|
{
|
||||||
"submodel": "refinedstorage:external_storage",
|
"when": {
|
||||||
|
"south": true
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/cable_extension",
|
||||||
"x": 180
|
"x": 180
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"west": {
|
{
|
||||||
"submodel": "refinedstorage:external_storage",
|
"when": {
|
||||||
|
"west": true
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/cable_extension",
|
||||||
"y": 270
|
"y": 270
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"up": {
|
{
|
||||||
"submodel": "refinedstorage:external_storage",
|
"when": {
|
||||||
|
"up": true
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/cable_extension",
|
||||||
"x": 270
|
"x": 270
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"down": {
|
{
|
||||||
"submodel": "refinedstorage:external_storage",
|
"when": {
|
||||||
|
"down": true
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/cable_extension",
|
||||||
"x": 90
|
"x": 90
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"north": {
|
{
|
||||||
"true": {
|
"when": {
|
||||||
"submodel": "refinedstorage:cable_extension"
|
"direction": "north"
|
||||||
},
|
},
|
||||||
"false": {
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/external_storage"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"east": {
|
{
|
||||||
"true": {
|
"when": {
|
||||||
"submodel": "refinedstorage:cable_extension",
|
"direction": "east"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/external_storage",
|
||||||
"y": 90
|
"y": 90
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"south": {
|
{
|
||||||
"true": {
|
"when": {
|
||||||
"submodel": "refinedstorage:cable_extension",
|
"direction": "south"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/external_storage",
|
||||||
"x": 180
|
"x": 180
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"west": {
|
{
|
||||||
"true": {
|
"when": {
|
||||||
"submodel": "refinedstorage:cable_extension",
|
"direction": "west"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/external_storage",
|
||||||
"y": 270
|
"y": 270
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"up": {
|
{
|
||||||
"true": {
|
"when": {
|
||||||
"submodel": "refinedstorage:cable_extension",
|
"direction": "up"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/external_storage",
|
||||||
"x": 270
|
"x": 270
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"down": {
|
{
|
||||||
"true": {
|
"when": {
|
||||||
"submodel": "refinedstorage:cable_extension",
|
"direction": "down"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "refinedstorage:block/external_storage",
|
||||||
"x": 90
|
"x": 90
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"gui.refinedstorage.fluid_amount": "Fluid amount in mB",
|
"gui.refinedstorage.fluid_amount": "Fluid amount in mB",
|
||||||
"gui.refinedstorage.disk_drive": "Disk Drive",
|
"gui.refinedstorage.disk_drive": "Disk Drive",
|
||||||
"gui.refinedstorage.disk_drive.disks": "Disks",
|
"gui.refinedstorage.disk_drive.disks": "Disks",
|
||||||
"gui.refinedstorage:external_storage": "External Storage",
|
"gui.refinedstorage.external_storage": "External Storage",
|
||||||
"gui.refinedstorage:importer": "Importer",
|
"gui.refinedstorage:importer": "Importer",
|
||||||
"gui.refinedstorage:exporter": "Exporter",
|
"gui.refinedstorage:exporter": "Exporter",
|
||||||
"gui.refinedstorage:detector": "Detector",
|
"gui.refinedstorage:detector": "Detector",
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
"block.refinedstorage.fluid_grid": "Fluid Grid",
|
"block.refinedstorage.fluid_grid": "Fluid Grid",
|
||||||
"block.refinedstorage.disk_drive": "Disk Drive",
|
"block.refinedstorage.disk_drive": "Disk Drive",
|
||||||
"block.refinedstorage:disk_manipulator": "Disk Manipulator",
|
"block.refinedstorage:disk_manipulator": "Disk Manipulator",
|
||||||
"block.refinedstorage:external_storage": "External Storage",
|
"block.refinedstorage.external_storage": "External Storage",
|
||||||
"block.refinedstorage:importer": "Importer",
|
"block.refinedstorage:importer": "Importer",
|
||||||
"block.refinedstorage:exporter": "Exporter",
|
"block.refinedstorage:exporter": "Exporter",
|
||||||
"block.refinedstorage:detector": "Detector",
|
"block.refinedstorage:detector": "Detector",
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
|
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
|
||||||
|
"textures": {
|
||||||
|
"border": "refinedstorage:block/cable_part_border"
|
||||||
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"name": "Line1",
|
"name": "Line1",
|
||||||
|
|||||||
@@ -0,0 +1,363 @@
|
|||||||
|
{
|
||||||
|
"parent": "block/block",
|
||||||
|
"textures": {
|
||||||
|
"cable": "refinedstorage:block/cable",
|
||||||
|
"border": "refinedstorage:block/cable_part_border"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"name": "Core",
|
||||||
|
"from": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
6
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Part1",
|
||||||
|
"from": [
|
||||||
|
10,
|
||||||
|
6,
|
||||||
|
6
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
16,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"rotation": {
|
||||||
|
"angle": 0,
|
||||||
|
"axis": "y",
|
||||||
|
"origin": [
|
||||||
|
16,
|
||||||
|
8,
|
||||||
|
9
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
10,
|
||||||
|
6,
|
||||||
|
16,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
10,
|
||||||
|
6,
|
||||||
|
16,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
10,
|
||||||
|
6,
|
||||||
|
16,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Part2",
|
||||||
|
"from": [
|
||||||
|
0,
|
||||||
|
6,
|
||||||
|
6
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"rotation": {
|
||||||
|
"angle": 0,
|
||||||
|
"axis": "y",
|
||||||
|
"origin": [
|
||||||
|
6,
|
||||||
|
8,
|
||||||
|
9
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
10,
|
||||||
|
6,
|
||||||
|
16,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"texture": "#cable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Line1",
|
||||||
|
"from": [
|
||||||
|
7.0,
|
||||||
|
7.0,
|
||||||
|
2.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
9.0,
|
||||||
|
9.0,
|
||||||
|
6.0
|
||||||
|
],
|
||||||
|
"faces": {
|
||||||
|
"east": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
4.0,
|
||||||
|
2.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
4.0,
|
||||||
|
4.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
4.0,
|
||||||
|
2.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
2.0,
|
||||||
|
4.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
2.0,
|
||||||
|
4.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Line2",
|
||||||
|
"from": [
|
||||||
|
3.0,
|
||||||
|
3.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
13.0,
|
||||||
|
13.0,
|
||||||
|
2.0
|
||||||
|
],
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
10.0,
|
||||||
|
10.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
2.0,
|
||||||
|
10.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
10.0,
|
||||||
|
10.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
2.0,
|
||||||
|
10.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
10.0,
|
||||||
|
2.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"texture": "#border",
|
||||||
|
"uv": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
10.0,
|
||||||
|
2.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -7,23 +7,22 @@
|
|||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"C": {
|
"C": {
|
||||||
"item": "#construction_core"
|
"item": "refinedstorage:construction_core"
|
||||||
},
|
},
|
||||||
"E": {
|
"E": {
|
||||||
"item": "refinedstorage:quartz_enriched_iron"
|
"item": "refinedstorage:quartz_enriched_iron"
|
||||||
},
|
},
|
||||||
"D": {
|
"D": {
|
||||||
"item": "#destruction_core"
|
"item": "refinedstorage:destruction_core"
|
||||||
},
|
},
|
||||||
"H": {
|
"H": {
|
||||||
"type": "forge:ore_dict",
|
"tag": "forge:chests"
|
||||||
"ore": "chest"
|
|
||||||
},
|
},
|
||||||
"M": {
|
"M": {
|
||||||
"item": "refinedstorage:cable"
|
"item": "refinedstorage:cable"
|
||||||
},
|
},
|
||||||
"P": {
|
"P": {
|
||||||
"item": "#improved_processor"
|
"item": "refinedstorage:improved_processor"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
Reference in New Issue
Block a user