Storage Disk/Fluid Storage Disk

This commit is contained in:
raoulvdberge
2019-09-15 14:07:22 +02:00
parent 26321e797d
commit a93cf426ec
74 changed files with 623 additions and 768 deletions

View File

@@ -1,15 +1,20 @@
package com.raoulvdberge.refinedstorage;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskFactoryFluid;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskFactoryItem;
import com.raoulvdberge.refinedstorage.item.*;
import com.raoulvdberge.refinedstorage.item.group.MainItemGroup;
import com.raoulvdberge.refinedstorage.network.NetworkHandler;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod(RS.ID)
@@ -19,12 +24,22 @@ public final class RS {
public static RS INSTANCE;
public RSConfig config;
public static final NetworkHandler NETWORK_HANDLER = new NetworkHandler();
public static final ItemGroup MAIN_GROUP = new MainItemGroup();
public RS() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onCommonSetup);
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, this::onRegisterItems);
}
@SubscribeEvent
public void onCommonSetup(FMLCommonSetupEvent e) {
NETWORK_HANDLER.register();
API.instance().getStorageDiskRegistry().add(StorageDiskFactoryItem.ID, new StorageDiskFactoryItem());
API.instance().getStorageDiskRegistry().add(StorageDiskFactoryFluid.ID, new StorageDiskFactoryFluid());
}
@SubscribeEvent
public void onRegisterBlocks(RegistryEvent.Register<Block> e) {
@@ -51,11 +66,19 @@ public final class RS {
e.getRegistry().register(new ItemCuttingTool());
for (ItemStorageType type : ItemStorageType.values()) {
e.getRegistry().register(new ItemStoragePart(type));
if (type != ItemStorageType.CREATIVE) {
e.getRegistry().register(new ItemStoragePart(type));
}
e.getRegistry().register(new ItemStorageDisk(type));
}
for (FluidStorageType type : FluidStorageType.values()) {
e.getRegistry().register(new ItemFluidStoragePart(type));
if (type != FluidStorageType.CREATIVE) {
e.getRegistry().register(new ItemFluidStoragePart(type));
}
e.getRegistry().register(new ItemFluidStorageDisk(type));
}
e.getRegistry().register(new ItemStorageHousing());
@@ -67,8 +90,6 @@ public final class RS {
config = new RSConfig(null, e.getSuggestedConfigurationFile());
PROXY.preInit(e);
NetworkHooks.openGui();
}
@EventHandler

View File

@@ -4,30 +4,38 @@ import com.raoulvdberge.refinedstorage.item.*;
import net.minecraftforge.registries.ObjectHolder;
public final class RSItems {
public static final ItemStorageDisk STORAGE_DISK = new ItemStorageDisk();
public static final ItemWirelessGrid WIRELESS_GRID = new ItemWirelessGrid();
public static final ItemWirelessFluidGrid WIRELESS_FLUID_GRID = new ItemWirelessFluidGrid();
public static final ItemWirelessCraftingMonitor WIRELESS_CRAFTING_MONITOR = new ItemWirelessCraftingMonitor();
@ObjectHolder(RS.ID + ":quartz_enriched_iron")
public static final ItemQuartzEnrichedIron QUARTZ_ENRICHED_IRON = null;
@ObjectHolder(RS.ID + ":construction_core")
public static final ItemCore CONSTRUCTION_CORE = null;
@ObjectHolder(RS.ID + ":destruction_core")
public static final ItemCore DESTRUCTION_CORE = null;
@ObjectHolder(RS.ID + ":silicon")
public static final ItemSilicon SILICON = null;
@ObjectHolder(RS.ID + ":processor_binding")
public static final ItemProcessorBinding PROCESSOR_BINDING = null;
@ObjectHolder(RS.ID + ":raw_basic_processor")
public static final ItemProcessor RAW_BASIC_PROCESSOR = null;
@ObjectHolder(RS.ID + ":raw_improved_processor")
public static final ItemProcessor RAW_IMPROVED_PROCESSOR = null;
@ObjectHolder(RS.ID + ":raw_advanced_processor")
public static final ItemProcessor RAW_ADVANCED_PROCESSOR = null;
@ObjectHolder(RS.ID + ":basic_processor")
public static final ItemProcessor BASIC_PROCESSOR = null;
@ObjectHolder(RS.ID + ":improved_processor")
public static final ItemProcessor IMPROVED_PROCESSOR = null;
@ObjectHolder(RS.ID + ":advanced_processor")
public static final ItemProcessor ADVANCED_PROCESSOR = null;
@ObjectHolder(RS.ID + ":1k_storage_part")
public static final ItemStoragePart ONE_K_STORAGE_PART = null;
@ObjectHolder(RS.ID + ":4k_storage_part")
@@ -36,13 +44,28 @@ public final class RSItems {
public static final ItemStoragePart SIXTEEN_K_STORAGE_PART = null;
@ObjectHolder(RS.ID + ":64k_storage_part")
public static final ItemStoragePart SIXTY_FOUR_K_STORAGE_PART = null;
@ObjectHolder(RS.ID + ":1k_storage_disk")
public static final ItemStorageDisk ONE_K_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":4k_storage_disk")
public static final ItemStorageDisk FOUR_K_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":16k_storage_disk")
public static final ItemStorageDisk SIXTEEN_K_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":64k_storage_disk")
public static final ItemStorageDisk SIXTY_FOUR_K_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":creative_storage_disk")
public static final ItemStorageDisk CREATIVE_STORAGE_DISK = null;
public static final ItemPattern PATTERN = new ItemPattern();
public static final ItemUpgrade UPGRADE = new ItemUpgrade();
public static final ItemStorageHousing STORAGE_HOUSING = new ItemStorageHousing();
public static final ItemFilter FILTER = new ItemFilter();
@ObjectHolder(RS.ID + ":network_card")
public static final ItemNetworkCard NETWORK_CARD = null;
public static final ItemFluidStorageDisk FLUID_STORAGE_DISK = new ItemFluidStorageDisk();
@ObjectHolder(RS.ID + ":security_card")
public static final ItemSecurityCard SECURITY_CARD = null;
@ObjectHolder(RS.ID + ":64k_fluid_storage_part")
public static final ItemFluidStoragePart SIXTY_FOUR_K_FLUID_STORAGE_PART = null;
@ObjectHolder(RS.ID + ":256k_fluid_storage_part")
@@ -51,13 +74,25 @@ public final class RSItems {
public static final ItemFluidStoragePart THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_PART = null;
@ObjectHolder(RS.ID + ":4096k_fluid_storage_part")
public static final ItemFluidStoragePart FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_PART = null;
@ObjectHolder(RS.ID + ":security_card")
public static final ItemSecurityCard SECURITY_CARD = null;
@ObjectHolder(RS.ID + ":64k_fluid_storage_disk")
public static final ItemFluidStorageDisk SIXTY_FOUR_K_FLUID_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":256k_fluid_storage_disk")
public static final ItemFluidStorageDisk TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":1024k_fluid_storage_disk")
public static final ItemFluidStorageDisk THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":4096k_fluid_storage_disk")
public static final ItemFluidStorageDisk FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":creative_fluid_storage_disk")
public static final ItemFluidStorageDisk CREATIVE_FLUID_STORAGE_DISK = null;
@ObjectHolder(RS.ID + ":storage_housing")
public static final ItemStorageHousing STORAGE_HOUSING = null;
@ObjectHolder(RS.ID + ":cutting_tool")
public static final ItemCuttingTool CUTTING_TOOL = null;
public static final ItemCover COVER = new ItemCover();
public static final ItemHollowCover HOLLOW_COVER = new ItemHollowCover();
public static final ItemWrench WRENCH = new ItemWrench();
@ObjectHolder(RS.ID + ":processor_binding")
public static final ItemProcessorBinding PROCESSOR_BINDING = null;
}

View File

@@ -27,6 +27,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
@@ -129,11 +130,11 @@ public interface IRSAPI {
IStorageDiskRegistry getStorageDiskRegistry();
/**
* @param world the world
* @param anyWorld any world associated with the server
* @return the storage disk manager
*/
@Nonnull
IStorageDiskManager getStorageDiskManager(World world);
IStorageDiskManager getStorageDiskManager(ServerWorld anyWorld);
/**
* @return the storage disk sync manager
@@ -161,7 +162,7 @@ public interface IRSAPI {
* @return a storage disk
*/
@Nonnull
IStorageDisk<ItemStack> createDefaultItemDisk(World world, int capacity);
IStorageDisk<ItemStack> createDefaultItemDisk(ServerWorld world, int capacity);
/**
* @param world the world
@@ -169,7 +170,7 @@ public interface IRSAPI {
* @return a fluid storage disk
*/
@Nonnull
IStorageDisk<FluidStack> createDefaultFluidDisk(World world, int capacity);
IStorageDisk<FluidStack> createDefaultFluidDisk(ServerWorld world, int capacity);
/**
* Creates crafting request info for an item.

View File

@@ -2,6 +2,7 @@ package com.raoulvdberge.refinedstorage.api.storage.disk;
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nullable;
@@ -33,5 +34,5 @@ public interface IStorageDisk<T> extends IStorage<T> {
/**
* @return the factory id as registered in {@link IStorageDiskRegistry}
*/
String getId();
ResourceLocation getFactoryId();
}

View File

@@ -1,7 +1,7 @@
package com.raoulvdberge.refinedstorage.api.storage.disk;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
/**
* Creates a storage disk from NBT or on-demand.
@@ -16,7 +16,7 @@ public interface IStorageDiskFactory<T> {
* @param tag the tag
* @return the storage disk
*/
IStorageDisk<T> createFromNbt(World world, CompoundNBT tag);
IStorageDisk<T> createFromNbt(ServerWorld world, CompoundNBT tag);
/**
* Creates a storage disk on-demand.
@@ -25,5 +25,5 @@ public interface IStorageDiskFactory<T> {
* @param capacity the capacity
* @return the storage disk
*/
IStorageDisk<T> create(World world, int capacity);
IStorageDisk<T> create(ServerWorld world, int capacity);
}

View File

@@ -1,5 +1,7 @@
package com.raoulvdberge.refinedstorage.api.storage.disk;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nullable;
/**
@@ -12,7 +14,7 @@ public interface IStorageDiskRegistry {
* @param id the id of this factory
* @param factory the factory
*/
void add(String id, IStorageDiskFactory factory);
void add(ResourceLocation id, IStorageDiskFactory factory);
/**
* Gets a factory.
@@ -21,5 +23,5 @@ public interface IStorageDiskRegistry {
* @return the factory, or null if no factory was found
*/
@Nullable
IStorageDiskFactory get(String id);
IStorageDiskFactory get(ResourceLocation id);
}

View File

@@ -1,7 +1,6 @@
package com.raoulvdberge.refinedstorage.apiimpl;
import com.raoulvdberge.refinedstorage.api.IRSAPI;
import com.raoulvdberge.refinedstorage.api.RSAPIInject;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternRenderHandler;
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementList;
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry;
@@ -22,7 +21,10 @@ import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskManager;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskRegistry;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskSync;
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
import com.raoulvdberge.refinedstorage.api.util.*;
import com.raoulvdberge.refinedstorage.api.util.Action;
import com.raoulvdberge.refinedstorage.api.util.IComparer;
import com.raoulvdberge.refinedstorage.api.util.IQuantityFormatter;
import com.raoulvdberge.refinedstorage.api.util.IStackList;
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingRequestInfo;
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementList;
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRegistry;
@@ -34,20 +36,24 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.grid.GridManager;
import com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter.ReaderWriterChannel;
import com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter.ReaderWriterHandlerRegistry;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.*;
import com.raoulvdberge.refinedstorage.apiimpl.util.*;
import com.raoulvdberge.refinedstorage.apiimpl.util.Comparer;
import com.raoulvdberge.refinedstorage.apiimpl.util.QuantityFormatter;
import com.raoulvdberge.refinedstorage.apiimpl.util.StackListFluid;
import com.raoulvdberge.refinedstorage.apiimpl.util.StackListItem;
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import java.lang.reflect.Field;
import java.util.*;
public class API implements IRSAPI {
@@ -190,23 +196,10 @@ public class API implements IRSAPI {
@Nonnull
@Override
public IStorageDiskManager getStorageDiskManager(World world) {
if (world.isRemote) {
throw new IllegalArgumentException("Attempting to access storage disk manager on the client");
}
/* TODO: Saving!
MapStorage storage = world.getMapStorage();
StorageDiskManager instance = (StorageDiskManager) storage.getOrLoadData(StorageDiskManager.class, StorageDiskManager.NAME);
public IStorageDiskManager getStorageDiskManager(ServerWorld anyWorld) {
ServerWorld world = anyWorld.getServer().getWorld(DimensionType.OVERWORLD);
if (instance == null) {
instance = new StorageDiskManager(StorageDiskManager.NAME);
storage.setData(StorageDiskManager.NAME, instance);
} else {
instance.tryReadDisks(world);
} */
return new StorageDiskManager("ABC");
return world.getSavedData().getOrCreate(() -> new StorageDiskManager(StorageDiskManager.NAME, world), StorageDiskManager.NAME);
}
@Nonnull
@@ -229,13 +222,13 @@ public class API implements IRSAPI {
@Override
@Nonnull
public IStorageDisk<ItemStack> createDefaultItemDisk(World world, int capacity) {
public IStorageDisk<ItemStack> createDefaultItemDisk(ServerWorld world, int capacity) {
return new StorageDiskItem(world, capacity);
}
@Override
@Nonnull
public IStorageDisk<FluidStack> createDefaultFluidDisk(World world, int capacity) {
public IStorageDisk<FluidStack> createDefaultFluidDisk(ServerWorld world, int capacity) {
return new StorageDiskFluid(world, capacity);
}

View File

@@ -101,8 +101,8 @@ public class CraftingTask implements ICraftingTask {
this.quantity = quantity;
this.pattern = pattern;
this.internalStorage = new StorageDiskItem(network.world(), -1);
this.internalFluidStorage = new StorageDiskFluid(network.world(), -1);
this.internalStorage = new StorageDiskItem(null, -1);
this.internalFluidStorage = new StorageDiskFluid(null, -1);
}
public CraftingTask(INetwork network, CompoundNBT tag) throws CraftingTaskReadException {
@@ -122,8 +122,8 @@ public class CraftingTask implements ICraftingTask {
StorageDiskFactoryItem factoryItem = new StorageDiskFactoryItem();
StorageDiskFactoryFluid factoryFluid = new StorageDiskFactoryFluid();
this.internalStorage = factoryItem.createFromNbt(network.world(), tag.getCompound(NBT_INTERNAL_STORAGE));
this.internalFluidStorage = factoryFluid.createFromNbt(network.world(), tag.getCompound(NBT_INTERNAL_FLUID_STORAGE));
this.internalStorage = factoryItem.createFromNbt(null, tag.getCompound(NBT_INTERNAL_STORAGE));
this.internalFluidStorage = factoryFluid.createFromNbt(null, tag.getCompound(NBT_INTERNAL_FLUID_STORAGE));
this.toExtractInitial = readItemStackList(tag.getList(NBT_TO_EXTRACT_INITIAL, Constants.NBT.TAG_COMPOUND));
this.toExtractInitialFluids = readFluidStackList(tag.getList(NBT_TO_EXTRACT_INITIAL_FLUIDS, Constants.NBT.TAG_COMPOUND));

View File

@@ -26,6 +26,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.LogicalSide;
import net.minecraftforge.fml.common.thread.EffectiveSide;
@@ -58,7 +59,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
if (EffectiveSide.get() == LogicalSide.SERVER) { // TODO : correct?
StackUtils.createStorages(
world,
(ServerWorld) world,
getStackInSlot(slot),
slot,
itemDisks,

View File

@@ -9,6 +9,7 @@ import com.raoulvdberge.refinedstorage.render.constants.ConstantsDisk;
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
import com.raoulvdberge.refinedstorage.util.StackUtils;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
@@ -95,7 +96,7 @@ public class StorageDiskFluidDriveWrapper implements IStorageDisk<FluidStack> {
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
}

View File

@@ -9,6 +9,7 @@ import com.raoulvdberge.refinedstorage.render.constants.ConstantsDisk;
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nonnull;
@@ -95,7 +96,7 @@ public class StorageDiskItemDriveWrapper implements IStorageDisk<ItemStack> {
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
}

View File

@@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.LogicalSide;
@@ -74,7 +75,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
if (EffectiveSide.get() == LogicalSide.SERVER) { // TODO: correct?
StackUtils.createStorages(
world,
(ServerWorld) world,
getStackInSlot(slot),
slot,
itemDisks,
@@ -95,7 +96,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
if (EffectiveSide.get() == LogicalSide.SERVER) { // TODO: correct?
StackUtils.createStorages(
world,
(ServerWorld) world,
getStackInSlot(slot),
3 + slot,
itemDisks,

View File

@@ -10,6 +10,7 @@ import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
import com.raoulvdberge.refinedstorage.util.StackUtils;
import com.raoulvdberge.refinedstorage.util.WorldUtils;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
@@ -55,8 +56,8 @@ public class StorageDiskFluidManipulatorWrapper implements IStorageDisk<FluidSta
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
@Override

View File

@@ -10,6 +10,7 @@ import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
import com.raoulvdberge.refinedstorage.util.WorldUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nonnull;
@@ -100,7 +101,7 @@ public class StorageDiskItemManipulatorWrapper implements IStorageDisk<ItemStack
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
}

View File

@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.FluidStack;
import java.util.List;
@@ -111,11 +112,11 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IGuiStorage,
}
public void loadStorage() {
IStorageDisk disk = API.instance().getStorageDiskManager(world).get(storageId);
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).get(storageId);
if (disk == null) {
API.instance().getStorageDiskManager(world).set(storageId, disk = API.instance().createDefaultFluidDisk(world, getType().getCapacity()));
API.instance().getStorageDiskManager(world).markForSaving();
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk = API.instance().createDefaultFluidDisk((ServerWorld) world, getType().getCapacity()));
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
}
this.storage = new StorageDiskFluidStorageWrapper(this, disk);

View File

@@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.FluidStack;
import java.util.List;
@@ -111,11 +112,11 @@ public class NetworkNodeStorage extends NetworkNode implements IGuiStorage, ISto
}
public void loadStorage() {
IStorageDisk disk = API.instance().getStorageDiskManager(world).get(storageId);
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).get(storageId);
if (disk == null) {
API.instance().getStorageDiskManager(world).set(storageId, disk = API.instance().createDefaultItemDisk(world, getType().getCapacity()));
API.instance().getStorageDiskManager(world).markForSaving();
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk = API.instance().createDefaultItemDisk((ServerWorld) world, getType().getCapacity()));
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
}
this.storage = new StorageDiskItemStorageWrapper(this, disk);

View File

@@ -8,6 +8,7 @@ import com.raoulvdberge.refinedstorage.api.util.Action;
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
import com.raoulvdberge.refinedstorage.util.StackUtils;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
@@ -81,7 +82,7 @@ public class StorageDiskFluidStorageWrapper implements IStorageDisk<FluidStack>
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
}

View File

@@ -8,6 +8,7 @@ import com.raoulvdberge.refinedstorage.api.util.Action;
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nonnull;
@@ -81,7 +82,7 @@ public class StorageDiskItemStorageWrapper implements IStorageDisk<ItemStack> {
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
}

View File

@@ -4,7 +4,8 @@ public enum FluidStorageType {
SIXTY_FOUR_K("64k", 64_000),
TWO_HUNDRED_FIFTY_SIX_K("256k", 256_000),
THOUSAND_TWENTY_FOUR_K("1024k", 1024_000),
FOUR_THOUSAND_NINETY_SIX_K("4096k", 4096_000);
FOUR_THOUSAND_NINETY_SIX_K("4096k", 4096_000),
CREATIVE("creative", -1);
private String name;
private int capacity;

View File

@@ -4,7 +4,8 @@ public enum ItemStorageType {
ONE_K("1k", 1000),
FOUR_K("4k", 4000),
SIXTEEN_K("16k", 16_000),
SIXTY_FOUR_K("64k", 64_000);
SIXTY_FOUR_K("64k", 64_000),
CREATIVE("creative", -1);
private String name;
private int capacity;

View File

@@ -1,18 +1,20 @@
package com.raoulvdberge.refinedstorage.apiimpl.storage.disk;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskFactory;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.FluidStack;
public class StorageDiskFactoryFluid implements IStorageDiskFactory<FluidStack> {
public static final String ID = "normal_fluid";
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid");
@Override
public IStorageDisk<FluidStack> createFromNbt(World world, CompoundNBT tag) {
public IStorageDisk<FluidStack> createFromNbt(ServerWorld world, CompoundNBT tag) {
StorageDiskFluid disk = new StorageDiskFluid(world, tag.getInt(StorageDiskFluid.NBT_CAPACITY));
ListNBT list = tag.getList(StorageDiskFluid.NBT_FLUIDS, Constants.NBT.TAG_COMPOUND);
@@ -29,7 +31,7 @@ public class StorageDiskFactoryFluid implements IStorageDiskFactory<FluidStack>
}
@Override
public IStorageDisk<FluidStack> create(World world, int capacity) {
public IStorageDisk<FluidStack> create(ServerWorld world, int capacity) {
return new StorageDiskFluid(world, capacity);
}
}

View File

@@ -1,19 +1,21 @@
package com.raoulvdberge.refinedstorage.apiimpl.storage.disk;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskFactory;
import com.raoulvdberge.refinedstorage.util.StackUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.Constants;
public class StorageDiskFactoryItem implements IStorageDiskFactory<ItemStack> {
public static final String ID = "normal_item";
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "item");
@Override
public IStorageDisk<ItemStack> createFromNbt(World world, CompoundNBT tag) {
public IStorageDisk<ItemStack> createFromNbt(ServerWorld world, CompoundNBT tag) {
StorageDiskItem disk = new StorageDiskItem(world, tag.getInt(StorageDiskItem.NBT_CAPACITY));
ListNBT list = tag.getList(StorageDiskItem.NBT_ITEMS, Constants.NBT.TAG_COMPOUND);
@@ -30,7 +32,7 @@ public class StorageDiskFactoryItem implements IStorageDiskFactory<ItemStack> {
}
@Override
public IStorageDisk<ItemStack> create(World world, int capacity) {
public IStorageDisk<ItemStack> create(ServerWorld world, int capacity) {
return new StorageDiskItem(world, capacity);
}
}

View File

@@ -12,7 +12,8 @@ import com.raoulvdberge.refinedstorage.util.StackUtils;
import net.minecraft.fluid.Fluid;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
@@ -25,7 +26,7 @@ public class StorageDiskFluid implements IStorageDisk<FluidStack> {
static final String NBT_FLUIDS = "Fluids";
static final int VERSION = 1;
private World world;
private ServerWorld world;
private int capacity;
private Multimap<Fluid, FluidStack> stacks = ArrayListMultimap.create();
@@ -33,7 +34,7 @@ public class StorageDiskFluid implements IStorageDisk<FluidStack> {
private IStorageDiskListener listener;
private IStorageDiskContainerContext context;
public StorageDiskFluid(World world, int capacity) {
public StorageDiskFluid(ServerWorld world, int capacity) {
if (world == null) {
throw new IllegalArgumentException("World cannot be null");
}
@@ -182,7 +183,7 @@ public class StorageDiskFluid implements IStorageDisk<FluidStack> {
}
@Override
public String getId() {
public ResourceLocation getFactoryId() {
return StorageDiskFactoryFluid.ID;
}

View File

@@ -7,6 +7,7 @@ import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskListener;
import com.raoulvdberge.refinedstorage.api.util.Action;
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
@@ -93,7 +94,7 @@ public class StorageDiskFluidPortable implements IStorageDisk<FluidStack> {
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
}

View File

@@ -13,7 +13,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nonnull;
@@ -26,7 +27,7 @@ public class StorageDiskItem implements IStorageDisk<ItemStack> {
static final String NBT_ITEMS = "Items";
static final int VERSION = 1;
private World world;
private ServerWorld world;
private int capacity;
private Multimap<Item, ItemStack> stacks = ArrayListMultimap.create();
@@ -34,7 +35,7 @@ public class StorageDiskItem implements IStorageDisk<ItemStack> {
private IStorageDiskListener listener;
private IStorageDiskContainerContext context;
public StorageDiskItem(World world, int capacity) {
public StorageDiskItem(ServerWorld world, int capacity) {
if (world == null) {
throw new IllegalArgumentException("World cannot be null");
}
@@ -61,7 +62,7 @@ public class StorageDiskItem implements IStorageDisk<ItemStack> {
}
@Override
public String getId() {
public ResourceLocation getFactoryId() {
return StorageDiskFactoryItem.ID;
}

View File

@@ -8,6 +8,7 @@ import com.raoulvdberge.refinedstorage.api.util.Action;
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -93,7 +94,7 @@ public class StorageDiskItemPortable implements IStorageDisk<ItemStack> {
}
@Override
public String getId() {
return parent.getId();
public ResourceLocation getFactoryId() {
return parent.getFactoryId();
}
}

View File

@@ -8,14 +8,15 @@ import com.raoulvdberge.refinedstorage.apiimpl.API;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.WorldSavedData;
import net.minecraftforge.common.util.Constants;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
public class StorageDiskManager extends WorldSavedData implements IStorageDiskManager {
public static final String NAME = "refinedstorage_disks";
@@ -25,13 +26,13 @@ public class StorageDiskManager extends WorldSavedData implements IStorageDiskMa
private static final String NBT_DISK_TYPE = "Type";
private static final String NBT_DISK_DATA = "Data";
private boolean canReadDisks;
private ListNBT disksTag;
private final Map<UUID, IStorageDisk> disks = new HashMap<>();
private final ServerWorld world;
private ConcurrentHashMap<UUID, IStorageDisk> disks = new ConcurrentHashMap<>();
public StorageDiskManager(String name) {
public StorageDiskManager(String name, ServerWorld world) {
super(name);
this.world = world;
}
@Override
@@ -95,14 +96,7 @@ public class StorageDiskManager extends WorldSavedData implements IStorageDiskMa
@Override
public void read(CompoundNBT tag) {
if (tag.contains(NBT_DISKS)) {
this.disksTag = tag.getList(NBT_DISKS, Constants.NBT.TAG_COMPOUND);
this.canReadDisks = true;
}
}
public void tryReadDisks(World world) {
if (this.canReadDisks) {
this.canReadDisks = false;
ListNBT disksTag = tag.getList(NBT_DISKS, Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < disksTag.size(); ++i) {
CompoundNBT diskTag = disksTag.getCompound(i);
@@ -111,7 +105,7 @@ public class StorageDiskManager extends WorldSavedData implements IStorageDiskMa
CompoundNBT data = diskTag.getCompound(NBT_DISK_DATA);
String type = diskTag.getString(NBT_DISK_TYPE);
IStorageDiskFactory factory = API.instance().getStorageDiskRegistry().get(type);
IStorageDiskFactory factory = API.instance().getStorageDiskRegistry().get(new ResourceLocation(type));
if (factory != null) {
disks.put(id, factory.createFromNbt(world, data));
}
@@ -128,7 +122,7 @@ public class StorageDiskManager extends WorldSavedData implements IStorageDiskMa
diskTag.putUniqueId(NBT_DISK_ID, entry.getKey());
diskTag.put(NBT_DISK_DATA, entry.getValue().writeToNbt());
diskTag.putString(NBT_DISK_TYPE, entry.getValue().getId());
diskTag.putString(NBT_DISK_TYPE, entry.getValue().getFactoryId().toString());
disks.add(diskTag);
}

View File

@@ -2,22 +2,23 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage.disk;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskFactory;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskRegistry;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
public class StorageDiskRegistry implements IStorageDiskRegistry {
private Map<String, IStorageDiskFactory> factories = new HashMap<>();
private Map<ResourceLocation, IStorageDiskFactory> factories = new HashMap<>();
@Override
public void add(String id, IStorageDiskFactory factory) {
public void add(ResourceLocation id, IStorageDiskFactory factory) {
factories.put(id, factory);
}
@Override
@Nullable
public IStorageDiskFactory get(String id) {
public IStorageDiskFactory get(ResourceLocation id) {
return factories.get(id);
}
}

View File

@@ -1,7 +1,9 @@
package com.raoulvdberge.refinedstorage.apiimpl.storage.disk;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskSync;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskSyncData;
import com.raoulvdberge.refinedstorage.network.MessageStorageDiskSizeRequest;
import javax.annotation.Nullable;
import java.util.HashMap;
@@ -29,7 +31,7 @@ public class StorageDiskSync implements IStorageDiskSync {
long lastSync = syncTime.getOrDefault(id, 0L);
if (System.currentTimeMillis() - lastSync > THROTTLE_MS) {
// TODO: Networking: RS.INSTANCE.network.sendToServer(new MessageStorageDiskSizeRequest(id));
RS.NETWORK_HANDLER.sendToServer(new MessageStorageDiskSizeRequest(id));
syncTime.put(id, System.currentTimeMillis());
}

View File

@@ -77,8 +77,8 @@ public class GuiStorage extends GuiBase<ContainerBase> {
public void drawForeground(int mouseX, int mouseY) {
drawString(7, 7, t(gui.getGuiTitle()));
drawString(7, 42, gui.getCapacity() == -1 ?
t("misc.refinedstorage:storage.stored_minimal", API.instance().getQuantityFormatter().formatWithUnits(gui.getStored())) :
t("misc.refinedstorage:storage.stored_capacity_minimal", API.instance().getQuantityFormatter().formatWithUnits(gui.getStored()), API.instance().getQuantityFormatter().formatWithUnits(gui.getCapacity()))
t("misc.refinedstorage.storage.stored_minimal", API.instance().getQuantityFormatter().formatWithUnits(gui.getStored())) :
t("misc.refinedstorage.storage.stored_capacity_minimal", API.instance().getQuantityFormatter().formatWithUnits(gui.getStored()), API.instance().getQuantityFormatter().formatWithUnits(gui.getCapacity()))
);
if (texture.contains("disk_drive")) { // HACK!
@@ -95,9 +95,9 @@ public class GuiStorage extends GuiBase<ContainerBase> {
}
drawTooltip(mouseX, mouseY, (gui.getCapacity() == -1 ?
t("misc.refinedstorage:storage.stored_minimal", API.instance().getQuantityFormatter().format(gui.getStored())) :
t("misc.refinedstorage:storage.stored_capacity_minimal", API.instance().getQuantityFormatter().format(gui.getStored()), API.instance().getQuantityFormatter().format(gui.getCapacity()))
) + "\n" + TextFormatting.GRAY + t("misc.refinedstorage:storage.full", full));
t("misc.refinedstorage.storage.stored_minimal", API.instance().getQuantityFormatter().format(gui.getStored())) :
t("misc.refinedstorage.storage.stored_capacity_minimal", API.instance().getQuantityFormatter().format(gui.getStored()), API.instance().getQuantityFormatter().format(gui.getCapacity()))
) + "\n" + TextFormatting.GRAY + t("misc.refinedstorage.storage.full", full));
}
}

View File

@@ -1,84 +1,60 @@
package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSItems;
import com.raoulvdberge.refinedstorage.api.storage.StorageType;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
import com.raoulvdberge.refinedstorage.item.info.ItemInfo;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskSyncData;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
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 ItemFluidStorageDisk extends ItemBase implements IStorageDiskProvider {
private static final String NBT_ID = "Id";
public static final int TYPE_64K = 0;
public static final int TYPE_256K = 1;
public static final int TYPE_1024K = 2;
public static final int TYPE_4096K = 3;
public static final int TYPE_CREATIVE = 4;
private final FluidStorageType type;
public ItemFluidStorageDisk() {
super(new ItemInfo(RS.ID, "fluid_storage_disk"));
public ItemFluidStorageDisk(FluidStorageType type) {
super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1));
//setMaxStackSize(1);
//setHasSubtypes(true);
//setMaxDamage(0);
}
this.type = type;
/* TODO
@Override
@SideOnly(Side.CLIENT)
public void registerModels(IModelRegistration modelRegistration) {
modelRegistration.setModelVariants(
this,
new ResourceLocation(RS.ID, "64k_fluid_storage_disk"),
new ResourceLocation(RS.ID, "256k_fluid_storage_disk"),
new ResourceLocation(RS.ID, "1024k_fluid_storage_disk"),
new ResourceLocation(RS.ID, "4096k_fluid_storage_disk"),
new ResourceLocation(RS.ID, "creative_fluid_storage_disk")
);
modelRegistration.setModel(this, TYPE_64K, new ModelResourceLocation(RS.ID + ":64k_fluid_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_256K, new ModelResourceLocation(RS.ID + ":256k_fluid_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_1024K, new ModelResourceLocation(RS.ID + ":1024k_fluid_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_4096K, new ModelResourceLocation(RS.ID + ":4096k_fluid_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_CREATIVE, new ModelResourceLocation(RS.ID + ":creative_fluid_storage_disk", "inventory"));
this.setRegistryName(RS.ID, type.getName() + "_fluid_storage_disk");
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
if (!isInCreativeTab(tab)) {
return;
}
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.inventoryTick(stack, world, entity, slot, selected);
for (int i = 0; i < 5; ++i) {
items.add(new ItemStack(this, 1, i));
if (!world.isRemote && !stack.hasTag()) {
UUID id = UUID.randomUUID();
API.instance().getStorageDiskManager((ServerWorld) world).set(id, API.instance().createDefaultFluidDisk((ServerWorld) world, getCapacity(stack)));
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
setId(stack, id);
}
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.onUpdate(stack, world, entity, slot, selected);
if (!world.isRemote) {
if (!isValid(stack)) {
API.instance().getOneSixMigrationHelper().migrateDisk(world, stack);
}
if (!stack.hasTagCompound()) {
UUID id = UUID.randomUUID();
API.instance().getStorageDiskManager(world).set(id, API.instance().createDefaultFluidDisk(world, getCapacity(stack)));
API.instance().getStorageDiskManager(world).markForSaving();
setId(stack, id);
}
}
}
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
if (isValid(stack)) {
@@ -89,46 +65,46 @@ public class ItemFluidStorageDisk extends ItemBase implements IStorageDiskProvid
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())));
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).setStyle(new Style().setColor(TextFormatting.GRAY)));
} else {
tooltip.add(I18n.format("misc.refinedstorage:storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())));
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(id.toString());
tooltip.add(new StringTextComponent(id.toString()).setStyle(new Style().setColor(TextFormatting.GRAY)));
}
}
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
ItemStack diskStack = player.getHeldItem(hand);
if (!world.isRemote && player.isSneaking() && diskStack.getMetadata() != TYPE_CREATIVE) {
IStorageDisk disk = API.instance().getStorageDiskManager(world).getByStack(diskStack);
if (!world.isRemote && player.isSneaking() && type != FluidStorageType.CREATIVE) {
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).getByStack(diskStack);
if (disk != null && disk.getStored() == 0) {
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, diskStack.getCount(), diskStack.getMetadata());
ItemStack storagePart = new ItemStack(ItemFluidStoragePart.getByType(type), diskStack.getCount());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
}
API.instance().getStorageDiskManager(world).remove(getId(diskStack));
API.instance().getStorageDiskManager(world).markForSaving();
API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack));
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING));
return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING));
}
}
return new ActionResult<>(EnumActionResult.PASS, diskStack);
return new ActionResult<>(ActionResultType.PASS, diskStack);
}
@Override
public int getEntityLifespan(ItemStack stack, World world) {
return Integer.MAX_VALUE;
}*/
}
@Override
public UUID getId(ItemStack disk) {
@@ -148,8 +124,7 @@ public class ItemFluidStorageDisk extends ItemBase implements IStorageDiskProvid
@Override
public int getCapacity(ItemStack disk) {
return 123;
// TODO return FluidStorageType.getById(disk.getItemDamage()).getCapacity();
return type.getCapacity();
}
@Override

View File

@@ -1,6 +1,7 @@
package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSItems;
import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import net.minecraft.item.Item;
@@ -10,4 +11,19 @@ public class ItemFluidStoragePart extends Item {
this.setRegistryName(RS.ID, type.getName() + "_fluid_storage_part");
}
public static ItemFluidStoragePart getByType(FluidStorageType type) {
switch (type) {
case SIXTY_FOUR_K:
return RSItems.SIXTY_FOUR_K_FLUID_STORAGE_PART;
case TWO_HUNDRED_FIFTY_SIX_K:
return RSItems.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_PART;
case THOUSAND_TWENTY_FOUR_K:
return RSItems.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_PART;
case FOUR_THOUSAND_NINETY_SIX_K:
return RSItems.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_PART;
default:
throw new IllegalArgumentException("Cannot get fluid storage part of " + type);
}
}
}

View File

@@ -1,84 +1,60 @@
package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSItems;
import com.raoulvdberge.refinedstorage.api.storage.StorageType;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
import com.raoulvdberge.refinedstorage.item.info.ItemInfo;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskSyncData;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
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 ItemStorageDisk extends ItemBase implements IStorageDiskProvider {
public class ItemStorageDisk extends Item implements IStorageDiskProvider {
private static final String NBT_ID = "Id";
public static final int TYPE_1K = 0;
public static final int TYPE_4K = 1;
public static final int TYPE_16K = 2;
public static final int TYPE_64K = 3;
public static final int TYPE_CREATIVE = 4;
private final ItemStorageType type;
public ItemStorageDisk() {
super(new ItemInfo(RS.ID, "storage_disk"));
public ItemStorageDisk(ItemStorageType type) {
super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1));
//setMaxStackSize(1);
//setHasSubtypes(true);
//setMaxDamage(0);
}
this.type = type;
/* TODO
@Override
@SideOnly(Side.CLIENT)
public void registerModels(IModelRegistration modelRegistration) {
modelRegistration.setModelVariants(
this,
new ResourceLocation(RS.ID, "1k_storage_disk"),
new ResourceLocation(RS.ID, "4k_storage_disk"),
new ResourceLocation(RS.ID, "16k_storage_disk"),
new ResourceLocation(RS.ID, "64k_storage_disk"),
new ResourceLocation(RS.ID, "creative_storage_disk")
);
modelRegistration.setModel(this, TYPE_1K, new ModelResourceLocation(RS.ID + ":1k_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_4K, new ModelResourceLocation(RS.ID + ":4k_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_16K, new ModelResourceLocation(RS.ID + ":16k_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_64K, new ModelResourceLocation(RS.ID + ":64k_storage_disk", "inventory"));
modelRegistration.setModel(this, TYPE_CREATIVE, new ModelResourceLocation(RS.ID + ":creative_storage_disk", "inventory"));
this.setRegistryName(RS.ID, type.getName() + "_storage_disk");
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
if (!isInCreativeTab(tab)) {
return;
}
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.inventoryTick(stack, world, entity, slot, selected);
for (int i = 0; i < 5; ++i) {
items.add(new ItemStack(this, 1, i));
if (!world.isRemote && !stack.hasTag()) {
UUID id = UUID.randomUUID();
API.instance().getStorageDiskManager((ServerWorld) world).set(id, API.instance().createDefaultItemDisk((ServerWorld) world, getCapacity(stack)));
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
setId(stack, id);
}
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.onUpdate(stack, world, entity, slot, selected);
if (!world.isRemote) {
if (!isValid(stack)) {
API.instance().getOneSixMigrationHelper().migrateDisk(world, stack);
}
if (!stack.hasTagCompound()) {
UUID id = UUID.randomUUID();
API.instance().getStorageDiskManager(world).set(id, API.instance().createDefaultItemDisk(world, getCapacity(stack)));
API.instance().getStorageDiskManager(world).markForSaving();
setId(stack, id);
}
}
}
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
if (isValid(stack)) {
@@ -89,46 +65,46 @@ public class ItemStorageDisk extends ItemBase implements IStorageDiskProvider {
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())));
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).setStyle(new Style().setColor(TextFormatting.GRAY)));
} else {
tooltip.add(I18n.format("misc.refinedstorage:storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())));
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(id.toString());
tooltip.add(new StringTextComponent(id.toString()).setStyle(new Style().setColor(TextFormatting.GRAY)));
}
}
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
ItemStack diskStack = player.getHeldItem(hand);
if (!world.isRemote && player.isSneaking() && diskStack.getMetadata() != TYPE_CREATIVE) {
IStorageDisk disk = API.instance().getStorageDiskManager(world).getByStack(diskStack);
if (!world.isRemote && player.isSneaking() && type != ItemStorageType.CREATIVE) {
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).getByStack(diskStack);
if (disk != null && disk.getStored() == 0) {
ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, diskStack.getCount(), diskStack.getMetadata());
ItemStack storagePart = new ItemStack(ItemStoragePart.getByType(type), diskStack.getCount());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
}
API.instance().getStorageDiskManager(world).remove(getId(diskStack));
API.instance().getStorageDiskManager(world).markForSaving();
API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack));
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING));
return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING));
}
}
return new ActionResult<>(EnumActionResult.PASS, diskStack);
return new ActionResult<>(ActionResultType.PASS, diskStack);
}
@Override
public int getEntityLifespan(ItemStack stack, World world) {
return Integer.MAX_VALUE;
}*/
}
@Override
public UUID getId(ItemStack disk) {
@@ -148,8 +124,7 @@ public class ItemStorageDisk extends ItemBase implements IStorageDiskProvider {
@Override
public int getCapacity(ItemStack disk) {
return 123;
// TODO return ItemStorageType.getById(disk.getItemDamage()).getCapacity();
return type.getCapacity();
}
@Override

View File

@@ -1,6 +1,7 @@
package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSItems;
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
import net.minecraft.item.Item;
@@ -10,4 +11,19 @@ public class ItemStoragePart extends ItemBase {
this.setRegistryName(RS.ID, type.getName() + "_storage_part");
}
public static ItemStoragePart getByType(ItemStorageType type) {
switch (type) {
case ONE_K:
return RSItems.ONE_K_STORAGE_PART;
case FOUR_K:
return RSItems.FOUR_K_STORAGE_PART;
case SIXTEEN_K:
return RSItems.SIXTEEN_K_STORAGE_PART;
case SIXTY_FOUR_K:
return RSItems.SIXTY_FOUR_K_STORAGE_PART;
default:
throw new IllegalArgumentException("Cannot get storage part of " + type);
}
}
}

View File

@@ -21,9 +21,9 @@ public class ItemBlockFluidStorage extends ItemBlockBase {
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())));
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())));
tooltip.add(I18n.format("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())));
}
}

View File

@@ -21,9 +21,9 @@ public class ItemBlockStorage extends ItemBlockBase {
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())));
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())));
tooltip.add(I18n.format("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())));
}
}

View File

@@ -0,0 +1,37 @@
package com.raoulvdberge.refinedstorage.network;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.NetworkEvent;
import java.util.UUID;
import java.util.function.Supplier;
public class MessageStorageDiskSizeRequest {
private UUID id;
public MessageStorageDiskSizeRequest(UUID id) {
this.id = id;
}
public static MessageStorageDiskSizeRequest decode(PacketBuffer buf) {
return new MessageStorageDiskSizeRequest(buf.readUniqueId());
}
public static void encode(MessageStorageDiskSizeRequest message, PacketBuffer buf) {
buf.writeUniqueId(message.id);
}
public static void handle(MessageStorageDiskSizeRequest message, Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> {
IStorageDisk disk = API.instance().getStorageDiskManager(ctx.get().getSender().getServerWorld()).get(message.id);
if (disk != null) {
RS.NETWORK_HANDLER.sendTo(ctx.get().getSender(), new MessageStorageDiskSizeResponse(message.id, disk.getStored(), disk.getCapacity()));
}
});
ctx.get().setPacketHandled(true);
}
}

View File

@@ -1,41 +0,0 @@
package com.raoulvdberge.refinedstorage.network;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import java.util.UUID;
public class MessageStorageDiskSizeRequest extends MessageHandlerPlayerToServer<MessageStorageDiskSizeRequest> implements IMessage {
private UUID id;
public MessageStorageDiskSizeRequest() {
}
public MessageStorageDiskSizeRequest(UUID id) {
this.id = id;
}
@Override
protected void handle(MessageStorageDiskSizeRequest message, ServerPlayerEntity player) {
IStorageDisk disk = API.instance().getStorageDiskManager(player.getEntityWorld()).get(message.id);
if (disk != null) {
RS.INSTANCE.network.sendTo(new MessageStorageDiskSizeResponse(message.id, disk.getStored(), disk.getCapacity()), player);
}
}
@Override
public void fromBytes(ByteBuf buf) {
id = UUID.fromString(ByteBufUtils.readUTF8String(buf));
}
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, id.toString());
}
}

View File

@@ -0,0 +1,37 @@
package com.raoulvdberge.refinedstorage.network;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskSync;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskSyncData;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.NetworkEvent;
import java.util.UUID;
import java.util.function.Supplier;
public class MessageStorageDiskSizeResponse {
private UUID id;
private int stored;
private int capacity;
public MessageStorageDiskSizeResponse(UUID id, int stored, int capacity) {
this.id = id;
this.stored = stored;
this.capacity = capacity;
}
public static void encode(MessageStorageDiskSizeResponse message, PacketBuffer buf) {
buf.writeUniqueId(message.id);
buf.writeInt(message.stored);
buf.writeInt(message.capacity);
}
public static MessageStorageDiskSizeResponse decode(PacketBuffer buf) {
return new MessageStorageDiskSizeResponse(buf.readUniqueId(), buf.readInt(), buf.readInt());
}
public static void handle(MessageStorageDiskSizeResponse message, Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> ((StorageDiskSync) API.instance().getStorageDiskSync()).setData(message.id, new StorageDiskSyncData(message.stored, message.capacity)));
ctx.get().setPacketHandled(true);
}
}

View File

@@ -1,48 +0,0 @@
package com.raoulvdberge.refinedstorage.network;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskSync;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskSyncData;
import io.netty.buffer.ByteBuf;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import java.util.UUID;
public class MessageStorageDiskSizeResponse implements IMessage, IMessageHandler<MessageStorageDiskSizeResponse, IMessage> {
private UUID id;
private int stored;
private int capacity;
public MessageStorageDiskSizeResponse() {
}
public MessageStorageDiskSizeResponse(UUID id, int stored, int capacity) {
this.id = id;
this.stored = stored;
this.capacity = capacity;
}
@Override
public void fromBytes(ByteBuf buf) {
id = UUID.fromString(ByteBufUtils.readUTF8String(buf));
stored = buf.readInt();
capacity = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, id.toString());
buf.writeInt(stored);
buf.writeInt(capacity);
}
@Override
public IMessage onMessage(MessageStorageDiskSizeResponse message, MessageContext ctx) {
((StorageDiskSync) API.instance().getStorageDiskSync()).setData(message.id, new StorageDiskSyncData(message.stored, message.capacity));
return null;
}
}

View File

@@ -0,0 +1,36 @@
package com.raoulvdberge.refinedstorage.network;
import com.raoulvdberge.refinedstorage.RS;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.network.NetworkDirection;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;
public class NetworkHandler {
private final String protocolVersion = Integer.toString(1);
private final SimpleChannel handler = NetworkRegistry.ChannelBuilder
.named(new ResourceLocation(RS.ID, "main_channel"))
.clientAcceptedVersions(protocolVersion::equals)
.serverAcceptedVersions(protocolVersion::equals)
.networkProtocolVersion(() -> protocolVersion)
.simpleChannel();
public void register() {
int id = 0;
handler.registerMessage(id++, MessageStorageDiskSizeRequest.class, MessageStorageDiskSizeRequest::encode, MessageStorageDiskSizeRequest::decode, MessageStorageDiskSizeRequest::handle);
handler.registerMessage(id++, MessageStorageDiskSizeResponse.class, MessageStorageDiskSizeResponse::encode, MessageStorageDiskSizeResponse::decode, MessageStorageDiskSizeResponse::handle);
}
public void sendToServer(Object message) {
handler.sendToServer(message);
}
public void sendTo(ServerPlayerEntity player, Object message) {
if (!(player instanceof FakePlayer)) {
handler.sendTo(message, player.connection.netManager, NetworkDirection.PLAY_TO_CLIENT);
}
}
}

View File

@@ -66,111 +66,13 @@ public class ProxyCommon {
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerRedstone.ID, tag -> new ReaderWriterHandlerRedstone());
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerForgeEnergy.ID, ReaderWriterHandlerForgeEnergy::new);
API.instance().getStorageDiskRegistry().add(StorageDiskFactoryItem.ID, new StorageDiskFactoryItem());
API.instance().getStorageDiskRegistry().add(StorageDiskFactoryFluid.ID, new StorageDiskFactoryFluid());
API.instance().addExternalStorageProvider(StorageType.ITEM, new ExternalStorageProviderItem());
API.instance().addExternalStorageProvider(StorageType.FLUID, new ExternalStorageProviderFluid());
int id = 0;
RS.INSTANCE.network.registerMessage(MessageTileDataParameter.class, MessageTileDataParameter.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageTileDataParameterUpdate.class, MessageTileDataParameterUpdate.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridItemInsertHeld.class, MessageGridItemInsertHeld.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridItemPull.class, MessageGridItemPull.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridClear.class, MessageGridClear.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridTransfer.class, MessageGridTransfer.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridSettingsUpdate.class, MessageGridSettingsUpdate.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridCraftingStart.class, MessageGridCraftingStart.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridPatternCreate.class, MessageGridPatternCreate.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageCraftingMonitorCancel.class, MessageCraftingMonitorCancel.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageCraftingMonitorElements.class, MessageCraftingMonitorElements.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridItemUpdate.class, MessageGridItemUpdate.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridItemDelta.class, MessageGridItemDelta.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridFluidUpdate.class, MessageGridFluidUpdate.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridFluidDelta.class, MessageGridFluidDelta.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridFluidPull.class, MessageGridFluidPull.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridFluidInsertHeld.class, MessageGridFluidInsertHeld.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageFilterUpdate.class, MessageFilterUpdate.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridCraftingPreview.class, MessageGridCraftingPreview.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageGridCraftingPreviewResponse.class, MessageGridCraftingPreviewResponse.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridCraftingStartResponse.class, MessageGridCraftingStartResponse.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridProcessingTransfer.class, MessageGridProcessingTransfer.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageReaderWriterUpdate.class, MessageReaderWriterUpdate.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageReaderWriterChannelAdd.class, MessageReaderWriterChannelAdd.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageReaderWriterChannelRemove.class, MessageReaderWriterChannelRemove.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageSecurityManagerUpdate.class, MessageSecurityManagerUpdate.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageWirelessFluidGridSettingsUpdate.class, MessageWirelessFluidGridSettingsUpdate.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageCrafterManagerSlotSizes.class, MessageCrafterManagerSlotSizes.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageCrafterManagerRequestSlotData.class, MessageCrafterManagerRequestSlotData.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageWirelessCraftingMonitorSettings.class, MessageWirelessCraftingMonitorSettings.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageStorageDiskSizeRequest.class, MessageStorageDiskSizeRequest.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageStorageDiskSizeResponse.class, MessageStorageDiskSizeResponse.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageConfigSync.class, MessageConfigSync.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageSlotFilterFluidSetAmount.class, MessageSlotFilterFluidSetAmount.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageSlotFilterSet.class, MessageSlotFilterSet.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageSlotFilterSetFluid.class, MessageSlotFilterSetFluid.class, id++, Side.SERVER);
RS.INSTANCE.network.registerMessage(MessageSlotFilterFluidUpdate.class, MessageSlotFilterFluidUpdate.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageGridOpen.class, MessageGridOpen.class, id++, Side.CLIENT);
RS.INSTANCE.network.registerMessage(MessageNetworkItemOpen.class, MessageNetworkItemOpen.class, id++, Side.SERVER);
NetworkRegistry.INSTANCE.registerGuiHandler(RS.INSTANCE, new GuiHandler());
MinecraftForge.EVENT_BUS.register(new NetworkNodeListener());
registerBlock(RSBlocks.CONTROLLER);
registerBlock(RSBlocks.GRID);
registerBlock(RSBlocks.PORTABLE_GRID);
registerBlock(RSBlocks.CRAFTING_MONITOR);
registerBlock(RSBlocks.STORAGE_MONITOR);
registerBlock(RSBlocks.SECURITY_MANAGER);
registerBlock(RSBlocks.CRAFTER);
registerBlock(RSBlocks.DISK_DRIVE);
registerBlock(RSBlocks.STORAGE);
registerBlock(RSBlocks.FLUID_STORAGE);
registerBlock(RSBlocks.CABLE);
registerBlock(RSBlocks.IMPORTER);
registerBlock(RSBlocks.EXPORTER);
registerBlock(RSBlocks.EXTERNAL_STORAGE);
registerBlock(RSBlocks.CONSTRUCTOR);
registerBlock(RSBlocks.DESTRUCTOR);
registerBlock(RSBlocks.READER);
registerBlock(RSBlocks.WRITER);
registerBlock(RSBlocks.DETECTOR);
registerBlock(RSBlocks.RELAY);
registerBlock(RSBlocks.INTERFACE);
registerBlock(RSBlocks.FLUID_INTERFACE);
registerBlock(RSBlocks.WIRELESS_TRANSMITTER);
registerBlock(RSBlocks.MACHINE_CASING);
registerBlock(RSBlocks.QUARTZ_ENRICHED_IRON);
registerBlock(RSBlocks.NETWORK_TRANSMITTER);
registerBlock(RSBlocks.NETWORK_RECEIVER);
registerBlock(RSBlocks.DISK_MANIPULATOR);
registerBlock(RSBlocks.CRAFTER_MANAGER);
registerItem(RSItems.QUARTZ_ENRICHED_IRON);
registerItem(RSItems.PROCESSOR_BINDING);
registerItem(RSItems.CUTTING_TOOL);
registerItem(RSItems.STORAGE_DISK);
registerItem(RSItems.FLUID_STORAGE_DISK);
registerItem(RSItems.STORAGE_HOUSING);
registerItem(RSItems.PATTERN);
registerItem(RSItems.STORAGE_PART);
registerItem(RSItems.FLUID_STORAGE_PART);
registerItem(RSItems.WIRELESS_GRID);
registerItem(RSItems.WIRELESS_FLUID_GRID);
registerItem(RSItems.WIRELESS_CRAFTING_MONITOR);
registerItem(RSItems.PROCESSOR);
registerItem(RSItems.CORE);
registerItem(RSItems.SILICON);
registerItem(RSItems.UPGRADE);
registerItem(RSItems.FILTER);
registerItem(RSItems.NETWORK_CARD);
registerItem(RSItems.SECURITY_CARD);
registerItem(RSItems.COVER);
registerItem(RSItems.HOLLOW_COVER);
registerItem(RSItems.WRENCH);
IntegrationInventorySorter.register();
}
@@ -184,26 +86,6 @@ public class ProxyCommon {
}
}
public void postInit(FMLPostInitializationEvent e) {
// NO OP
}
@SubscribeEvent
public void registerBlocks(RegistryEvent.Register<Block> e) {
blocksToRegister.forEach(e.getRegistry()::register);
if (IntegrationFunkyLocomotion.isLoaded()) {
MoveFactoryRegisterer.register(blocksToRegister);
}
}
@SubscribeEvent
public void registerItems(RegistryEvent.Register<Item> e) {
itemsToRegister.forEach(e.getRegistry()::register);
OreDictionary.registerOre("itemSilicon", RSItems.SILICON);
}
@SubscribeEvent
public void registerRecipes(RegistryEvent.Register<IRecipe> e) {
e.getRegistry().register(new RecipeCover().setRegistryName(new ResourceLocation(RS.ID, "cover")));
@@ -233,65 +115,5 @@ public class ProxyCommon {
if (e.getWorld().isRemote && RS.INSTANCE.config.getOriginalClientVersion() != null) {
RS.INSTANCE.config = RS.INSTANCE.config.getOriginalClientVersion();
}
}
@SubscribeEvent
public void fixItemMappings(RegistryEvent.MissingMappings<Item> e) {
OneSixMigrationHelper.removalHook();
for (RegistryEvent.MissingMappings.Mapping<Item> missing : e.getMappings()) {
if (missing.key.getNamespace().equals(RS.ID) && missing.key.getPath().equals("solderer")) {
missing.ignore();
}
}
}
@SubscribeEvent
public void fixBlockMappings(RegistryEvent.MissingMappings<Block> e) {
OneSixMigrationHelper.removalHook();
for (RegistryEvent.MissingMappings.Mapping<Block> missing : e.getMappings()) {
if (missing.key.getNamespace().equals(RS.ID) && missing.key.getPath().equals("solderer")) {
missing.ignore();
}
}
}
private void registerBlock(BlockBase block) {
blocksToRegister.add(block);
registerItem(block.createItem());
if (block.getInfo().hasTileEntity()) {
registerTile(block.getInfo());
}
}
private void registerItem(Item item) {
itemsToRegister.add(item);
}
private void registerTile(IBlockInfo info) {
Class<? extends TileBase> clazz = info.createTileEntity().getClass();
GameRegistry.registerTileEntity(clazz, info.getId());
try {
TileBase tileInstance = clazz.newInstance();
if (tileInstance instanceof TileNode) {
API.instance().getNetworkNodeRegistry().add(((TileNode) tileInstance).getNodeId(), (tag, world, pos) -> {
NetworkNode node = ((TileNode) tileInstance).createNode(world, pos);
node.read(tag);
return node;
});
}
tileInstance.getDataManager().getParameters().forEach(TileDataManager::registerParameter);
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}*/
}

View File

@@ -33,6 +33,7 @@ import net.minecraft.inventory.CraftResultInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
@@ -95,7 +96,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
storage = null;
cache = null;
} else {
IStorageDisk disk = API.instance().getStorageDiskManager(player.getEntityWorld()).getByStack(getDisk().getStackInSlot(0));
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) player.world).getByStack(getDisk().getStackInSlot(0));
if (disk != null) {
StorageType type = ((IStorageDiskProvider) getDisk().getStackInSlot(0).getItem()).getType();

View File

@@ -48,6 +48,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.LazyOptional;
@@ -172,7 +173,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
this.storage = null;
this.cache = null;
} else {
IStorageDisk disk = API.instance().getStorageDiskManager(world).getByStack(getDisk().getStackInSlot(0));
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).getByStack(getDisk().getStackInSlot(0));
if (disk != null) {
StorageType type = ((IStorageDiskProvider) getDisk().getStackInSlot(0).getItem()).getType();

View File

@@ -11,7 +11,7 @@ import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
@@ -94,7 +94,7 @@ public final class StackUtils {
}
@SuppressWarnings("unchecked")
public static void createStorages(World world, ItemStack diskStack, int slot, IStorageDisk<ItemStack>[] itemDisks, IStorageDisk<FluidStack>[] fluidDisks, Function<IStorageDisk<ItemStack>, IStorageDisk> itemDiskWrapper, Function<IStorageDisk<FluidStack>, IStorageDisk> fluidDiskWrapper) {
public static void createStorages(ServerWorld world, ItemStack diskStack, int slot, IStorageDisk<ItemStack>[] itemDisks, IStorageDisk<FluidStack>[] fluidDisks, Function<IStorageDisk<ItemStack>, IStorageDisk> itemDiskWrapper, Function<IStorageDisk<FluidStack>, IStorageDisk> fluidDiskWrapper) {
if (diskStack.isEmpty()) {
itemDisks[slot] = null;
fluidDisks[slot] = null;

View File

@@ -88,11 +88,11 @@
"misc.refinedstorage:energy_stored": "%d / %d FE",
"misc.refinedstorage:energy_usage": "Usage: %d FE/t",
"misc.refinedstorage:energy_usage_minimal": "%d FE/t",
"misc.refinedstorage:storage.stored": "Stored: %s",
"misc.refinedstorage:storage.stored_capacity": "Stored: %s / %s",
"misc.refinedstorage:storage.stored_minimal": "%s",
"misc.refinedstorage:storage.stored_capacity_minimal": "%s / %s",
"misc.refinedstorage:storage.full": "%d%% full",
"misc.refinedstorage.storage.stored": "Stored: %s",
"misc.refinedstorage.storage.stored_capacity": "Stored: %s / %s",
"misc.refinedstorage.storage.stored_minimal": "%s",
"misc.refinedstorage.storage.stored_capacity_minimal": "%s / %s",
"misc.refinedstorage.storage.full": "%d%% full",
"misc.refinedstorage:network_item.tooltip": "Linked to %d, %d, %d.",
"misc.refinedstorage:network_item.out_of_range": "There is no Wireless Transmitter in range.",
"misc.refinedstorage:network_item.not_found": "Controller not found.",
@@ -221,18 +221,16 @@
"block.refinedstorage:portable_grid.1": "Creative Portable Grid",
"block.refinedstorage:portable_grid.tooltip": "Sneak to place in the world.",
"block.refinedstorage:crafter_manager": "Crafter Manager",
"item.refinedstorage:storage_disk.0": "1k Storage Disk",
"item.refinedstorage:storage_disk.1": "4k Storage Disk",
"item.refinedstorage:storage_disk.2": "16k Storage Disk",
"item.refinedstorage:storage_disk.3": "64k Storage Disk",
"item.refinedstorage:storage_disk.4": "Creative Storage Disk",
"item.refinedstorage:storage_disk.5": "Debug Storage Disk",
"item.refinedstorage:fluid_storage_disk.0": "64k Fluid Storage Disk",
"item.refinedstorage:fluid_storage_disk.1": "256k Fluid Storage Disk",
"item.refinedstorage:fluid_storage_disk.2": "1024k Fluid Storage Disk",
"item.refinedstorage:fluid_storage_disk.3": "4096k Fluid Storage Disk",
"item.refinedstorage:fluid_storage_disk.4": "Creative Fluid Storage Disk",
"item.refinedstorage:fluid_storage_disk.5": "Debug Fluid Storage Disk",
"item.refinedstorage.1k_storage_disk": "1k Storage Disk",
"item.refinedstorage.4k_storage_disk": "4k Storage Disk",
"item.refinedstorage.16k_storage_disk": "16k Storage Disk",
"item.refinedstorage.64k_storage_disk": "64k Storage Disk",
"item.refinedstorage.creative_storage_disk": "Creative Storage Disk",
"item.refinedstorage.64k_fluid_storage_disk": "64k Fluid Storage Disk",
"item.refinedstorage.256k_fluid_storage_disk": "256k Fluid Storage Disk",
"item.refinedstorage.1024k_fluid_storage_disk": "1024k Fluid Storage Disk",
"item.refinedstorage.4096k_fluid_storage_disk": "4096k Fluid Storage Disk",
"item.refinedstorage.creative_fluid_storage_disk": "Creative Fluid Storage Disk",
"item.refinedstorage:wireless_grid.0": "Wireless Grid",
"item.refinedstorage:wireless_grid.1": "Creative Wireless Grid",
"item.refinedstorage:wireless_fluid_grid.0": "Wireless Fluid Grid",

View File

@@ -1,28 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 2
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 2
}
}

View File

@@ -1,16 +0,0 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:fluid_storage_part",
"data": 2
}
],
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 2
}
}

View File

@@ -1,28 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 1
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 1
}
}

View File

@@ -1,16 +0,0 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:fluid_storage_part",
"data": 1
}
],
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 1
}
}

View File

@@ -1,28 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 3
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 3
}
}

View File

@@ -1,16 +0,0 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:fluid_storage_part",
"data": 3
}
],
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 3
}
}

View File

@@ -1,28 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:fluid_storage_part",
"data": 0
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 0
}
}

View File

@@ -1,16 +0,0 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:fluid_storage_part",
"data": 0
}
],
"result": {
"item": "refinedstorage:fluid_storage_disk",
"data": 0
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 509 B

View File

@@ -0,0 +1,25 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:1024k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:1024k_fluid_storage_disk"
}
}

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:1024k_fluid_storage_part"
}
],
"result": {
"item": "refinedstorage:1024k_fluid_storage_disk"
}
}

View File

@@ -7,22 +7,19 @@
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:storage_part",
"data": 2
"item": "refinedstorage:16k_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:storage_disk",
"data": 2
"item": "refinedstorage:16k_storage_disk"
}
}

View File

@@ -5,12 +5,10 @@
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:storage_part",
"data": 2
"item": "refinedstorage:16k_storage_part"
}
],
"result": {
"item": "refinedstorage:storage_disk",
"data": 2
"item": "refinedstorage:16k_storage_disk"
}
}

View File

@@ -7,22 +7,19 @@
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:storage_part",
"data": 0
"item": "refinedstorage:1k_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:storage_disk",
"data": 0
"item": "refinedstorage:1k_storage_disk"
}
}

View File

@@ -5,12 +5,10 @@
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:storage_part",
"data": 0
"item": "refinedstorage:1k_storage_part"
}
],
"result": {
"item": "refinedstorage:storage_disk",
"data": 0
"item": "refinedstorage:1k_storage_disk"
}
}

View File

@@ -0,0 +1,25 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:256k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:256k_fluid_storage_disk"
}
}

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:256k_fluid_storage_part"
}
],
"result": {
"item": "refinedstorage:256k_fluid_storage_disk"
}
}

View File

@@ -0,0 +1,25 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:4096k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:4096k_fluid_storage_disk"
}
}

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:4096k_fluid_storage_part"
}
],
"result": {
"item": "refinedstorage:4096k_fluid_storage_disk"
}
}

View File

@@ -7,22 +7,19 @@
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:storage_part",
"data": 1
"item": "refinedstorage:4k_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:storage_disk",
"data": 1
"item": "refinedstorage:4k_storage_disk"
}
}

View File

@@ -5,12 +5,10 @@
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:storage_part",
"data": 1
"item": "refinedstorage:4k_storage_part"
}
],
"result": {
"item": "refinedstorage:storage_disk",
"data": 1
"item": "refinedstorage:4k_storage_disk"
}
}

View File

@@ -0,0 +1,25 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GRG",
"RPR",
"EEE"
],
"key": {
"G": {
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:64k_fluid_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:64k_fluid_storage_disk"
}
}

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:64k_fluid_storage_part"
}
],
"result": {
"item": "refinedstorage:64k_fluid_storage_disk"
}
}

View File

@@ -7,22 +7,19 @@
],
"key": {
"G": {
"type": "forge:ore_dict",
"ore": "blockGlass"
"tag": "forge:glass"
},
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "refinedstorage:storage_part",
"data": 3
"item": "refinedstorage:64k_storage_part"
},
"E": {
"item": "refinedstorage:quartz_enriched_iron"
}
},
"result": {
"item": "refinedstorage:storage_disk",
"data": 3
"item": "refinedstorage:64k_storage_disk"
}
}

View File

@@ -5,12 +5,10 @@
"item": "refinedstorage:storage_housing"
},
{
"item": "refinedstorage:storage_part",
"data": 3
"item": "refinedstorage:64k_storage_part"
}
],
"result": {
"item": "refinedstorage:storage_disk",
"data": 3
"item": "refinedstorage:64k_storage_disk"
}
}