-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d92c26d
commit 5db897d
Showing
16 changed files
with
326 additions
and
25 deletions.
There are no files selected for viewing
8 changes: 5 additions & 3 deletions
8
...fabricaeexnihilo/recipes/milking/cow.json → .../recipes/barrel_crafting/milking/cow.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"type": "fabricaeexnihilo:milking", | ||
"entity": "minecraft:cow", | ||
"fluid": "fabricaeexnihilo:milk", | ||
"amount": 810, | ||
"cooldown": 20 | ||
"cooldown": 20, | ||
"entity": "minecraft:cow", | ||
"fluid": { | ||
"type": "fabricaeexnihilo:milk" | ||
} | ||
} |
8 changes: 5 additions & 3 deletions
8
...bricaeexnihilo/recipes/milking/witch.json → ...ecipes/barrel_crafting/milking/witch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"type": "fabricaeexnihilo:milking", | ||
"entity": "minecraft:witch", | ||
"fluid": "fabricaeexnihilo:witchwater", | ||
"amount": 810, | ||
"cooldown": 20 | ||
"cooldown": 20, | ||
"entity": "minecraft:witch", | ||
"fluid": { | ||
"type": "fabricaeexnihilo:witchwater" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
src/main/java/wraith/fabricaeexnihilo/datagen/builder/recipe/MilkingRecipeJsonBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package wraith.fabricaeexnihilo.datagen.builder.recipe; | ||
|
||
import com.google.gson.JsonObject; | ||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; | ||
import net.minecraft.advancement.criterion.CriterionConditions; | ||
import net.minecraft.data.server.recipe.CraftingRecipeJsonBuilder; | ||
import net.minecraft.data.server.recipe.RecipeJsonProvider; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.recipe.RecipeSerializer; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.Nullable; | ||
import wraith.fabricaeexnihilo.recipe.ModRecipes; | ||
import wraith.fabricaeexnihilo.util.CodecUtils; | ||
|
||
import java.util.function.Consumer; | ||
|
||
@SuppressWarnings("UnstableApiUsage") | ||
public class MilkingRecipeJsonBuilder implements CraftingRecipeJsonBuilder { | ||
private final EntityType<?> entity; | ||
private final FluidVariant fluid; | ||
private long amount = 810; | ||
private int cooldown = 20; | ||
|
||
public MilkingRecipeJsonBuilder(EntityType<?> entity, FluidVariant fluid) { | ||
this.entity = entity; | ||
this.fluid = fluid; | ||
} | ||
|
||
public MilkingRecipeJsonBuilder amount(long amount) { | ||
this.amount = amount; | ||
return this; | ||
} | ||
|
||
public MilkingRecipeJsonBuilder cooldown(int cooldown) { | ||
this.cooldown = cooldown; | ||
return this; | ||
} | ||
|
||
@Override | ||
public CraftingRecipeJsonBuilder criterion(String name, CriterionConditions conditions) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public CraftingRecipeJsonBuilder group(@Nullable String group) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public Item getOutputItem() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Deprecated | ||
@Override | ||
public void offerTo(Consumer<RecipeJsonProvider> exporter) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public void offerTo(Consumer<RecipeJsonProvider> exporter, String recipePath) { | ||
offerTo(exporter, new Identifier(recipePath)); | ||
} | ||
|
||
@Override | ||
public void offerTo(Consumer<RecipeJsonProvider> exporter, Identifier recipeId) { | ||
exporter.accept(new MilkingRecipeJsonProvider(entity, fluid, amount, cooldown, recipeId)); | ||
} | ||
|
||
private record MilkingRecipeJsonProvider(EntityType<?> entity, | ||
FluidVariant fluid, | ||
long amount, | ||
int cooldown, | ||
Identifier id) implements RecipeJsonProvider { | ||
|
||
@Override | ||
public void serialize(JsonObject json) { | ||
json.addProperty("entity", Registries.ENTITY_TYPE.getId(entity).toString()); | ||
json.add("fluid", CodecUtils.toJson(CodecUtils.FLUID_VARIANT, fluid)); | ||
json.addProperty("amount", amount); | ||
json.addProperty("cooldown", cooldown); | ||
} | ||
|
||
@Override | ||
public Identifier getRecipeId() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public RecipeSerializer<?> getSerializer() { | ||
return ModRecipes.MILKING_SERIALIZER; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public JsonObject toAdvancementJson() { | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Identifier getAdvancementId() { | ||
return null; | ||
} | ||
} | ||
} |
Oops, something went wrong.