Fix effect command giving 20 times as much duration
This commit is contained in:
@@ -36,7 +36,7 @@ public abstract class ComponentPotion implements IBuilderComponent
|
|||||||
|
|
||||||
compound.setByte("Id", (byte) Potion.getIdFromPotion(entry.getKey()));
|
compound.setByte("Id", (byte) Potion.getIdFromPotion(entry.getKey()));
|
||||||
compound.setByte("Amplifier", (byte) (potion.getAmplifier() - 1));
|
compound.setByte("Amplifier", (byte) (potion.getAmplifier() - 1));
|
||||||
compound.setInteger("Duration", potion.getDuration() > 0 ? Math.min(potion.getDuration(), 1000000) : 1000000);
|
compound.setInteger("Duration", potion.getDurationTicks() > 0 ? Math.min(potion.getDurationTicks(), 1000000) : 1000000);
|
||||||
compound.setBoolean("Ambient", potion.getAmbient());
|
compound.setBoolean("Ambient", potion.getAmbient());
|
||||||
compound.setBoolean("ShowParticles", potion.getShowParticles());
|
compound.setBoolean("ShowParticles", potion.getShowParticles());
|
||||||
|
|
||||||
|
|||||||
@@ -88,16 +88,26 @@ public class PotionMetadata
|
|||||||
this.ambient = ambient;
|
this.ambient = ambient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDuration()
|
public int getDurationTicks()
|
||||||
{
|
{
|
||||||
return PotionMetadata.getDuration(this.seconds, this.minutes, this.hours);
|
return PotionMetadata.getDurationTicks(this.seconds, this.minutes, this.hours);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getDuration(int seconds, int minutes, int hours)
|
public int getDurationSeconds()
|
||||||
|
{
|
||||||
|
return PotionMetadata.getDurationSeconds(this.seconds, this.minutes, this.hours);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getDurationTicks(int seconds, int minutes, int hours)
|
||||||
{
|
{
|
||||||
return seconds * 20 + minutes * 1200 + hours * 72000;
|
return seconds * 20 + minutes * 1200 + hours * 72000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getDurationSeconds(int seconds, int minutes, int hours)
|
||||||
|
{
|
||||||
|
return seconds + minutes * 60 + hours * 3600;
|
||||||
|
}
|
||||||
|
|
||||||
public PotionMetadata withAmplifier(byte amplifier)
|
public PotionMetadata withAmplifier(byte amplifier)
|
||||||
{
|
{
|
||||||
this.amplifier = amplifier;
|
this.amplifier = amplifier;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
|||||||
public void setSeconds(int seconds)
|
public void setSeconds(int seconds)
|
||||||
{
|
{
|
||||||
this.seconds = seconds;
|
this.seconds = seconds;
|
||||||
this.setDuration(PotionMetadata.getDuration(this.seconds, this.minutes, this.hours));
|
this.setDuration(PotionMetadata.getDurationSeconds(this.seconds, this.minutes, this.hours));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinutes()
|
public int getMinutes()
|
||||||
@@ -119,7 +119,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
|||||||
public void setMinutes(int minutes)
|
public void setMinutes(int minutes)
|
||||||
{
|
{
|
||||||
this.minutes = minutes;
|
this.minutes = minutes;
|
||||||
this.setDuration(PotionMetadata.getDuration(this.seconds, this.minutes, this.hours));
|
this.setDuration(PotionMetadata.getDurationSeconds(this.seconds, this.minutes, this.hours));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHours()
|
public int getHours()
|
||||||
@@ -130,7 +130,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
|||||||
public void setHours(int hours)
|
public void setHours(int hours)
|
||||||
{
|
{
|
||||||
this.hours = hours;
|
this.hours = hours;
|
||||||
this.setDuration(PotionMetadata.getDuration(this.seconds, this.minutes, this.hours));
|
this.setDuration(PotionMetadata.getDurationSeconds(this.seconds, this.minutes, this.hours));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuilderGeneric getRemoveCommand()
|
public BuilderGeneric getRemoveCommand()
|
||||||
|
|||||||
Reference in New Issue
Block a user