Re-add the Fluid Storage Block

This commit is contained in:
raoulvdberge
2019-10-13 21:33:47 +02:00
parent 33a6e8a56e
commit 7859ca41a2
46 changed files with 657 additions and 387 deletions

View File

@@ -8,10 +8,7 @@ import com.raoulvdberge.refinedstorage.render.BakedModelOverrideRegistry;
import com.raoulvdberge.refinedstorage.render.model.baked.DiskDriveBakedModel;
import com.raoulvdberge.refinedstorage.render.model.baked.FullbrightBakedModel;
import com.raoulvdberge.refinedstorage.render.model.baked.PatternBakedModel;
import com.raoulvdberge.refinedstorage.screen.ControllerScreen;
import com.raoulvdberge.refinedstorage.screen.DiskDriveScreen;
import com.raoulvdberge.refinedstorage.screen.FilterScreen;
import com.raoulvdberge.refinedstorage.screen.StorageBlockScreen;
import com.raoulvdberge.refinedstorage.screen.*;
import com.raoulvdberge.refinedstorage.screen.factory.GridScreenFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScreenManager;
@@ -121,6 +118,7 @@ public class ClientSetup {
ScreenManager.registerFactory(RSContainers.DISK_DRIVE, DiskDriveScreen::new);
ScreenManager.registerFactory(RSContainers.GRID, new GridScreenFactory());
ScreenManager.registerFactory(RSContainers.STORAGE_BLOCK, StorageBlockScreen::new);
ScreenManager.registerFactory(RSContainers.FLUID_STORAGE_BLOCK, FluidStorageBlockScreen::new);
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);

View File

@@ -9,6 +9,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.node.CableNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
@@ -18,14 +19,12 @@ import com.raoulvdberge.refinedstorage.block.*;
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
import com.raoulvdberge.refinedstorage.config.ClientConfig;
import com.raoulvdberge.refinedstorage.config.ServerConfig;
import com.raoulvdberge.refinedstorage.container.ControllerContainer;
import com.raoulvdberge.refinedstorage.container.DiskDriveContainer;
import com.raoulvdberge.refinedstorage.container.FilterContainer;
import com.raoulvdberge.refinedstorage.container.StorageContainer;
import com.raoulvdberge.refinedstorage.container.*;
import com.raoulvdberge.refinedstorage.container.factory.GridContainerFactory;
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerFactory;
import com.raoulvdberge.refinedstorage.item.*;
import com.raoulvdberge.refinedstorage.item.blockitem.ControllerBlockItem;
import com.raoulvdberge.refinedstorage.item.blockitem.FluidStorageBlockItem;
import com.raoulvdberge.refinedstorage.item.blockitem.StorageBlockItem;
import com.raoulvdberge.refinedstorage.item.group.MainItemGroup;
import com.raoulvdberge.refinedstorage.loottable.StorageBlockLootFunctionSerializer;
@@ -106,6 +105,12 @@ public final class RS {
API.instance().getNetworkNodeRegistry().add(StorageNetworkNode.SIXTY_FOUR_K_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new StorageNetworkNode(world, pos, ItemStorageType.SIXTY_FOUR_K)));
API.instance().getNetworkNodeRegistry().add(StorageNetworkNode.CREATIVE_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new StorageNetworkNode(world, pos, ItemStorageType.CREATIVE)));
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.SIXTY_FOUR_K)));
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.TWO_HUNDRED_FIFTY_SIX_K)));
API.instance().getNetworkNodeRegistry().add(FluidStorageNetworkNode.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK_ID, (tag, world, pos) -> readAndReturn(tag, new FluidStorageNetworkNode(world, pos, FluidStorageType.THOUSAND_TWENTY_FOUR_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().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
LootFunctionManager.registerFunction(new StorageBlockLootFunctionSerializer());
@@ -135,11 +140,13 @@ public final class RS {
e.getRegistry().register(new GridBlock(GridType.PATTERN));
e.getRegistry().register(new GridBlock(GridType.FLUID));
e.getRegistry().register(new StorageBlock(ItemStorageType.ONE_K));
e.getRegistry().register(new StorageBlock(ItemStorageType.FOUR_K));
e.getRegistry().register(new StorageBlock(ItemStorageType.SIXTEEN_K));
e.getRegistry().register(new StorageBlock(ItemStorageType.SIXTY_FOUR_K));
e.getRegistry().register(new StorageBlock(ItemStorageType.CREATIVE));
for (ItemStorageType type : ItemStorageType.values()) {
e.getRegistry().register(new StorageBlock(type));
}
for (FluidStorageType type : FluidStorageType.values()) {
e.getRegistry().register(new FluidStorageBlock(type));
}
}
@SubscribeEvent
@@ -158,6 +165,12 @@ public final class RS {
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.SIXTEEN_K), RSBlocks.SIXTEEN_K_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "16k_storage_block")));
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.SIXTY_FOUR_K), RSBlocks.SIXTY_FOUR_K_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "64k_storage_block")));
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.CREATIVE), RSBlocks.CREATIVE_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "creative_storage_block")));
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.SIXTY_FOUR_K), RSBlocks.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "64k_fluid_storage_block")));
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.TWO_HUNDRED_FIFTY_SIX_K), RSBlocks.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "256k_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.CREATIVE), RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "creative_fluid_storage_block")));
}
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
@@ -175,6 +188,7 @@ public final class RS {
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<DiskDriveContainer, DiskDriveTile>((windowId, inv, tile) -> new DiskDriveContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "disk_drive"));
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<FluidStorageContainer, FluidStorageTile>((windowId, inv, tile) -> new FluidStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_storage_block"));
}
@SubscribeEvent
@@ -236,6 +250,12 @@ public final class RS {
e.getRegistry().register(new StorageBlockItem(RSBlocks.SIXTEEN_K_STORAGE_BLOCK));
e.getRegistry().register(new StorageBlockItem(RSBlocks.SIXTY_FOUR_K_STORAGE_BLOCK));
e.getRegistry().register(new StorageBlockItem(RSBlocks.CREATIVE_STORAGE_BLOCK));
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK));
e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.TWO_HUNDRED_FIFTY_SIX_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.CREATIVE_FLUID_STORAGE_BLOCK));
}
/* TODO

View File

@@ -18,7 +18,6 @@ public final class RSBlocks {
public static final BlockNetworkTransmitter NETWORK_TRANSMITTER = new BlockNetworkTransmitter();
public static final BlockNetworkReceiver NETWORK_RECEIVER = new BlockNetworkReceiver();
public static final BlockFluidInterface FLUID_INTERFACE = new BlockFluidInterface();
public static final BlockFluidStorage FLUID_STORAGE = new BlockFluidStorage();
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
public static final BlockReader READER = new BlockReader();
public static final BlockWriter WRITER = new BlockWriter();
@@ -61,6 +60,17 @@ public final class RSBlocks {
@ObjectHolder(RS.ID + ":creative_storage_block")
public static final StorageBlock CREATIVE_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":64k_fluid_storage_block")
public static final FluidStorageBlock SIXTY_FOUR_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":256k_fluid_storage_block")
public static final FluidStorageBlock TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":1024k_fluid_storage_block")
public static final FluidStorageBlock THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":4096k_fluid_storage_block")
public static final FluidStorageBlock FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":creative_fluid_storage_block")
public static final FluidStorageBlock CREATIVE_FLUID_STORAGE_BLOCK = null;
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
public static final BlockCrafterManager CRAFTER_MANAGER = new BlockCrafterManager();

View File

@@ -11,7 +11,6 @@ public final class RSContainers {
@ObjectHolder(RS.ID + ":controller")
public static final ContainerType<ControllerContainer> CONTROLLER = null;
@ObjectHolder(RS.ID + ":grid")
public static final ContainerType<GridContainer> GRID = null;
@@ -38,8 +37,6 @@ public final class RSContainers {
//@ObjectHolder(RS.ID + ":fluid_interface")
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
//@ObjectHolder(RS.ID + ":fluid_storage")
public static final ContainerType<FluidInterfaceContainer> FLUID_STORAGE = null;
//@ObjectHolder(RS.ID + ":importer")
public static final ContainerType<ImporterContainer> IMPORTER = null;
//@ObjectHolder(RS.ID + ":interface")
@@ -58,6 +55,8 @@ public final class RSContainers {
@ObjectHolder(RS.ID + ":storage_block")
public static final ContainerType<StorageContainer> STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":fluid_storage_block")
public static final ContainerType<FluidStorageContainer> FLUID_STORAGE_BLOCK = null;
//@ObjectHolder(RS.ID + ":storage_monitor")
public static final ContainerType<StorageMonitorContainer> STORAGE_MONITOR = null;

View File

@@ -16,8 +16,6 @@ public class RSOldConfig {
public int interfaceUsage;
public int fluidInterfaceUsage;
public int relayUsage;
public int storageUsage;
public int fluidStorageUsage;
public int wirelessTransmitterUsage;
public int networkTransmitterUsage;
public int networkReceiverUsage;
@@ -105,8 +103,6 @@ public class RSOldConfig {
interfaceUsage = config.getInt("interface", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Interfaces");
fluidInterfaceUsage = config.getInt("fluidInterface", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Fluid Interfaces");
relayUsage = config.getInt("relay", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Relays");
storageUsage = config.getInt("storage", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Storage Blocks");
fluidStorageUsage = config.getInt("fluidStorage", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Fluid Storage Blocks");
wirelessTransmitterUsage = config.getInt("wirelessTransmitter", ENERGY, 8, 0, Integer.MAX_VALUE, "The energy used by Wireless Transmitters");
networkTransmitterUsage = config.getInt("networkTransmitter", ENERGY, 64, 0, Integer.MAX_VALUE, "The energy used by Network Transmitters");
networkReceiverUsage = config.getInt("networkReceiver", ENERGY, 0, 0, Integer.MAX_VALUE, "The energy used by Network Receivers");

View File

@@ -39,8 +39,6 @@ public class RSTiles {
public static final TileEntityType<TileExternalStorage> EXTERNAL_STORAGE = null;
//@ObjectHolder(RS.ID + ":fluid_interface")
public static final TileEntityType<TileFluidInterface> FLUID_INTERFACE = null;
//@ObjectHolder(RS.ID + ":fluid_storage")
public static final TileEntityType<TileFluidInterface> FLUID_STORAGE = null;
@ObjectHolder(RS.ID + ":grid")
public static final TileEntityType<GridTile> GRID = null;
@@ -86,6 +84,17 @@ public class RSTiles {
@ObjectHolder(RS.ID + ":creative_storage_block")
public static final TileEntityType<StorageTile> CREATIVE_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":64k_fluid_storage_block")
public static final TileEntityType<FluidStorageTile> SIXTY_FOUR_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":256k_fluid_storage_block")
public static final TileEntityType<FluidStorageTile> TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":1024k_fluid_storage_block")
public static final TileEntityType<FluidStorageTile> THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":4096k_fluid_storage_block")
public static final TileEntityType<FluidStorageTile> FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK = null;
@ObjectHolder(RS.ID + ":creative_fluid_storage_block")
public static final TileEntityType<FluidStorageTile> CREATIVE_FLUID_STORAGE_BLOCK = null;
//@ObjectHolder(RS.ID + ":portable_grid")
public static final TileEntityType<TilePortableGrid> PORTABLE_GRID = null;
}

View File

@@ -1,7 +1,6 @@
package com.raoulvdberge.refinedstorage.apiimpl.network.node.storage;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSBlocks;
import com.raoulvdberge.refinedstorage.api.network.INetwork;
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
@@ -12,19 +11,18 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.IStorageScreen;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.FluidStorageCache;
import com.raoulvdberge.refinedstorage.block.BlockFluidStorage;
import com.raoulvdberge.refinedstorage.block.enums.FluidStorageType;
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeListener;
import com.raoulvdberge.refinedstorage.tile.TileFluidStorage;
import com.raoulvdberge.refinedstorage.tile.FluidStorageTile;
import com.raoulvdberge.refinedstorage.tile.config.IAccessType;
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
import com.raoulvdberge.refinedstorage.tile.config.IPrioritizable;
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
import net.minecraft.block.BlockState;
import com.raoulvdberge.refinedstorage.util.FluidStorageBlockUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
@@ -38,8 +36,12 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.List;
import java.util.UUID;
public class NetworkNodeFluidStorage extends NetworkNode implements IStorageScreen, IStorageProvider, IComparable, IWhitelistBlacklist, IPrioritizable, IAccessType, IStorageDiskContainerContext {
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid_storage");
public class FluidStorageNetworkNode extends NetworkNode implements IStorageScreen, IStorageProvider, IComparable, IWhitelistBlacklist, IPrioritizable, IAccessType, IStorageDiskContainerContext {
public static final ResourceLocation SIXTY_FOUR_K_FLUID_STORAGE_BLOCK_ID = new ResourceLocation(RS.ID, "64k_fluid_storage_block");
public static final ResourceLocation TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK_ID = new ResourceLocation(RS.ID, "256k_fluid_storage_block");
public static final ResourceLocation THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK_ID = new ResourceLocation(RS.ID, "1024k_fluid_storage_block");
public static final ResourceLocation FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK_ID = new ResourceLocation(RS.ID, "4096k_fluid_storage_block");
public static final ResourceLocation CREATIVE_FLUID_STORAGE_BLOCK_ID = new ResourceLocation(RS.ID, "creative_fluid_storage_block");
private static final String NBT_PRIORITY = "Priority";
private static final String NBT_COMPARE = "Compare";
@@ -59,13 +61,28 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageScre
private UUID storageId = UUID.randomUUID();
private IStorageDisk<FluidStack> storage;
public NetworkNodeFluidStorage(World world, BlockPos pos) {
public FluidStorageNetworkNode(World world, BlockPos pos, FluidStorageType type) {
super(world, pos);
this.type = type;
}
@Override
public int getEnergyUsage() {
return RS.INSTANCE.config.fluidStorageUsage;
switch (type) {
case SIXTY_FOUR_K:
return RS.SERVER_CONFIG.getFluidStorageBlock().getSixtyFourKUsage();
case TWO_HUNDRED_FIFTY_SIX_K:
return RS.SERVER_CONFIG.getFluidStorageBlock().getTwoHundredFiftySixKUsage();
case THOUSAND_TWENTY_FOUR_K:
return RS.SERVER_CONFIG.getFluidStorageBlock().getThousandTwentyFourKUsage();
case FOUR_THOUSAND_NINETY_SIX_K:
return RS.SERVER_CONFIG.getFluidStorageBlock().getFourThousandNinetySixKUsage();
case CREATIVE:
return RS.SERVER_CONFIG.getFluidStorageBlock().getCreativeUsage();
default:
return 0;
}
}
@Override
@@ -91,7 +108,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageScre
@Override
public ResourceLocation getId() {
return ID;
return FluidStorageBlockUtils.getNetworkNodeId(type);
}
@Override
@@ -118,7 +135,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageScre
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).get(storageId);
if (disk == null) {
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk = API.instance().createDefaultFluidDisk((ServerWorld) world, getType().getCapacity()));
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk = API.instance().createDefaultFluidDisk((ServerWorld) world, type.getCapacity()));
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
}
@@ -176,18 +193,6 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageScre
accessType = AccessTypeUtils.readAccessType(tag);
}
public FluidStorageType getType() {
if (type == null && world != null) {
BlockState state = world.getBlockState(pos);
if (state.getBlock() == RSBlocks.FLUID_STORAGE) {
type = state.get(BlockFluidStorage.TYPE);
}
}
return type == null ? FluidStorageType.TYPE_64K : type;
}
@Override
public int getCompare() {
return compare;
@@ -218,7 +223,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageScre
@Override
public ITextComponent getTitle() {
return new TranslationTextComponent("block.refinedstorage:fluid_storage." + getType().getId() + ".name");
return new TranslationTextComponent("block.refinedstorage." + type.getName() + "_fluid_storage_block");
}
@Override
@@ -228,37 +233,37 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageScre
@Override
public TileDataParameter<Integer, ?> getRedstoneModeParameter() {
return TileFluidStorage.REDSTONE_MODE;
return FluidStorageTile.REDSTONE_MODE;
}
@Override
public TileDataParameter<Integer, ?> getCompareParameter() {
return TileFluidStorage.COMPARE;
return FluidStorageTile.COMPARE;
}
@Override
public TileDataParameter<Integer, ?> getWhitelistBlacklistParameter() {
return TileFluidStorage.WHITELIST_BLACKLIST;
return FluidStorageTile.WHITELIST_BLACKLIST;
}
@Override
public TileDataParameter<Integer, ?> getPriorityParameter() {
return TileFluidStorage.PRIORITY;
return FluidStorageTile.PRIORITY;
}
@Override
public TileDataParameter<AccessType, ?> getAccessTypeParameter() {
return TileFluidStorage.ACCESS_TYPE;
return FluidStorageTile.ACCESS_TYPE;
}
@Override
public long getStored() {
return TileFluidStorage.STORED.getValue();
return FluidStorageTile.STORED.getValue();
}
@Override
public long getCapacity() {
return getType().getCapacity();
return type.getCapacity();
}
@Override

View File

@@ -16,10 +16,10 @@ import javax.annotation.Nullable;
import java.util.Collection;
public class StorageDiskFluidStorageWrapper implements IStorageDisk<FluidStack> {
private NetworkNodeFluidStorage storage;
private FluidStorageNetworkNode storage;
private IStorageDisk<FluidStack> parent;
public StorageDiskFluidStorageWrapper(NetworkNodeFluidStorage storage, IStorageDisk<FluidStack> parent) {
public StorageDiskFluidStorageWrapper(FluidStorageNetworkNode storage, IStorageDisk<FluidStack> parent) {
this.storage = storage;
this.parent = parent;
this.setSettings(null, storage);

View File

@@ -1,87 +0,0 @@
package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.block.enums.FluidStorageType;
import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder;
import com.raoulvdberge.refinedstorage.tile.TileFluidStorage;
import net.minecraft.state.EnumProperty;
public class BlockFluidStorage extends BlockNode {
public static final EnumProperty<FluidStorageType> TYPE = EnumProperty.create("type", FluidStorageType.class);
public BlockFluidStorage() {
super(BlockInfoBuilder.forId("fluid_storage").hardness(5.8F).tileEntity(TileFluidStorage::new).create());
}
/*
@Override
@OnlyIn(Dist.CLIENT)
public void registerModels(IModelRegistration modelRegistration) {
modelRegistration.setModel(this, FluidStorageType.TYPE_64K.getId(), new ModelResourceLocation(info.getId(), "type=64k"));
modelRegistration.setModel(this, FluidStorageType.TYPE_256K.getId(), new ModelResourceLocation(info.getId(), "type=256k"));
modelRegistration.setModel(this, FluidStorageType.TYPE_1024K.getId(), new ModelResourceLocation(info.getId(), "type=1024k"));
modelRegistration.setModel(this, FluidStorageType.TYPE_4096K.getId(), new ModelResourceLocation(info.getId(), "type=4096k"));
modelRegistration.setModel(this, FluidStorageType.TYPE_CREATIVE.getId(), new ModelResourceLocation(info.getId(), "type=creative"));
}
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> items) {
for (int i = 0; i <= 4; ++i) {
items.add(new ItemStack(this, 1, i));
}
}
@Override
protected BlockStateContainer createBlockState() {
return createBlockStateBuilder()
.add(TYPE)
.build();
}
@Override
public BlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(TYPE, FluidStorageType.getById(meta));
}
@Override
public int getMetaFromState(BlockState state) {
return ((FluidStorageType) state.getValue(TYPE)).getId();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
return openNetworkGui(RSGui.FLUID_STORAGE, player, world, pos, side);
}
@Override
public Item createItem() {
return new ItemBlockFluidStorage(this);
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
if (!world.isRemote) {
NetworkNodeFluidStorage storage = ((TileFluidStorage) world.getTileEntity(pos)).getNode();
if (stack.hasTagCompound() && stack.getTagCompound().hasUniqueId(NetworkNodeFluidStorage.NBT_ID)) {
storage.setStorageId(stack.getTagCompound().getUniqueId(NetworkNodeFluidStorage.NBT_ID));
}
storage.loadStorage();
}
// Call this after loading the storage, so the network discovery can use the loaded storage.
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
TileFluidStorage storage = (TileFluidStorage) world.getTileEntity(pos);
ItemStack stack = new ItemStack(this, 1, getMetaFromState(state));
stack.setTagCompound(new CompoundNBT());
stack.getTagCompound().setUniqueId(NetworkNodeFluidStorage.NBT_ID, storage.getNode().getStorageId());
drops.add(stack);
}*/
}

View File

@@ -0,0 +1,81 @@
package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.container.FluidStorageContainer;
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerProvider;
import com.raoulvdberge.refinedstorage.tile.FluidStorageTile;
import com.raoulvdberge.refinedstorage.util.BlockUtils;
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import javax.annotation.Nullable;
public class FluidStorageBlock extends NodeBlock {
private final FluidStorageType type;
public FluidStorageBlock(FluidStorageType type) {
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
this.type = type;
this.setRegistryName(RS.ID, type.getName() + "_fluid_storage_block");
}
public FluidStorageType getType() {
return type;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity player, ItemStack stack) {
if (!world.isRemote) {
FluidStorageNetworkNode storage = ((FluidStorageTile) world.getTileEntity(pos)).getNode();
if (stack.hasTag() && stack.getTag().hasUniqueId(FluidStorageNetworkNode.NBT_ID)) {
storage.setStorageId(stack.getTag().getUniqueId(FluidStorageNetworkNode.NBT_ID));
}
storage.loadStorage();
}
// Call this after loading the storage, so the network discovery can use the loaded storage.
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new FluidStorageTile(type);
}
@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<FluidStorageTile>(
((FluidStorageTile) world.getTileEntity(pos)).getNode().getTitle(),
(tile, windowId, inventory, p) -> new FluidStorageContainer(tile, player, windowId),
pos
), pos));
}
return true;
}
}

View File

@@ -1,49 +0,0 @@
package com.raoulvdberge.refinedstorage.block.enums;
import net.minecraft.util.IStringSerializable;
public enum FluidStorageType implements IStringSerializable {
TYPE_64K(0, 64_000, "64k"),
TYPE_256K(1, 256_000, "256k"),
TYPE_1024K(2, 1024_000, "1024k"),
TYPE_4096K(3, 4096_000, "4096k"),
TYPE_CREATIVE(4, -1, "creative");
private int id;
private int capacity;
private String name;
FluidStorageType(int id, int capacity, String name) {
this.id = id;
this.capacity = capacity;
this.name = name;
}
@Override
public String getName() {
return name;
}
public int getId() {
return id;
}
public int getCapacity() {
return capacity;
}
@Override
public String toString() {
return name;
}
public static FluidStorageType getById(int id) {
for (FluidStorageType type : FluidStorageType.values()) {
if (type.getId() == id) {
return type;
}
}
return TYPE_CREATIVE;
}
}

View File

@@ -11,6 +11,7 @@ public class ServerConfig {
private Grid grid;
private DiskDrive diskDrive;
private StorageBlock storageBlock;
private FluidStorageBlock fluidStorageBlock;
private Upgrades upgrades;
public ServerConfig() {
@@ -19,6 +20,7 @@ public class ServerConfig {
grid = new Grid();
diskDrive = new DiskDrive();
storageBlock = new StorageBlock();
fluidStorageBlock = new FluidStorageBlock();
upgrades = new Upgrades();
spec = builder.build();
@@ -48,6 +50,10 @@ public class ServerConfig {
return storageBlock;
}
public FluidStorageBlock getFluidStorageBlock() {
return fluidStorageBlock;
}
public ForgeConfigSpec getSpec() {
return spec;
}
@@ -255,4 +261,44 @@ public class ServerConfig {
return creativeUsage.get();
}
}
public class FluidStorageBlock {
private final ForgeConfigSpec.IntValue sixtyFourKUsage;
private final ForgeConfigSpec.IntValue twoHundredFiftySixKUsage;
private final ForgeConfigSpec.IntValue thousandTwentyFourKUsage;
private final ForgeConfigSpec.IntValue fourThousandNinetySixKUsage;
private final ForgeConfigSpec.IntValue creativeUsage;
public FluidStorageBlock() {
builder.push("fluidStorageBlock");
sixtyFourKUsage = builder.comment("The energy used by the 64k Fluid Storage Block").defineInRange("sixtyFourKUsage", 2, 0, Integer.MAX_VALUE);
twoHundredFiftySixKUsage = builder.comment("The energy used by the 256k Fluid Storage Block").defineInRange("twoHundredFiftySixKUsage", 4, 0, Integer.MAX_VALUE);
thousandTwentyFourKUsage = builder.comment("The energy used by the 1024k Fluid Storage Block").defineInRange("thousandTwentyFourKUsage", 6, 0, Integer.MAX_VALUE);
fourThousandNinetySixKUsage = builder.comment("The energy used by the 4096k Fluid Storage Block").defineInRange("fourThousandNinetySixKUsage", 8, 0, Integer.MAX_VALUE);
creativeUsage = builder.comment("The energy used by the Creative Fluid Storage Block").defineInRange("creativeUsage", 10, 0, Integer.MAX_VALUE);
builder.pop();
}
public int getSixtyFourKUsage() {
return sixtyFourKUsage.get();
}
public int getTwoHundredFiftySixKUsage() {
return twoHundredFiftySixKUsage.get();
}
public int getThousandTwentyFourKUsage() {
return thousandTwentyFourKUsage.get();
}
public int getFourThousandNinetySixKUsage() {
return fourThousandNinetySixKUsage.get();
}
public int getCreativeUsage() {
return creativeUsage.get();
}
}
}

View File

@@ -2,12 +2,12 @@ package com.raoulvdberge.refinedstorage.container;
import com.raoulvdberge.refinedstorage.RSContainers;
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
import com.raoulvdberge.refinedstorage.tile.TileFluidStorage;
import com.raoulvdberge.refinedstorage.tile.FluidStorageTile;
import net.minecraft.entity.player.PlayerEntity;
public class FluidStorageContainer extends BaseContainer {
public FluidStorageContainer(TileFluidStorage fluidStorage, PlayerEntity player, int windowId) {
super(RSContainers.FLUID_STORAGE, fluidStorage, player, windowId);
public FluidStorageContainer(FluidStorageTile fluidStorage, PlayerEntity player, int windowId) {
super(RSContainers.FLUID_STORAGE_BLOCK, fluidStorage, player, windowId);
for (int i = 0; i < 9; ++i) {
addSlot(new FluidFilterSlot(fluidStorage.getNode().getFilters(), i, 8 + (18 * i), 20));

View File

@@ -0,0 +1,122 @@
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSBlocks;
import com.raoulvdberge.refinedstorage.RSItems;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
import com.raoulvdberge.refinedstorage.api.storage.disk.StorageDiskSyncData;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.block.FluidStorageBlock;
import com.raoulvdberge.refinedstorage.item.FluidStoragePartItem;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.text.*;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nullable;
import java.util.List;
import java.util.UUID;
public class FluidStorageBlockItem extends BaseBlockItem {
private final FluidStorageType type;
public FluidStorageBlockItem(FluidStorageBlock block) {
super(block, new Item.Properties().group(RS.MAIN_GROUP));
this.type = block.getType();
this.setRegistryName(block.getRegistryName());
}
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
if (isValid(stack)) {
UUID id = getId(stack);
API.instance().getStorageDiskSync().sendRequest(id);
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
if (data != null) {
if (data.getCapacity() == -1) {
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).setStyle(new Style().setColor(TextFormatting.GRAY)));
} else {
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).setStyle(new Style().setColor(TextFormatting.GRAY)));
}
}
if (flag.isAdvanced()) {
tooltip.add(new StringTextComponent(id.toString()).setStyle(new Style().setColor(TextFormatting.GRAY)));
}
}
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
ItemStack storageStack = player.getHeldItem(hand);
if (!world.isRemote && player.isSneaking() && type != FluidStorageType.CREATIVE) {
UUID diskId = null;
IStorageDisk disk = null;
if (isValid(storageStack)) {
diskId = getId(storageStack);
disk = API.instance().getStorageDiskManager((ServerWorld) world).get(diskId);
}
// Newly created fluid storages won't have a tag yet, so allow invalid disks as well.
if (disk == null || disk.getStored() == 0) {
ItemStack fluidStoragePart = new ItemStack(FluidStoragePartItem.getByType(type));
if (!player.inventory.addItemStackToInventory(fluidStoragePart.copy())) {
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), fluidStoragePart);
}
ItemStack processor = new ItemStack(RSItems.BASIC_PROCESSOR);
if (!player.inventory.addItemStackToInventory(processor.copy())) {
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), processor);
}
ItemStack bucket = new ItemStack(Items.BUCKET);
if (!player.inventory.addItemStackToInventory(bucket.copy())) {
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), bucket);
}
if (disk != null) {
API.instance().getStorageDiskManager((ServerWorld) world).remove(diskId);
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
}
return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSBlocks.MACHINE_CASING));
}
}
return new ActionResult<>(ActionResultType.PASS, storageStack);
}
@Override
public int getEntityLifespan(ItemStack stack, World world) {
return Integer.MAX_VALUE;
}
private UUID getId(ItemStack disk) {
return disk.getTag().getUniqueId(FluidStorageNetworkNode.NBT_ID);
}
private boolean isValid(ItemStack disk) {
return disk.hasTag() && disk.getTag().hasUniqueId(FluidStorageNetworkNode.NBT_ID);
}
}

View File

@@ -1,94 +0,0 @@
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.block.BlockFluidStorage;
public class ItemBlockFluidStorage extends ItemBlockBase {
public ItemBlockFluidStorage(BlockFluidStorage block) {
super(block);
}
/* TODO
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
if (isValid(stack)) {
UUID id = getId(stack);
API.instance().getStorageDiskSync().sendRequest(id);
IStorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
if (data != null) {
if (data.getCapacity() == -1) {
tooltip.add(I18n.format("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())));
} else {
tooltip.add(I18n.format("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())));
}
}
if (flag.isAdvanced()) {
tooltip.add(id.toString());
}
}
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, EnumHand hand) {
ItemStack storageStack = player.getHeldItem(hand);
if (!world.isRemote && player.isSneaking() && storageStack.getMetadata() != ItemFluidStorageDisk.TYPE_CREATIVE) {
UUID diskId = null;
IStorageDisk disk = null;
if (isValid(storageStack)) {
diskId = getId(storageStack);
disk = API.instance().getStorageDiskManager(world).get(diskId);
}
// Newly created storages won't have a tag yet, so allow invalid disks as well.
if (disk == null || disk.getStored() == 0) {
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, storageStack.getCount(), storageStack.getMetadata());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
}
ItemStack processor = new ItemStack(RSItems.PROCESSOR, storageStack.getCount(), ItemProcessor.TYPE_BASIC);
if (!player.inventory.addItemStackToInventory(processor.copy())) {
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), processor);
}
if (disk != null) {
API.instance().getStorageDiskManager(world).remove(diskId);
API.instance().getStorageDiskManager(world).markForSaving();
}
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSBlocks.MACHINE_CASING));
}
}
return new ActionResult<>(EnumActionResult.PASS, storageStack);
}
@Override
public int getEntityLifespan(ItemStack stack, World world) {
return Integer.MAX_VALUE;
}
private UUID getId(ItemStack disk) {
return disk.getTagCompound().getUniqueId(NetworkNodeFluidStorage.NBT_ID);
}
private boolean isValid(ItemStack disk) {
return disk.hasTagCompound() && disk.getTagCompound().hasUniqueId(NetworkNodeFluidStorage.NBT_ID);
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
super.onUpdate(stack, world, entity, itemSlot, isSelected);
if (!world.isRemote) {
OneSixMigrationHelper.migrateFluidStorageBlockItem(world, stack);
}
}*/
}

View File

@@ -1,6 +1,8 @@
package com.raoulvdberge.refinedstorage.loottable;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
import com.raoulvdberge.refinedstorage.tile.FluidStorageTile;
import com.raoulvdberge.refinedstorage.tile.StorageTile;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -14,9 +16,12 @@ public class StorageBlockLootFunction implements ILootFunction {
public ItemStack apply(ItemStack stack, LootContext lootContext) {
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
if (tile != null) {
if (tile instanceof StorageTile) {
stack.setTag(new CompoundNBT());
stack.getTag().putUniqueId(StorageNetworkNode.NBT_ID, ((StorageTile) tile).getRemovedNode().getStorageId());
} else if (tile instanceof FluidStorageTile) {
stack.setTag(new CompoundNBT());
stack.getTag().putUniqueId(FluidStorageNetworkNode.NBT_ID, ((FluidStorageTile) tile).getRemovedNode().getStorageId());
}
return stack;

View File

@@ -0,0 +1,25 @@
package com.raoulvdberge.refinedstorage.screen;
import com.raoulvdberge.refinedstorage.container.FluidStorageContainer;
import com.raoulvdberge.refinedstorage.tile.FluidStorageTile;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
public class FluidStorageBlockScreen extends StorageScreen<FluidStorageContainer> {
public FluidStorageBlockScreen(FluidStorageContainer container, PlayerInventory inventory, ITextComponent title) {
super(
container,
inventory,
title,
"gui/storage.png",
null,
FluidStorageTile.REDSTONE_MODE,
FluidStorageTile.COMPARE,
FluidStorageTile.WHITELIST_BLACKLIST,
FluidStorageTile.PRIORITY,
FluidStorageTile.ACCESS_TYPE,
FluidStorageTile.STORED::getValue,
() -> (long) ((FluidStorageTile) container.getTile()).getFluidStorageType().getCapacity()
);
}
}

View File

@@ -0,0 +1,49 @@
package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.tile.config.IAccessType;
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
import com.raoulvdberge.refinedstorage.tile.config.IPrioritizable;
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
import com.raoulvdberge.refinedstorage.util.FluidStorageBlockUtils;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class FluidStorageTile extends NetworkNodeTile<FluidStorageNetworkNode> {
public static final TileDataParameter<Integer, FluidStorageTile> PRIORITY = IPrioritizable.createParameter();
public static final TileDataParameter<Integer, FluidStorageTile> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer, FluidStorageTile> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
public static final TileDataParameter<AccessType, FluidStorageTile> ACCESS_TYPE = IAccessType.createParameter();
public static final TileDataParameter<Long, FluidStorageTile> STORED = new TileDataParameter<>(RSSerializers.LONG_SERIALIZER, 0L, t -> t.getNode().getStorage() != null ? (long) t.getNode().getStorage().getStored() : 0);
private final FluidStorageType type;
public FluidStorageTile(FluidStorageType type) {
super(FluidStorageBlockUtils.getTileEntityType(type));
this.type = type;
dataManager.addWatchedParameter(PRIORITY);
dataManager.addWatchedParameter(COMPARE);
dataManager.addWatchedParameter(WHITELIST_BLACKLIST);
dataManager.addWatchedParameter(STORED);
dataManager.addWatchedParameter(ACCESS_TYPE);
}
public FluidStorageType getFluidStorageType() {
return type;
}
@Override
@Nonnull
public FluidStorageNetworkNode createNode(World world, BlockPos pos) {
return new FluidStorageNetworkNode(world, pos, type);
}
}

View File

@@ -1,40 +0,0 @@
package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.RSTiles;
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.NetworkNodeFluidStorage;
import com.raoulvdberge.refinedstorage.tile.config.IAccessType;
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
import com.raoulvdberge.refinedstorage.tile.config.IPrioritizable;
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class TileFluidStorage extends NetworkNodeTile<NetworkNodeFluidStorage> {
public static final TileDataParameter<Integer, TileFluidStorage> PRIORITY = IPrioritizable.createParameter();
public static final TileDataParameter<Integer, TileFluidStorage> COMPARE = IComparable.createParameter();
public static final TileDataParameter<Integer, TileFluidStorage> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
public static final TileDataParameter<AccessType, TileFluidStorage> ACCESS_TYPE = IAccessType.createParameter();
public static final TileDataParameter<Long, TileFluidStorage> STORED = new TileDataParameter<>(RSSerializers.LONG_SERIALIZER, 0L, t -> t.getNode().getStorage() != null ? (long) t.getNode().getStorage().getStored() : 0);
public TileFluidStorage() {
super(RSTiles.FLUID_STORAGE);
dataManager.addWatchedParameter(PRIORITY);
dataManager.addWatchedParameter(COMPARE);
dataManager.addWatchedParameter(WHITELIST_BLACKLIST);
dataManager.addWatchedParameter(STORED);
dataManager.addWatchedParameter(ACCESS_TYPE);
}
@Override
@Nonnull
public NetworkNodeFluidStorage createNode(World world, BlockPos pos) {
return new NetworkNodeFluidStorage(world, pos);
}
}

View File

@@ -0,0 +1,44 @@
package com.raoulvdberge.refinedstorage.util;
import com.raoulvdberge.refinedstorage.RSTiles;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.tile.FluidStorageTile;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
public class FluidStorageBlockUtils {
public static ResourceLocation getNetworkNodeId(FluidStorageType type) {
switch (type) {
case SIXTY_FOUR_K:
return FluidStorageNetworkNode.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK_ID;
case TWO_HUNDRED_FIFTY_SIX_K:
return FluidStorageNetworkNode.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK_ID;
case THOUSAND_TWENTY_FOUR_K:
return FluidStorageNetworkNode.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK_ID;
case FOUR_THOUSAND_NINETY_SIX_K:
return FluidStorageNetworkNode.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK_ID;
case CREATIVE:
return FluidStorageNetworkNode.CREATIVE_FLUID_STORAGE_BLOCK_ID;
default:
throw new IllegalArgumentException("Unknown storage type " + type);
}
}
public static TileEntityType<FluidStorageTile> getTileEntityType(FluidStorageType type) {
switch (type) {
case SIXTY_FOUR_K:
return RSTiles.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK;
case TWO_HUNDRED_FIFTY_SIX_K:
return RSTiles.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK;
case THOUSAND_TWENTY_FOUR_K:
return RSTiles.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK;
case FOUR_THOUSAND_NINETY_SIX_K:
return RSTiles.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK;
case CREATIVE:
return RSTiles.CREATIVE_FLUID_STORAGE_BLOCK;
default:
throw new IllegalArgumentException("Unknown storage type " + type);
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "refinedstorage:block/1024k_fluid_storage_block"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "refinedstorage:block/256k_fluid_storage_block"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "refinedstorage:block/4096k_fluid_storage_block"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "refinedstorage:block/64k_fluid_storage_block"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "refinedstorage:block/creative_fluid_storage_block"
}
}
}

View File

@@ -1,36 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "cube_all",
"transform": "forge:default-block"
},
"variants": {
"type": {
"64k": {
"textures": {
"all": "refinedstorage:blocks/64k_fluid_storage_block"
}
},
"256k": {
"textures": {
"all": "refinedstorage:blocks/256k_fluid_storage_block"
}
},
"1024k": {
"textures": {
"all": "refinedstorage:blocks/1024k_fluid_storage_block"
}
},
"4096k": {
"textures": {
"all": "refinedstorage:blocks/4096k_fluid_storage_block"
}
},
"creative": {
"textures": {
"all": "refinedstorage:blocks/creative_fluid_storage_block"
}
}
}
}
}

View File

@@ -205,11 +205,11 @@
"block.refinedstorage:network_receiver": "Network Receiver",
"block.refinedstorage:network_transmitter": "Network Transmitter",
"block.refinedstorage:fluid_interface": "Fluid Interface",
"block.refinedstorage:fluid_storage.0": "64k Fluid Storage Block",
"block.refinedstorage:fluid_storage.1": "256k Fluid Storage Block",
"block.refinedstorage:fluid_storage.2": "1024k Fluid Storage Block",
"block.refinedstorage:fluid_storage.3": "4096k Fluid Storage Block",
"block.refinedstorage:fluid_storage.4": "Creative Fluid Storage Block",
"block.refinedstorage.64k_fluid_storage_block": "64k Fluid Storage Block",
"block.refinedstorage.256k_fluid_storage_block": "256k Fluid Storage Block",
"block.refinedstorage.1024k_fluid_storage_block": "1024k Fluid Storage Block",
"block.refinedstorage.4096k_fluid_storage_block": "4096k Fluid Storage Block",
"block.refinedstorage.creative_fluid_storage_block": "Creative Fluid Storage Block",
"block.refinedstorage:reader": "Reader",
"block.refinedstorage:writer": "Writer",
"block.refinedstorage:security_manager": "Security Manager",

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "refinedstorage:block/1024k_fluid_storage_block"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "refinedstorage:block/256k_fluid_storage_block"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "refinedstorage:block/4096k_fluid_storage_block"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "refinedstorage:block/64k_fluid_storage_block"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "refinedstorage:block/creative_fluid_storage_block"
}
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/1024k_fluid_storage_block"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/256k_fluid_storage_block"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/4096k_fluid_storage_block"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/64k_fluid_storage_block"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/creative_fluid_storage_block"
}

View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "refinedstorage:1024k_fluid_storage_block",
"functions": [
{
"function": "refinedstorage:storage_block"
}
]
}
]
}
]
}

View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "refinedstorage:256k_fluid_storage_block",
"functions": [
{
"function": "refinedstorage:storage_block"
}
]
}
]
}
]
}

View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "refinedstorage:4096k_fluid_storage_block",
"functions": [
{
"function": "refinedstorage:storage_block"
}
]
}
]
}
]
}

View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "refinedstorage:64k_fluid_storage_block",
"functions": [
{
"function": "refinedstorage:storage_block"
}
]
}
]
}
]
}

View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "refinedstorage:creative_fluid_storage_block",
"functions": [
{
"function": "refinedstorage:storage_block"
}
]
}
]
}
]
}

View File

@@ -13,15 +13,13 @@
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 2
"item": "refinedstorage:1024k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage",
"data": 2
"item": "refinedstorage:1024k_fluid_storage_block"
}
}

View File

@@ -13,15 +13,13 @@
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 1
"item": "refinedstorage:256k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage",
"data": 1
"item": "refinedstorage:256k_fluid_storage_block"
}
}

View File

@@ -13,15 +13,13 @@
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 3
"item": "refinedstorage:4096k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage",
"data": 3
"item": "refinedstorage:4096k_fluid_storage_block"
}
}

View File

@@ -13,15 +13,13 @@
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 0
"item": "refinedstorage:64k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage",
"data": 0
"item": "refinedstorage:64k_fluid_storage_block"
}
}