• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# World.UniversalCoords类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Chraft.World.UniversalCoords的典型用法代码示例。如果您正苦于以下问题:C# UniversalCoords类的具体用法?C# UniversalCoords怎么用?C# UniversalCoords使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UniversalCoords类属于Chraft.World命名空间,在下文中一共展示了UniversalCoords类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SingleContainerInterface

        internal SingleContainerInterface(World.WorldManager world, InterfaceType interfaceType, UniversalCoords coords, sbyte slotCount)
            : base(world, interfaceType, slotCount)
        {
            Coords = coords;

            Load();
        }
开发者ID:TheaP,项目名称:c-raft,代码行数:7,代码来源:SingleContainerInterface.cs


示例2: ForNSEW

 public void ForNSEW(UniversalCoords coords, ForEachBlock predicate)
 {
     predicate(UniversalCoords.FromWorld(coords.WorldX - 1, coords.WorldY, coords.WorldZ));
     predicate(UniversalCoords.FromWorld(coords.WorldX + 1, coords.WorldY, coords.WorldZ));
     predicate(UniversalCoords.FromWorld(coords.WorldX, coords.WorldY, coords.WorldZ - 1));
     predicate(UniversalCoords.FromWorld(coords.WorldX, coords.WorldY, coords.WorldZ + 1));
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:7,代码来源:Chunk.cs


示例3: Open

        /// <summary>
        /// Opens the Workbench and specifies where items should be dropped if exiting the workbench with items still in it.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        public virtual void Open(UniversalCoords coords)
        {
            _useProvidedDropCoordinates = true;
            _DropCoords = coords;

            this.Open();
        }
开发者ID:dekema2,项目名称:c-raft,代码行数:13,代码来源:WorkbenchInterface.cs


示例4: LargeChestInterface

        /// <summary>
        /// Creates a Large Chest interface for the two chests specified (North or East chest, and South or West chest)
        /// </summary>
        /// <param name="world"></param>
        /// <param name="neChest">The North or East chest coordinates</param>
        /// <param name="swChest">The South or West chest coordinates</param>
        public LargeChestInterface(World.WorldManager world, UniversalCoords neChest, UniversalCoords swChest)
            : base(world, InterfaceType.Chest, 54)
        {
            NEChest = neChest;
            SWChest = swChest;

            Load();
        }
开发者ID:Smjert,项目名称:c-raft,代码行数:14,代码来源:LargeChestInterface.cs


示例5: StopBurning

 public static void StopBurning(WorldManager world, UniversalCoords coords)
 {
     string id = String.Format("{0}-{1},{2},{3}", world.Name, coords.WorldX, coords.WorldY, coords.WorldZ);
     lock (_staticLock)
     {
         if (_furnaceInstances.ContainsKey(id))
             _furnaceInstances[id].StopBurning();
     }
 }
开发者ID:IdentErr,项目名称:c-raft,代码行数:9,代码来源:FurnaceInterface.cs


示例6: ForAdjacent

 public void ForAdjacent(UniversalCoords coords, ForEachBlock predicate)
 {
     predicate(UniversalCoords.FromWorld(coords.WorldX - 1, coords.WorldY, coords.WorldZ));
     predicate(UniversalCoords.FromWorld(coords.WorldX + 1, coords.WorldY, coords.WorldZ));
     predicate(UniversalCoords.FromWorld(coords.WorldX, coords.WorldY, coords.WorldZ - 1));
     predicate(UniversalCoords.FromWorld(coords.WorldX, coords.WorldY, coords.WorldZ + 1));
     if (coords.BlockY > 0)
         predicate(UniversalCoords.FromWorld(coords.WorldX, coords.WorldY - 1, coords.WorldZ));
     if (coords.BlockY < 127)
         predicate(UniversalCoords.FromWorld(coords.WorldX, coords.WorldY + 1, coords.WorldZ));
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:11,代码来源:Chunk.cs


示例7: BlockPathWeight

 protected override double BlockPathWeight(UniversalCoords coords)
 {
     if (this.World.GetBlockId(coords.WorldX, coords.WorldY - 1, coords.WorldZ) == (byte)BlockData.Blocks.Grass)
     {
         return 10.0;
     }
     else
     {
         return this.World.GetBlockLightBrightness(coords) - 0.5; // stay out of lower half of brightness spectrum
     }
 }
开发者ID:dekema2,项目名称:c-raft,代码行数:11,代码来源:Animal.cs


示例8: fixed

 public unsafe byte this[UniversalCoords coords]
 {
     get
     {
         fixed (byte* types = Types)
             return types[coords.BlockPackedCoords];
     }
     set
     {
         fixed (byte* types = Types)
             types[coords.BlockPackedCoords] = value;
     }
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:13,代码来源:ChunkBase.cs


示例9:

 public Chunk this[UniversalCoords coords]
 {
     get
     {
         Chunk chunk;
         Chunks.TryGetValue(coords.ChunkPackedCoords, out chunk);
         return chunk;
     }
     private set
     {
         Chunks.AddOrUpdate(coords.ChunkPackedCoords, value, (key, oldValue) => value);
     }
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:13,代码来源:ChunkSet.cs


示例10: Destroy

 public static void Destroy(WorldManager world, UniversalCoords coords)
 {
     PersistentContainer container = Instance(world, coords);
     if (container == null)
         return;
     Chunk chunk = world.GetChunk(coords);
     if (chunk == null)
         return;
     PersistentContainer unused;
     container.Destroy();
     chunk.Containers.TryRemove(container.Coords.BlockPackedCoords, out unused);
     if (container is LargeChestContainer)
         chunk.Containers.TryRemove((container as LargeChestContainer).SecondCoords.BlockPackedCoords, out unused);
 }
开发者ID:dekema2,项目名称:c-raft,代码行数:14,代码来源:ContainerFactory.cs


示例11: Close

 public static void Close(PersistentContainerInterface containerInterface, UniversalCoords coords)
 {
     PersistentContainer container = Instance(containerInterface.World, coords);
     if (container == null)
         return;
     container.RemoveInterface(containerInterface);
     Chunk chunk = container.World.GetChunk(coords);
     if (chunk == null)
         return;
     PersistentContainer unused;
     if (container is LargeChestContainer && container.IsUnused())
     {
         chunk.Containers.TryRemove(container.Coords.BlockPackedCoords, out unused);
         chunk.Containers.TryRemove((container as LargeChestContainer).SecondCoords.BlockPackedCoords, out unused);
     } else if (container is SmallChestContainer && container.IsUnused())
         chunk.Containers.TryRemove(container.Coords.BlockPackedCoords, out unused);
 }
开发者ID:dekema2,项目名称:c-raft,代码行数:17,代码来源:ContainerFactory.cs


示例12: GetDoubleChestCoords

        public static UniversalCoords[] GetDoubleChestCoords(WorldManager world, UniversalCoords coords)
        {
            Chunk chunk = world.GetChunk(coords);
            if (chunk == null || !IsDoubleChest(chunk, coords))
                return null;
            // Is this chest the "North or East", or the "South or West"
            BlockData.Blocks[] nsewBlocks = new BlockData.Blocks[4];
            UniversalCoords[] nsewBlockPositions = new UniversalCoords[4];
            int nsewCount = 0;
            byte? blockId;
            chunk.ForNSEW(coords, uc =>
            {
                blockId = world.GetBlockId(uc) ?? 0;
                nsewBlocks[nsewCount] = (BlockData.Blocks)blockId;
                nsewBlockPositions[nsewCount] = uc;
                nsewCount++;
            });
            UniversalCoords firstCoords;
            UniversalCoords secondCoords;

            if ((byte)nsewBlocks[0] == (byte)BlockData.Blocks.Chest) // North
            {
                firstCoords = nsewBlockPositions[0];
                secondCoords = coords;
            }
            else if ((byte)nsewBlocks[2] == (byte)BlockData.Blocks.Chest) // East
            {
                firstCoords = nsewBlockPositions[2];
                secondCoords = coords;
            }
            else if ((byte)nsewBlocks[1] == (byte)BlockData.Blocks.Chest) // South
            {
                firstCoords = coords;
                secondCoords = nsewBlockPositions[1];
            }
            else// if ((byte)nsewBlocks[3] == (byte)BlockData.Blocks.Chest) // West
            {
                firstCoords = coords;
                secondCoords = nsewBlockPositions[3];
            }
            return new UniversalCoords[] { firstCoords, secondCoords };
        }
开发者ID:dekema2,项目名称:c-raft,代码行数:42,代码来源:ContainerFactory.cs


示例13: GrowCactus

        public void GrowCactus(UniversalCoords coords)
        {
            if (GetType(coords) == BlockData.Blocks.Cactus)
                return;

            if (GetType(UniversalCoords.FromWorld(coords.WorldX, coords.WorldY - 3, coords.WorldZ)) == BlockData.Blocks.Cactus)
                return;

            if (!IsNSEWTo(coords, (byte)BlockData.Blocks.Air))
                return;

            if (World.Server.Rand.Next(60) == 0)
            {
                SetType(coords, BlockData.Blocks.Cactus);
            }
        }
开发者ID:dekema2,项目名称:c-raft,代码行数:16,代码来源:Chunk.cs


示例14: Load

        public static Chunk Load(UniversalCoords coords, WorldManager world)
        {
            string path = world.Folder + "/x" + coords.ChunkX + "_z" + coords.ChunkZ + ".gz";

            if (!CanLoad(path))
                return null;

            Stream zip = null;

            Chunk chunk = new Chunk(world, coords);

            try
            {
                zip = new DeflateStream(File.Open(path, FileMode.Open), CompressionMode.Decompress);

                int version = zip.ReadByte();

                switch(version)
                {
                    /* When there's a new mod you do:
                    case 1:
                    {
                     * dosomething
                     * goto case 0;
                    }*/
                    case 0:
                    {
                        chunk.LightToRecalculate = Convert.ToBoolean(zip.ReadByte());
                        chunk.HeightMap = new byte[16,16];
                        int height;
                        chunk.MaxHeight = 0;
                        for (int x = 0; x < 16; ++x)
                        {
                            for (int z = 0; z < 16; ++z)
                            {
                                height = chunk.HeightMap[x, z] = (byte) zip.ReadByte();

                                if (chunk.MaxHeight < height)
                                    chunk.MaxHeight = height;
                            }
                        }
                        chunk.LoadAllBlocks(zip);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                world.Logger.Log(ex);
                return null;
            }
            if (zip != null)
                zip.Dispose();

            (BlockHelper.Instance((byte) BlockData.Blocks.Sign_Post) as BlockSignBase).LoadSignsFromDisk(chunk, world.SignsFolder);

            return chunk;
        }
开发者ID:dekema2,项目名称:c-raft,代码行数:58,代码来源:Chunk.cs


示例15: FurnaceInterface

 public FurnaceInterface(World.WorldManager world, UniversalCoords coords)
     : base(world, InterfaceType.Furnace, coords, 3)
 {
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:4,代码来源:FurnaceInterface.cs


示例16: FurnaceInstance

 public FurnaceInstance(WorldManager world, UniversalCoords coords)
 {
     this.World = world;
     Coords = coords;
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:5,代码来源:FurnaceInterface.cs


示例17: RemoveFurnaceInterface

 private static void RemoveFurnaceInterface(UniversalCoords coords, FurnaceInterface furnace)
 {
     string id = String.Format("{0}-{1},{2},{3}", furnace.World.Name, coords.WorldX, coords.WorldY, coords.WorldZ);
     lock (_staticLock)
     {
         if (_furnaceInstances.ContainsKey(id))
         {
             _furnaceInstances[id].Remove(furnace);
         }
     }
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:11,代码来源:FurnaceInterface.cs


示例18: AddFurnaceInterface

        /// <summary>
        /// Adds the FurnaceInterface to a FurnaceInstance, then returns the FurnaceInstance it is added to.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <param name="furnace"></param>
        /// <returns>The FurnaceInstance that the FurnaceInterface was added to</returns>
        private static FurnaceInstance AddFurnaceInterface(UniversalCoords coords, FurnaceInterface furnace)
        {
            string id = String.Format("{0}-{1},{2},{3}", furnace.World.Name, coords.WorldX, coords.WorldY, coords.WorldZ);
            lock (_staticLock)
            {
                FurnaceInstance furnaceInstance;
                if (!_furnaceInstances.ContainsKey(id))
                {
                    furnaceInstance = new FurnaceInstance(furnace.World, coords);
                    _furnaceInstances[id] = furnaceInstance;
                }
                else
                {
                    furnaceInstance = _furnaceInstances[id];
                }
                furnaceInstance.Add(furnace);

                return furnaceInstance;
            }
        }
开发者ID:Smjert,项目名称:c-raft,代码行数:28,代码来源:FurnaceInterface.cs


示例19: DispenserInterface

 public DispenserInterface(World.WorldManager world, UniversalCoords coords)
     : base(world, InterfaceType.Dispenser, coords, 9)
 {
 }
开发者ID:IdentErr,项目名称:c-raft,代码行数:4,代码来源:DispenserInterface.cs


示例20: SmallChestInterface

 public SmallChestInterface(World.WorldManager world, UniversalCoords coords)
     : base(world, InterfaceType.Chest, coords, 27)
 {
 }
开发者ID:Smjert,项目名称:c-raft,代码行数:4,代码来源:SmallChestInterface.cs



注:本文中的Chraft.World.UniversalCoords类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# World.WorldManager类代码示例发布时间:2022-05-24
下一篇:
C# Net.PacketReader类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap