|
object.has("burnTime") ? |
|
object.get("burnTime").getAsInt() : |
|
object.has("superHeat") && object.get("superHeat").getAsBoolean() ? |
|
32 : 20 |
|
// Lava Burn Time per Mb is 20, create mod codes sets that 32 * 1000 / 10 for any superheat |
|
// This is from BlazeBurnerBlockEntity#tryUpdateFuel (Line 193) |
|
, object.has("superHeat") && object.get("superHeat").getAsBoolean() // default not to superheat |
|
, object.has("amountConsumedPerTick") ? |
|
object.get("amountConsumedPerTick").getAsInt() : |
|
object.has("superHeat") && object.get("superHeat").getAsBoolean() ? |
|
10 : 1 // default not to consume 10 if superHeat, 1 if not |
Like, why??
Just do something like
public record LiquidFuel(
Holder<Fluid> fluid,
int burnTime,
int amountConsumedPerTick,
boolean superHeat
) {
public static final Codec<LiquidFuel> LIQUID_FUEL_CODEC = RecordCodecBuilder.create(inst -> inst.group(
FluidStack.FLUID_NON_EMPTY_CODEC.fieldOf("fluid").forGetter(LiquidFuel::fluid),
Codec.INT.fieldOf("burnTime").forGetter(LiquidFuel::burnTime),
Codec.INT.fieldOf("amountConsumedPerTick").forGetter(LiquidFuel::amountConsumedPerTick),
Codec.BOOL.optionalFieldOf("superHeat", false).forGetter(LiquidFuel::superHeat)
).apply(inst, LiquidFuel::new));
}
Then for a datamap
public static final DataMapType<Fluid, LiquidFuel> LIQUID_FUEL = DataMapType.builder(
ResourceLocation.withNamespaceAndPath("createliquidfuel", "liquid_fuel"),
Registries.FLUID,
LiquidFuel.CODEC
).synced(
LiquidFuel.CODEC,
true
).build();
So people can attach this to datagen and not play dark magic
I beg of you for this feature. Save us all from your Gson and Triplet hell.
CreateLiquidFuel/src/main/java/com/forsteri/createliquidfuel/core/LiquidBurnerFuelJsonLoader.java
Lines 51 to 61 in 202229f
Like, why??
Just do something like
Then for a datamap
So people can attach this to datagen and not play dark magic
I beg of you for this feature. Save us all from your Gson and Triplet hell.