Fixes and shit

This commit is contained in:
Raoul Van den Berge
2016-06-30 16:59:31 +02:00
parent 822fbf83ee
commit 124ff35260
4 changed files with 15 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.ICraftingTask; import refinedstorage.api.autocrafting.ICraftingTask;
import refinedstorage.api.storage.CompareFlags; import refinedstorage.api.storage.CompareFlags;
import refinedstorage.api.storage.IGroupedStorage; import refinedstorage.api.storage.IGroupedStorage;
import refinedstorage.api.storage.IStorage;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -64,6 +65,11 @@ public interface INetworkMaster {
*/ */
IGroupedStorage getStorage(); IGroupedStorage getStorage();
/**
* @return The storages connected to this network
*/
List<IStorage> getStorages();
/** /**
* @return The crafting tasks in this network, do NOT modify this list * @return The crafting tasks in this network, do NOT modify this list
*/ */

View File

@@ -4,7 +4,6 @@ import net.minecraft.item.ItemStack;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import java.util.Collection; import java.util.Collection;
import java.util.List;
/** /**
* This holds all items from all the connected storages from a {@link INetworkMaster}. * This holds all items from all the connected storages from a {@link INetworkMaster}.
@@ -14,7 +13,7 @@ public interface IGroupedStorage {
* Rebuilds the storages and items for a network. Typically called when a {@link IStorageProvider} is * Rebuilds the storages and items for a network. Typically called when a {@link IStorageProvider} is
* added or removed from the network. * added or removed from the network.
*/ */
void rebuild(List<IStorage> storages); void rebuild();
/** /**
* Adds an item to the network. Will merge it with another item if it already exists. * Adds an item to the network. Will merge it with another item if it already exists.

View File

@@ -11,7 +11,6 @@ import refinedstorage.api.storage.IGroupedStorage;
import refinedstorage.api.storage.IStorage; import refinedstorage.api.storage.IStorage;
import java.util.Collection; import java.util.Collection;
import java.util.List;
public class GroupedStorage implements IGroupedStorage { public class GroupedStorage implements IGroupedStorage {
private INetworkMaster network; private INetworkMaster network;
@@ -22,10 +21,10 @@ public class GroupedStorage implements IGroupedStorage {
} }
@Override @Override
public void rebuild(List<IStorage> storages) { public void rebuild() {
stacks.clear(); stacks.clear();
for (IStorage storage : storages) { for (IStorage storage : network.getStorages()) {
for (ItemStack stack : storage.getItems()) { for (ItemStack stack : storage.getItems()) {
add(stack); add(stack);
} }

View File

@@ -252,6 +252,11 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
return storage; return storage;
} }
@Override
public List<IStorage> getStorages() {
return storages;
}
@Override @Override
public List<ICraftingTask> getCraftingTasks() { public List<ICraftingTask> getCraftingTasks() {
return craftingTasks; return craftingTasks;
@@ -400,7 +405,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
} }
}); });
this.storage.rebuild(storages); storage.rebuild();
} }
@Override @Override