Add block provider interfaces

This commit is contained in:
Drew DeVault 2014-12-28 15:38:58 -07:00
parent 0f91a00326
commit 2b7d721326
5 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,12 @@
using System;
namespace TrueCraft.API.Logic
{
public interface IBlockProvider
{
byte ID { get; }
double Hardness { get; }
string DisplayName { get; }
Tuple<int, int> TextureMap { get; }
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace TrueCraft.API.Logic
{
public interface IItemProvider
{
short ID { get; }
}
}

View File

@ -69,6 +69,8 @@
<Compile Include="Windows\IWindow.cs" />
<Compile Include="Windows\IWindowArea.cs" />
<Compile Include="Windows\WindowChangeEventArgs.cs" />
<Compile Include="Logic\IBlockProvider.cs" />
<Compile Include="Logic\IItemProvider.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@ -78,6 +80,7 @@
<Folder Include="Logging\" />
<Folder Include="Entities\" />
<Folder Include="Windows\" />
<Folder Include="Logic\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\externals\fNbt\fNbt\fNbt.csproj">

View File

@ -0,0 +1,27 @@
using System;
using TrueCraft.API.Logic;
namespace TrueCraft.Core.Logic
{
/// <summary>
/// Provides common implementations of block logic.
/// </summary>
public abstract class BlockProvider : IBlockProvider, IItemProvider
{
short IItemProvider.ID
{
get
{
return ID;
}
}
public abstract byte ID { get; }
public virtual double Hardness { get { return 0; } }
public virtual string DisplayName { get { return string.Empty; } }
public virtual Tuple<int, int> TextureMap { get { return null; } }
}
}

View File

@ -109,6 +109,7 @@
<Compile Include="Windows\CraftingWindowArea.cs" />
<Compile Include="Windows\InventoryWindow.cs" />
<Compile Include="Windows\WindowArea.cs" />
<Compile Include="Logic\BlockProvider.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@ -126,5 +127,7 @@
<Folder Include="World\" />
<Folder Include="Logging\" />
<Folder Include="Windows\" />
<Folder Include="Logic\" />
<Folder Include="Logic\Blocks\" />
</ItemGroup>
</Project>