Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
bin/
obj/
/test
/packages/
riderModule.iml
/_ReSharper.Caches/
*.idea
*.DS_Store
/.idea/**/*
/Releases/**/*
# .NET build output
[Bb]in/
[Oo]bj/
artifacts/

# Generated release packages
/Releases/

# Visual Studio
/.vs/
*.suo
*.user
*.rsuser
*.sln.DotSettings.user
/.vs/SmithingPlus
/.vs/ProjectEvaluation
*.binlog

# JetBrains Rider and ReSharper
/.idea/
*.sln.iml
riderModule.iml
_ReSharper.Caches/

# Restored packages
/packages/

# Operating-system metadata
.DS_Store
Thumbs.db
Desktop.ini
19 changes: 0 additions & 19 deletions CakeBuild/CakeBuild.csproj

This file was deleted.

162 changes: 0 additions & 162 deletions CakeBuild/Program.cs

This file was deleted.

20 changes: 0 additions & 20 deletions Directory.Build.props

This file was deleted.

26 changes: 16 additions & 10 deletions SmithingPlus.sln
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CakeBuild", "CakeBuild\CakeBuild.csproj", "{008A5C0F-3196-4E28-B037-07EB18C2EC2D}"
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmithingPlus", "SmithingPlus\SmithingPlus.csproj", "{CB2100BC-F653-402A-9FBA-EA463C2BD4FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmithingPlus", "SmithingPlus\SmithingPlus.csproj", "{E59ECD07-2CF4-4BAF-B740-149A3676F3EF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CakeBuild", "ZZCakeBuild\CakeBuild.csproj", "{BC68EDF6-C294-4819-B7F4-9EA99B73E69D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{008A5C0F-3196-4E28-B037-07EB18C2EC2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{008A5C0F-3196-4E28-B037-07EB18C2EC2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{008A5C0F-3196-4E28-B037-07EB18C2EC2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{008A5C0F-3196-4E28-B037-07EB18C2EC2D}.Release|Any CPU.Build.0 = Release|Any CPU
{E59ECD07-2CF4-4BAF-B740-149A3676F3EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E59ECD07-2CF4-4BAF-B740-149A3676F3EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E59ECD07-2CF4-4BAF-B740-149A3676F3EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E59ECD07-2CF4-4BAF-B740-149A3676F3EF}.Release|Any CPU.Build.0 = Release|Any CPU
{BC68EDF6-C294-4819-B7F4-9EA99B73E69D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC68EDF6-C294-4819-B7F4-9EA99B73E69D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC68EDF6-C294-4819-B7F4-9EA99B73E69D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC68EDF6-C294-4819-B7F4-9EA99B73E69D}.Release|Any CPU.Build.0 = Release|Any CPU
{CB2100BC-F653-402A-9FBA-EA463C2BD4FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB2100BC-F653-402A-9FBA-EA463C2BD4FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB2100BC-F653-402A-9FBA-EA463C2BD4FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB2100BC-F653-402A-9FBA-EA463C2BD4FC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions SmithingPlus.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Solution>
<Project Path="SmithingPlus/SmithingPlus.csproj" />
<Project Path="ZZCakeBuild/CakeBuild.csproj" />
</Solution>
11 changes: 8 additions & 3 deletions SmithingPlus/BitsRecovery/BitsRecoveryPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ private static void RecoverBitsFromWorkItem(BlockEntityAnvil __instance, IPlayer
return;
}

var metalBitStack = metalMaterial.MetalBitStack;
ItemStack? metalBitStack = metalMaterial.MetalBitStack;
if (metalBitStack == null)
{
Core.Logger.VerboseDebug("[BitsRecovery] The resolved metal material has no metal bit item.");
return;
}
var temperature = workItemStack.Collectible.GetTemperature(byPlayer.Entity.World, workItemStack);
metalBitStack?.Collectible.SetTemperature(byPlayer.Entity.World, metalBitStack, temperature);
metalBitStack.Collectible.SetTemperature(byPlayer.Entity.World, metalBitStack, temperature);
if (byPlayer.InventoryManager.TryGiveItemstack(metalBitStack)) return;
byPlayer.Entity.World.SpawnItemEntity(metalBitStack, byPlayer.Entity.Pos.XYZ);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ public override void OnHeldInteractStop(float secondsUsed,
var firedCrucibleCode = crucibleStack.Collectible.CodeWithVariant("type", "fired");
var firedCrucibleItem = world.GetBlock(firedCrucibleCode);
if (firedCrucibleItem == null)
{
Core.Logger.Warning(
$"[{nameof(OnHeldInteractStop)}] Something went wrong, cannot find fired crucible with code {firedCrucibleCode}");
return;
}
var emptyCrucibleStack = new ItemStack(firedCrucibleItem);
if (!playerInventory.TryGiveItemstack(metalBitStack, true))
world.SpawnItemEntity(metalBitStack, blockSel.Position);
Expand Down Expand Up @@ -142,4 +145,4 @@ private static bool CanAccessBlock(EntityPlayer entityPlayer, BlockSelection blo
entityPlayer.World.Claims.TryAccess(entityPlayer.Player, blockSel.Position,
EnumBlockAccessFlags.BuildOrBreak);
}
}
}
14 changes: 11 additions & 3 deletions SmithingPlus/BitsRecovery/CollectibleBehaviorSmeltedContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@

namespace SmithingPlus.BitsRecovery;

#nullable enable

public class CollectibleBehaviorSmeltedContainer(CollectibleObject collObj) : CollectibleBehavior(collObj)
{
public override void GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo)
public override void GetHeldItemInfo(ItemSlot? inSlot, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo)
{
base.GetHeldItemInfo(inSlot, dsc, world, withDebugInfo);
var temp = inSlot.Itemstack.GetTemperature(world);
ItemStack? itemStack = inSlot?.Itemstack;
if (itemStack == null)
{
return;
}

float temp = itemStack.GetTemperature(world);
if (temp < CollectibleBehaviorScrapeCrucible.MaxScrapeTemperature)
dsc.AppendLine(Lang.Get($"{Core.ModId}:heldhelp-scrapecrucible"));
}
}
}
11 changes: 8 additions & 3 deletions SmithingPlus/BitsRecovery/HelveHammerRecoveryPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ public static void Postfix(BlockEntityAnvil __instance, ref int __state)
return;
}

var metalBitStack = metalMaterial.MetalBitStack;
ItemStack? metalBitStack = metalMaterial.MetalBitStack;
if (metalBitStack == null)
{
Core.Logger.VerboseDebug("[BitsRecovery] The resolved metal material has no metal bit item.");
return;
}
var temperature = workItemStack.Collectible.GetTemperature(api.World, workItemStack);
metalBitStack?.Collectible.SetTemperature(api.World, metalBitStack, temperature);
metalBitStack.Collectible.SetTemperature(api.World, metalBitStack, temperature);
__instance.Api.World.SpawnItemEntity(metalBitStack, __instance.Pos);
}
}
}
Loading