"Hacking" a game is another way of saying cheating the game, or using methods outside the game to get certain results in the game. Minecraft can be changed in a number of ways, as listed below.
Step
Method 1 of 3: Getting In-Game Cheats

Step 1. Create a new world

Step 2. Make sure the Cheats option is enabled

Step 3. In game, press t to open chat

Step 4. Various commands can be used to change things in the game
For example, typing "/time set 0" will change the time from noon to sunrise
Method 2 of 3: Increase Immunity

Step 1. Open an inventory editor, such as INVedit

Step 2. Give the player armor

Step 3. Set the damage to a very low negative number (eg -40000)

Step 4. Save your settings to a world

Step 5. Open the world where you saved those settings

Step 6. You will be invincible against the mafia as long as you wear this armor
Note: Falls that cause damage, drowning, or fire can still hurt you
Method 3 of 3: Using Another Cheat Method

Step 1. Look for tutorials and download Cheat Engine

Step 2. Install mods that allow you to manipulate games like INVedit or MCedit.