Wednesday, January 11, 2017

Simple Coins 0.3.0 Build for Minecraft 1.11.2 - Persistence is key

Simple Coins 0.3.0 Download

Quite a few changes. Firstly the Mint block. The crafting recipe has been changed.

In order to make coins, the mint is now required to craft the coins. The crafting recipes for the coins have been removed. Just right click the mint block, and place the nuggets as so:

The coins can also be crafted back to nuggets.



Man, this piece of the build took a while to finish. Firstly was just getting the GUI to correctly work. It kept crashing at first because I assigned nulls to ItemStack variables or methods and that was the deprecated way to do it. Forge now requires ItemStack.EMPTY to be used.

Next issue was getting the custom slots to behave correctly. For some reason, the custom slots would just not let me take the item in the slot unless the cursor was already holding another ItemStack. After doing looking on GitHub as to what other modders' did. I changed the assign of the custom slots, I created an InventoryCrafting variable along with an IInventory variable that would assign to MintCraftResult - A class that extends InventoryCraftResult but returns false every time isItemValidForSlot is called.

This fixed all issues of clicking on the custom slots. But then my next issue was the input doubling when the amount was greater than 1. There was something occurring with the slotClick method, so I had to override it, and super.slotClick and ensure the after crafting, the input would decrease by 1 no matter what.

It took me 3 days to implement a Mint Block that actually works. More experienced modders can probably do this in less than a few hours. There were times when I wanted to give up. But I didn't. Even if I felt like I couldn't figure something out, I just kept going. And sometimes the answer won't come to you when you're working on it. It's good to take a break sometimes. This is all cliche-sounding but there is truth to this.

I'm unsure where I want to take this mod in the future, I thinking of making villagers be able to trade with coins instead of emeralds.

No comments:

Post a Comment