Created
October 7, 2025 16:21
-
-
Save LuviKunG/fe64434e2b71db945d12931a787f2c96 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Minecraft Item Calculator. | |
| // Author: Thanut Panichyotai (@LuviKunG) | |
| // https://github.com/LuviKunG | |
| // HOW TO USE: | |
| // Enter the max item count and item count, then press Enter. | |
| // The program will calculate how many stacks and items are needed. Press Enter to exit. | |
| namespace MinecraftItemCalc | |
| { | |
| /// <summary> | |
| /// Main Program | |
| /// </summary> | |
| public static class Program | |
| { | |
| /// <summary> | |
| /// Main Entry Point | |
| /// </summary> | |
| public static void Main() | |
| { | |
| Console.Clear(); | |
| int itemMaxCount = 0; | |
| while (itemMaxCount <= 0) | |
| { | |
| Console.WriteLine("Welcome to Minecraft Item Calculator!"); | |
| Console.Write("Enter max item count: "); | |
| string? itemMaxCountString = Console.ReadLine(); | |
| if (string.IsNullOrWhiteSpace(itemMaxCountString)) | |
| { | |
| return; | |
| } | |
| if (!int.TryParse(itemMaxCountString, out itemMaxCount)) | |
| { | |
| Console.WriteLine("Invalid item count. Press any key to continue..."); | |
| Console.ReadKey(); | |
| continue; | |
| } | |
| } | |
| int itemCount = 0; | |
| while (itemCount <= 0) | |
| { | |
| Console.Write("Enter item count: "); | |
| string? itemCountString = Console.ReadLine(); | |
| if (string.IsNullOrWhiteSpace(itemCountString)) | |
| { | |
| return; | |
| } | |
| if (!int.TryParse(itemCountString, out itemCount)) | |
| { | |
| Console.WriteLine("Invalid item count. Press any key to continue..."); | |
| Console.ReadKey(); | |
| continue; | |
| } | |
| int stack = Convert.ToInt32(Math.Floor((double)itemCount / itemMaxCount)); | |
| int mod = itemCount % itemMaxCount; | |
| Console.WriteLine($"{stack} Stack(s) and {mod} Item(s)"); | |
| itemCount = 0; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment