Added a debug storage disk

This commit is contained in:
Raoul Van den Berge
2016-07-02 22:19:11 +02:00
parent 51b157660c
commit a88b335307
7 changed files with 62 additions and 3 deletions

View File

@@ -5,6 +5,9 @@
- Fixed delay until grid items are visible - Fixed delay until grid items are visible
- Performance improvements - Performance improvements
**Features**
- Added a debug storage disk
### 0.8.3 ### 0.8.3
**Bugfixes** **Bugfixes**
- Fixed drawer controllers not working with external storage - Fixed drawer controllers not working with external storage

View File

@@ -38,6 +38,10 @@ public enum EnumStorageType implements IStringSerializable {
} }
public static EnumStorageType getById(int id) { public static EnumStorageType getById(int id) {
if (id == 5) {
return TYPE_CREATIVE;
}
for (EnumStorageType type : EnumStorageType.values()) { for (EnumStorageType type : EnumStorageType.values()) {
if (type.getId() == id) { if (type.getId() == id) {
return type; return type;

View File

@@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
@@ -14,6 +15,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 {
@@ -22,6 +25,9 @@ public class ItemStorageDisk extends ItemBase {
public static final int TYPE_16K = 2; public static final int TYPE_16K = 2;
public static final int TYPE_64K = 3; public static final int TYPE_64K = 3;
public static final int TYPE_CREATIVE = 4; public static final int TYPE_CREATIVE = 4;
public static final int TYPE_DEBUG = 5;
private NBTTagCompound debugDiskTag;
public ItemStorageDisk() { public ItemStorageDisk() {
super("storage_disk"); super("storage_disk");
@@ -33,11 +39,48 @@ public class ItemStorageDisk extends ItemBase {
@Override @Override
public void getSubItems(Item item, CreativeTabs tab, List list) { public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 6; ++i) {
list.add(NBTStorage.createStackWithNBT(new ItemStack(item, 1, i))); list.add(i == TYPE_DEBUG ? createDebugDisk() : NBTStorage.createStackWithNBT(new ItemStack(item, 1, i)));
} }
} }
private ItemStack createDebugDisk() {
ItemStack debugDisk = new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, ItemStorageDisk.TYPE_DEBUG);
if (debugDiskTag == null) {
debugDiskTag = NBTStorage.createNBT();
NBTStorage storage = new NBTStorage(debugDiskTag, -1, null) {
@Override
public int getPriority() {
return 0;
}
};
Iterator<Item> it = Item.REGISTRY.iterator();
while (it.hasNext()) {
Item item = it.next();
if (item != RefinedStorageItems.STORAGE_DISK) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
item.getSubItems(item, CreativeTabs.INVENTORY, stacks);
for (ItemStack itemStack : stacks) {
storage.push(itemStack, 1000, false);
}
}
}
storage.writeToNBT();
}
debugDisk.setTagCompound(debugDiskTag.copy());
return debugDisk;
}
@Override @Override
public void addInformation(ItemStack disk, EntityPlayer player, List list, boolean b) { public void addInformation(ItemStack disk, EntityPlayer player, List list, boolean b) {
int capacity = EnumStorageType.getById(disk.getItemDamage()).getCapacity(); int capacity = EnumStorageType.getById(disk.getItemDamage()).getCapacity();

View File

@@ -31,7 +31,8 @@ public class ClientProxy extends CommonProxy {
new ResourceLocation("refinedstorage:4k_storage_disk"), new ResourceLocation("refinedstorage:4k_storage_disk"),
new ResourceLocation("refinedstorage:16k_storage_disk"), new ResourceLocation("refinedstorage:16k_storage_disk"),
new ResourceLocation("refinedstorage:64k_storage_disk"), new ResourceLocation("refinedstorage:64k_storage_disk"),
new ResourceLocation("refinedstorage:creative_storage_disk") new ResourceLocation("refinedstorage:creative_storage_disk"),
new ResourceLocation("refinedstorage:debug_storage_disk")
); );
ModelBakery.registerItemVariants(RefinedStorageItems.STORAGE_PART, ModelBakery.registerItemVariants(RefinedStorageItems.STORAGE_PART,
@@ -69,6 +70,7 @@ public class ClientProxy extends CommonProxy {
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_DISK, ItemStorageDisk.TYPE_16K, new ModelResourceLocation("refinedstorage:16k_storage_disk", "inventory")); ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_DISK, ItemStorageDisk.TYPE_16K, new ModelResourceLocation("refinedstorage:16k_storage_disk", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_DISK, ItemStorageDisk.TYPE_64K, new ModelResourceLocation("refinedstorage:64k_storage_disk", "inventory")); ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_DISK, ItemStorageDisk.TYPE_64K, new ModelResourceLocation("refinedstorage:64k_storage_disk", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_DISK, ItemStorageDisk.TYPE_CREATIVE, new ModelResourceLocation("refinedstorage:creative_storage_disk", "inventory")); ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_DISK, ItemStorageDisk.TYPE_CREATIVE, new ModelResourceLocation("refinedstorage:creative_storage_disk", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_DISK, ItemStorageDisk.TYPE_DEBUG, new ModelResourceLocation("refinedstorage:debug_storage_disk", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_PART, ItemStoragePart.TYPE_1K, new ModelResourceLocation("refinedstorage:1k_storage_part", "inventory")); ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_PART, ItemStoragePart.TYPE_1K, new ModelResourceLocation("refinedstorage:1k_storage_part", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_PART, ItemStoragePart.TYPE_4K, new ModelResourceLocation("refinedstorage:4k_storage_part", "inventory")); ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_PART, ItemStoragePart.TYPE_4K, new ModelResourceLocation("refinedstorage:4k_storage_part", "inventory"));

View File

@@ -117,6 +117,7 @@ item.refinedstorage:storage_disk.1.name=4k Storage Disk
item.refinedstorage:storage_disk.2.name=16k Storage Disk item.refinedstorage:storage_disk.2.name=16k Storage Disk
item.refinedstorage:storage_disk.3.name=64k Storage Disk item.refinedstorage:storage_disk.3.name=64k Storage Disk
item.refinedstorage:storage_disk.4.name=Creative Storage Disk item.refinedstorage:storage_disk.4.name=Creative Storage Disk
item.refinedstorage:storage_disk.5.name=Debug Storage Disk
item.refinedstorage:wireless_grid.0.name=Wireless Grid item.refinedstorage:wireless_grid.0.name=Wireless Grid
item.refinedstorage:wireless_grid.1.name=Creative Wireless Grid item.refinedstorage:wireless_grid.1.name=Creative Wireless Grid
item.refinedstorage:quartz_enriched_iron.name=Quartz Enriched Iron item.refinedstorage:quartz_enriched_iron.name=Quartz Enriched Iron

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "refinedstorage:items/debug_storage_disk"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B