Skip to content

Commit

Permalink
Store duration in NBT
Browse files Browse the repository at this point in the history
  • Loading branch information
jakimfett committed Nov 5, 2014
1 parent 031ef53 commit 18b25d7
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ public void writeToNBT(NBTTagCompound nbt)
int count = 0;
while (potionEffects.hasNext())
{
int potionID = ((PotionEffect) potionEffects.next()).getPotionID();
nbt.setInteger("effect" + count, potionID);
PotionEffect effect = (PotionEffect) potionEffects.next();
nbt.setInteger("effect" + count, effect.getPotionID());
nbt.setInteger("duration" + count, effect.getDuration());
count++;
}
}
Expand Down Expand Up @@ -247,7 +248,8 @@ public void readFromNBT(NBTTagCompound nbt)
while (count >= 0)
{
int potionID = nbt.getInteger("effect" + count);
PotionEffect effect = new PotionEffect(potionID, 40, 0);
int duration = nbt.getInteger("duration" + count);
PotionEffect effect = new PotionEffect(potionID, duration, 0);

this.fluidTank.potionEffects.add(effect);
count--;
Expand Down

0 comments on commit 18b25d7

Please sign in to comment.