private void Tick(object state) { if (!Monitor.TryEnter(_tickSync)) { return; } try { if (_frames.Count == 0) { return; } var currentFrame = _frameTicker.GetCurrentFrame(this); if (currentFrame >= _frames.Count) { return; } ItemMap map = new ItemMap(_frames[currentFrame].EntityId); ItemFrameBlockEntity blockEntity = _itemFrameBlockEntity; if (blockEntity != null) { blockEntity.SetItem(map, 0); _level.SetBlockEntity(blockEntity); } } finally { Monitor.Exit(_tickSync); } }
public FullyLuminousItemFrame(MapEntity frame, ItemFrameBlockEntity itemFrameBlockEntity, Level level) : this() { ItemMap map = new ItemMap(frame.EntityId); ItemFrameBlockEntity blockEntity = itemFrameBlockEntity; if (blockEntity != null) { blockEntity.SetItem(map); level.SetBlockEntity(blockEntity); } }
public override bool Interact(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoord) { Item itemInHande = player.Inventory.GetItemInHand(); ItemFrameBlockEntity blockEntity = world.GetBlockEntity(blockCoordinates) as ItemFrameBlockEntity; if (blockEntity != null) { blockEntity.SetItem(itemInHande); world.SetBlockEntity(blockEntity); } return(true); }