Skip to content

Commit

Permalink
I thought the recipes were over...
Browse files Browse the repository at this point in the history
  • Loading branch information
Electro593 committed Feb 3, 2025
1 parent 92742e8 commit e0f72ca
Show file tree
Hide file tree
Showing 360 changed files with 1,681 additions and 1,370 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
@Mixin(RecipeManager.class)
public class RecipeManagerMixin {

//TODO this isn't quite working
@WrapOperation(method = "apply(Ljava/util/Map;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/serialization/Codec;parse(Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;"))
@WrapOperation(method = "apply(Ljava/util/Map;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/serialization/Codec;parse(Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;"), remap = false)
private DataResult<?> injectAdditionalRecipes(Codec<?> instance, DynamicOps<?> dynamicOps, Object data, Operation<DataResult<?>> original, @Local LocalRef<Identifier> identifier, @Local ImmutableMultimap.Builder<RecipeType<?>, RecipeEntry<?>> builder, @Local ImmutableMap.Builder<Identifier, RecipeEntry<?>> builder2) {
DataResult<?> result = original.call(instance, dynamicOps, data);
if (result.result().isPresent() && result.result().get() instanceof IRecipeGenerator recipeGenerator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public record FermentationData(
List<FermentationStatusEffectEntry> statusEffectEntries
) {

public static final FermentationData DEFAULT = new FermentationData(1f, 0.1f, List.of());

public static final Codec<FermentationData> CODEC = RecordCodecBuilder.create(i -> i.group(
Codec.FLOAT.optionalFieldOf("fermentation_speed_mod", 1f).forGetter(FermentationData::fermentationSpeedMod),
Codec.FLOAT.optionalFieldOf("angels_share_percent_per_mc_day", 0.1f).forGetter(FermentationData::angelsSharePercentPerMcDay),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ public FluidIngredient getFluidInput() {

@Override
public float getAngelsSharePerMcDay() {
if (this.fermentationData == null) {
return 0;
}
return this.fermentationData.angelsSharePercentPerMcDay();
}

Expand All @@ -154,12 +151,7 @@ public ItemStack tap(Inventory inventory, long secondsFermented, float downfall)
private ItemStack tapWith(float thickness, long secondsFermented, float downfall) {
ItemStack stack = this.outputItemStack.copy();
stack.setCount(1);

if (this.fermentationData == null) {
return stack;
} else {
return getFermentedStack(this.fermentationData, thickness, secondsFermented, downfall, stack);
}
return getFermentedStack(this.fermentationData, thickness, secondsFermented, downfall, stack);
}

public static ItemStack getFermentedStack(@NotNull FermentationData fermentationData, float thickness, long secondsFermented, float downfall, ItemStack inputStack) {
Expand Down Expand Up @@ -223,7 +215,7 @@ public RecipeSerializer<?> getSerializer() {
// but this way it might be easier for translations either way
public static MutableText getDurationText(int minFermentationTimeHours, FermentationData fermentationData) {
MutableText text;
if (fermentationData == null) {
if (fermentationData.equals(FermentationData.DEFAULT)) {
if (minFermentationTimeHours == 1) {
text = Text.translatable("container.spectrum.rei.titration_barrel.time_hour");
} else if (minFermentationTimeHours == 24) {
Expand Down Expand Up @@ -264,11 +256,11 @@ public static class Serializer implements RecipeSerializer<TitrationBarrelRecipe
Codec.BOOL.optionalFieldOf("secret", false).forGetter(recipe -> recipe.secret),
Identifier.CODEC.optionalFieldOf("required_advancement").forGetter(recipe -> recipe.requiredAdvancementIdentifier),
IngredientStack.Serializer.CODEC.listOf().fieldOf("ingredients").forGetter(recipe -> recipe.inputStacks),
FluidIngredient.CODEC.fieldOf("fluid").forGetter(recipe -> recipe.fluid),
FluidIngredient.CODEC.optionalFieldOf("fluid", FluidIngredient.EMPTY).forGetter(recipe -> recipe.fluid),
ItemStack.VALIDATED_CODEC.fieldOf("result").forGetter(recipe -> recipe.outputItemStack),
Registries.ITEM.getCodec().fieldOf("tapping_item").forGetter(recipe -> recipe.tappingItem),
Codec.INT.fieldOf("min_fermentation_time_hours").forGetter(recipe -> recipe.minFermentationTimeHours),
FermentationData.CODEC.fieldOf("fermentation").forGetter(recipe -> recipe.fermentationData)
Registries.ITEM.getCodec().optionalFieldOf("tapping_item", Items.AIR).forGetter(recipe -> recipe.tappingItem),
Codec.INT.optionalFieldOf("min_fermentation_time_hours", 24).forGetter(recipe -> recipe.minFermentationTimeHours),
FermentationData.CODEC.optionalFieldOf("fermentation", FermentationData.DEFAULT).forGetter(recipe -> recipe.fermentationData)
).apply(i, TitrationBarrelRecipe::new));

private static final PacketCodec<RegistryByteBuf, TitrationBarrelRecipe> PACKET_CODEC = PacketCodecHelper.tuple(
Expand Down
24 changes: 20 additions & 4 deletions src/main/resources/data/minecraft/recipe/cake.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@
"CCC"
],
"key": {
"A": "#c:milk",
"B": "minecraft:sugar",
"C": "minecraft:wheat",
"E": "#c:eggs"
"A": [
{
"tag": "c:milk"
}
],
"B": [
{
"item": "minecraft:sugar"
}
],
"C": [
{
"item": "minecraft:wheat"
}
],
"E": [
{
"tag": "c:eggs"
}
]
},
"result": {
"id": "minecraft:cake"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "cobbled_blackslag",
"ingredient": "spectrum:blackslag",
"ingredient": [
{
"item": "spectrum:blackslag"
}
],
"crushedItemsPerPointOfDamage": 0.8,
"experience": 0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "cobbled_blackslag",
"ingredient": "spectrum:infested_blackslag",
"ingredient": [
{
"item": "spectrum:infested_blackslag"
}
],
"crushedItemsPerPointOfDamage": 0.8,
"experience": 0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "block_cracking",
"ingredient": "spectrum:basalt_bricks",
"ingredient": [
{
"item": "spectrum:basalt_bricks"
}
],
"crushedItemsPerPointOfDamage": 1,
"experience": 0.0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "block_cracking",
"ingredient": "spectrum:basalt_tiles",
"ingredient": [
{
"item": "spectrum:basalt_tiles"
}
],
"crushedItemsPerPointOfDamage": 1,
"experience": 0.0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "block_cracking",
"ingredient": "spectrum:blackslag_bricks",
"ingredient": [
{
"item": "spectrum:blackslag_bricks"
}
],
"crushedItemsPerPointOfDamage": 1,
"experience": 0.0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "block_cracking",
"ingredient": "spectrum:blackslag_tiles",
"ingredient": [
{
"item": "spectrum:blackslag_tiles"
}
],
"crushedItemsPerPointOfDamage": 1,
"experience": 0.0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "block_cracking",
"ingredient": "spectrum:calcite_bricks",
"ingredient": [
{
"item": "spectrum:calcite_bricks"
}
],
"crushedItemsPerPointOfDamage": 1,
"experience": 0.0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "spectrum:anvil_crushing",
"group": "block_cracking",
"ingredient": "spectrum:calcite_tiles",
"ingredient": [
{
"item": "spectrum:calcite_tiles"
}
],
"crushedItemsPerPointOfDamage": 1,
"experience": 0.0,
"result": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"category": "food",
"cookingtime": 600,
"experience": 0.35,
"ingredient": "spectrum:lizard_meat",
"ingredient": [
{
"item": "spectrum:lizard_meat"
}
],
"result": {
"id": "spectrum:cooked_lizard_meat"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"count": 2
},
{
"item": "minecraft:echo_shard",
"count": 1,
"result": {
"id": "minecraft:echo_shard",
"count": 1
},
"chance": 0.25
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
"ingredient": "spectrum:pure_glowstone",
"results": [
{
"id": "minecraft:glowstone_dust",
"count": 4
"result": {
"id": "minecraft:glowstone_dust",
"count": 4
}
},
{
"item": "minecraft:glowstone_dust",
"count": 1,
"result": {
"id": "minecraft:glowstone_dust",
"count": 1
},
"chance": 0.5
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"count": 4
},
{
"item": "minecraft:lapis_lazuli",
"count": 1,
"result": {
"id": "minecraft:lapis_lazuli",
"count": 1
},
"chance": 0.5
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"count": 4
},
{
"item": "minecraft:prismarine_crystals",
"count": 2,
"result": {
"id": "minecraft:prismarine_crystals",
"count": 2
},
"chance": 0.5
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"count": 4
},
{
"item": "minecraft:quartz",
"id": "minecraft:quartz",
"count": 2,
"chance": 0.5
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"count": 4
},
{
"item": "minecraft:redstone",
"count": 2,
"result": {
"id": "minecraft:redstone",
"count": 2
},
"chance": 0.5
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"count": 4
},
{
"item": "minecraft:diamond",
"id": "minecraft:diamond",
"chance": 0.02
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"count": 1
},
{
"item": "minecraft:netherite_scrap",
"id": "minecraft:netherite_scrap",
"chance": 0.5
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"count": 4
},
{
"item": "minecraft:redstone",
"id": "minecraft:redstone",
"chance": 0.5
},
{
"item": "minecraft:glowstone_dust",
"id": "minecraft:glowstone_dust",
"chance": 0.1
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,31 @@
"grows_without_catalyst": false,
"catalysts": [
{
"ingredient": "minecraft:raw_copper",
"ingredient": [
{
"item": "minecraft:raw_copper"
}
],
"growth_acceleration_mod": 7.5,
"ink_consumption_mod": 10.0,
"consume_chance_per_second": 0.05
},
{
"ingredient": "minecraft:copper_ingot",
"ingredient": [
{
"item": "minecraft:copper_ingot"
}
],
"growth_acceleration_mod": 1.0,
"ink_consumption_mod": 0.5,
"consume_chance_per_second": 0.15
},
{
"ingredient": "spectrum:pure_copper",
"ingredient": [
{
"item": "spectrum:pure_copper"
}
],
"growth_acceleration_mod": 1.708,
"ink_consumption_mod": 0.707,
"consume_chance_per_second": 0.01
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,31 @@
"grows_without_catalyst": false,
"catalysts": [
{
"ingredient": "spectrum:bismuth_flake",
"ingredient": [
{
"item": "spectrum:bismuth_flake"
}
],
"growth_acceleration_mod": 8.0,
"ink_consumption_mod": 1.0,
"consume_chance_per_second": 0.2
},
{
"ingredient": "spectrum:stardust",
"ingredient": [
{
"item": "spectrum:stardust"
}
],
"growth_acceleration_mod": 2.0,
"ink_consumption_mod": 0.25,
"consume_chance_per_second": 0.02
},
{
"ingredient": "spectrum:star_fragment",
"ingredient": [
{
"item": "spectrum:star_fragment"
}
],
"growth_acceleration_mod": 1.25,
"ink_consumption_mod": 1.0,
"consume_chance_per_second": 0.0002
Expand Down
Loading

0 comments on commit e0f72ca

Please sign in to comment.