Example #1
0
        public override Entity Create(Region tregion, BsonDocument doc)
        {
            BlockItemEntity ent = new BlockItemEntity(tregion, BlockInternal.FromItemDatum(doc["bie_bi"].AsInt32), Location.Zero);

            ent.ApplyPhysicsData(doc);
            return(ent);
        }
Example #2
0
 public BlockItemEntityTag(BlockItemEntity ent)
 {
     Internal = ent;
 }
Example #3
0
 public override Entity Create(Region tregion, BsonDocument doc)
 {
     BlockItemEntity ent = new BlockItemEntity(tregion, BlockInternal.FromItemDatum(doc["bie_bi"].AsInt32), Location.Zero);
     ent.ApplyPhysicsData(doc);
     return ent;
 }
Example #4
0
 public void BreakNaturally(Location pos, bool regentrans = true)
 {
     pos = pos.GetBlockLocation();
     Chunk ch = LoadChunk(ChunkLocFor(pos));
     lock (ch.EditSessionLock)
     {
         int x = (int)Math.Floor(pos.X) - (int)ch.WorldPosition.X * Chunk.CHUNK_SIZE;
         int y = (int)Math.Floor(pos.Y) - (int)ch.WorldPosition.Y * Chunk.CHUNK_SIZE;
         int z = (int)Math.Floor(pos.Z) - (int)ch.WorldPosition.Z * Chunk.CHUNK_SIZE;
         BlockInternal bi = ch.GetBlockAt(x, y, z);
         if (((BlockFlags)bi.BlockLocalData).HasFlag(BlockFlags.PROTECTED))
         {
             return;
         }
         Material mat = (Material)bi.BlockMaterial;
         ch.BlocksInternal[ch.BlockIndex(x, y, z)].BlockLocalData |= (byte)BlockFlags.PROTECTED;
         if (mat != (ushort)Material.AIR)
         {
             ch.SetBlockAt(x, y, z, new BlockInternal((ushort)Material.AIR, 0, 0, (byte)BlockFlags.EDITED));
             ch.LastEdited = GlobalTickTime;
             SurroundRunPhysics(pos);
             if (regentrans)
             {
                 ChunkSendToAll(new BlockEditPacketOut(new Location[] { pos }, new ushort[] { 0 }, new byte[] { 0 }, new byte[] { 0 }), ch.WorldPosition);
             }
             bi.Material = mat.GetBreaksInto();
             BlockItemEntity bie = new BlockItemEntity(this, new BlockInternal((ushort)bi._BlockMaterialInternal, bi.BlockData, bi._BlockPaintInternal, 0), pos);
             SpawnEntity(bie);
         }
     }
 }