Fixed Fluid Transformation recipes requiring byproducts
This commit is contained in:
parent
ed89544011
commit
2efbfb676f
|
|
@ -1,5 +1,6 @@
|
|||
## Ex Deorum 3.5
|
||||
- Remove Yellorium Dust sieve drop (#116)
|
||||
- Fixed Fluid Transformation recipes requiring byproducts
|
||||
|
||||
## Ex Deorum 3.4
|
||||
- Fix JEI bug with sieve recipes overflowing due to JEI API changes
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ import java.util.function.Function;
|
|||
|
||||
// much simpler version of SimpleWeightedRandomList that supports .equals
|
||||
public class WeightedList<T> {
|
||||
private static final WeightedList<Object> EMPTY = new WeightedList<>(0, new Object[0], new int[0]);
|
||||
|
||||
private final int totalWeight;
|
||||
private final Object[] values;
|
||||
private final int[] weights;
|
||||
|
|
@ -134,6 +136,11 @@ public class WeightedList<T> {
|
|||
return new Builder<>();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> WeightedList<T> empty() {
|
||||
return (WeightedList<T>) EMPTY;
|
||||
}
|
||||
|
||||
public static class Builder<T> {
|
||||
private final ArrayList<T> values = new ArrayList<>();
|
||||
private final IntArrayList weights = new IntArrayList();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public record FluidTransformationRecipe(
|
|||
CodecUtil.fluidField("result_fluid", FluidTransformationRecipe::resultFluid),
|
||||
Codec.INT.fieldOf("result_color").forGetter(FluidTransformationRecipe::resultColor),
|
||||
BlockPredicate.CODEC.fieldOf("catalyst").forGetter(FluidTransformationRecipe::catalyst),
|
||||
WeightedList.codec(Codec.STRING.xmap(RecipeUtil::parseBlockState, RecipeUtil::writeBlockState)).fieldOf("byproducts").forGetter(FluidTransformationRecipe::byproducts),
|
||||
WeightedList.codec(Codec.STRING.xmap(RecipeUtil::parseBlockState, RecipeUtil::writeBlockState)).optionalFieldOf("byproducts", WeightedList.empty()).forGetter(FluidTransformationRecipe::byproducts),
|
||||
Codec.INT.fieldOf("duration").forGetter(FluidTransformationRecipe::duration)
|
||||
).apply(instance, FluidTransformationRecipe::new));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, FluidTransformationRecipe> STREAM_CODEC = StreamCodec.of(FluidTransformationRecipe::toNetwork, FluidTransformationRecipe::fromNetwork);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user