mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-30 14:55:07 +01:00
Fix crash when empty fluids are specified
This commit is contained in:
parent
51bb416b0e
commit
a624a6e452
2 changed files with 5 additions and 3 deletions
|
@ -147,6 +147,8 @@ public class FluidHelper {
|
||||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(id);
|
Fluid fluid = ForgeRegistries.FLUIDS.getValue(id);
|
||||||
if (fluid == null)
|
if (fluid == null)
|
||||||
throw new JsonSyntaxException("Unknown fluid '" + id + "'");
|
throw new JsonSyntaxException("Unknown fluid '" + id + "'");
|
||||||
|
if (fluid == Fluids.EMPTY)
|
||||||
|
throw new JsonSyntaxException("Invalid empty fluid '" + id + "'");
|
||||||
int amount = GsonHelper.getAsInt(json, "amount");
|
int amount = GsonHelper.getAsInt(json, "amount");
|
||||||
FluidStack stack = new FluidStack(fluid, amount);
|
FluidStack stack = new FluidStack(fluid, amount);
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
||||||
|
|
||||||
public static FluidIngredient deserialize(@Nullable JsonElement je) {
|
public static FluidIngredient deserialize(@Nullable JsonElement je) {
|
||||||
if (!isFluidIngredient(je))
|
if (!isFluidIngredient(je))
|
||||||
throw new JsonSyntaxException("Invalid fluid ingredient: " + Objects.toString(je));
|
throw new JsonSyntaxException("Invalid fluid ingredient: " + je);
|
||||||
|
|
||||||
JsonObject json = je.getAsJsonObject();
|
JsonObject json = je.getAsJsonObject();
|
||||||
FluidIngredient ingredient = json.has("fluidTag") ? new FluidTagIngredient() : new FluidStackIngredient();
|
FluidIngredient ingredient = json.has("fluidTag") ? new FluidTagIngredient() : new FluidStackIngredient();
|
||||||
|
|
Loading…
Reference in a new issue