Refactoring

This commit is contained in:
WayofTime 2015-01-16 10:00:50 -05:00
parent fd330233dd
commit 56ccd3188d
76 changed files with 876 additions and 433 deletions
src/main/java/WayofTime/alchemicalWizardry/api

View file

@ -392,11 +392,11 @@ public class ItemSpellMultiTool extends Item
{
par3List.add("A mace filled with ancient alchemy");
if (!(par1ItemStack.stackTagCompound == null))
if (!(par1ItemStack.getTagCompound() == null))
{
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
if (!par1ItemStack.getTagCompound().getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
par3List.add("Current owner: " + par1ItemStack.getTagCompound().getString("ownerName"));
}
for (String str : this.getToolListString(par1ItemStack))
@ -479,7 +479,7 @@ public class ItemSpellMultiTool extends Item
tag.setFloat("itemAttack", Math.max(damage, 0.0f));
stack.stackTagCompound.setTag(tagName, tag);
stack.getTagCompound().setTag(tagName, tag);
} else
{
stack.setTagCompound(new NBTTagCompound());
@ -488,7 +488,7 @@ public class ItemSpellMultiTool extends Item
tag.setFloat("itemAttack", Math.max(damage, 0.0f));
stack.stackTagCompound.setTag(tagName, tag);
stack.getTagCompound().setTag(tagName, tag);
}
}
@ -655,7 +655,7 @@ public class ItemSpellMultiTool extends Item
tag.setBoolean("silkTouch", silkTouch);
stack.stackTagCompound.setTag(tagName, tag);
stack.getTagCompound().setTag(tagName, tag);
} else
{
stack.setTagCompound(new NBTTagCompound());
@ -664,7 +664,7 @@ public class ItemSpellMultiTool extends Item
tag.setBoolean("silkTouch", silkTouch);
stack.stackTagCompound.setTag(tagName, tag);
stack.getTagCompound().setTag(tagName, tag);
}
}
@ -691,7 +691,7 @@ public class ItemSpellMultiTool extends Item
tag.setInteger("fortuneLevel", Math.max(fortune, 0));
stack.stackTagCompound.setTag(tagName, tag);
stack.getTagCompound().setTag(tagName, tag);
} else
{
stack.setTagCompound(new NBTTagCompound());
@ -700,7 +700,7 @@ public class ItemSpellMultiTool extends Item
tag.setInteger("fortuneLevel", Math.max(fortune, 0));
stack.stackTagCompound.setTag(tagName, tag);
stack.getTagCompound().setTag(tagName, tag);
}
}
@ -776,7 +776,7 @@ public class ItemSpellMultiTool extends Item
tag.setFloat("critChance", Math.max(chance, 0));
container.stackTagCompound.setTag(tagName, tag);
container.getTagCompound().setTag(tagName, tag);
} else
{
container.setTagCompound(new NBTTagCompound());
@ -785,7 +785,7 @@ public class ItemSpellMultiTool extends Item
tag.setFloat("critChance", Math.max(chance, 0));
container.stackTagCompound.setTag(tagName, tag);
container.getTagCompound().setTag(tagName, tag);
}
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.api.items.interfaces;
import net.minecraft.item.ItemStack;
public interface ILPGauge
{
public boolean canSeeLPBar(ItemStack itemStack);
}

View file

@ -1,6 +1,7 @@
package WayofTime.alchemicalWizardry.api.rituals;
import net.minecraft.nbt.NBTTagCompound;
import WayofTime.alchemicalWizardry.common.Int3;
/**
* This class is used to pass ritual-specific data into the RitualEffect from the containing Master Ritual Stone. This is basically used as auxillarary storage,
@ -9,13 +10,33 @@ import net.minecraft.nbt.NBTTagCompound;
*/
public class LocalRitualStorage
{
public void writeToNBT(NBTTagCompound tag)
{
public int xCoord;
public int yCoord;
public int zCoord;
public void writeToNBT(NBTTagCompound tag)
{
tag.setInteger("xCoord", xCoord);
tag.setInteger("yCoord", yCoord);
tag.setInteger("zCoord", zCoord);
}
public void readFromNBT(NBTTagCompound tag)
{
this.xCoord = tag.getInteger("xCoord");
this.yCoord = tag.getInteger("yCoord");
this.zCoord = tag.getInteger("zCoord");
}
public void readFromNBT(NBTTagCompound tag)
public Int3 getLocation()
{
return new Int3(xCoord, yCoord, zCoord);
}
public void setLocation(Int3 location)
{
this.xCoord = location.xCoord;
this.yCoord = location.yCoord;
this.zCoord = location.zCoord;
}
}

View file

@ -57,7 +57,7 @@ public abstract class RitualEffect
public LocalRitualStorage getNewLocalStorage()
{
return null;
return new LocalRitualStorage();
}
public void addOffsetRunes(ArrayList<RitualComponent> ritualList, int off1, int off2, int y, int rune)

View file

@ -381,32 +381,32 @@ public class SoulNetworkHandler
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
{
if (item.stackTagCompound == null)
if (item.getTagCompound() == null)
{
item.setTagCompound(new NBTTagCompound());
}
if (item.stackTagCompound.getString("ownerName").equals(""))
if (item.getTagCompound().getString("ownerName").equals(""))
{
ItemBindEvent event = new ItemBindEvent(player, SoulNetworkHandler.getUsername(player), item);
if(!MinecraftForge.EVENT_BUS.post(event))
{
item.stackTagCompound.setString("ownerName", event.key);
item.getTagCompound().setString("ownerName", event.key);
}
}
}
public static void checkAndSetItemOwner(ItemStack item, String ownerName)
{
if (item.stackTagCompound == null)
if (item.getTagCompound() == null)
{
item.setTagCompound(new NBTTagCompound());
}
if (item.stackTagCompound.getString("ownerName").equals(""))
if (item.getTagCompound().getString("ownerName").equals(""))
{
item.stackTagCompound.setString("ownerName", ownerName);
item.getTagCompound().setString("ownerName", ownerName);
}
}
@ -448,11 +448,11 @@ public class SoulNetworkHandler
public static String getOwnerName(ItemStack item)
{
if (item.stackTagCompound == null)
if (item.getTagCompound() == null)
{
item.setTagCompound(new NBTTagCompound());
}
return item.stackTagCompound.getString("ownerName");
return item.getTagCompound().getString("ownerName");
}
}