public PieceQuad GetPieceTemplate(BlockBase block, Rand rnd, BlockGroup group) { if (group == null) { if (block.BlockCore.Ceiling) { group = Ceilings; } else if (block.BlockCore.EndPiece) { group = EndBlock; } else if (block.BlockCore.StartPiece) { group = StartBlock; } else { if (block.Box.TopOnly && block.BlockCore.UseTopOnlyTexture) { group = Platforms; if (group.Widths.Length == 0) { group = Pillars; } } else { group = Pillars; } } } // Get the block's info var box = block.Box; var core = block.BlockCore; // Get the width of the block (accounting for possible rotations for Meatboy levels) float width = 0; if (core.MyOrientation == PieceQuad.Orientation.RotateRight || core.MyOrientation == PieceQuad.Orientation.RotateLeft) { width = box.Current.Size.Y; } else { width = box.Current.Size.X; } int int_width = group.SnapWidthUp(width - .1f); // Get the piecequad template try { return(group.Choose(int_width, rnd)); } catch { Tools.Log(string.Format("Could not find {0} of width {1} for tileset {2}", "block", width, Name)); return(null); } }