Rename class

This commit is contained in:
Raoul Van den Berge
2016-10-10 23:39:04 +02:00
parent ee6faa2a0f
commit 4832d1e442
20 changed files with 76 additions and 76 deletions

View File

@@ -10,8 +10,8 @@ import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.task.ICraftingTask;
import refinedstorage.api.network.grid.IFluidGridHandler;
import refinedstorage.api.network.grid.IItemGridHandler;
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
import refinedstorage.api.storage.item.IGroupedItemStorage;
import refinedstorage.api.storage.fluid.IFluidStorageCache;
import refinedstorage.api.storage.item.IItemStorageCache;
import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.API;
@@ -64,14 +64,14 @@ public interface INetworkMaster {
IWirelessGridHandler getWirelessGridHandler();
/**
* @return the {@link IGroupedItemStorage} of this network
* @return the {@link IItemStorageCache} of this network
*/
IGroupedItemStorage getItemStorage();
IItemStorageCache getItemStorageCache();
/**
* @return the {@link IGroupedFluidStorage} of this network
* @return the {@link IFluidStorageCache} of this network
*/
IGroupedFluidStorage getFluidStorage();
IFluidStorageCache getFluidStorageCache();
/**
* @return the crafting tasks in this network, do NOT modify this list

View File

@@ -14,30 +14,30 @@ import java.util.List;
* individual {@link IFluidStorage} constantly (performance impact) and to send and detect storage changes
* more efficiently.
*/
public interface IGroupedFluidStorage {
public interface IFluidStorageCache {
/**
* Rebuilds the global fluid list.
* Rebuilds the cache.
* Typically called when a {@link IFluidStorageProvider} is added or removed from the network.
*/
void rebuild();
/**
* Adds an item to the global fluid list.
* Adds an item to the cache.
* <p>
* Note that this doesn't modify any of the connected storages, but just modifies the global fluid list.
* Note that this doesn't modify any of the connected storages, but just modifies the cache.
* Use {@link INetworkMaster#insertFluid(FluidStack, int, boolean)} to add a fluid to an actual storage.
* <p>
* Will merge it with another fluid if it already exists.
*
* @param stack the stack to add, do NOT modify
* @param rebuilding whether this method is called while the storage is rebuilding
* @param rebuilding true if this method is called while rebuilding, false otherwise
*/
void add(@Nonnull FluidStack stack, boolean rebuilding);
/**
* Removes a fluid from the global fluid list.
* Removes a fluid from the cache.
* <p>
* Note that this doesn't modify any of the connected storages, but just modifies the global fluid list.
* Note that this doesn't modify any of the connected storages, but just modifies the cache.
* Use {@link INetworkMaster#extractFluid(FluidStack, int, int)} to remove an fluid from an actual storage.
*
* @param stack the fluid to remove, do NOT modify
@@ -45,7 +45,7 @@ public interface IGroupedFluidStorage {
void remove(@Nonnull FluidStack stack);
/**
* @return the list behind this grouped storage
* @return the list behind this cache
*/
IFluidStackList getList();

View File

@@ -14,30 +14,30 @@ import java.util.List;
* individual {@link IItemStorage} constantly (performance impact) and to send and detect storage changes
* more efficiently.
*/
public interface IGroupedItemStorage {
public interface IItemStorageCache {
/**
* Rebuilds the global item list.
* Rebuilds the cache.
* Typically called when a {@link IItemStorageProvider} is added or removed from the network.
*/
void rebuild();
/**
* Adds an item to the global item list.
* Adds an item to the cache.
* <p>
* Note that this doesn't modify any of the connected storages, but just modifies the global item list.
* Note that this doesn't modify any of the connected storages, but just modifies the cache.
* Use {@link INetworkMaster#insertItem(ItemStack, int, boolean)} to add an item to an actual storage.
* <p>
* Will merge it with another item if it already exists.
*
* @param stack the stack to add, do NOT modify
* @param rebuilding whether this method is called while the storage is rebuilding
* @param rebuilding true if this method is called while rebuilding, false otherwise
*/
void add(@Nonnull ItemStack stack, boolean rebuilding);
/**
* Removes a item from global item list.
* Removes an item from the cache.
* <p>
* Note that this doesn't modify any of the connected storages, but just modifies the global item list.
* Note that this doesn't modify any of the connected storages, but just modifies the cache.
* Use {@link INetworkMaster#extractItem(ItemStack, int, int)} to remove an item from an actual storage.
*
* @param stack the item to remove, do NOT modify
@@ -45,7 +45,7 @@ public interface IGroupedItemStorage {
void remove(@Nonnull ItemStack stack);
/**
* @return the list behind this grouped storage
* @return the list behind this cope
*/
IItemStackList getList();

View File

@@ -50,7 +50,7 @@ public class CraftingTask implements ICraftingTask {
}
public void calculate() {
IItemStackList list = network.getItemStorage().getList().copy();
IItemStackList list = network.getItemStorageCache().getList().copy();
int newQuantity = quantity;
@@ -99,12 +99,12 @@ public class CraftingTask implements ICraftingTask {
FluidStack fluidInItem = RSUtils.getFluidFromStack(input, true);
if (fluidInItem != null && RSUtils.hasFluidBucket(fluidInItem)) {
FluidStack fluidInStorage = network.getFluidStorage().getList().get(fluidInItem);
FluidStack fluidInStorage = network.getFluidStorageCache().getList().get(fluidInItem);
if (fluidInStorage == null || fluidInStorage.amount < fluidInItem.amount) {
missing.add(input);
} else {
boolean hasBucket = network.getItemStorage().getList().get(RSUtils.EMPTY_BUCKET) != null;
boolean hasBucket = network.getItemStorageCache().getList().get(RSUtils.EMPTY_BUCKET) != null;
ICraftingPattern bucketPattern = network.getPattern(RSUtils.EMPTY_BUCKET);
if (!hasBucket) {

View File

@@ -155,11 +155,11 @@ public class NetworkNodeGraph implements INetworkNodeGraph {
}
if (node instanceof IItemStorageProvider) {
controller.getItemStorage().rebuild();
controller.getItemStorageCache().rebuild();
}
if (node instanceof IFluidStorageProvider) {
controller.getFluidStorage().rebuild();
controller.getFluidStorageCache().rebuild();
}
controller.getDataManager().sendParameterToWatchers(TileController.NODES);

View File

@@ -22,7 +22,7 @@ public class FluidGridHandler implements IFluidGridHandler {
@Override
public void onExtract(int hash, boolean shift, EntityPlayerMP player) {
FluidStack stack = network.getFluidStorage().getList().get(hash);
FluidStack stack = network.getFluidStorageCache().getList().get(hash);
if (stack != null && RSUtils.hasFluidBucket(stack)) {
ItemStack bucket = network.extractItem(RSUtils.EMPTY_BUCKET, 1);

View File

@@ -21,7 +21,7 @@ public class ItemGridHandler implements IItemGridHandler {
@Override
public void onExtract(int hash, int flags, EntityPlayerMP player) {
ItemStack item = network.getItemStorage().getList().get(hash);
ItemStack item = network.getItemStorageCache().getList().get(hash);
if (item == null) {
return;
@@ -119,7 +119,7 @@ public class ItemGridHandler implements IItemGridHandler {
@Override
public void onCraftingPreviewRequested(EntityPlayerMP player, int hash, int quantity) {
ItemStack stack = network.getItemStorage().getList().get(hash);
ItemStack stack = network.getItemStorageCache().getList().get(hash);
if (stack != null) {
CraftingTask task = new CraftingTask(network, stack, network.getPattern(stack), quantity);

View File

@@ -3,8 +3,8 @@ package refinedstorage.apiimpl.storage.fluid;
import net.minecraftforge.fluids.FluidStack;
import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.storage.fluid.IFluidStorageCache;
import refinedstorage.api.storage.fluid.IFluidStorageProvider;
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
import refinedstorage.api.util.IFluidStackList;
import refinedstorage.apiimpl.API;
import refinedstorage.tile.config.IAccessType;
@@ -13,12 +13,12 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class GroupedFluidStorage implements IGroupedFluidStorage {
public class FluidStorageCache implements IFluidStorageCache {
private INetworkMaster network;
private List<IFluidStorage> storages = new ArrayList<>();
private IFluidStackList list = API.instance().createFluidStackList();
public GroupedFluidStorage(INetworkMaster network) {
public FluidStorageCache(INetworkMaster network) {
this.network = network;
}

View File

@@ -3,8 +3,8 @@ package refinedstorage.apiimpl.storage.item;
import net.minecraft.item.ItemStack;
import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.item.IGroupedItemStorage;
import refinedstorage.api.storage.item.IItemStorage;
import refinedstorage.api.storage.item.IItemStorageCache;
import refinedstorage.api.storage.item.IItemStorageProvider;
import refinedstorage.api.util.IItemStackList;
import refinedstorage.apiimpl.API;
@@ -14,12 +14,12 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class GroupedItemStorage implements IGroupedItemStorage {
public class ItemStorageCache implements IItemStorageCache {
private INetworkMaster network;
private List<IItemStorage> storages = new ArrayList<>();
private IItemStackList list = API.instance().createItemStackList();
public GroupedItemStorage(INetworkMaster network) {
public ItemStorageCache(INetworkMaster network) {
this.network = network;
}

View File

@@ -35,9 +35,9 @@ public class MessageGridFluidUpdate implements IMessage, IMessageHandler<Message
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(network.getFluidStorage().getList().getStacks().size());
buf.writeInt(network.getFluidStorageCache().getList().getStacks().size());
for (FluidStack stack : network.getFluidStorage().getList().getStacks()) {
for (FluidStack stack : network.getFluidStorageCache().getList().getStacks()) {
RSUtils.writeFluidStack(buf, stack);
}
}

View File

@@ -35,9 +35,9 @@ public class MessageGridItemUpdate implements IMessage, IMessageHandler<MessageG
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(network.getItemStorage().getList().getStacks().size());
buf.writeInt(network.getItemStorageCache().getList().getStacks().size());
for (ItemStack stack : network.getItemStorage().getList().getStacks()) {
for (ItemStack stack : network.getItemStorageCache().getList().getStacks()) {
RSUtils.writeItemStack(buf, network, stack);
}
}

View File

@@ -35,17 +35,17 @@ import refinedstorage.api.network.IWirelessGridHandler;
import refinedstorage.api.network.grid.IFluidGridHandler;
import refinedstorage.api.network.grid.IItemGridHandler;
import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
import refinedstorage.api.storage.item.IGroupedItemStorage;
import refinedstorage.api.storage.fluid.IFluidStorageCache;
import refinedstorage.api.storage.item.IItemStorage;
import refinedstorage.api.storage.item.IItemStorageCache;
import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.API;
import refinedstorage.apiimpl.network.NetworkNodeGraph;
import refinedstorage.apiimpl.network.WirelessGridHandler;
import refinedstorage.apiimpl.network.grid.FluidGridHandler;
import refinedstorage.apiimpl.network.grid.ItemGridHandler;
import refinedstorage.apiimpl.storage.fluid.GroupedFluidStorage;
import refinedstorage.apiimpl.storage.item.GroupedItemStorage;
import refinedstorage.apiimpl.storage.fluid.FluidStorageCache;
import refinedstorage.apiimpl.storage.item.ItemStorageCache;
import refinedstorage.block.BlockController;
import refinedstorage.block.EnumControllerType;
import refinedstorage.block.EnumGridType;
@@ -178,8 +178,8 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
private INetworkNodeGraph nodeGraph = new NetworkNodeGraph(this);
private IGroupedItemStorage itemStorage = new GroupedItemStorage(this);
private IGroupedFluidStorage fluidStorage = new GroupedFluidStorage(this);
private IItemStorageCache itemStorage = new ItemStorageCache(this);
private IFluidStorageCache fluidStorage = new FluidStorageCache(this);
private List<ICraftingPattern> patterns = new ArrayList<>();
@@ -370,12 +370,12 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
nodeGraph.disconnectAll();
}
public IGroupedItemStorage getItemStorage() {
public IItemStorageCache getItemStorageCache() {
return itemStorage;
}
@Override
public IGroupedFluidStorage getFluidStorage() {
public IFluidStorageCache getFluidStorageCache() {
return fluidStorage;
}

View File

@@ -130,22 +130,22 @@ public class TileDetector extends TileNode implements IComparable, IType {
powered = found;
} else {
ItemStack stack = network.getItemStorage().getList().get(slot, compare);
ItemStack stack = network.getItemStorageCache().getList().get(slot, compare);
powered = isPowered(stack == null ? null : stack.stackSize);
}
} else {
powered = mode == MODE_AUTOCRAFTING ? !network.getCraftingTasks().isEmpty() : isPowered(network.getItemStorage().getList().getStacks().stream().map(s -> s.stackSize).mapToInt(Number::intValue).sum());
powered = mode == MODE_AUTOCRAFTING ? !network.getCraftingTasks().isEmpty() : isPowered(network.getItemStorageCache().getList().getStacks().stream().map(s -> s.stackSize).mapToInt(Number::intValue).sum());
}
} else if (type == IType.FLUIDS) {
FluidStack slot = fluidFilters.getFluidStackInSlot(0);
if (slot != null) {
FluidStack stack = network.getFluidStorage().getList().get(slot, compare);
FluidStack stack = network.getFluidStorageCache().getList().get(slot, compare);
powered = isPowered(stack == null ? null : stack.amount);
} else {
powered = isPowered(network.getFluidStorage().getList().getStacks().stream().map(s -> s.amount).mapToInt(Number::intValue).sum());
powered = isPowered(network.getFluidStorageCache().getList().getStacks().stream().map(s -> s.amount).mapToInt(Number::intValue).sum());
}
}
}

View File

@@ -119,8 +119,8 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
RSUtils.constructFromDrive(getStackInSlot(slot), slot, itemStorages, fluidStorages, ItemStorage::new, FluidStorage::new);
if (network != null) {
network.getItemStorage().rebuild();
network.getFluidStorage().rebuild();
network.getItemStorageCache().rebuild();
network.getFluidStorageCache().rebuild();
}
if (worldObj != null) {
@@ -200,8 +200,8 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
public void onConnectionChange(INetworkMaster network, boolean state) {
super.onConnectionChange(network, state);
network.getItemStorage().rebuild();
network.getFluidStorage().rebuild();
network.getItemStorageCache().rebuild();
network.getFluidStorageCache().rebuild();
}
@Override
@@ -361,8 +361,8 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
public void setAccessType(int value) {
accessType = value;
network.getFluidStorage().rebuild();
network.getItemStorage().rebuild();
network.getFluidStorageCache().rebuild();
network.getItemStorageCache().rebuild();
markDirty();
}

View File

@@ -267,7 +267,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
if (IFilterable.isEmpty(itemFilters)) {
ItemStack toExtract = null;
ArrayList<ItemStack> networkItems = new ArrayList<>(network.getItemStorage().getList().getStacks());
ArrayList<ItemStack> networkItems = new ArrayList<>(network.getItemStorageCache().getList().getStacks());
int j = 0;
@@ -348,7 +348,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
if (IFilterable.isEmpty(itemFilters)) {
FluidStack toExtract = null;
ArrayList<FluidStack> networkFluids = new ArrayList<>(network.getFluidStorage().getList().getStacks());
ArrayList<FluidStack> networkFluids = new ArrayList<>(network.getFluidStorageCache().getList().getStacks());
int j = 0;

View File

@@ -83,7 +83,7 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
if (handler != null) {
for (FluidStack stack : fluidFilters.getFluids()) {
if (stack != null) {
FluidStack stackInStorage = network.getFluidStorage().getList().get(stack, compare);
FluidStack stackInStorage = network.getFluidStorageCache().getList().get(stack, compare);
if (stackInStorage != null) {
int toExtract = Math.min(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), stackInStorage.amount);

View File

@@ -125,7 +125,7 @@ public class TileFluidInterface extends TileNode implements IComparable {
}
} else if (stack != null) {
// Fill the out fluid
FluidStack stackInStorage = network.getFluidStorage().getList().get(stack, compare);
FluidStack stackInStorage = network.getFluidStorageCache().getList().get(stack, compare);
if (stackInStorage != null) {
int toExtract = Math.min(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), stackInStorage.amount);

View File

@@ -113,7 +113,7 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
storage = new FluidStorage();
if (network != null) {
network.getFluidStorage().rebuild();
network.getFluidStorageCache().rebuild();
}
}
}
@@ -128,7 +128,7 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
public void onConnectionChange(INetworkMaster network, boolean state) {
super.onConnectionChange(network, state);
network.getFluidStorage().rebuild();
network.getFluidStorageCache().rebuild();
}
@Override
@@ -292,7 +292,7 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
public void setAccessType(int value) {
accessType = value;
network.getFluidStorage().rebuild();
network.getFluidStorageCache().rebuild();
markDirty();
}

View File

@@ -113,7 +113,7 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
storage = new ItemStorage();
if (network != null) {
network.getItemStorage().rebuild();
network.getItemStorageCache().rebuild();
}
}
}
@@ -128,7 +128,7 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
public void onConnectionChange(INetworkMaster network, boolean state) {
super.onConnectionChange(network, state);
network.getItemStorage().rebuild();
network.getItemStorageCache().rebuild();
}
@Override
@@ -299,7 +299,7 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
public void setAccessType(int value) {
accessType = value;
network.getItemStorage().rebuild();
network.getItemStorageCache().rebuild();
markDirty();
}

View File

@@ -120,8 +120,8 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
updateStorage(network);
network.getItemStorage().rebuild();
network.getFluidStorage().rebuild();
network.getItemStorageCache().rebuild();
network.getFluidStorageCache().rebuild();
}
@Override
@@ -142,11 +142,11 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
}
if (itemChangeDetected) {
network.getItemStorage().rebuild();
network.getItemStorageCache().rebuild();
}
if (fluidChangeDetected) {
network.getFluidStorage().rebuild();
network.getFluidStorageCache().rebuild();
}
if (getFacingTile() instanceof IDrawerGroup && lastDrawerCount != ((IDrawerGroup) getFacingTile()).getDrawerCount()) {
@@ -273,8 +273,8 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
}
}
network.getItemStorage().rebuild();
network.getFluidStorage().rebuild();
network.getItemStorageCache().rebuild();
network.getFluidStorageCache().rebuild();
}
@Override
@@ -347,8 +347,8 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
accessType = type;
// Refresh item/fluid cache
network.getItemStorage().rebuild();
network.getFluidStorage().rebuild();
network.getItemStorageCache().rebuild();
network.getFluidStorageCache().rebuild();
markDirty();
}