public static BlockEntity GetBlockEntityById(string blockEntityId) { BlockEntity blockEntity = null; if (blockEntityId == "Sign") { blockEntity = new Sign(); } else if (blockEntityId == "Chest") { blockEntity = new ChestBlockEntity(); } else if (blockEntityId == "EnchantTable") { blockEntity = new EnchantingTableBlockEntity(); } else if (blockEntityId == "Furnace") { blockEntity = new FurnaceBlockEntity(); } else if (blockEntityId == "Skull") { blockEntity = new SkullBlockEntity(); } return(blockEntity); }
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords) { byte direction = player.GetDirection(); //switch (direction) //{ // case 1: // Metadata = 2; // break; // West // case 2: // Metadata = 5; // break; // North // case 3: // Metadata = 3; // break; // East // case 0: // Metadata = 4; // break; // South //} EnchantingTableBlockEntity tableBlockEntity = new EnchantingTableBlockEntity { Coordinates = Coordinates }; world.SetBlockEntity(tableBlockEntity); return(false); }
public static BlockEntity GetBlockEntityById(string blockEntityId) { BlockEntity blockEntity = null; if (blockEntityId == "Sign") blockEntity = new Sign(); else if (blockEntityId == "Chest") blockEntity = new ChestBlockEntity(); else if (blockEntityId == "EnchantTable") blockEntity = new EnchantingTableBlockEntity(); else if (blockEntityId == "Furnace") blockEntity = new FurnaceBlockEntity(); return blockEntity; }
public static BlockEntity GetBlockEntityById(string blockEntityId) { BlockEntity blockEntity = null; if (blockEntityId == "Sign") { blockEntity = new Sign(); } else if (blockEntityId == "Chest") { blockEntity = new ChestBlockEntity(); } else if (blockEntityId == "EnchantTable") { blockEntity = new EnchantingTableBlockEntity(); } else if (blockEntityId == "Furnace") { blockEntity = new FurnaceBlockEntity(); } else if (blockEntityId == "Skull") { blockEntity = new SkullBlockEntity(); } else if (blockEntityId == "ItemFrame") { blockEntity = new ItemFrameBlockEntity(); } else if (blockEntityId == "Bed") { blockEntity = new BedBlockEntity(); } else if (blockEntityId == "Banner") { blockEntity = new BannerBlockEntity(); } else if (blockEntityId == "FlowerPot") { blockEntity = new FlowerPotBlockEntity(); } else if (blockEntityId == "Beacon") { blockEntity = new BeaconBlockEntity(); } else if (blockEntityId == "MobSpawner") { blockEntity = new MobSpawnerBlockEntity(); } return(blockEntity); }
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); }
public static BlockEntity GetBlockEntityById(string blockEntityId) { BlockEntity blockEntity = CustomBlockEntityFactory?.GetBlockEntityById(blockEntityId); if (blockEntity != null) { return(blockEntity); } if (blockEntityId == "Sign") { blockEntity = new SignBlockEntity(); } else if (blockEntityId == "Chest") { blockEntity = new ChestBlockEntity(); } else if (blockEntityId == "EnchantTable") { blockEntity = new EnchantingTableBlockEntity(); } else if (blockEntityId == "Furnace") { blockEntity = new FurnaceBlockEntity(); } else if (blockEntityId == "BlastFurnace") { blockEntity = new BlastFurnaceBlockEntity(); } else if (blockEntityId == "Skull") { blockEntity = new SkullBlockEntity(); } else if (blockEntityId == "ItemFrame") { blockEntity = new ItemFrameBlockEntity(); } else if (blockEntityId == "Bed") { blockEntity = new BedBlockEntity(); } else if (blockEntityId == "Banner") { blockEntity = new BannerBlockEntity(); } else if (blockEntityId == "FlowerPot") { blockEntity = new FlowerPotBlockEntity(); } else if (blockEntityId == "Beacon") { blockEntity = new BeaconBlockEntity(); } else if (blockEntityId == "MobSpawner") { blockEntity = new MobSpawnerBlockEntity(); } else if (blockEntityId == "ChalkboardBlock") { blockEntity = new ChalkboardBlockEntity(); } else if (blockEntityId == "ShulkerBox") { blockEntity = new ShulkerBoxBlockEntity(); } else if (blockEntityId == "StructureBlock") { blockEntity = new StructureBlockBlockEntity(); } return(blockEntity); }