First Machine Age's Mods (Combined repo.)
Revisão | 25abc26f8951b59c6d592168a898d484bf79e57c (tree) |
---|---|
Hora | 2021-08-10 07:34:08 |
Autor | ![]() |
Commiter | melchior |
a Fix for incorrect Recipie validation
should resolve incorrect recipie matches
(affects only shapeless ones...?)
@@ -0,0 +1,32 @@ | ||
1 | +using System; | |
2 | + | |
3 | +using ProtoBuf; | |
4 | + | |
5 | +namespace AnvilMetalRecovery | |
6 | +{ | |
7 | + [ProtoContract(ImplicitFields = ImplicitFields.None)] | |
8 | + public class AMRConfig | |
9 | + { | |
10 | + public AMRConfig( ) | |
11 | + { | |
12 | + ToolFragmentRecovery = true; | |
13 | + VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault; | |
14 | + } | |
15 | + | |
16 | + [ProtoMember(1)] | |
17 | + public bool ToolFragmentRecovery; | |
18 | + | |
19 | + [ProtoMember(2)] | |
20 | + public float VoxelEquivalentValue; | |
21 | + | |
22 | + | |
23 | + [ProtoAfterDeserialization] | |
24 | + private void ClampRange( ) | |
25 | + { | |
26 | + VoxelEquivalentValue = Math.Max(1f, Math.Min(VoxelEquivalentValue, MetalRecoverySystem.IngotVoxelDefault)); | |
27 | + } | |
28 | + | |
29 | + | |
30 | + } | |
31 | +} | |
32 | + |
@@ -157,7 +157,7 @@ namespace AnvilMetalRecovery | ||
157 | 157 | api.Logger.VerboseDebug("MatchesForCrafting::'{0}'", this.Code); |
158 | 158 | #endif |
159 | 159 | |
160 | - if (inputStack != null) { | |
160 | + if (inputStack != null && inputStack.Class == EnumItemClass.Item && inputStack.Item.Code == this.Code) { | |
161 | 161 | var metalCode = MetalCode(inputStack); |
162 | 162 | var metalUnits = MetalQuantity(inputStack); |
163 | 163 |
@@ -167,10 +167,12 @@ namespace AnvilMetalRecovery | ||
167 | 167 | gridRecipe.Output.Quantity = ( int )(Math.Round(metalUnits * AnvilMetalRecoveryMod.CachedConfiguration.VoxelEquivalentValue) / 5); |
168 | 168 | gridRecipe.Output.Code = metalBits.Code; |
169 | 169 | gridRecipe.Output.Resolve(api.World, "VariableMetalItem_crafting"); |
170 | - } | |
170 | + | |
171 | + return true; | |
172 | + } | |
171 | 173 | } |
172 | 174 | |
173 | - return true; | |
175 | + return false; | |
174 | 176 | } |
175 | 177 | } |
176 | 178 | } |
@@ -0,0 +1,11 @@ | ||
1 | +{ | |
2 | + ingredientPattern: "C I", | |
3 | + recipeGroup: 1, | |
4 | + ingredients: { | |
5 | + "C": { type: "item", code: "game:chisel-*", isTool: true, toolDurabilityCost: 5}, | |
6 | + "I": { type: "item", code: "metal_fragments", name: "metal" } | |
7 | + }, | |
8 | + width: 1, | |
9 | + height: 2, | |
10 | + output: { type: "item", code: "game:metalbit-copper", quantity: 0 } | |
11 | +} | |
\ No newline at end of file |
@@ -4,7 +4,7 @@ | ||
4 | 4 | "description" : "Get back lost scrap and smithing discards. Plus more.", |
5 | 5 | "authors": ["Melchior"], |
6 | 6 | "ModID":"metalrecovery", |
7 | - "version": "0.1.13", | |
7 | + "version": "0.1.14", | |
8 | 8 | "dependencies": { |
9 | 9 | "game": "1.15.3", |
10 | 10 | "survival": "" |