W.I.P. new Item Mallet
This commit is contained in:
parent
4a74b80c89
commit
dae3fdec76
9 changed files with 209 additions and 8 deletions
|
|
@ -58,7 +58,10 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="MetalRecoverySystem.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="MetalRecovery_BlockEntityAnvil.cs" />
|
||||
<Compile Include="BlockEntities\MetalRecovery_BlockEntityAnvil.cs" />
|
||||
<Compile Include="Items\ItemMallet.cs">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="modinfo.json">
|
||||
|
|
@ -73,6 +76,15 @@
|
|||
<None Include="assets\fma\lang\en.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="assets\fma\shapes\item\tools\mallet.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="assets\fma\itemtypes\tools\mallet.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="assets\fma\recipes\grid\tool\mallet.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="assets\" />
|
||||
|
|
@ -83,6 +95,13 @@
|
|||
<Folder Include="assets\fma\shapes\item\" />
|
||||
<Folder Include="assets\fma\shapes\item\shavings\" />
|
||||
<Folder Include="assets\fma\lang\" />
|
||||
<Folder Include="BlockEntities\" />
|
||||
<Folder Include="assets\fma\shapes\item\tools\" />
|
||||
<Folder Include="assets\fma\itemtypes\tools\" />
|
||||
<Folder Include="Items\" />
|
||||
<Folder Include="assets\fma\recipes\" />
|
||||
<Folder Include="assets\fma\recipes\grid\" />
|
||||
<Folder Include="assets\fma\recipes\grid\tool\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
67
AnvilMetalRecovery/Items/ItemMallet.cs
Normal file
67
AnvilMetalRecovery/Items/ItemMallet.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
|
||||
using Vintagestory.API.Common;
|
||||
using Vintagestory.API.Config;
|
||||
|
||||
namespace AnvilMetalRecovery
|
||||
{
|
||||
public class ItemMallet : Item
|
||||
{
|
||||
public ItemMallet( )
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mallet is a Hammer compatible replacement for many of the same uses, most Crafstmen can't tell the difference.
|
||||
/// Useless for smith work...
|
||||
/// </summary>
|
||||
/// <param name="inputStack"></param>
|
||||
/// <param name="gridRecipe"></param>
|
||||
/// <param name="ingredient"></param>
|
||||
/// <returns></returns>
|
||||
public override bool MatchesForCrafting(ItemStack inputStack, GridRecipe gridRecipe, CraftingRecipeIngredient ingredient)
|
||||
{
|
||||
api.World.Logger.VerboseDebug($"{gridRecipe.Name} : {ingredient.Code} ({ingredient.Name})");
|
||||
if (gridRecipe.Output.Code.BeginsWith(GlobalConstants.DefaultDomain, @"nugget")||
|
||||
gridRecipe.Output.Code.BeginsWith(GlobalConstants.DefaultDomain, @"lime")) {
|
||||
//It don't *DO* rock crushing.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ingredient.IsTool && ingredient.Code.BeginsWith(GlobalConstants.DefaultDomain, @"hammer")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should return true if thisStack is a satisfactory replacement of otherStack.
|
||||
/// It's bascially an Equals() test, but it ignores any additional attributes that exist in otherStack
|
||||
/// </summary>
|
||||
/// <param name="thisStack"></param>
|
||||
/// <param name="otherStack"></param>
|
||||
/// <returns></returns>
|
||||
//public override bool Satisfies(ItemStack thisStack, ItemStack otherStack)
|
||||
//{
|
||||
//return base.Satisfies(thisStack, otherStack);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Damages the item.
|
||||
/// </summary>
|
||||
/// <returns>The item.</returns>
|
||||
/// <param name="world">World.</param>
|
||||
/// <param name="byEntity">By entity.</param>
|
||||
/// <param name="itemslot">Itemslot.</param>
|
||||
/// <param name="amount">Amount.</param>
|
||||
public override void DamageItem(IWorldAccessor world, Vintagestory.API.Common.Entities.Entity byEntity, ItemSlot itemslot, int amount = 1)
|
||||
{
|
||||
//Tweak Numbers...when chiseling
|
||||
base.DamageItem(world, byEntity, itemslot, amount);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Vintagestory.API.Common;
|
||||
using Vintagestory.API.Server;
|
||||
using Vintagestory.Common;
|
||||
|
|
@ -21,18 +22,20 @@ namespace AnvilMetalRecovery
|
|||
|
||||
public override bool ShouldLoad(EnumAppSide forSide)
|
||||
{
|
||||
return forSide.IsServer( );
|
||||
return true;
|
||||
}
|
||||
|
||||
public override double ExecuteOrder( )
|
||||
{
|
||||
return 0.11d;
|
||||
return 0.10d;
|
||||
}
|
||||
|
||||
public override void Start(ICoreAPI api)
|
||||
{
|
||||
base.Start(api);
|
||||
this.CoreAPI = api;
|
||||
CoreAPI.RegisterItemClass(@"ItemMallet", typeof(ItemMallet));
|
||||
|
||||
base.Start(api);
|
||||
}
|
||||
|
||||
public override void StartServerSide(ICoreServerAPI api)
|
||||
|
|
@ -89,6 +92,14 @@ namespace AnvilMetalRecovery
|
|||
registry.blockEntityTypeToClassnameMapping[blockentity] = className;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ReplaceItemClassType(this ClassRegistry registry, string className, Type replacer)
|
||||
{
|
||||
if (registry.ItemClassToTypeMapping.ContainsKey(className)) {
|
||||
//replace it
|
||||
registry.ItemClassToTypeMapping[className] = replacer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
49
AnvilMetalRecovery/assets/fma/itemtypes/tools/mallet.json
Normal file
49
AnvilMetalRecovery/assets/fma/itemtypes/tools/mallet.json
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
code: "mallet",
|
||||
class: "ItemMallet",
|
||||
attributes: {
|
||||
handbook: {
|
||||
include: true
|
||||
},
|
||||
toolrackTransform: {
|
||||
rotation: { y: 1, z: -1 },
|
||||
translation: { x: -0.2 },
|
||||
scale: 1.5,
|
||||
}
|
||||
},
|
||||
tool: "hammer",
|
||||
heldTpHitAnimation: "smithing",
|
||||
shape: { base: "item/tools/mallet" },
|
||||
textures: {
|
||||
"head": { base:"game:block/wood/debarked/birch"},
|
||||
"side": { base:"game:block/wood/treetrunk/oak"},
|
||||
"wood": { base:"game:item/tool/material/wood"}
|
||||
},
|
||||
tooltier: 1,
|
||||
durability: 200,
|
||||
attackpower: 1,
|
||||
creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] },
|
||||
fpHandTransform: {
|
||||
translation: { x: 0.0468, y: -0.2, z: 0 },
|
||||
rotation: { x: 15, y: 15, z: 90 },
|
||||
scale: 2.5
|
||||
},
|
||||
guiTransform: {
|
||||
rotate: false,
|
||||
translation: { x: 0, y: 5, z: 0 },
|
||||
rotation: { x: -77, y: -135, z: 160 },
|
||||
origin: { x: 0.54, y: 0.5, z: 0.48 },
|
||||
scale: 2.6
|
||||
},
|
||||
groundTransform: {
|
||||
translation: { x: 0, y: 0, z: 0 },
|
||||
rotation: { x: 0, y: 0, z: 0 },
|
||||
origin: { x: 0.5, y: 0.45, z: 0.5 },
|
||||
scale: 4.5
|
||||
},
|
||||
tpHandTransform: {
|
||||
translation: { x: -0.75, y: -0.48, z: -0.52 },
|
||||
rotation: { x: 90, y: 1, z: 0 },
|
||||
scale: 1
|
||||
}
|
||||
}
|
||||
11
AnvilMetalRecovery/assets/fma/recipes/grid/tool/mallet.json
Normal file
11
AnvilMetalRecovery/assets/fma/recipes/grid/tool/mallet.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
ingredientPattern: "K H S",
|
||||
ingredients: {
|
||||
"K": { type: "item", code:"game:knife-*", isTool: true},
|
||||
"H": { type: "block", code: "game:log-*", name: "head" },
|
||||
"S": { type: "item", code: "game:stick" }
|
||||
},
|
||||
width: 1,
|
||||
height: 3,
|
||||
output: { type: "item", code: "mallet", quantity: 1 }
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
"textureWidth": 16,
|
||||
"textureHeight": 16,
|
||||
"textures": {
|
||||
"metal": "game:block/metal/ingot/metal"
|
||||
"metal": "game:block/metal/ingot/iron"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
|
|
|||
44
AnvilMetalRecovery/assets/fma/shapes/item/tools/mallet.json
Normal file
44
AnvilMetalRecovery/assets/fma/shapes/item/tools/mallet.json
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"editor": {
|
||||
"allAngles": false,
|
||||
"entityTextureMode": false
|
||||
},
|
||||
"textureWidth": 16,
|
||||
"textureHeight": 8,
|
||||
"textureSizes": {
|
||||
},
|
||||
"textures": {
|
||||
"head": "game:block/wood/debarked/birch",
|
||||
"side": "game:block/wood/treetrunk/oak",
|
||||
"wood": "game:item/tool/material/wood"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "handle",
|
||||
"from": [ 0.5, 7.5, 7.5 ],
|
||||
"to": [ 13.5, 8.5, 8.5 ],
|
||||
"rotationOrigin": [ -3.0, 0.0, 8.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#wood", "uv": [ 2.0, 3.0, 15.0, 4.0 ] },
|
||||
"east": { "texture": "#wood", "uv": [ 6.5, 5.25, 7.5, 6.25 ] },
|
||||
"south": { "texture": "#wood", "uv": [ 1.5, 5.5, 14.5, 6.5 ] },
|
||||
"west": { "texture": "#wood", "uv": [ 7.0, 3.25, 8.0, 4.25 ] },
|
||||
"up": { "texture": "#wood", "uv": [ 2.0, 4.0, 15.0, 5.0 ] },
|
||||
"down": { "texture": "#wood", "uv": [ 1.5, 4.25, 14.5, 5.25 ] }
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Head",
|
||||
"from": [ 7.5, 5.5, 5.5 ],
|
||||
"to": [ 13.0, 10.5, 10.5 ],
|
||||
"rotationOrigin": [ -1.0, -1.0, -1.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#head", "uv": [ 4.0, 2.0, 9.5, 7.0 ] },
|
||||
"east": { "texture": "#side", "uv": [ 5.0, 1.5, 10.0, 6.5 ] },
|
||||
"south": { "texture": "#head", "uv": [ 5.0, 1.75, 10.5, 6.75 ] },
|
||||
"west": { "texture": "#side", "uv": [ 5.5, 1.75, 10.5, 6.75 ] },
|
||||
"up": { "texture": "#head", "uv": [ 5.0, 1.5, 13.0, 6.5 ], "autoUv": false },
|
||||
"down": { "texture": "#head", "uv": [ 4.5, 1.75, 10.0, 6.75 ] }
|
||||
}
|
||||
}
|
||||
]}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"type": "code",
|
||||
"name": "Anvil Metal Recovery",
|
||||
"description" : "Get back that lost scrap and smithing discards!",
|
||||
"name": "Metal Recovery & More",
|
||||
"description" : "Get back lost scrap and smithing discards, and more.",
|
||||
"authors": ["Melchior"],
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"dependencies": {
|
||||
"game": "1.12.11",
|
||||
"survival": ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue