public override bool PlaceBlock(Level world, Player player, BlockCoordinates targetCoordinates, BlockFace face, Vector3 faceCoords) { FacingDirection = (int)face; var bannerBlockEntity = new BannerBlockEntity { Coordinates = Coordinates, Base = Base, }; bannerBlockEntity.SetCompound(ExtraData); world.SetBlockEntity(bannerBlockEntity); return(false); }
public override bool PlaceBlock(Level world, Player player, BlockCoordinates targetCoordinates, BlockFace face, Vector3 faceCoords) { // metadata for banner is a value 0-15 that signify the orientation of the banner. Same as PC metadata. Metadata = (byte)((int)(Math.Floor((player.KnownPosition.Yaw + 180) * 16 / 360) + 0.5) & 0x0f); var bannerBlockEntity = new BannerBlockEntity { Coordinates = Coordinates, Base = Base, }; bannerBlockEntity.SetCompound(ExtraData); world.SetBlockEntity(bannerBlockEntity); return(false); }
public override void PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords) { var coor = GetNewCoordinatesFromFace(blockCoordinates, face); if (face == BlockFace.Up) // On top of block { var banner = new StandingBanner(); banner.Coordinates = coor; // metadata for banner is a value 0-15 that signify the orientation of the banner. Same as PC metadata. banner.Metadata = (byte)((int)(Math.Floor((player.KnownPosition.Yaw + 180) * 16 / 360) + 0.5) & 0x0f); world.SetBlock(banner); } else if (face == BlockFace.North) // At the bottom of block { // Doesn't work, ignore if that happen. return; } else { var banner = new WallBanner(); banner.Coordinates = coor; banner.Metadata = (byte)face; world.SetBlock(banner); } // Then we create and set the wall block entity that has all the intersting data var bannerBlockEntity = new BannerBlockEntity { Coordinates = coor, Base = Metadata, }; bannerBlockEntity.SetCompound(ExtraData); world.SetBlockEntity(bannerBlockEntity); }