• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

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

修訂dae3fdec76a9e8e4a00424a5d3b4a5d0b566194b (tree)
時間2020-05-10 14:49:53
作者melchior <melchior@user...>
Commitermelchior

Log Message

W.I.P. new Item Mallet

Change Summary

差異

--- a/AnvilMetalRecovery/AnvilMetalRecovery.csproj
+++ b/AnvilMetalRecovery/AnvilMetalRecovery.csproj
@@ -58,7 +58,10 @@
5858 <ItemGroup>
5959 <Compile Include="MetalRecoverySystem.cs" />
6060 <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>
6265 </ItemGroup>
6366 <ItemGroup>
6467 <None Include="modinfo.json">
@@ -73,6 +76,15 @@
7376 <None Include="assets\fma\lang\en.json">
7477 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
7578 </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>
7688 </ItemGroup>
7789 <ItemGroup>
7890 <Folder Include="assets\" />
@@ -83,6 +95,13 @@
8395 <Folder Include="assets\fma\shapes\item\" />
8496 <Folder Include="assets\fma\shapes\item\shavings\" />
8597 <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\" />
86105 </ItemGroup>
87106 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
88107 </Project>
\ No newline at end of file
--- /dev/null
+++ b/AnvilMetalRecovery/Items/ItemMallet.cs
@@ -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+
--- a/AnvilMetalRecovery/MetalRecoverySystem.cs
+++ b/AnvilMetalRecovery/MetalRecoverySystem.cs
@@ -1,5 +1,6 @@
11 using System;
22 using System.Collections.Generic;
3+
34 using Vintagestory.API.Common;
45 using Vintagestory.API.Server;
56 using Vintagestory.Common;
@@ -21,18 +22,20 @@ namespace AnvilMetalRecovery
2122
2223 public override bool ShouldLoad(EnumAppSide forSide)
2324 {
24- return forSide.IsServer( );
25+ return true;
2526 }
2627
2728 public override double ExecuteOrder( )
2829 {
29- return 0.11d;
30+ return 0.10d;
3031 }
3132
3233 public override void Start(ICoreAPI api)
3334 {
34- base.Start(api);
3535 this.CoreAPI = api;
36+ CoreAPI.RegisterItemClass(@"ItemMallet", typeof(ItemMallet));
37+
38+ base.Start(api);
3639 }
3740
3841 public override void StartServerSide(ICoreServerAPI api)
@@ -89,6 +92,14 @@ namespace AnvilMetalRecovery
8992 registry.blockEntityTypeToClassnameMapping[blockentity] = className;
9093 }
9194 }
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+ }
92103 }
93104 }
94105
--- /dev/null
+++ b/AnvilMetalRecovery/assets/fma/itemtypes/tools/mallet.json
@@ -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+}
--- /dev/null
+++ b/AnvilMetalRecovery/assets/fma/recipes/grid/tool/mallet.json
@@ -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
--- a/AnvilMetalRecovery/assets/fma/shapes/item/shavings/metal_shavings.json
+++ b/AnvilMetalRecovery/assets/fma/shapes/item/shavings/metal_shavings.json
@@ -6,7 +6,7 @@
66 "textureWidth": 16,
77 "textureHeight": 16,
88 "textures": {
9- "metal": "game:block/metal/ingot/metal"
9+ "metal": "game:block/metal/ingot/iron"
1010 },
1111 "elements": [
1212 {
--- /dev/null
+++ b/AnvilMetalRecovery/assets/fma/shapes/item/tools/mallet.json
@@ -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
--- a/AnvilMetalRecovery/modinfo.json
+++ b/AnvilMetalRecovery/modinfo.json
@@ -1,9 +1,9 @@
11 {
22 "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.",
55 "authors": ["Melchior"],
6- "version": "0.1.1",
6+ "version": "0.1.2",
77 "dependencies": {
88 "game": "1.12.11",
99 "survival": ""