return;
}
}
WrappedStack wrappedStack = new WrappedStack(itemStack);
EnergyValue newEnergyValue = new EnergyValue(energyValue);
if (wrappedStack != null && newEnergyValue != null && Float.compare(newEnergyValue.getEnergyValue(), 0) > 0)
{
if (args[0].equalsIgnoreCase("pre"))
{
Map<WrappedStack, EnergyValue> preAssignedValues = SerializationHelper.readEnergyValueStackMapFromJsonFile(Files.PRE_ASSIGNED_ENERGY_VALUES);
preAssignedValues.put(wrappedStack, newEnergyValue);
SerializationHelper.writeEnergyValueStackMapToJsonFile(Files.PRE_ASSIGNED_ENERGY_VALUES, preAssignedValues);
EnergyValueRegistry.getInstance().setShouldRegenNextRestart(true);
}
else if (args[0].equalsIgnoreCase("post"))
{
EnergyValueRegistry.getInstance().setEnergyValue(wrappedStack, newEnergyValue);
Map<WrappedStack, EnergyValue> postAssignedValues = SerializationHelper.readEnergyValueStackMapFromJsonFile(Files.POST_ASSIGNED_ENERGY_VALUES);
postAssignedValues.put(wrappedStack, newEnergyValue);
SerializationHelper.writeEnergyValueStackMapToJsonFile(Files.POST_ASSIGNED_ENERGY_VALUES, postAssignedValues);
PacketHandler.INSTANCE.sendToAll(new MessageSetEnergyValue(wrappedStack, newEnergyValue));
}
// Notify admins and log the value change
func_152373_a(commandSender, this, "command.ee3.set-value.success", new Object[]{commandSender.getCommandSenderName(), args[0], wrappedStack.toString(), newEnergyValue.toString()});
LogHelper.info(String.format("%s set the EnergyValue of %s to %s", commandSender.getCommandSenderName(), wrappedStack, newEnergyValue));
}
else
{
throw new WrongUsageException("command.ee3.set-value.usage");