private void OnDestroyBlock(IBlockInWorld block) { World.RemoveBlock(block.Bounds.Position); foreach (var itemStack in block.Object.GetDroppedItems()) { /* var itemObj = new MobileItem(itemStack) { Position = command.Block.AbsolutePosition }; * command.World.Items.Add(itemObj); */ Player.Inventory.Put(itemStack); } }
public override void OnNeighborChanged(World world, IBlockInWorld changedNeighbor) { base.OnNeighborChanged(world, changedNeighbor); if (!world.IsBottomBlock(Bounds.Position, changedNeighbor.Bounds.Position)) { return; } var bottomBlock = world.GetBottomBlock(Bounds.Position); if (bottomBlock?.Object.BlockType != world.BlockTypes.Dirt && bottomBlock?.Object.BlockType != world.BlockTypes.DirtWithGrass) { world.RemoveBlock(Bounds.LeftTopFront); } }
public virtual void OnNeighborChanged(World world, IBlockInWorld changedNeighbor) { }