当前位置: 首页>>代码示例>>C#>>正文


C# World.getBlockTileEntity方法代码示例

本文整理汇总了C#中CraftyServer.Core.World.getBlockTileEntity方法的典型用法代码示例。如果您正苦于以下问题:C# World.getBlockTileEntity方法的具体用法?C# World.getBlockTileEntity怎么用?C# World.getBlockTileEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CraftyServer.Core.World的用法示例。


在下文中一共展示了World.getBlockTileEntity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: blockActivated

 public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
 {
     object obj = world.getBlockTileEntity(i, j, k);
     if (world.isBlockOpaqueCube(i, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockOpaqueCube(i - 1, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockOpaqueCube(i + 1, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k - 1))
     {
         return true;
     }
     if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k + 1))
     {
         return true;
     }
     if (world.getBlockId(i - 1, j, k) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.getBlockTileEntity(i - 1, j, k),
                                       ((IInventory) (obj)));
     }
     if (world.getBlockId(i + 1, j, k) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)),
                                       (TileEntityChest) world.getBlockTileEntity(i + 1, j, k));
     }
     if (world.getBlockId(i, j, k - 1) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.getBlockTileEntity(i, j, k - 1),
                                       ((IInventory) (obj)));
     }
     if (world.getBlockId(i, j, k + 1) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)),
                                       (TileEntityChest) world.getBlockTileEntity(i, j, k + 1));
     }
     if (world.singleplayerWorld)
     {
         return true;
     }
     else
     {
         entityplayer.displayGUIChest(((IInventory) (obj)));
         return true;
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:53,代码来源:BlockChest.cs

示例2: onBlockClicked

 public override void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
 {
     if (world.singleplayerWorld)
     {
         return;
     }
     else
     {
         var tileentitynote = (TileEntityNote) world.getBlockTileEntity(i, j, k);
         tileentitynote.triggerNote(world, i, j, k);
         return;
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:13,代码来源:BlockNote.cs

示例3: blockActivated

 public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
 {
     if (world.singleplayerWorld)
     {
         return true;
     }
     else
     {
         var tileentitynote = (TileEntityNote) world.getBlockTileEntity(i, j, k);
         tileentitynote.changePitch();
         tileentitynote.triggerNote(world, i, j, k);
         return true;
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:14,代码来源:BlockNote.cs

示例4: onNeighborBlockChange

 public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
 {
     if (l > 0 && blocksList[l].canProvidePower())
     {
         bool flag = world.isBlockGettingPowered(i, j, k);
         var tileentitynote = (TileEntityNote) world.getBlockTileEntity(i, j, k);
         if (tileentitynote.previousRedstoneState != flag)
         {
             if (flag)
             {
                 tileentitynote.triggerNote(world, i, j, k);
             }
             tileentitynote.previousRedstoneState = flag;
         }
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:16,代码来源:BlockNote.cs

示例5: generate


//.........这里部分代码省略.........

            if (j1 < 1 || j1 > 5)
            {
                return false;
            }
            for (int l1 = i - l - 1; l1 <= i + l + 1; l1++)
            {
                for (int k2 = j + byte0; k2 >= j - 1; k2--)
                {
                    for (int j3 = k - i1 - 1; j3 <= k + i1 + 1; j3++)
                    {
                        if (l1 == i - l - 1 || k2 == j - 1 || j3 == k - i1 - 1 || l1 == i + l + 1 || k2 == j + byte0 + 1 ||
                            j3 == k + i1 + 1)
                        {
                            if (k2 >= 0 && !world.getBlockMaterial(l1, k2 - 1, j3).isSolid())
                            {
                                world.setBlockWithNotify(l1, k2, j3, 0);
                                continue;
                            }
                            if (!world.getBlockMaterial(l1, k2, j3).isSolid())
                            {
                                continue;
                            }
                            if (k2 == j - 1 && random.nextInt(4) != 0)
                            {
                                world.setBlockWithNotify(l1, k2, j3, Block.cobblestoneMossy.blockID);
                            }
                            else
                            {
                                world.setBlockWithNotify(l1, k2, j3, Block.cobblestone.blockID);
                            }
                        }
                        else
                        {
                            world.setBlockWithNotify(l1, k2, j3, 0);
                        }
                    }
                }
            }

            for (int i2 = 0; i2 < 2; i2++)
            {
                for (int l2 = 0; l2 < 3; l2++)
                {
                    int k3 = (i + random.nextInt(l*2 + 1)) - l;
                    int l3 = j;
                    int i4 = (k + random.nextInt(i1*2 + 1)) - i1;
                    if (!world.isAirBlock(k3, l3, i4))
                    {
                        continue;
                    }
                    int j4 = 0;
                    if (world.getBlockMaterial(k3 - 1, l3, i4).isSolid())
                    {
                        j4++;
                    }
                    if (world.getBlockMaterial(k3 + 1, l3, i4).isSolid())
                    {
                        j4++;
                    }
                    if (world.getBlockMaterial(k3, l3, i4 - 1).isSolid())
                    {
                        j4++;
                    }
                    if (world.getBlockMaterial(k3, l3, i4 + 1).isSolid())
                    {
                        j4++;
                    }
                    if (j4 != 1)
                    {
                        continue;
                    }
                    world.setBlockWithNotify(k3, l3, i4, Block.crate.blockID);
                    var tileentitychest = (TileEntityChest) world.getBlockTileEntity(k3, l3, i4);
                    int k4 = 0;
                    do
                    {
                        if (k4 >= 8)
                        {
                            goto label0;
                        }
                        ItemStack itemstack = pickCheckLootItem(random);
                        if (itemstack != null)
                        {
                            tileentitychest.setInventorySlotContents(
                                random.nextInt(tileentitychest.getSizeInventory()), itemstack);
                        }
                        k4++;
                    } while (true);
                }

                label0:
                ;
            }

            world.setBlockWithNotify(i, j, k, Block.mobSpawner.blockID);
            var tileentitymobspawner = (TileEntityMobSpawner) world.getBlockTileEntity(i, j, k);
            tileentitymobspawner.setMobID(pickMobSpawner(random));
            return true;
        }
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:WorldGenDungeons.cs

示例6: onBlockRemoval

        public override void onBlockRemoval(World world, int i, int j, int k)
        {
            var tileentitychest = (TileEntityChest) world.getBlockTileEntity(i, j, k);

            for (int l = 0; l < tileentitychest.getSizeInventory(); l++)
            {
                ItemStack itemstack = tileentitychest.getStackInSlot(l);
                if (itemstack == null)
                {
                    continue;
                }
                float f = random.nextFloat()*0.8F + 0.1F;
                float f1 = random.nextFloat()*0.8F + 0.1F;
                float f2 = random.nextFloat()*0.8F + 0.1F;
                do
                {
                    if (itemstack.stackSize <= 0)
                    {
                        goto label0;
                    }
                    int i1 = random.nextInt(21) + 10;
                    if (i1 > itemstack.stackSize)
                    {
                        i1 = itemstack.stackSize;
                    }
                    itemstack.stackSize -= i1;
                    var entityitem = new EntityItem(world, i + f, j + f1, k + f2,
                                                    new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage()));
                    float f3 = 0.05F;
                    entityitem.motionX = (float) random.nextGaussian()*f3;
                    entityitem.motionY = (float) random.nextGaussian()*f3 + 0.2F;
                    entityitem.motionZ = (float) random.nextGaussian()*f3;
                    world.entityJoinedWorld(entityitem);
                } while (true);
            }
            label0:
            base.onBlockRemoval(world, i, j, k);
        }
开发者ID:riverar,项目名称:Crafty,代码行数:38,代码来源:BlockChest.cs


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