public void RotateBlock(AffineTransform transform, float degrees, float radians) { this.Position = transform.Apply(this.Position); if (this.IsWorldObjectBlock()) { WorldEditWorldObjectBlockData worldObjectBlockData = (WorldEditWorldObjectBlockData)this.BlockData; worldObjectBlockData.SetRotation(worldObjectBlockData.Rotation * QuaternionUtils.FromAxisAngle(Vector3.Up, radians)); this.BlockData = worldObjectBlockData; } else if (!this.IsPlantBlock() && !this.BlockType.Equals(typeof(EmptyBlock))) { if (BlockUtils.HasRotatedVariants(this.BlockType, out Type[] variants))
public bool RotateClipboard(float pAngle) { if (mClipboard == null) { return(false); } AffineTransform transform = new AffineTransform(); pAngle = (float)(Math.PI * MathUtil.NormalizeAngle0to360(pAngle) / 180.0); transform = transform.RotateY(pAngle); for (int i = 0; i < mClipboard.Count; i++) { var block = mClipboard[i].Clone(); block.Position = transform.Apply(block.Position); mClipboard[i] = block; } return(true); }