Block modifications.

Added two new properties.
- Opaque: Whether or not the block is opaque
- LightModifier: The amount removed from the light level as it passes
through the block(for transparent blocks).

Merged all rail block classes into RailBlock.cs and made them extend
RailBlock
This commit is contained in:
Daniel Vidmar 2015-01-26 00:14:58 -05:00
parent ff7b009d82
commit 351ab96f99
51 changed files with 160 additions and 60 deletions

View File

@ -36,6 +36,20 @@ namespace TrueCraft.Core.Logic
/// </summary>
public virtual byte Luminance { get { return 0; } }
/// <summary>
/// Whether or not the block is opaque
/// </summary>
public virtual bool Opaque { get { return true; } }
/// <summary>
/// The amount removed from the light level as it passes through this block.
/// 255 - Let no light pass through(this may change)
/// Notes:
/// - This isn't needed for opaque blocks
/// - This is needed since some "partial" transparent blocks remove more than 1 level from light passing through such as Ice.
/// </summary>
public virtual byte LightModifier { get { return 1; } }
/// <summary>
/// The name of the block as it would appear to players.
/// </summary>

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.2; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Bed"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Button"; } }
}

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.4; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Cactus"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Cake"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 2.5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Chest"; } }

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 4; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
//TODO: Mark this as a block that diffuses sun light.
public override string DisplayName { get { return "Cobweb"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Crops"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Dead Bush"; } }

View File

@ -1,25 +0,0 @@
using System;
using TrueCraft.API.Logic;
namespace TrueCraft.Core.Logic.Blocks
{
public class DetectorRailBlock : BlockProvider
{
public static readonly byte BlockID = 0x1C;
public override byte ID { get { return 0x1C; } }
public override double BlastResistance { get { return 3.5; } }
public override double Hardness { get { return 0.7; } }
public override byte Luminance { get { return 0; } }
public override string DisplayName { get { return "Detector Rail"; } }
public override Tuple<int, int> GetTextureMap(byte metadata)
{
return new Tuple<int, int>(3, 12);
}
}
}

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.6; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 255; } }
public override string DisplayName { get { return "Farmland"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 2; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Fence"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 15; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Fire"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Flower"; } }

View File

@ -31,6 +31,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte Luminance { get { return 13; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Furnace (lit)"; } }
}
}

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.3; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Glass"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.3; } }
public override byte Luminance { get { return 15; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Glowstone"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.6; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Grass"; } }

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 3; } }
public override string DisplayName { get { return "Ice"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Iron Door"; } }

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 1; } }
public override byte Luminance { get { return 15; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 255; } }
public override string DisplayName { get { return "Jack 'o' Lantern"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.4; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Ladder"; } }

View File

@ -15,6 +15,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte Luminance { get { return 15; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 255; } }
public override string DisplayName { get { return "Lava"; } }
}

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.2; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
//TODO: Mark this as a block that diffuses sun light.
public override string DisplayName { get { return "Leaves"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Lever"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Locked Chest"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Monster Spawner"; } }

View File

@ -18,6 +18,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte ID { get { return 0x27; } }
public override byte Luminance { get { return 1; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Brown Mushroom"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Piston"; } }
@ -35,6 +37,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Sticky Piston"; } }
public override Tuple<int, int> GetTextureMap(byte metadata)

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return -1; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Portal"; } }

View File

@ -1,25 +0,0 @@
using System;
using TrueCraft.API.Logic;
namespace TrueCraft.Core.Logic.Blocks
{
public class PoweredRailBlock : BlockProvider
{
public static readonly byte BlockID = 0x1B;
public override byte ID { get { return 0x1B; } }
public override double BlastResistance { get { return 3.5; } }
public override double Hardness { get { return 0.7; } }
public override byte Luminance { get { return 0; } }
public override string DisplayName { get { return "Powered Rail"; } }
public override Tuple<int, int> GetTextureMap(byte metadata)
{
return new Tuple<int, int>(3, 11);
}
}
}

View File

@ -10,6 +10,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.5; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
}
public class WoodenPressurePlateBlock : PressurePlateBlock

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0.7; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Rail"; } }
@ -22,4 +24,32 @@ namespace TrueCraft.Core.Logic.Blocks
return new Tuple<int, int>(0, 8);
}
}
public class PoweredRailBlock : RailBlock
{
public static readonly new byte BlockID = 0x1B;
public override byte ID { get { return 0x1B; } }
public override string DisplayName { get { return "Powered Rail"; } }
public override Tuple<int, int> GetTextureMap(byte metadata)
{
return new Tuple<int, int>(3, 11);
}
}
public class DetectorRailBlock : RailBlock
{
public static readonly new byte BlockID = 0x1C;
public override byte ID { get { return 0x1C; } }
public override string DisplayName { get { return "Detector Rail"; } }
public override Tuple<int, int> GetTextureMap(byte metadata)
{
return new Tuple<int, int>(3, 12);
}
}
}

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Redstone Dust"; } }

View File

@ -30,6 +30,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte ID { get { return 0x4A; } }
public override byte Luminance { get { return 9; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Redstone Ore (glowing)"; } }
}

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Redstone Repeater"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 7; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Redstone Torch"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Rose"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Sapling"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 1; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Sign"; } }

View File

@ -35,6 +35,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Snow"; } }
public override Tuple<int, int> GetTextureMap(byte metadata)

View File

@ -14,7 +14,11 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 2; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 255; } }
public override string DisplayName { get { return "Stone Slab"; } }
public override Tuple<int, int> GetTextureMap(byte metadata)

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 255; } }
public override string DisplayName { get { return "Stone Stairs"; } }
}

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Sugar cane"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Tall Grass"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 13; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Torch"; } }

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 3; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Trapdoor"; } }

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 100; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 3; } }
public override string DisplayName { get { return "Water"; } }
}

View File

@ -14,6 +14,8 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 3; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override string DisplayName { get { return "Wooden Door"; } }

View File

@ -14,6 +14,10 @@ namespace TrueCraft.Core.Logic.Blocks
public override double Hardness { get { return 0; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return false; } }
public override byte LightModifier { get { return 255; } }
public override string DisplayName { get { return "Wooden Stairs"; } }
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -123,7 +123,6 @@
<Compile Include="Logic\Blocks\CobwebBlock.cs" />
<Compile Include="Logic\Blocks\CraftingTableBlock.cs" />
<Compile Include="Logic\Blocks\CropsBlock.cs" />
<Compile Include="Logic\Blocks\DetectorRailBlock.cs" />
<Compile Include="Logic\Blocks\DiamondOreBlock.cs" />
<Compile Include="Logic\Blocks\DirtBlock.cs" />
<Compile Include="Logic\Blocks\DispenserBlock.cs" />
@ -155,7 +154,6 @@
<Compile Include="Logic\Blocks\ObsidianBlock.cs" />
<Compile Include="Logic\Blocks\PistonBlock.cs" />
<Compile Include="Logic\Blocks\PortalBlock.cs" />
<Compile Include="Logic\Blocks\PoweredRailBlock.cs" />
<Compile Include="Logic\Blocks\PressurePlateBlock.cs" />
<Compile Include="Logic\Blocks\PumpkinBlock.cs" />
<Compile Include="Logic\Blocks\RailBlock.cs" />
@ -209,11 +207,5 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Networking\Packets\" />
<Folder Include="World\" />
<Folder Include="Logging\" />
<Folder Include="Windows\" />
<Folder Include="Logic\" />
<Folder Include="Logic\Blocks\" />
</ItemGroup>
</Project>