Better naming

This commit is contained in:
Raoul Van den Berge
2016-05-18 17:28:47 +02:00
parent 819e624b62
commit 4023e87275
5 changed files with 18 additions and 18 deletions

View File

@@ -41,7 +41,7 @@ public class ItemBlockStorage extends ItemBlockBase {
public static ItemStack initNBT(ItemStack stack) {
NBTTagCompound tag = new NBTTagCompound();
tag.setTag(TileStorage.NBT_STORAGE, NBTStorage.getBaseNBT());
tag.setTag(TileStorage.NBT_STORAGE, NBTStorage.createNBT());
stack.setTagCompound(tag);
return stack;
}

View File

@@ -34,7 +34,7 @@ public class ItemStorageDisk extends ItemBase {
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
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) {
super.onCreated(stack, world, player);
NBTStorage.initNBT(stack);
NBTStorage.createStackWithNBT(stack);
}
}

View File

@@ -361,7 +361,7 @@ public class CommonProxy {
);
// Storage Housing
GameRegistry.addRecipe(NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_HOUSING)),
GameRegistry.addRecipe(NBTStorage.createStackWithNBT(new ItemStack(RefinedStorageItems.STORAGE_HOUSING)),
"GRG",
"R R",
"EEE",
@@ -372,7 +372,7 @@ public class CommonProxy {
// Storage Disks
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,
"GRG",

View File

@@ -16,19 +16,19 @@ public class NBTStorage implements IStorage {
public static final String NBT_ITEM_DAMAGE = "Damage";
public static final String NBT_ITEM_NBT = "NBT";
private NBTTagCompound nbtTag;
private NBTTagCompound nbt;
private int capacity;
private int priority;
public NBTStorage(NBTTagCompound tag, int capacity, int priority) {
this.nbtTag = tag;
public NBTStorage(NBTTagCompound nbt, int capacity, int priority) {
this.nbt = nbt;
this.capacity = capacity;
this.priority = priority;
}
@Override
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) {
items.add(createItemGroupFromNBT(list.getCompoundTagAt(i)));
@@ -37,9 +37,9 @@ public class NBTStorage implements IStorage {
@Override
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) {
NBTTagCompound tag = list.getCompoundTagAt(i);
@@ -70,7 +70,7 @@ public class NBTStorage implements IStorage {
public ItemStack take(ItemStack stack, int flags) {
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) {
NBTTagCompound tag = list.getCompoundTagAt(i);
@@ -88,7 +88,7 @@ public class NBTStorage implements IStorage {
list.removeTag(i);
}
nbtTag.setInteger(NBT_STORED, getStored(nbtTag) - quantity);
nbt.setInteger(NBT_STORED, getStored(nbt) - quantity);
ItemStack newItem = group.toItemStack();
@@ -107,7 +107,7 @@ public class NBTStorage implements IStorage {
return true;
}
return (getStored(nbtTag) + stack.stackSize) <= capacity;
return (getStored(nbt) + stack.stackSize) <= capacity;
}
@Override
@@ -123,7 +123,7 @@ public class NBTStorage implements IStorage {
return tag.getInteger(NBT_STORED);
}
public static NBTTagCompound getBaseNBT() {
public static NBTTagCompound createNBT() {
NBTTagCompound tag = new NBTTagCompound();
tag.setTag(NBT_ITEMS, new NBTTagList());
@@ -132,8 +132,8 @@ public class NBTStorage implements IStorage {
return tag;
}
public static ItemStack initNBT(ItemStack stack) {
stack.setTagCompound(getBaseNBT());
public static ItemStack createStackWithNBT(ItemStack stack) {
stack.setTagCompound(createNBT());
return stack;
}
}

View File

@@ -29,7 +29,7 @@ public class TileStorage extends TileMachine implements IStorageProvider, IStora
private InventorySimple inventory = new InventorySimple("storage", 9, this);
private NBTTagCompound tag = NBTStorage.getBaseNBT();
private NBTTagCompound tag = NBTStorage.createNBT();
private int priority = 0;
private int compare = 0;