Refactoring
This commit is contained in:
parent
fd330233dd
commit
56ccd3188d
76 changed files with 876 additions and 433 deletions
|
@ -46,7 +46,7 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
{
|
||||
par3List.add("A sigil with a lovely affinity for fluids");
|
||||
|
||||
if (!(par1ItemStack.stackTagCompound == null))
|
||||
if (!(par1ItemStack.getTagCompound() == null))
|
||||
{
|
||||
switch (this.getActionState(par1ItemStack))
|
||||
{
|
||||
|
@ -122,22 +122,22 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
|
||||
public int getActionState(ItemStack item)
|
||||
{
|
||||
if (item.stackTagCompound == null)
|
||||
if (item.getTagCompound() == null)
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
return item.stackTagCompound.getInteger("actionState");
|
||||
return item.getTagCompound().getInteger("actionState");
|
||||
}
|
||||
|
||||
public void setActionState(ItemStack item, int actionState)
|
||||
{
|
||||
if (item.stackTagCompound == null)
|
||||
if (item.getTagCompound() == null)
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
item.stackTagCompound.setInteger("actionState", actionState);
|
||||
item.getTagCompound().setInteger("actionState", actionState);
|
||||
}
|
||||
|
||||
public int cycleActionState(ItemStack item)
|
||||
|
@ -648,11 +648,11 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
@Override
|
||||
public FluidStack getFluid(ItemStack container)
|
||||
{
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid"))
|
||||
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid"));
|
||||
return FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -671,12 +671,12 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
|
||||
if (!doFill)
|
||||
{
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid"))
|
||||
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid"))
|
||||
{
|
||||
return Math.min(capacity, resource.amount);
|
||||
}
|
||||
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid"));
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid"));
|
||||
|
||||
if (stack == null || stack.amount <= 0)
|
||||
{
|
||||
|
@ -691,27 +691,27 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
return Math.min(capacity - stack.amount, resource.amount);
|
||||
}
|
||||
|
||||
if (container.stackTagCompound == null)
|
||||
if (container.getTagCompound() == null)
|
||||
{
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (!container.stackTagCompound.hasKey("Fluid"))
|
||||
if (!container.getTagCompound().hasKey("Fluid"))
|
||||
{
|
||||
NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound());
|
||||
|
||||
if (capacity < resource.amount)
|
||||
{
|
||||
fluidTag.setInteger("Amount", capacity);
|
||||
container.stackTagCompound.setTag("Fluid", fluidTag);
|
||||
container.getTagCompound().setTag("Fluid", fluidTag);
|
||||
return capacity;
|
||||
}
|
||||
|
||||
container.stackTagCompound.setTag("Fluid", fluidTag);
|
||||
container.getTagCompound().setTag("Fluid", fluidTag);
|
||||
return resource.amount;
|
||||
}
|
||||
|
||||
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid");
|
||||
NBTTagCompound fluidTag = container.getTagCompound().getCompoundTag("Fluid");
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(fluidTag);
|
||||
|
||||
if (stack == null || stack.amount <= 0)
|
||||
|
@ -721,11 +721,11 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
if (capacity < resource.amount)
|
||||
{
|
||||
fluidTag1.setInteger("Amount", capacity);
|
||||
container.stackTagCompound.setTag("Fluid", fluidTag1);
|
||||
container.getTagCompound().setTag("Fluid", fluidTag1);
|
||||
return capacity;
|
||||
}
|
||||
|
||||
container.stackTagCompound.setTag("Fluid", fluidTag1);
|
||||
container.getTagCompound().setTag("Fluid", fluidTag1);
|
||||
return resource.amount;
|
||||
}
|
||||
|
||||
|
@ -744,19 +744,19 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
stack.amount = capacity;
|
||||
}
|
||||
|
||||
container.stackTagCompound.setTag("Fluid", stack.writeToNBT(fluidTag));
|
||||
container.getTagCompound().setTag("Fluid", stack.writeToNBT(fluidTag));
|
||||
return filled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid"))
|
||||
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid"));
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid"));
|
||||
if (stack == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -767,18 +767,18 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
{
|
||||
if (maxDrain >= capacity)
|
||||
{
|
||||
container.stackTagCompound.removeTag("Fluid");
|
||||
container.getTagCompound().removeTag("Fluid");
|
||||
|
||||
if (container.stackTagCompound.hasNoTags())
|
||||
if (container.getTagCompound().hasNoTags())
|
||||
{
|
||||
container.stackTagCompound = null;
|
||||
container.setTagCompound(null);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid");
|
||||
NBTTagCompound fluidTag = container.getTagCompound().getCompoundTag("Fluid");
|
||||
fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain);
|
||||
container.stackTagCompound.setTag("Fluid", fluidTag);
|
||||
container.getTagCompound().setTag("Fluid", fluidTag);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue