public static Block GetBlock(this BlockEntity input) { Block Block = new Air(); switch (input.Id) { case "Sign": Block = new StandingSign(); break; case "Chest": Block = new Chest(); break; case "EnchantTable": Block = new EnchantingTable(); break; case "Furnace": Block = new Furnace(); break; case "Skull": Block = new Skull(); break; case "ItemFrame": Block = new ItemFrame(); break; } return(Block); }
private IEnchantery Enchantery() { IEnchantery tempEnchantery = CreateItem <IEnchantery>(); //do this just to increment the numbers IEnchantery enchantery = new EnchantingTable(); //create the real object we need enchantery.Zone = tempEnchantery.Zone; enchantery.Id = tempEnchantery.Id; enchantery.Attributes.Add(ItemAttribute.NoGet); enchantery.KeyWords.Add("table"); enchantery.SentenceDescription = "table"; enchantery.ShortDescription = "The table glows with wisps of energy radiating upward."; enchantery.LookDescription = "The table glows faintly as wisps of energy radiate up into the air before dissipating."; enchantery.ExamineDescription = "The table once was a dark oak but with time and enchantments it has begun to glow a slight blue color casting a blue tint on everything in the room."; return(enchantery); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); enchantingTable = new EnchantingTable(); item = new Mock <IItem>(); room = new Mock <IRoom>(); pedistalItem = new Mock <IItem>(); pedistalContainer = pedistalItem.As <IContainer>(); world = new Mock <IWorld>(); zone = new Mock <IZone>(); zones = new Dictionary <int, IZone>(); rooms = new Dictionary <int, IRoom>(); findObjects = new Mock <IFindObjects>(); gem = new Mock <IItem>(); random = new Mock <IRandom>(); tagWrapper = new Mock <ITagWrapper>(); world.Setup(e => e.Zones).Returns(zones); zone.Setup(e => e.Rooms).Returns(rooms); zones.Add(23, zone.Object); rooms.Add(8, room.Object); findObjects.Setup(e => e.FindItemsInRoom(room.Object, "pedestal")).Returns(new List <IItem> { (IItem)pedistalContainer.Object }); pedistalContainer.Setup(e => e.Items).Returns(new List <IItem>() { gem.Object }); gem.Setup(e => e.Zone).Returns(16); gem.Setup(e => e.Id).Returns(1); item.Setup(e => e.Enchantments).Returns(new List <IEnchantment>()); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.World = world.Object; GlobalReference.GlobalValues.FindObjects = findObjects.Object; GlobalReference.GlobalValues.Random = random.Object; GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; }
public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords) { if (player.GameMode != GameMode.Creative) { ItemStack itemStackInHand = player.Inventory.GetItemInHand(); itemStackInHand.Count--; if (itemStackInHand.Count <= 0) { // set empty player.Inventory.Slots[player.Inventory.Slots.IndexOf(itemStackInHand)] = new ItemStack(); } } var coor = GetNewCoordinatesFromFace(blockCoordinates, face); EnchantingTable table = new EnchantingTable { Coordinates = coor, Metadata = (byte)Metadata }; if (!table.CanPlace(world, face)) { return; } table.PlaceBlock(world, player, coor, face, faceCoords); // Then we create and set the sign block entity that has all the intersting data EnchantingTableBlockEntity tableBlockEntity = new EnchantingTableBlockEntity { Coordinates = coor }; world.SetBlockEntity(tableBlockEntity); }