Better naming
This commit is contained in:
@@ -41,7 +41,7 @@ public class ItemBlockStorage extends ItemBlockBase {
|
|||||||
|
|
||||||
public static ItemStack initNBT(ItemStack stack) {
|
public static ItemStack initNBT(ItemStack stack) {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tag.setTag(TileStorage.NBT_STORAGE, NBTStorage.getBaseNBT());
|
tag.setTag(TileStorage.NBT_STORAGE, NBTStorage.createNBT());
|
||||||
stack.setTagCompound(tag);
|
stack.setTagCompound(tag);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ 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 < 5; ++i) {
|
||||||
list.add(NBTStorage.initNBT(new ItemStack(item, 1, i)));
|
list.add(NBTStorage.createStackWithNBT(new ItemStack(item, 1, i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +68,6 @@ public class ItemStorageDisk extends ItemBase {
|
|||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
||||||
super.onCreated(stack, world, player);
|
super.onCreated(stack, world, player);
|
||||||
|
|
||||||
NBTStorage.initNBT(stack);
|
NBTStorage.createStackWithNBT(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ public class CommonProxy {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Storage Housing
|
// Storage Housing
|
||||||
GameRegistry.addRecipe(NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_HOUSING)),
|
GameRegistry.addRecipe(NBTStorage.createStackWithNBT(new ItemStack(RefinedStorageItems.STORAGE_HOUSING)),
|
||||||
"GRG",
|
"GRG",
|
||||||
"R R",
|
"R R",
|
||||||
"EEE",
|
"EEE",
|
||||||
@@ -372,7 +372,7 @@ public class CommonProxy {
|
|||||||
|
|
||||||
// Storage Disks
|
// Storage Disks
|
||||||
for (int type = 0; type <= 3; ++type) {
|
for (int type = 0; type <= 3; ++type) {
|
||||||
ItemStack disk = NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, type));
|
ItemStack disk = NBTStorage.createStackWithNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, type));
|
||||||
|
|
||||||
GameRegistry.addRecipe(disk,
|
GameRegistry.addRecipe(disk,
|
||||||
"GRG",
|
"GRG",
|
||||||
|
|||||||
@@ -16,19 +16,19 @@ public class NBTStorage implements IStorage {
|
|||||||
public static final String NBT_ITEM_DAMAGE = "Damage";
|
public static final String NBT_ITEM_DAMAGE = "Damage";
|
||||||
public static final String NBT_ITEM_NBT = "NBT";
|
public static final String NBT_ITEM_NBT = "NBT";
|
||||||
|
|
||||||
private NBTTagCompound nbtTag;
|
private NBTTagCompound nbt;
|
||||||
private int capacity;
|
private int capacity;
|
||||||
private int priority;
|
private int priority;
|
||||||
|
|
||||||
public NBTStorage(NBTTagCompound tag, int capacity, int priority) {
|
public NBTStorage(NBTTagCompound nbt, int capacity, int priority) {
|
||||||
this.nbtTag = tag;
|
this.nbt = nbt;
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addItems(List<ItemGroup> items) {
|
public void addItems(List<ItemGroup> items) {
|
||||||
NBTTagList list = (NBTTagList) nbtTag.getTag(NBT_ITEMS);
|
NBTTagList list = (NBTTagList) nbt.getTag(NBT_ITEMS);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); ++i) {
|
for (int i = 0; i < list.tagCount(); ++i) {
|
||||||
items.add(createItemGroupFromNBT(list.getCompoundTagAt(i)));
|
items.add(createItemGroupFromNBT(list.getCompoundTagAt(i)));
|
||||||
@@ -37,9 +37,9 @@ public class NBTStorage implements IStorage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void push(ItemStack stack) {
|
public void push(ItemStack stack) {
|
||||||
NBTTagList list = (NBTTagList) nbtTag.getTag(NBT_ITEMS);
|
NBTTagList list = (NBTTagList) nbt.getTag(NBT_ITEMS);
|
||||||
|
|
||||||
nbtTag.setInteger(NBT_STORED, getStored(nbtTag) + stack.stackSize);
|
nbt.setInteger(NBT_STORED, getStored(nbt) + stack.stackSize);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); ++i) {
|
for (int i = 0; i < list.tagCount(); ++i) {
|
||||||
NBTTagCompound tag = list.getCompoundTagAt(i);
|
NBTTagCompound tag = list.getCompoundTagAt(i);
|
||||||
@@ -70,7 +70,7 @@ public class NBTStorage implements IStorage {
|
|||||||
public ItemStack take(ItemStack stack, int flags) {
|
public ItemStack take(ItemStack stack, int flags) {
|
||||||
int quantity = stack.stackSize;
|
int quantity = stack.stackSize;
|
||||||
|
|
||||||
NBTTagList list = (NBTTagList) nbtTag.getTag(NBT_ITEMS);
|
NBTTagList list = (NBTTagList) nbt.getTag(NBT_ITEMS);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); ++i) {
|
for (int i = 0; i < list.tagCount(); ++i) {
|
||||||
NBTTagCompound tag = list.getCompoundTagAt(i);
|
NBTTagCompound tag = list.getCompoundTagAt(i);
|
||||||
@@ -88,7 +88,7 @@ public class NBTStorage implements IStorage {
|
|||||||
list.removeTag(i);
|
list.removeTag(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
nbtTag.setInteger(NBT_STORED, getStored(nbtTag) - quantity);
|
nbt.setInteger(NBT_STORED, getStored(nbt) - quantity);
|
||||||
|
|
||||||
ItemStack newItem = group.toItemStack();
|
ItemStack newItem = group.toItemStack();
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public class NBTStorage implements IStorage {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (getStored(nbtTag) + stack.stackSize) <= capacity;
|
return (getStored(nbt) + stack.stackSize) <= capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,7 +123,7 @@ public class NBTStorage implements IStorage {
|
|||||||
return tag.getInteger(NBT_STORED);
|
return tag.getInteger(NBT_STORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NBTTagCompound getBaseNBT() {
|
public static NBTTagCompound createNBT() {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
|
||||||
tag.setTag(NBT_ITEMS, new NBTTagList());
|
tag.setTag(NBT_ITEMS, new NBTTagList());
|
||||||
@@ -132,8 +132,8 @@ public class NBTStorage implements IStorage {
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack initNBT(ItemStack stack) {
|
public static ItemStack createStackWithNBT(ItemStack stack) {
|
||||||
stack.setTagCompound(getBaseNBT());
|
stack.setTagCompound(createNBT());
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class TileStorage extends TileMachine implements IStorageProvider, IStora
|
|||||||
|
|
||||||
private InventorySimple inventory = new InventorySimple("storage", 9, this);
|
private InventorySimple inventory = new InventorySimple("storage", 9, this);
|
||||||
|
|
||||||
private NBTTagCompound tag = NBTStorage.getBaseNBT();
|
private NBTTagCompound tag = NBTStorage.createNBT();
|
||||||
|
|
||||||
private int priority = 0;
|
private int priority = 0;
|
||||||
private int compare = 0;
|
private int compare = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user