Stuff&things

This commit is contained in:
Raoul Van den Berge
2016-06-28 15:26:46 +02:00
parent 0e7bc64646
commit c37f3dd314
2 changed files with 34 additions and 3 deletions

View File

@@ -14,6 +14,8 @@ import refinedstorage.RefinedStorageItems;
import refinedstorage.apiimpl.storage.NBTStorage; import refinedstorage.apiimpl.storage.NBTStorage;
import refinedstorage.block.EnumStorageType; import refinedstorage.block.EnumStorageType;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
public class ItemStorageDisk extends ItemBase { public class ItemStorageDisk extends ItemBase {
@@ -51,7 +53,36 @@ public class ItemStorageDisk extends ItemBase {
@Override @Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote && player.isSneaking() && NBTStorage.getStoredFromNBT(stack.getTagCompound()) == 0 && stack.getMetadata() != TYPE_CREATIVE) { if (!world.isRemote) {
ItemStack debugDisk = new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, ItemStorageDisk.TYPE_CREATIVE);
debugDisk.setTagCompound(NBTStorage.createNBT());
NBTStorage storage = new NBTStorage(debugDisk.getTagCompound(), -1, null) {
@Override
public int getPriority() {
return 0;
}
};
Iterator<Item> it = Item.REGISTRY.iterator();
while (it.hasNext()) {
Item item = it.next();
List<ItemStack> stacks = new ArrayList<ItemStack>();
item.getSubItems(item, CreativeTabs.BREWING, stacks);
for (ItemStack itemStack : stacks) {
storage.push(itemStack, 1000, false);
}
}
storage.writeToNBT();
return new ActionResult(EnumActionResult.SUCCESS, debugDisk);
} else if (!world.isRemote && player.isSneaking() && NBTStorage.getStoredFromNBT(stack.getTagCompound()) == 0 && stack.getMetadata() != TYPE_CREATIVE) {
ItemStack storagePart = new ItemStack(RefinedStorageItems.STORAGE_PART, 1, stack.getMetadata()); ItemStack storagePart = new ItemStack(RefinedStorageItems.STORAGE_PART, 1, stack.getMetadata());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) { if (!player.inventory.addItemStackToInventory(storagePart.copy())) {

View File

@@ -421,7 +421,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
} }
} }
combinedItems.clear(); /*combinedItems.clear();
combinedItemsIndices.clear(); combinedItemsIndices.clear();
for (int i = 0; i < items.size(); ++i) { for (int i = 0; i < items.size(); ++i) {
@@ -451,7 +451,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
} }
} }
items.removeAll(combinedItems); items.removeAll(combinedItems);*/
} }
@Override @Override