use of ladysnake.gaspunk.api.IGasAgent in project Gaspunk by Ladysnake.
the class GasDeserializer method parseAgents.
private void parseAgents(JsonReader in, Gas.Builder builder) throws IOException {
in.beginArray();
while (in.hasNext()) {
IGasAgent agent = null;
double potency = 0;
in.beginObject();
while (in.hasNext()) {
String name = in.nextName();
switch(name) {
case "agent":
String id = in.nextString();
agent = GasAgents.getAgent(new ResourceLocation(id));
if (agent == null)
throw new JsonParseException("Invalid agent provided: " + id + " " + in.getPath());
break;
case "potency":
potency = in.nextDouble();
break;
}
}
in.endObject();
builder.addAgent(Objects.requireNonNull(agent, "no agent type provided"), (float) potency);
}
in.endArray();
}
use of ladysnake.gaspunk.api.IGasAgent in project Gaspunk by Ladysnake.
the class GasAgents method createDamageAgent.
public static IGasAgent createDamageAgent(String name) {
IGasAgent ret = name(new DamageAgent(20), name);
AGENT_MAP.put(new ResourceLocation(GasPunk.MOD_ID, name), ret);
return ret;
}
Aggregations