bang on #253. this in no way fixes it and i'm halfway convinced it's a FD error

This commit is contained in:
gamma-delta 2022-09-22 09:18:19 -05:00
parent 2e45a02298
commit 4acfc707a7
12 changed files with 137 additions and 132 deletions

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.datagen;
import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient;
import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.crafting.Ingredient;
@ -27,7 +27,7 @@ public interface IXplatIngredients {
Ingredient whenModIngredient(Ingredient defaultIngredient, String modid, Ingredient modIngredient);
ToolIngredient axeStrip();
FarmersDelightToolIngredient axeStrip();
ToolIngredient axeDig();
FarmersDelightToolIngredient axeDig();
}

View file

@ -22,144 +22,144 @@ import java.util.List;
import java.util.function.Consumer;
public class FarmersDelightCuttingRecipeBuilder implements RecipeBuilder {
private String group = "";
private final List<ProcessingOutput> outputs = Lists.newArrayList();
private Ingredient input;
private ToolIngredient toolAction;
private SoundEvent sound;
private String group = "";
private final List<ProcessingOutput> outputs = Lists.newArrayList();
private Ingredient input;
private FarmersDelightToolIngredient toolAction;
private SoundEvent sound;
@Override
public FarmersDelightCuttingRecipeBuilder unlockedBy(String s, CriterionTriggerInstance criterionTriggerInstance) {
return this;
}
@Override
public FarmersDelightCuttingRecipeBuilder unlockedBy(String s, CriterionTriggerInstance criterionTriggerInstance) {
return this;
}
@Override
public @NotNull FarmersDelightCuttingRecipeBuilder group(@Nullable String name) {
group = name;
return this;
}
@Override
public @NotNull FarmersDelightCuttingRecipeBuilder group(@Nullable String name) {
group = name;
return this;
}
@Override
public Item getResult() {
return Items.AIR; // Irrelevant, we implement serialization ourselves
}
@Override
public Item getResult() {
return Items.AIR; // Irrelevant, we implement serialization ourselves
}
public FarmersDelightCuttingRecipeBuilder withInput(ItemLike item) {
return withInput(Ingredient.of(item));
}
public FarmersDelightCuttingRecipeBuilder withInput(ItemLike item) {
return withInput(Ingredient.of(item));
}
public FarmersDelightCuttingRecipeBuilder withInput(ItemStack stack) {
return withInput(Ingredient.of(stack));
}
public FarmersDelightCuttingRecipeBuilder withInput(ItemStack stack) {
return withInput(Ingredient.of(stack));
}
public FarmersDelightCuttingRecipeBuilder withInput(Ingredient ingredient) {
this.input = ingredient;
return this;
}
public FarmersDelightCuttingRecipeBuilder withInput(Ingredient ingredient) {
this.input = ingredient;
return this;
}
public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output) {
return withOutput(1f, output, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output) {
return withOutput(1f, output, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output) {
return withOutput(chance, output, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output) {
return withOutput(chance, output, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output, int count) {
return withOutput(1f, output, count);
}
public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output, int count) {
return withOutput(1f, output, count);
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output, int count) {
return withOutput(new ItemStack(output, count), chance);
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output, int count) {
return withOutput(new ItemStack(output, count), chance);
}
public FarmersDelightCuttingRecipeBuilder withOutput(ItemStack output, float chance) {
this.outputs.add(new ItemProcessingOutput(output, chance));
return this;
}
public FarmersDelightCuttingRecipeBuilder withOutput(ItemStack output, float chance) {
this.outputs.add(new ItemProcessingOutput(output, chance));
return this;
}
public FarmersDelightCuttingRecipeBuilder withOutput(String name) {
return withOutput(1f, name, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(String name) {
return withOutput(1f, name, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(String name, int count) {
return withOutput(1f, name, count);
}
public FarmersDelightCuttingRecipeBuilder withOutput(String name, int count) {
return withOutput(1f, name, count);
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name) {
return withOutput(chance, name, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name) {
return withOutput(chance, name, 1);
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name, int count) {
this.outputs.add(new CompatProcessingOutput(name, count, chance));
return this;
}
public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name, int count) {
this.outputs.add(new CompatProcessingOutput(name, count, chance));
return this;
}
public FarmersDelightCuttingRecipeBuilder withTool(ToolIngredient ingredient) {
this.toolAction = ingredient;
return this;
}
public FarmersDelightCuttingRecipeBuilder withTool(FarmersDelightToolIngredient ingredient) {
this.toolAction = ingredient;
return this;
}
public FarmersDelightCuttingRecipeBuilder withSound(SoundEvent sound) {
this.sound = sound;
return this;
}
public FarmersDelightCuttingRecipeBuilder withSound(SoundEvent sound) {
this.sound = sound;
return this;
}
@Override
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation resourceLocation) {
consumer.accept(new CuttingRecipe(resourceLocation));
}
@Override
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation resourceLocation) {
consumer.accept(new CuttingRecipe(resourceLocation));
}
public class CuttingRecipe implements FinishedRecipe {
public class CuttingRecipe implements FinishedRecipe {
private final ResourceLocation id;
private final ResourceLocation id;
public CuttingRecipe(ResourceLocation id) {
this.id = id;
}
public CuttingRecipe(ResourceLocation id) {
this.id = id;
}
@Override
public void serializeRecipeData(@NotNull JsonObject json) {
json.addProperty("type", "farmersdelight:cutting");
@Override
public void serializeRecipeData(@NotNull JsonObject json) {
json.addProperty("type", "farmersdelight:cutting");
if (!group.isEmpty()) {
json.addProperty("group", group);
}
if (!group.isEmpty()) {
json.addProperty("group", group);
}
JsonArray jsonIngredients = new JsonArray();
JsonArray jsonOutputs = new JsonArray();
JsonArray jsonIngredients = new JsonArray();
JsonArray jsonOutputs = new JsonArray();
jsonIngredients.add(input.toJson());
jsonIngredients.add(input.toJson());
outputs.forEach(o -> jsonOutputs.add(o.serialize()));
outputs.forEach(o -> jsonOutputs.add(o.serialize()));
json.add("ingredients", jsonIngredients);
json.add("tool", toolAction.serialize());
json.add("result", jsonOutputs);
json.add("ingredients", jsonIngredients);
json.add("tool", toolAction.serialize());
json.add("result", jsonOutputs);
if (sound != null) {
json.addProperty("sound", Registry.SOUND_EVENT.getKey(sound).toString());
}
}
if (sound != null) {
json.addProperty("sound", Registry.SOUND_EVENT.getKey(sound).toString());
}
}
@Override
public @NotNull ResourceLocation getId() {
return id;
}
@Override
public @NotNull ResourceLocation getId() {
return id;
}
@Override
public @NotNull RecipeSerializer<?> getType() {
return RecipeSerializer.SHAPELESS_RECIPE; // Irrelevant, we implement serialization ourselves
}
@Override
public @NotNull RecipeSerializer<?> getType() {
return RecipeSerializer.SHAPELESS_RECIPE; // Irrelevant, we implement serialization ourselves
}
@Override
public JsonObject serializeAdvancement() {
return null;
}
@Override
public JsonObject serializeAdvancement() {
return null;
}
@Override
public ResourceLocation getAdvancementId() {
return null;
}
}
@Override
public ResourceLocation getAdvancementId() {
return null;
}
}
}

View file

@ -2,6 +2,6 @@ package at.petrak.hexcasting.datagen.recipe.builders;
import com.google.gson.JsonObject;
public interface ToolIngredient {
public interface FarmersDelightToolIngredient {
JsonObject serialize();
}

View file

@ -4,7 +4,7 @@ fabricLoaderVersion=0.14.5
fiberVersion=0.23.0-2
cardinalComponentsVersion=4.2.0
serializationHooksVersion=0.1.0+1.18.095e8a6
serializationHooksVersion=0.3.24
reiVersion=8.0.442
emiVersion=0.1.0+1.18.2

View file

@ -64,13 +64,13 @@ fa04d5bc32f5646cd67bc8e8b572bdb7849b735e data\hexcasting\recipes\akashic_bookshe
3f9756b2c5137b285c4faa88ab43c4996b6b2bb6 data\hexcasting\recipes\ancient_scroll_paper_lantern.json
1157a6545ece0e2b8734b8a1428f9a3c021c8b73 data\hexcasting\recipes\wand_akashic.json
2c542a616b312e41537fb25a2362877dd50d2692 data\hexcasting\recipes\akashic_connector.json
ffe8e09c41222b5b909626436dbd7099e01ccc64 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_door.json
23ce84fdf212622afcb49f059d1362ae47a89b29 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_door.json
2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data\minecraft\tags\blocks\pressure_plates.json
1ba431aef086bb60bfe8fe01b4d2bf5dfb7593c4 data\hexcasting\loot_tables\blocks\impetus_look.json
f3e78a96f17dc5ed54047bb24be58dbf3151c8fa data\hexcasting\advancements\recipes\hexcasting.creative_tab\ancient_scroll_paper_lantern.json
fc57d15e9f9f11347a2170dd06053954345368d2 data\hexcasting\advancements\recipes\hexcasting.creative_tab\lens.json
5c471f81cc168826f1652a39a71aeb85e786ea16 data\hexcasting\recipes\scroll_paper_lantern.json
4d8667ebdad42e7220009f69a1f6f465a73b2a9a data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_wood.json
47adb42c3e28de093c673588904ddf5056db2c27 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_wood.json
9d4704f96cc4cfa3275092fb58ff90c98449abe3 data\hexcasting\loot_tables\blocks\ancient_scroll_paper.json
ab5d271371323d93ff6eed18179ee4f7fd8c939c data\hexcasting\recipes\brainsweep\impetus_rightclick.json
48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data\minecraft\tags\items\slabs.json
@ -104,7 +104,7 @@ c11dc4388c18dadff5d93126eb0f7ae848d627b9 data\hexcasting\advancements\recipes\br
186dc05888e66e17af0217bd0680648dc3da3968 data\hexcasting\recipes\dye_colorizer_orange.json
d3ad9a9e92dd125f872d9671930d4e57f24894ed data\hexcasting\recipes\pride_colorizer_demigirl.json
2ad42dd4a4877a23cb7f45e8b75c9f53f58d12f5 data\hexcasting\recipes\wand_acacia.json
77afbbd8280136eb11d1aab1219d6057063e8f75 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_trapdoor.json
da367b70498fdf51c87238322537ddfbf26809d3 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_trapdoor.json
2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data\minecraft\tags\items\wooden_pressure_plates.json
ce79c9e183b57bfbdb75cd074d7ff6e48894d05c data\hexcasting\loot_tables\blocks\akashic_connector.json
d7213631b2f9075c9bdef0d5a48ca28f85f5a090 data\hexcasting\advancements\recipes\hexcasting.creative_tab\scroll_paper.json
@ -195,7 +195,7 @@ e5ae652aee1567ac2e626fa0f88f160993a6f9a5 data\hexcasting\advancements\recipes\he
c25784941d6416744fb2ca2d43a3203e5c3e7c8a data\minecraft\tags\blocks\leaves.json
ef016ca292fa4edc7496b64e6f2931f4e7d90636 data\hexcasting\recipes\amethyst_dust_packing.json
cd7e618d7c08ffff67683852f799362fb8aaebaf data\hexcasting\recipes\pride_colorizer_nonbinary.json
b8825decc5079bbe72c8a189e36bda2efefaf26f data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_log.json
11c4b7fb3901161324a952ff0760f5d52e1c2c26 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_log.json
f7bbc60f547a02378ddb1f23395add4822725fed data\hexcasting\recipes\wand_oak.json
3fe1fcf17e1e25aebede47c537f92888330ccf9f data\hexcasting\advancements\recipes\hexcasting.creative_tab\abacus.json
2d80cb505efc0ba0d34d1768413128fcda17630f data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_demigirl.json

View file

@ -7,7 +7,7 @@
],
"tool": {
"type": "farmersdelight:tool",
"tag": "fabric:tools/axes"
"tag": "c:tools/axes"
},
"result": [
{

View file

@ -7,7 +7,7 @@
],
"tool": {
"type": "farmersdelight:tool",
"tag": "fabric:tools/axes"
"tag": "c:tools/axes"
},
"result": [
{

View file

@ -7,7 +7,7 @@
],
"tool": {
"type": "farmersdelight:tool",
"tag": "fabric:tools/axes"
"tag": "c:tools/axes"
},
"result": [
{

View file

@ -7,7 +7,7 @@
],
"tool": {
"type": "farmersdelight:tool",
"tag": "fabric:tools/axes"
"tag": "c:tools/axes"
},
"result": [
{

View file

@ -6,7 +6,7 @@ import at.petrak.hexcasting.datagen.HexItemTagProvider;
import at.petrak.hexcasting.datagen.HexLootTables;
import at.petrak.hexcasting.datagen.IXplatIngredients;
import at.petrak.hexcasting.datagen.recipe.HexplatRecipes;
import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient;
import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient;
import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient;
import at.petrak.hexcasting.xplat.IXplatAbstractions;
import com.google.gson.JsonObject;
@ -121,20 +121,20 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint {
return FabricModConditionalIngredient.of(defaultIngredient, modid, modIngredient);
}
private final ToolIngredient AXE_INGREDIENT = () -> {
private final FarmersDelightToolIngredient AXE_INGREDIENT = () -> {
JsonObject object = new JsonObject();
object.addProperty("type", "farmersdelight:tool");
object.addProperty("tag", "fabric:tools/axes");
object.addProperty("tag", "c:tools/axes");
return object;
};
@Override
public ToolIngredient axeStrip() {
public FarmersDelightToolIngredient axeStrip() {
return AXE_INGREDIENT;
}
@Override
public ToolIngredient axeDig() {
public FarmersDelightToolIngredient axeDig() {
return AXE_INGREDIENT;
}
};

View file

@ -253,8 +253,9 @@ public class FabricXplatImpl implements IXplatAbstractions {
@SuppressWarnings("UnstableApiUsage")
public boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, Fluid fluid) {
Storage<FluidVariant> target = FluidStorage.SIDED.find(level, pos, Direction.UP);
if (target == null)
if (target == null) {
return false;
}
try (Transaction transaction = Transaction.openOuter()) {
long insertedAmount = target.insert(FluidVariant.of(fluid), FluidConstants.BUCKET, transaction);
if (insertedAmount > 0) {
@ -269,8 +270,9 @@ public class FabricXplatImpl implements IXplatAbstractions {
@SuppressWarnings("UnstableApiUsage")
public boolean drainAllFluid(Level level, BlockPos pos) {
Storage<FluidVariant> target = FluidStorage.SIDED.find(level, pos, Direction.UP);
if (target == null)
if (target == null) {
return false;
}
try (Transaction transaction = Transaction.openOuter()) {
boolean any = false;
for (var view : target.iterable(transaction)) {
@ -396,7 +398,8 @@ public class FabricXplatImpl implements IXplatAbstractions {
@Override
public boolean isBreakingAllowed(Level world, BlockPos pos, BlockState state, Player player) {
return PlayerBlockBreakEvents.BEFORE.invoker().beforeBlockBreak(world, player, pos, state, world.getBlockEntity(pos));
return PlayerBlockBreakEvents.BEFORE.invoker()
.beforeBlockBreak(world, player, pos, state, world.getBlockEntity(pos));
}
@Override
@ -431,4 +434,5 @@ public class FabricXplatImpl implements IXplatAbstractions {
}
return PEHKUI_API;
}
}

View file

@ -3,7 +3,7 @@ package at.petrak.hexcasting.forge.datagen;
import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.datagen.*;
import at.petrak.hexcasting.datagen.recipe.HexplatRecipes;
import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient;
import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient;
import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels;
import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels;
import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient;
@ -128,8 +128,9 @@ public class HexForgeDataGenerators {
return ForgeModConditionalIngredient.of(defaultIngredient, modid, modIngredient);
}
// https://github.com/vectorwing/FarmersDelight/blob/1.18.2/src/generated/resources/data/farmersdelight/recipes/cutting/amethyst_block.json
@Override
public ToolIngredient axeStrip() {
public FarmersDelightToolIngredient axeStrip() {
return () -> {
JsonObject object = new JsonObject();
object.addProperty("type", "farmersdelight:tool_action");
@ -139,7 +140,7 @@ public class HexForgeDataGenerators {
}
@Override
public ToolIngredient axeDig() {
public FarmersDelightToolIngredient axeDig() {
return () -> {
JsonObject object = new JsonObject();
object.addProperty("type", "farmersdelight:tool_action");