From 5fbdd9167463667282c0a7806de1f028d1eea8d1 Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Thu, 3 Oct 2024 21:16:41 +0200 Subject: [PATCH] Fix Upgrade Core recipe (Fixes #104) --- .../.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 ++-- .../recipe/transmutation/upgrade_core.json | 4 +--- .../datagen/data/ForceRecipeProvider.java | 4 ++-- .../forcecraft/recipe/TransmutationRecipe.java | 13 +++++++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index f3ba73e7..8b33618e 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.21.1 2024-09-27T23:05:17.3373723 Recipes +// 1.21.1 2024-10-03T21:15:00.664536 Recipes 3e6d620f7add54f0a4894209d84ba72c8bebe1ca data/forcecraft/advancement/recipes/building_blocks/force_black_torch.json 9c1f7e54da6ecd6a41cec7802d0c30a0c915b7c1 data/forcecraft/advancement/recipes/building_blocks/force_blue_torch.json d82ae03117d94de897534994565aceca4eafb713 data/forcecraft/advancement/recipes/building_blocks/force_brick.json @@ -630,7 +630,7 @@ c33a3ca56210bbe9f112551d612e3a365fd391be data/forcecraft/recipe/transmutation/st 8e8ad90aa1dd22b531e26eb610da20d2e5d1bd8c data/forcecraft/recipe/transmutation/stick_from_wooden_sword.json e29e842cc19006d27f61ec181abd1c73f98e3f8e data/forcecraft/recipe/transmutation/string_from_bow.json 6ea4032498758de24d685a9ad0afcead6fbb762a data/forcecraft/recipe/transmutation/tripwire_hook_from_crossbow.json -73e50e1fd1ce94f55236bc21a06a71b65516eae9 data/forcecraft/recipe/transmutation/upgrade_core.json +b2ac238f265edc5d2d7a4dc9ebb29c154abbff45 data/forcecraft/recipe/transmutation/upgrade_core.json 49d7fe867a7c70e5ff289e7220f74a67bd81d3d7 data/forcecraft/recipe/transmutation/upgrade_tome.json e0dfc55d30600af7fe71289e372f2cf255025e4d data/forcecraft/recipe/treasure_core.json 2f986aa5a44c0cde4b444444f28c194879ab9068 data/forcecraft/recipe/white_force_furnace_from_dye.json diff --git a/src/generated/resources/data/forcecraft/recipe/transmutation/upgrade_core.json b/src/generated/resources/data/forcecraft/recipe/transmutation/upgrade_core.json index 73192cf7..f1c0a6df 100644 --- a/src/generated/resources/data/forcecraft/recipe/transmutation/upgrade_core.json +++ b/src/generated/resources/data/forcecraft/recipe/transmutation/upgrade_core.json @@ -6,9 +6,7 @@ }, { "type": "neoforge:components", - "components": { - "forcecraft:tome_experience": 100 - }, + "components": {}, "items": "forcecraft:experience_tome" } ], diff --git a/src/main/java/com/mrbysco/forcecraft/datagen/data/ForceRecipeProvider.java b/src/main/java/com/mrbysco/forcecraft/datagen/data/ForceRecipeProvider.java index 0b6804d4..36c4bb5e 100644 --- a/src/main/java/com/mrbysco/forcecraft/datagen/data/ForceRecipeProvider.java +++ b/src/main/java/com/mrbysco/forcecraft/datagen/data/ForceRecipeProvider.java @@ -1773,8 +1773,8 @@ private void addTransmutationRecipes(RecipeOutput output) { .save(output, Reference.modLoc("transmutation/upgrade_tome")); TransmutationRecipeBuilder.transmutation(ForceRegistry.UPGRADE_CORE.get()) - .requires(DataComponentIngredient.of(false, DataComponentPredicate.builder() - .expect(ForceComponents.TOME_EXPERIENCE.get(), 100).build(), ForceRegistry.EXPERIENCE_TOME.get())) + .requires(DataComponentIngredient.of(false, DataComponentPredicate.builder().build(), + ForceRegistry.EXPERIENCE_TOME.get())) .unlockedBy("has_experience_tome", has(ForceRegistry.EXPERIENCE_TOME.get())) .save(output, Reference.modLoc("transmutation/upgrade_core")); diff --git a/src/main/java/com/mrbysco/forcecraft/recipe/TransmutationRecipe.java b/src/main/java/com/mrbysco/forcecraft/recipe/TransmutationRecipe.java index 064ff9c1..ebd4313a 100644 --- a/src/main/java/com/mrbysco/forcecraft/recipe/TransmutationRecipe.java +++ b/src/main/java/com/mrbysco/forcecraft/recipe/TransmutationRecipe.java @@ -87,14 +87,16 @@ public boolean matches(CraftingInput inv, Level level) { else inputs.add(itemstack); } else { if (itemstack.getItem() instanceof ExperienceTomeItem) { - if (itemstack.has(ForceComponents.TOME_EXPERIENCE) && itemstack.getOrDefault(ForceComponents.TOME_EXPERIENCE, 0) < 100) { + int experience = itemstack.getOrDefault(ForceComponents.TOME_EXPERIENCE, 0); + + if (itemstack.has(ForceComponents.TOME_EXPERIENCE) && experience < 100) { return false; } else { ItemStack experienceTome = new ItemStack(ForceRegistry.EXPERIENCE_TOME.get()); - itemstack.set(ForceComponents.TOME_EXPERIENCE, 100); + itemstack.set(ForceComponents.TOME_EXPERIENCE, experience); if (isSimple) stackedContents.accountStack(experienceTome, 1); - else inputs.add(experienceTome); + else inputs.add(itemstack); } } else { if (!itemstack.isDamaged()) { @@ -107,7 +109,10 @@ public boolean matches(CraftingInput inv, Level level) { } } - return stacks == this.ingredients.size() && (isSimple ? stackedContents.canCraft(this, (IntList) null) : RecipeMatcher.findMatches(inputs, this.ingredients) != null); + return stacks == this.ingredients.size() && (isSimple ? + stackedContents.canCraft(this, (IntList) null) : + RecipeMatcher.findMatches(inputs, this.ingredients) != null + ); } @Override