This commit is contained in:
Electroblob77
2020-04-09 21:22:43 +01:00
parent f7b678e291
commit bd11c9c759
@@ -285,14 +285,13 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
* @throws IllegalArgumentException if the given {@link Enchantment} is not an {@link Imbuement}.
*/
public void setImbuementDuration(Enchantment enchantment, int duration){
// It is best to throw an exception here, because otherwise the error would either go unnoticed (if
// non-imbuements
// were ignored) or cause a ClassCastException later (if non-imbuements were allowed to be added).
// It is best to throw an exception here, because otherwise the error would either go unnoticed (if non-
// -imbuements were ignored) or cause a ClassCastException later (if non-imbuements were allowed to be added)
if(enchantment instanceof Imbuement){
this.imbuementDurations.put((Imbuement)enchantment, duration);
}else{
throw new IllegalArgumentException(
"Attempted to set an imbuement duration for something that isn't an Imbuement! (This exception has been thrown now to prevent a ClassCastException from occurring later.)");
"Attempted to set an imbuement duration for something that isn't an Imbuement!");
}
}