Example #1
0
        public T GetHandler <T>(BlockIdentifier identifier) where T : IBlockHandler
        {
            if (_handlers.TryGetValue(identifier, out var handler))
            {
                return((T)handler);
            }

            return(default);
Example #2
0
 private static bool BlockTypeIsSupported(BlockIdentifier blockID)
 {
     return
     blockID == BlockIdentifier.Dirt ||
     blockID == BlockIdentifier.Cobblestone ||
     blockID == BlockIdentifier.WoodPlank ||
     blockID == BlockIdentifier.StoneBrick ||
     blockID == BlockIdentifier.BrickBlock ||
     blockID == BlockIdentifier.Wood ||
     blockID == BlockIdentifier.Leaves ||
     blockID == BlockIdentifier.Grass;
 }
Example #3
0
 private static bool BlockTypeIsSupported(BlockIdentifier blockID)
 {
     return
         (blockID == BlockIdentifier.Dirt ||
          blockID == BlockIdentifier.Cobblestone ||
          blockID == BlockIdentifier.WoodPlank ||
          blockID == BlockIdentifier.StoneBrick ||
          blockID == BlockIdentifier.BrickBlock ||
          blockID == BlockIdentifier.Wood ||
          blockID == BlockIdentifier.Leaves ||
          blockID == BlockIdentifier.Grass);
 }
Example #4
0
        public static PhysicalMaterial FromBlockIdentifier(BlockIdentifier blockIdentifier)
        {
            switch (blockIdentifier)
            {
            case BlockIdentifier.Cobblestone:
            case BlockIdentifier.CobblestoneStairs:
            case BlockIdentifier.CobblestoneWall:
            case BlockIdentifier.Stone:
            case BlockIdentifier.StoneBrick:
            case BlockIdentifier.StoneBrickStairs:
            case BlockIdentifier.StonePlate:
            case BlockIdentifier.StoneSlab:
                return(PhysicalMaterial.Stone);

            default: return(PhysicalMaterial.Dirt);
            }
        }
        public static PhysicalMaterial FromBlockIdentifier(BlockIdentifier blockIdentifier)
        {
            switch (blockIdentifier)
            {
                case BlockIdentifier.Cobblestone:
                case BlockIdentifier.CobblestoneStairs:
                case BlockIdentifier.CobblestoneWall:
                case BlockIdentifier.Stone:
                case BlockIdentifier.StoneBrick:
                case BlockIdentifier.StoneBrickStairs:
                case BlockIdentifier.StonePlate:
                case BlockIdentifier.StoneSlab:
                    return PhysicalMaterial.Stone;

                default: return PhysicalMaterial.Dirt;
            }
        }
Example #6
0
 public Block FindBlock(BlockIdentifier identifier)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public Block(BlockIdentifier id, byte data)
 {
     this.id = id; this.data = data;
 }