First Machine Age's Mods (Combined repo.)
修訂 | dae3fdec76a9e8e4a00424a5d3b4a5d0b566194b (tree) |
---|---|
時間 | 2020-05-10 14:49:53 |
作者 | melchior <melchior@user...> |
Commiter | melchior |
W.I.P. new Item Mallet
@@ -58,7 +58,10 @@ | ||
58 | 58 | <ItemGroup> |
59 | 59 | <Compile Include="MetalRecoverySystem.cs" /> |
60 | 60 | <Compile Include="Properties\AssemblyInfo.cs" /> |
61 | - <Compile Include="MetalRecovery_BlockEntityAnvil.cs" /> | |
61 | + <Compile Include="BlockEntities\MetalRecovery_BlockEntityAnvil.cs" /> | |
62 | + <Compile Include="Items\ItemMallet.cs"> | |
63 | + <CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
64 | + </Compile> | |
62 | 65 | </ItemGroup> |
63 | 66 | <ItemGroup> |
64 | 67 | <None Include="modinfo.json"> |
@@ -73,6 +76,15 @@ | ||
73 | 76 | <None Include="assets\fma\lang\en.json"> |
74 | 77 | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
75 | 78 | </None> |
79 | + <None Include="assets\fma\shapes\item\tools\mallet.json"> | |
80 | + <CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
81 | + </None> | |
82 | + <None Include="assets\fma\itemtypes\tools\mallet.json"> | |
83 | + <CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
84 | + </None> | |
85 | + <None Include="assets\fma\recipes\grid\tool\mallet.json"> | |
86 | + <CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
87 | + </None> | |
76 | 88 | </ItemGroup> |
77 | 89 | <ItemGroup> |
78 | 90 | <Folder Include="assets\" /> |
@@ -83,6 +95,13 @@ | ||
83 | 95 | <Folder Include="assets\fma\shapes\item\" /> |
84 | 96 | <Folder Include="assets\fma\shapes\item\shavings\" /> |
85 | 97 | <Folder Include="assets\fma\lang\" /> |
98 | + <Folder Include="BlockEntities\" /> | |
99 | + <Folder Include="assets\fma\shapes\item\tools\" /> | |
100 | + <Folder Include="assets\fma\itemtypes\tools\" /> | |
101 | + <Folder Include="Items\" /> | |
102 | + <Folder Include="assets\fma\recipes\" /> | |
103 | + <Folder Include="assets\fma\recipes\grid\" /> | |
104 | + <Folder Include="assets\fma\recipes\grid\tool\" /> | |
86 | 105 | </ItemGroup> |
87 | 106 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
88 | 107 | </Project> |
\ No newline at end of file |
@@ -0,0 +1,67 @@ | ||
1 | +using System; | |
2 | + | |
3 | +using Vintagestory.API.Common; | |
4 | +using Vintagestory.API.Config; | |
5 | + | |
6 | +namespace AnvilMetalRecovery | |
7 | +{ | |
8 | + public class ItemMallet : Item | |
9 | + { | |
10 | + public ItemMallet( ) | |
11 | + { | |
12 | + } | |
13 | + | |
14 | + /// <summary> | |
15 | + /// Mallet is a Hammer compatible replacement for many of the same uses, most Crafstmen can't tell the difference. | |
16 | + /// Useless for smith work... | |
17 | + /// </summary> | |
18 | + /// <param name="inputStack"></param> | |
19 | + /// <param name="gridRecipe"></param> | |
20 | + /// <param name="ingredient"></param> | |
21 | + /// <returns></returns> | |
22 | + public override bool MatchesForCrafting(ItemStack inputStack, GridRecipe gridRecipe, CraftingRecipeIngredient ingredient) | |
23 | + { | |
24 | + api.World.Logger.VerboseDebug($"{gridRecipe.Name} : {ingredient.Code} ({ingredient.Name})"); | |
25 | + if (gridRecipe.Output.Code.BeginsWith(GlobalConstants.DefaultDomain, @"nugget")|| | |
26 | + gridRecipe.Output.Code.BeginsWith(GlobalConstants.DefaultDomain, @"lime")) { | |
27 | + //It don't *DO* rock crushing. | |
28 | + return false; | |
29 | + } | |
30 | + | |
31 | + if (ingredient.IsTool && ingredient.Code.BeginsWith(GlobalConstants.DefaultDomain, @"hammer")) { | |
32 | + return true; | |
33 | + } | |
34 | + | |
35 | + return false; | |
36 | + } | |
37 | + | |
38 | + /// <summary> | |
39 | + /// Should return true if thisStack is a satisfactory replacement of otherStack. | |
40 | + /// It's bascially an Equals() test, but it ignores any additional attributes that exist in otherStack | |
41 | + /// </summary> | |
42 | + /// <param name="thisStack"></param> | |
43 | + /// <param name="otherStack"></param> | |
44 | + /// <returns></returns> | |
45 | + //public override bool Satisfies(ItemStack thisStack, ItemStack otherStack) | |
46 | + //{ | |
47 | + //return base.Satisfies(thisStack, otherStack); | |
48 | + //} | |
49 | + | |
50 | + /// <summary> | |
51 | + /// Damages the item. | |
52 | + /// </summary> | |
53 | + /// <returns>The item.</returns> | |
54 | + /// <param name="world">World.</param> | |
55 | + /// <param name="byEntity">By entity.</param> | |
56 | + /// <param name="itemslot">Itemslot.</param> | |
57 | + /// <param name="amount">Amount.</param> | |
58 | + public override void DamageItem(IWorldAccessor world, Vintagestory.API.Common.Entities.Entity byEntity, ItemSlot itemslot, int amount = 1) | |
59 | + { | |
60 | + //Tweak Numbers...when chiseling | |
61 | + base.DamageItem(world, byEntity, itemslot, amount); | |
62 | + | |
63 | + } | |
64 | + | |
65 | + } | |
66 | +} | |
67 | + |
@@ -1,5 +1,6 @@ | ||
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | + | |
3 | 4 | using Vintagestory.API.Common; |
4 | 5 | using Vintagestory.API.Server; |
5 | 6 | using Vintagestory.Common; |
@@ -21,18 +22,20 @@ namespace AnvilMetalRecovery | ||
21 | 22 | |
22 | 23 | public override bool ShouldLoad(EnumAppSide forSide) |
23 | 24 | { |
24 | - return forSide.IsServer( ); | |
25 | + return true; | |
25 | 26 | } |
26 | 27 | |
27 | 28 | public override double ExecuteOrder( ) |
28 | 29 | { |
29 | - return 0.11d; | |
30 | + return 0.10d; | |
30 | 31 | } |
31 | 32 | |
32 | 33 | public override void Start(ICoreAPI api) |
33 | 34 | { |
34 | - base.Start(api); | |
35 | 35 | this.CoreAPI = api; |
36 | + CoreAPI.RegisterItemClass(@"ItemMallet", typeof(ItemMallet)); | |
37 | + | |
38 | + base.Start(api); | |
36 | 39 | } |
37 | 40 | |
38 | 41 | public override void StartServerSide(ICoreServerAPI api) |
@@ -89,6 +92,14 @@ namespace AnvilMetalRecovery | ||
89 | 92 | registry.blockEntityTypeToClassnameMapping[blockentity] = className; |
90 | 93 | } |
91 | 94 | } |
95 | + | |
96 | + internal static void ReplaceItemClassType(this ClassRegistry registry, string className, Type replacer) | |
97 | + { | |
98 | + if (registry.ItemClassToTypeMapping.ContainsKey(className)) { | |
99 | + //replace it | |
100 | + registry.ItemClassToTypeMapping[className] = replacer; | |
101 | + } | |
102 | + } | |
92 | 103 | } |
93 | 104 | } |
94 | 105 |
@@ -0,0 +1,49 @@ | ||
1 | +{ | |
2 | + code: "mallet", | |
3 | + class: "ItemMallet", | |
4 | + attributes: { | |
5 | + handbook: { | |
6 | + include: true | |
7 | + }, | |
8 | + toolrackTransform: { | |
9 | + rotation: { y: 1, z: -1 }, | |
10 | + translation: { x: -0.2 }, | |
11 | + scale: 1.5, | |
12 | + } | |
13 | + }, | |
14 | + tool: "hammer", | |
15 | + heldTpHitAnimation: "smithing", | |
16 | + shape: { base: "item/tools/mallet" }, | |
17 | + textures: { | |
18 | + "head": { base:"game:block/wood/debarked/birch"}, | |
19 | + "side": { base:"game:block/wood/treetrunk/oak"}, | |
20 | + "wood": { base:"game:item/tool/material/wood"} | |
21 | + }, | |
22 | + tooltier: 1, | |
23 | + durability: 200, | |
24 | + attackpower: 1, | |
25 | + creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] }, | |
26 | + fpHandTransform: { | |
27 | + translation: { x: 0.0468, y: -0.2, z: 0 }, | |
28 | + rotation: { x: 15, y: 15, z: 90 }, | |
29 | + scale: 2.5 | |
30 | + }, | |
31 | + guiTransform: { | |
32 | + rotate: false, | |
33 | + translation: { x: 0, y: 5, z: 0 }, | |
34 | + rotation: { x: -77, y: -135, z: 160 }, | |
35 | + origin: { x: 0.54, y: 0.5, z: 0.48 }, | |
36 | + scale: 2.6 | |
37 | + }, | |
38 | + groundTransform: { | |
39 | + translation: { x: 0, y: 0, z: 0 }, | |
40 | + rotation: { x: 0, y: 0, z: 0 }, | |
41 | + origin: { x: 0.5, y: 0.45, z: 0.5 }, | |
42 | + scale: 4.5 | |
43 | + }, | |
44 | + tpHandTransform: { | |
45 | + translation: { x: -0.75, y: -0.48, z: -0.52 }, | |
46 | + rotation: { x: 90, y: 1, z: 0 }, | |
47 | + scale: 1 | |
48 | + } | |
49 | +} |
@@ -0,0 +1,11 @@ | ||
1 | +{ | |
2 | + ingredientPattern: "K H S", | |
3 | + ingredients: { | |
4 | + "K": { type: "item", code:"game:knife-*", isTool: true}, | |
5 | + "H": { type: "block", code: "game:log-*", name: "head" }, | |
6 | + "S": { type: "item", code: "game:stick" } | |
7 | + }, | |
8 | + width: 1, | |
9 | + height: 3, | |
10 | + output: { type: "item", code: "mallet", quantity: 1 } | |
11 | +} | |
\ No newline at end of file |
@@ -6,7 +6,7 @@ | ||
6 | 6 | "textureWidth": 16, |
7 | 7 | "textureHeight": 16, |
8 | 8 | "textures": { |
9 | - "metal": "game:block/metal/ingot/metal" | |
9 | + "metal": "game:block/metal/ingot/iron" | |
10 | 10 | }, |
11 | 11 | "elements": [ |
12 | 12 | { |
@@ -0,0 +1,44 @@ | ||
1 | +{ | |
2 | + "editor": { | |
3 | + "allAngles": false, | |
4 | + "entityTextureMode": false | |
5 | + }, | |
6 | + "textureWidth": 16, | |
7 | + "textureHeight": 8, | |
8 | + "textureSizes": { | |
9 | + }, | |
10 | + "textures": { | |
11 | + "head": "game:block/wood/debarked/birch", | |
12 | + "side": "game:block/wood/treetrunk/oak", | |
13 | + "wood": "game:item/tool/material/wood" | |
14 | + }, | |
15 | + "elements": [ | |
16 | + { | |
17 | + "name": "handle", | |
18 | + "from": [ 0.5, 7.5, 7.5 ], | |
19 | + "to": [ 13.5, 8.5, 8.5 ], | |
20 | + "rotationOrigin": [ -3.0, 0.0, 8.0 ], | |
21 | + "faces": { | |
22 | + "north": { "texture": "#wood", "uv": [ 2.0, 3.0, 15.0, 4.0 ] }, | |
23 | + "east": { "texture": "#wood", "uv": [ 6.5, 5.25, 7.5, 6.25 ] }, | |
24 | + "south": { "texture": "#wood", "uv": [ 1.5, 5.5, 14.5, 6.5 ] }, | |
25 | + "west": { "texture": "#wood", "uv": [ 7.0, 3.25, 8.0, 4.25 ] }, | |
26 | + "up": { "texture": "#wood", "uv": [ 2.0, 4.0, 15.0, 5.0 ] }, | |
27 | + "down": { "texture": "#wood", "uv": [ 1.5, 4.25, 14.5, 5.25 ] } | |
28 | + } | |
29 | + }, | |
30 | + { | |
31 | + "name": "Head", | |
32 | + "from": [ 7.5, 5.5, 5.5 ], | |
33 | + "to": [ 13.0, 10.5, 10.5 ], | |
34 | + "rotationOrigin": [ -1.0, -1.0, -1.0 ], | |
35 | + "faces": { | |
36 | + "north": { "texture": "#head", "uv": [ 4.0, 2.0, 9.5, 7.0 ] }, | |
37 | + "east": { "texture": "#side", "uv": [ 5.0, 1.5, 10.0, 6.5 ] }, | |
38 | + "south": { "texture": "#head", "uv": [ 5.0, 1.75, 10.5, 6.75 ] }, | |
39 | + "west": { "texture": "#side", "uv": [ 5.5, 1.75, 10.5, 6.75 ] }, | |
40 | + "up": { "texture": "#head", "uv": [ 5.0, 1.5, 13.0, 6.5 ], "autoUv": false }, | |
41 | + "down": { "texture": "#head", "uv": [ 4.5, 1.75, 10.0, 6.75 ] } | |
42 | + } | |
43 | + } | |
44 | + ]} | |
\ No newline at end of file |
@@ -1,9 +1,9 @@ | ||
1 | 1 | { |
2 | 2 | "type": "code", |
3 | - "name": "Anvil Metal Recovery", | |
4 | - "description" : "Get back that lost scrap and smithing discards!", | |
3 | + "name": "Metal Recovery & More", | |
4 | + "description" : "Get back lost scrap and smithing discards, and more.", | |
5 | 5 | "authors": ["Melchior"], |
6 | - "version": "0.1.1", | |
6 | + "version": "0.1.2", | |
7 | 7 | "dependencies": { |
8 | 8 | "game": "1.12.11", |
9 | 9 | "survival": "" |