• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

First Machine Age's Mods (Combined repo.)


Commit MetaInfo

Révisionb46e1569559926fa4b091f9baa49663a627914b8 (tree)
l'heure2023-05-07 04:08:52
Auteurmelchior <melchior@user...>
Commitermelchior

Message de Log

Updates for 1.18 W.I.P. Set I

Change Summary

Modification

--- a/AnvilMetalRecovery/AnvilMetalRecovery.csproj
+++ b/AnvilMetalRecovery/AnvilMetalRecovery.csproj
@@ -88,6 +88,7 @@
8888 <Compile Include="Data\RecoveryEntryTable.cs" />
8989 <Compile Include="BlockBehaviors\MoldDestructionRecovererBehavior.cs" />
9090 <Compile Include="Harmony\WateringCanDaptor.cs" />
91+ <Compile Include="Data\MetalInfo.cs" />
9192 </ItemGroup>
9293 <ItemGroup>
9394 <None Include="modinfo.json">
@@ -130,6 +131,8 @@
130131 <None Include="assets\fma\patches\wateringcan_behavior.json">
131132 </None>
132133 <None Include="Blocks\BlockWateringCanPlus.cs" />
134+ <None Include="assets\fma\patches\old_item_remapping.json">
135+ </None>
133136 </ItemGroup>
134137 <ItemGroup>
135138 <Folder Include="assets\" />
--- a/AnvilMetalRecovery/BlockBehaviors/MoldDestructionRecovererBehavior.cs
+++ b/AnvilMetalRecovery/BlockBehaviors/MoldDestructionRecovererBehavior.cs
@@ -77,7 +77,7 @@ namespace AnvilMetalRecovery
7777
7878 internal void SpawnMetalBits(IWorldAccessor world, BlockPos pos, int unitQuantity, string baseMetalCode)
7979 {
80- if (unitQuantity > 0)
80+ if (unitQuantity > 0 && pos != null && !string.IsNullOrEmpty(baseMetalCode))
8181 {
8282 int shavingQty = unitQuantity / shavingValue;
8383 Item metalShavingsItem = world.Api.World.GetItem(MetalBits_partial.AppendPathVariant(baseMetalCode));
--- a/AnvilMetalRecovery/Data/AMR_Config.cs
+++ b/AnvilMetalRecovery/Data/AMR_Config.cs
@@ -14,14 +14,14 @@ namespace AnvilMetalRecovery
1414 {
1515 ToolFragmentRecovery = true;
1616 VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
17- ToolRecoveryRate = 0.95f;
17+ ToolRecoveryRate = 0.85f;
1818 }
1919
2020 public AMRConfig(bool setDefaultBL)
2121 {
2222 ToolFragmentRecovery = true;
2323 VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
24- ToolRecoveryRate = 0.95f;
24+ ToolRecoveryRate = 0.85f;
2525 if (setDefaultBL) {
2626 BlackList = new List<AssetLocation> {
2727 new AssetLocation(@"game:metalplate"),
--- /dev/null
+++ b/AnvilMetalRecovery/Data/MetalInfo.cs
@@ -0,0 +1,41 @@
1+using System;
2+using System.ComponentModel;
3+
4+using Newtonsoft.Json;
5+
6+namespace AnvilMetalRecovery
7+{
8+ //Too outdated for...: [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
9+ [JsonObject(MemberSerialization.OptIn)]
10+ public struct MetalInfo
11+ {
12+ [JsonProperty("code", Required = Required.Always)]
13+ public readonly string Code;
14+
15+ [JsonProperty("meltPoint")]
16+ [DefaultValue(1000f)]
17+ public readonly float MeltingPoint;
18+
19+ [JsonProperty("boilPoint")]
20+ [DefaultValue(100f)]
21+ public readonly float BoilingPoint;
22+
23+ [JsonIgnore]
24+ [DefaultValue(30)]
25+ public int MeltingDuration;
26+
27+ [JsonProperty("density")]
28+ [DefaultValue(10000f)]
29+ public readonly float Density;
30+
31+ [JsonProperty("specificHeatCapacity")]
32+ [DefaultValue(1f)]
33+ public readonly float SpecificHeatCapacity;
34+
35+ [JsonProperty("elemental")]
36+ public readonly bool Elemental;
37+
38+ [JsonProperty("tier")]
39+ public readonly int Tier;
40+ }
41+}
\ No newline at end of file
--- a/AnvilMetalRecovery/Data/RecoveryEntry.cs
+++ b/AnvilMetalRecovery/Data/RecoveryEntry.cs
@@ -1,27 +1,69 @@
11 using System;
2+using System.Collections;
3+using System.Collections.Generic;
4+using System.Linq;
25
36 using Vintagestory.API.Common;
47
58 namespace AnvilMetalRecovery
69 {
7- public struct RecoveryEntry
10+ public class RecoveryEntry
811 {
912 public readonly AssetLocation CollectableCode;
10- public AssetLocation IngotCode;
13+ public Dictionary<AssetLocation, uint> MaterialComposition;//e.g. 50x Ingot-Copper, 10x Ingot-Zinc...
14+
15+ public AssetLocation PrimaryMaterial
16+ {
17+ get {
18+ return MaterialComposition.First().Key;
19+ }
20+ }
21+
22+ public uint FirstQuantity {
23+ get
24+ {
25+ return MaterialComposition.First( ).Value;
26+ }
27+ }
28+
29+ public uint TotalQuantity
30+ {
31+ get
32+ {
33+ return ( uint )MaterialComposition.Sum(mt => mt.Value);
34+ }
35+ }
36+
37+ public bool MultiComponent
38+ {
39+ get
40+ {
41+ return MaterialComposition.Count > 1;
42+ }
43+ }
44+
1145 /// <summary>
12- /// Metal Quantity (VOXELS)
46+ /// Initializes a singluar entry recovery entry for 1:1 items
1347 /// </summary>
14- public uint Quantity;
15- public float Melting_Duration;//TODO: Replace with 1.17 MetalAlloy mappings
16- public int Melting_Point;//TODO: Replace with 1.17 MetalAlloy mappings
17-
18- public RecoveryEntry(AssetLocation coll, AssetLocation ingot, uint qty, float dur, int point)
48+ /// <param name="coll">Coll.</param>
49+ /// <param name="ingot">Ingot.</param>
50+ /// <param name="qty">Qty.</param>
51+ public RecoveryEntry(AssetLocation coll, AssetLocation ingot, uint qty)
1952 {
2053 CollectableCode = coll.Clone();
21- IngotCode = ingot.Clone();
22- Quantity = qty;
23- Melting_Duration = dur;
24- Melting_Point = point;
54+ MaterialComposition = new Dictionary<AssetLocation, uint>( );
55+ MaterialComposition.Add(ingot, qty);
56+ }
57+
58+ /// <summary>
59+ /// Initializes a singluar entry recovery entry for 1:2 items
60+ /// </summary>
61+ public RecoveryEntry(AssetLocation coll, AssetLocation ingotA, uint qtyA,AssetLocation ingotB, uint qtyB)
62+ {
63+ CollectableCode = coll.Clone( );
64+ MaterialComposition = new Dictionary<AssetLocation, uint>( );
65+ MaterialComposition.Add(ingotA, qtyA);
66+ MaterialComposition.Add(ingotB, qtyB);
2567 }
2668 }
2769 }
--- a/AnvilMetalRecovery/Harmony/AnvilDaptor.cs
+++ b/AnvilMetalRecovery/Harmony/AnvilDaptor.cs
@@ -91,6 +91,8 @@ namespace AnvilMetalRecovery.Patches
9191 if (anvil.BaseMaterial != null && anvil.SplitCount > 0)
9292 {
9393 dsc.AppendFormat("[ {0} ] : {1} × {2}\n", anvil.SplitCount, Lang.GetUnformatted($"game:item-metalbit-{anvil.BaseMetal}"), anvil.ShavingQuantity);
94+ } else if (anvil.IsShavable == false) {
95+ dsc.AppendLine( Lang.GetUnformatted($"fma:cant_recover"));
9496 }
9597 }
9698
@@ -317,13 +319,13 @@ namespace AnvilMetalRecovery.Patches
317319 if (itemToVoxelLookup.ContainsKey(bea.SelectedRecipe.Output.Code)) {
318320 var result = itemToVoxelLookup[bea.SelectedRecipe.Output.Code];
319321 #if DEBUG
320- Logger.VerboseDebug("(old) Selected Recipe: {0} base-material: '{1}' worth {2} units; spawning", bea.SelectedRecipe.Output.Code, result.IngotCode, result.Quantity);
322+ Logger.VerboseDebug("(old) Selected Recipe: {0} base-material: '{1}' worth {2} units; spawning", bea.SelectedRecipe.Output.Code, result.PrimaryMaterial, result.TotalQuantity);
321323 #endif
322324
323- int shavingQty = ( int )(result.Quantity / MetalRecoverySystem.IngotVoxelDefault);
325+ int shavingQty = ( int )(result.TotalQuantity / MetalRecoverySystem.IngotVoxelDefault);
324326
325327 if (shavingQty > 0) {
326- Item metalShavingsItem = World.GetItem(MetalShavingsCode.AppendPathVariant(result.IngotCode.PathEnding()));
328+ Item metalShavingsItem = World.GetItem(MetalShavingsCode.AppendPathVariant(result.PrimaryMaterial.PathEnding()));
327329
328330 if (metalShavingsItem != null) {
329331 ItemStack metalShavingsStack = new ItemStack(metalShavingsItem, shavingQty);
--- a/AnvilMetalRecovery/Items/VariableMetalItem.cs
+++ b/AnvilMetalRecovery/Items/VariableMetalItem.cs
@@ -14,6 +14,7 @@ namespace AnvilMetalRecovery
1414 public class VariableMetalItem : Item
1515 {
1616 private const string default_IngotCode = @"game:ingot-copper";
17+ private const string default_MetalbitCode = @"metalbit-";
1718 private const string metalQuantityKey = @"metalQuantity";
1819 private const string metalIngotCodeKey = @"metalIngotCode";
1920
@@ -91,47 +92,43 @@ namespace AnvilMetalRecovery
9192 var metalQuantity = ( int )Math.Floor(MetalQuantity(inSlot.Itemstack) * AnvilMetalRecoveryMod.CachedConfiguration.VoxelEquivalentValue);
9293 var props = RegenerateCombustablePropsFromStack(inSlot.Itemstack);
9394
95+ base.GetHeldItemInfo(inSlot, dsc, world, withDebugInfo);
96+
9497 dsc.AppendLine(Lang.Get("fma:itemdesc-item-metal_fragments"));
9598 dsc.AppendLine(Lang.Get("fma:metal_worth", metalQuantity, metalName));
9699 }
97100
98-
99- //TODO: Merge - to the New metal V.S. stock metal bits...?
100- //TryMergeStacks ???
101- //virtual bool CanBePlacedInto(ItemStack stack, ItemSlot slot) //?
102- //virtual void OnModifiedInInventorySlot //Only for new-Inserts (?)
103-
104101 public void ApplyMetalProperties(RecoveryEntry recoveryData, ref ItemStack contStack, float percentAdjust = 1.0f)
105102 {
106- contStack.Attributes.SetInt(metalQuantityKey, ( int )(recoveryData.Quantity * percentAdjust));
107- contStack.Attributes.SetString(metalIngotCodeKey, recoveryData.IngotCode.ToString( ));
103+ contStack.Attributes.SetInt(metalQuantityKey, ( int )(recoveryData.TotalQuantity * percentAdjust));
104+ contStack.Attributes.SetString(metalIngotCodeKey, recoveryData.PrimaryMaterial.ToString( ));
108105
109106 RegenerateCombustablePropsFromStack(contStack);
110107 }
111108
109+ //Why is this actually done...? whole item isn't smeltable now...
112110 protected CombustibleProperties RegenerateCombustablePropsFromStack(ItemStack contStack)
113111 {
114112 if (contStack == null ) return null;
115113 //if (contStack.Class == EnumItemClass.Item && contStack.Item.CombustibleProps != null) return contStack.Item.CombustibleProps;
116114
117- var metalCode = MetalIngotCode(contStack);
115+ var metalAssetCode = MetalIngotCode(contStack);
118116 var metalUnits = MetalQuantity(contStack);
119117
120- if (metalCode != null || metalUnits > 0)
118+ if (metalAssetCode != null && metalUnits > 0)
119+ if (MetalRecoverySystem.MetalProperties.ContainsKey(metalAssetCode.PathEnding()))
121120 {
122- var sourceMetalItem = api.World.GetItem(metalCode);
121+ var sourceInfo = MetalRecoverySystem.MetalProperties[metalAssetCode.PathEnding( )];//Mabey more...rustic lookup?
123122
124- if (sourceMetalItem == null || sourceMetalItem.IsMissing || sourceMetalItem.CombustibleProps == null) return null;
125-
126123 var aCombustibleProps = new CombustibleProperties( ) {
127124 SmeltingType = EnumSmeltType.Smelt,
128- MeltingPoint = sourceMetalItem.CombustibleProps.MeltingPoint,
129- MeltingDuration = sourceMetalItem.CombustibleProps.MeltingDuration,
130- HeatResistance = sourceMetalItem.CombustibleProps.HeatResistance,
131- MaxTemperature = sourceMetalItem.CombustibleProps.MaxTemperature,
132- SmokeLevel = sourceMetalItem.CombustibleProps.SmokeLevel,
125+ MeltingPoint = ( int )sourceInfo.MeltingPoint,
126+ MeltingDuration = sourceInfo.MeltingDuration,
127+ //HeatResistance = 500, //sourceInfo.SpecificHeatCapacity & Formula...?
128+ MaxTemperature = ( int )sourceInfo.BoilingPoint,
129+ //SmokeLevel = sourceInfo.SmokeLevel,
133130 SmeltedRatio = 100,
134- SmeltedStack = new JsonItemStack( ) { Type = EnumItemClass.Item, Code = sourceMetalItem.Code.Clone( ), Quantity = (int)Math.Floor(metalUnits * AnvilMetalRecoveryMod.CachedConfiguration.VoxelEquivalentValue) }
131+ SmeltedStack = new JsonItemStack( ) { Type = EnumItemClass.Item, Code = metalAssetCode.Clone( ), Quantity = (int)Math.Floor(metalUnits * AnvilMetalRecoveryMod.CachedConfiguration.VoxelEquivalentValue) }
135132 };
136133 aCombustibleProps.SmeltedStack.Resolve(api.World, "VariableMetalItem_regen", true);
137134
@@ -168,7 +165,9 @@ namespace AnvilMetalRecovery
168165 var metalCode = MetalCode(inputStack);
169166 var metalUnits = MetalQuantity(inputStack);
170167
171- Item metalBits = api.World.GetItem(new AssetLocation(GlobalConstants.DefaultDomain, @"metalbit-" + metalCode));
168+ //TODO: Smarter lookup here - allow for 3rd party metals
169+ Item metalBits = api.World.GetItem(new AssetLocation(GlobalConstants.DefaultDomain, default_MetalbitCode + metalCode));
170+ //This whole scenario can't work for multi-material items...spawn remainder of items in grid, or on craft?
172171 if (metalBits != null)
173172 {
174173 gridRecipe.Output.Quantity = ( int )(Math.Round(metalUnits * AnvilMetalRecoveryMod.CachedConfiguration.VoxelEquivalentValue) / 5);
--- a/AnvilMetalRecovery/MetalRecoverySystem.cs
+++ b/AnvilMetalRecovery/MetalRecoverySystem.cs
@@ -15,8 +15,9 @@ using Vintagestory.Server;
1515
1616 /* IDEAS / ISSUES
1717 * # DONE: Watering Can (molten-metal state) Ingot Cooling *Tssss*
18- * # WIP : Ingot breaks -> Metal fragments / bits (or a blob?)
18+ * # WIP : Mold breaks -> Metal fragments : bits...
1919 * # DONE: Tool-break configurable ratio
20+ * # IDEA: Recycling Bench block/tool
2021 */
2122 namespace AnvilMetalRecovery
2223 {
@@ -36,7 +37,8 @@ namespace AnvilMetalRecovery
3637
3738 public event Action AMR_DataReady;
3839
39- private RecoveryEntryTable itemToVoxelLookup = new RecoveryEntryTable();//Item Asset Code to: Ammount & Material
40+ protected RecoveryEntryTable itemToVoxelLookup = new RecoveryEntryTable();//Item Asset Code to: Ammount & Material
41+ public static Dictionary<string, MetalInfo> MetalProperties;//for easy lookup
4042
4143 private ICoreAPI CoreAPI;
4244
@@ -115,7 +117,7 @@ namespace AnvilMetalRecovery
115117 if (api.Side.IsServer())
116118 {
117119 if (api is ServerCoreAPI) {
118- ServerCore = api as ServerCoreAPI;
120+ ServerCore = api as ServerCoreAPI;
119121 }
120122 }
121123 else
@@ -138,7 +140,8 @@ namespace AnvilMetalRecovery
138140 PrepareDownlinkChannel( );
139141 ServerCore.Event.PlayerJoin += SendClientConfigMessage;
140142 ServerCore.Event.ServerRunPhase(EnumServerRunPhase.Shutdown, PersistServersideConfig);
141- ServerCore.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering);
143+ ServerCore.Event.ServerRunPhase(EnumServerRunPhase.GameReady, UnravelMetalProperties);
144+ ServerCore.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering);
142145 ServerCore.Event.ServerRunPhase(EnumServerRunPhase.RunGame, CacheRecoveryDataTable);
143146
144147 SetupGeneralObservers( );
@@ -172,9 +175,11 @@ namespace AnvilMetalRecovery
172175 public override void AssetsFinalize(ICoreAPI api)
173176 {
174177 Mod.Logger.VerboseDebug("AssetsFinalize");
175-
176- //PerformBlockClassSwaps( );
177- AttachExtraBlockBehaviors( );
178+
179+ if (api.Side.IsServer())
180+ {
181+ AttachExtraBlockBehaviors( );
182+ }
178183 }
179184
180185 private void RegisterItemClassMappings( )
@@ -192,24 +197,7 @@ namespace AnvilMetalRecovery
192197 this.CoreAPI.RegisterCollectibleBehaviorClass(MoldDestructionRecovererBehavior.BehaviorClassName, typeof(MoldDestructionRecovererBehavior));
193198 }
194199
195- /*
196- private void PerformBlockClassSwaps()
197- {
198- #if DEBUG
199- Mod.Logger.Debug("PerformBlockClassSwaps");
200- #endif
201-
202- if (ServerCore.World is ServerMain) {
203- var serverMain = ServerCore.World as ServerMain;
204- var wateringCanBlock = serverMain.GetBlock(BlockWateringCanPlus.TargetCode);
205- #if DEBUG
206- Mod.Logger.VerboseDebug("Change class from {0} to {1}", wateringCanBlock.Class, BlockWateringCanPlus.BlockClassName);
207- #endif
208- wateringCanBlock.Class = BlockWateringCanPlus.BlockClassName;
209- ServerCore.World.Blocks[wateringCanBlock.BlockId] = wateringCanBlock;//Mabey redundant?
210- }
211200
212- }*/
213201
214202 private void AttachExtraBlockBehaviors()
215203 {
--- a/AnvilMetalRecovery/MetalRecoverySystem_Components.cs
+++ b/AnvilMetalRecovery/MetalRecoverySystem_Components.cs
@@ -1,6 +1,8 @@
11 using System;
2+using System.Collections.Generic;
23 using System.Linq;
34
5+using Newtonsoft.Json.Linq;
46
57 using Vintagestory.API.Common;
68 using Vintagestory.API.Config;
@@ -16,9 +18,37 @@ namespace AnvilMetalRecovery
1618 {
1719 public partial class MetalRecoverySystem : ModSystem
1820 {
21+ private void UnravelMetalProperties( )
22+ {
23+ MetalProperties = new Dictionary<string, MetalInfo>( );
24+ var metalAsset = ServerCore.Assets.TryGet("game:worldproperties/block/metal.json",true);
25+ JObject originalJson = JObject.Parse(metalAsset.ToText());
26+ var variants = originalJson.SelectToken(@"variants").Children( ).ToList( );
27+
28+ foreach (var variant in variants)
29+ {
30+ var metalI = variant.ToObject<MetalInfo>();
31+
32+ if (!MetalProperties.ContainsKey(metalI.Code)) MetalProperties.Add(metalI.Code, metalI);
33+
34+ #if DEBUG
35+ Mod.Logger.Debug($"parsed '{metalI.Code}' T:{metalI.Tier}, {(metalI.Elemental ?"Element":"Alloy")} Melt:{metalI.MeltingPoint}℃");
36+ #endif
37+ }
38+
39+
40+ }
41+
42+ /// <summary>
43+ /// Materials the data gathering.
44+ /// </summary>
45+ /// <remarks>
46+ /// Sum, tally Voxels in smthing recipes for all 'metal'-ingot derived items
47+ /// </remarks>
48+ /// <returns>The data gathering.</returns>
1949 private void MaterialDataGathering( )
2050 {
21- //Count out Voxels in smthing recipes for all metal-ingot(?) derived items;
51+ //TODO: FIX 3rd-PARTY MOD COMPATIBILITY !!!
2252 var examineList = this.SmithingRecipies.Where(sr => sr.Enabled && sr.Ingredient.Type == EnumItemClass.Item && sr.Output.Type == EnumItemClass.Item);
2353
2454 foreach (var recipie in examineList) {
@@ -43,7 +73,8 @@ namespace AnvilMetalRecovery
4373 if (metalObject != null && metalObject.CombustibleProps != null && metalObject.CombustibleProps.SmeltingType == EnumSmeltType.Smelt && metalObject.CombustibleProps.SmeltedRatio > 0) {
4474 //Item Input Has a metal Unit value...(Smeltable)
4575 //Resolve?
46- int setVoxels = 0;
76+ int setVoxels = 0, meltPoint = 0;
77+ float meltDur = 0;
4778 setVoxels = recipie.Voxels.OfType<bool>( ).Count(vox => vox);
4879
4980 #if DEBUG
@@ -56,16 +87,13 @@ namespace AnvilMetalRecovery
5687 Mod.Logger.Warning($"Duplicate recipie '{recipie.Name}' output item: '{outputItem.Code.ToString()}'");
5788 }
5889 else {
59- itemToVoxelLookup.Add(new RecoveryEntry(outputItem.Code, metalObject.Code,
60- ( uint )(setVoxels / recipie.Output.Quantity),
61- metalObject.CombustibleProps.MeltingDuration,
62- metalObject.CombustibleProps.MeltingPoint)
63- );
90+ LookupMetalCode(metalObject.Code, out meltDur, out meltPoint);
91+
92+ itemToVoxelLookup.Add(new RecoveryEntry(outputItem.Code, metalObject.Code, ( uint )(setVoxels / recipie.Output.Quantity)));
6493 #if DEBUG
6594 Mod.Logger.VerboseDebug($"Mapped: ('tool') '{outputItem.Code}' -> ('tool') '{outputItem.Code}'");
6695 #endif
67- }
68-
96+ }
6997 }
7098 else {
7199 //Tool-head map to Tool item; decode
@@ -83,12 +111,10 @@ namespace AnvilMetalRecovery
83111 if (itemToVoxelLookup.ContainsKey(itemToolCode)) {
84112 Mod.Logger.Warning($"Duplicate recipie '{recipie.Name}' output tool-item: '{itemToolCode.ToString( )}'");
85113 }
86- else
87- itemToVoxelLookup.Add( new RecoveryEntry(itemToolCode.Clone( ), metalObject.Code,
88- ( uint )(setVoxels / recipie.Output.Quantity),
89- metalObject.CombustibleProps.MeltingDuration,
90- metalObject.CombustibleProps.MeltingPoint)
91- );
114+ else {
115+ LookupMetalCode(metalObject.Code, out meltDur, out meltPoint);
116+ itemToVoxelLookup.Add(new RecoveryEntry(itemToolCode.Clone( ), metalObject.Code, ( uint )(setVoxels / recipie.Output.Quantity)));
117+ }
92118 #if DEBUG
93119 Mod.Logger.VerboseDebug($"Mapped: (head) '{outputItem.Code}' -> (tool) '{itemToolCode}'");
94120 #endif
@@ -98,7 +124,7 @@ namespace AnvilMetalRecovery
98124 }
99125 }
100126
101- Mod.Logger.Event("tallied {0} smithables totaling {1} metal units from {2} smithing recipies!", itemToVoxelLookup.Count, itemToVoxelLookup.Sum(ie => ie.Quantity), this.SmithingRecipies.Count);
127+ Mod.Logger.Event("tallied {0} smithables totaling {1} metal units from {2} smithing recipies!", itemToVoxelLookup.Count, itemToVoxelLookup.Sum(ie => ie.TotalQuantity), this.SmithingRecipies.Count);
102128 }
103129
104130 private bool SmithingRecipieValidator(SmithingRecipe aRecipie )
@@ -127,7 +153,7 @@ namespace AnvilMetalRecovery
127153
128154 RecoveryEntry rec = itemToVoxelLookup[hotbarData.ItemCode];
129155 #if DEBUG
130- Mod.Logger.VerboseDebug("broken-item {0} abs. WORTH: {1:F1}*{2} units", hotbarData.ItemCode.ToString( ), (rec.Quantity * CachedConfiguration.VoxelEquivalentValue), rec.IngotCode.ToShortString( ));
156+ Mod.Logger.VerboseDebug("broken-item {0} abs. WORTH: {1:F1}*{2} units", hotbarData.ItemCode.ToString( ), (rec.TotalQuantity * CachedConfiguration.VoxelEquivalentValue), rec.PrimaryMaterial.ToShortString( ));
131157 #endif
132158
133159 if (String.IsNullOrEmpty(hotbarData.PlayerUID) || String.IsNullOrEmpty(hotbarData.InventoryID)) return;
@@ -223,6 +249,19 @@ namespace AnvilMetalRecovery
223249 }
224250
225251 }
252+
253+ private bool LookupMetalCode(AssetLocation metalAssetCode, out float melting_duration, out int melting_point)
254+ {
255+ melting_duration = 30f;//same for ALL metals?
256+ melting_point = 0;
257+ string metalName = metalAssetCode.PathEnding();//Better be an Ingot!
258+ if (MetalProperties.ContainsKey(metalName)) {
259+ melting_point = ( int )MetalProperties[metalName].MeltingPoint;
260+ return true;
261+ }
262+
263+ return false;
264+ }
226265 }
227266 }
228267
--- a/AnvilMetalRecovery/assets/fma/itemtypes/metal/fragments.json
+++ b/AnvilMetalRecovery/assets/fma/itemtypes/metal/fragments.json
@@ -8,6 +8,7 @@
88 }
99 },
1010 storageFlags: 5,
11+ dimensions: { width: 0.26, height: 0.26, length: 0.26 },
1112 shape: { base: "fma:item/metal/fragments" },
1213 textures: {
1314 "metal": { base: "game:block/metal/plate/gold" },
--- a/AnvilMetalRecovery/assets/fma/lang/en.json
+++ b/AnvilMetalRecovery/assets/fma/lang/en.json
@@ -27,4 +27,5 @@
2727 "fma:itemdesc-item-metal_fragments": "Try, chopping it apart with a Chisel...",
2828 "fma:metal_worth":"Worth {0} units of {1}.",
2929 "fma:spray_cooler_text":"\n...mabey it can cool off hot things, too?",
30+ "fma:cant_recover":"<font color=\"red\">This work isn't recoverable.</font>",
3031 }
\ No newline at end of file
--- /dev/null
+++ b/AnvilMetalRecovery/assets/fma/patches/old_item_remapping.json
@@ -0,0 +1,34 @@
1+[
2+{
3+ "file": "game:config/remaps.json",
4+ "op": "add",
5+ "side": "server",
6+ "path": "/fma:v0.1.18-rc.3",
7+ "value": [
8+ "/iir map fma:metal_shaving-copper game:metalbit-copper",
9+ "/iir map fma:metal_shaving-bismuth game:metalbit-bismuth ",
10+ "/iir map fma:metal_shaving-bismuthbronze game:metalbit-bismuthbronze ",
11+ "/iir map fma:metal_shaving-blackbronze game:metalbit-blackbronze ",
12+ "/iir map fma:metal_shaving-brass game:metalbit-brass ",
13+ "/iir map fma:metal_shaving-chromium game:metalbit-chromium ",
14+ "/iir map fma:metal_shaving-gold game:metalbit-gold ",
15+ "/iir map fma:metal_shaving-iron game:metalbit-iron ",
16+ "/iir map fma:metal_shaving-meteoriciron game:metalbit-meteoriciron ",
17+ "/iir map fma:metal_shaving-lead game:metalbit-lead ",
18+ "/iir map fma:metal_shaving-molybdochalkos game:metalbit-molybdochalkos ",
19+ "/iir map fma:metal_shaving-platinum game:metalbit-platinum ",
20+ "/iir map fma:metal_shaving-rhodium game:metalbit-rhodium ",
21+ "/iir map fma:metal_shaving-silver game:metalbit-silver ",
22+ "/iir map fma:metal_shaving-stainlesssteel game:metalbit-stainlesssteel ",
23+ "/iir map fma:metal_shaving-steel game:metalbit-steel ",
24+ "/iir map fma:metal_shaving-tin game:metalbit-tin ",
25+ "/iir map fma:metal_shaving-tinbronze game:metalbit-tinbronze ",
26+ "/iir map fma:metal_shaving-titanium game:metalbit-titanium ",
27+ "/iir map fma:metal_shaving-uranium game:metalbit-uranium ",
28+ "/iir map fma:metal_shaving-zinc game:metalbit-zinc ",
29+ "/iir map fma:metal_shaving-blistersteel game:metalbit-blistersteel ",
30+ "/iir map fma:metal_shaving-leadsolder game:metalbit-leadsolder ",
31+ "/iir map fma:metal_shaving-silversolder game:metalbit-silversolder "
32+ ]
33+}
34+]
\ No newline at end of file
--- a/AnvilMetalRecovery/modinfo.json
+++ b/AnvilMetalRecovery/modinfo.json
@@ -4,9 +4,9 @@
44 "description" : "Get back smithing discards, broken tool scrap, failed molds; and MORE!",
55 "authors": ["Melchior"],
66 "ModID":"metalrecovery",
7- "version": "0.1.18-rc.8",
7+ "version": "0.1.19-pre.0",
88 "dependencies": {
9- "game": "1.17.0-rc.0",
9+ "game": "1.18.0",
1010 "survival": ""
1111 },
1212 "website": "http://nowebsite.nope"