This repository has been archived on 2024-06-13. You can view files and clone it, but cannot push or open issues or pull requests.
Drew DeVault a361703746 Implement walking sounds
These sounds change depending on what kind of block you're walking in.

Still to come: sound effects for mining and placing blocks
2015-10-05 22:06:59 -04:00

77 lines
2.5 KiB
C#

using System;
using TrueCraft.API.Logic;
using TrueCraft.API;
using TrueCraft.API.World;
using TrueCraft.API.Networking;
using TrueCraft.Core.Logic.Items;
using TrueCraft.Core.Networking.Packets;
using fNbt;
namespace TrueCraft.Core.Logic.Blocks
{
public class WallSignBlock : BlockProvider
{
public static readonly byte BlockID = 0x44;
public override byte ID { get { return 0x44; } }
public override double BlastResistance { get { return 5; } }
public override double Hardness { get { return 1; } }
public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return true; } } // This is weird. You can stack signs on signs in Minecraft.
public override string DisplayName { get { return "Sign"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override BoundingBox? BoundingBox { get { return null; } }
public override Tuple<int, int> GetTextureMap(byte metadata)
{
return new Tuple<int, int>(4, 0);
}
public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
{
world.SetMetadata(descriptor.Coordinates, (byte)MathHelper.DirectionByRotationFlat(user.Entity.Yaw, true));
}
protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item)
{
return new[] { new ItemStack(SignItem.ItemID) };
}
public override void BlockMined(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
{
world.SetTileEntity(descriptor.Coordinates, null);
base.BlockMined(descriptor, face, world, user);
}
public override void TileEntityLoadedForClient(BlockDescriptor descriptor, IWorld world, NbtCompound entity, IRemoteClient client)
{
client.QueuePacket(new UpdateSignPacket
{
X = descriptor.Coordinates.X,
Y = (short)descriptor.Coordinates.Y,
Z = descriptor.Coordinates.Z,
Text = new[]
{
entity["Text1"].StringValue,
entity["Text2"].StringValue,
entity["Text3"].StringValue,
entity["Text4"].StringValue
}
});
}
}
}