--Originally published at miguelmzbi
Here we are now. One day before the final “exam”, doing the blog that needs to be blogged.
Coldcraft!
Well, first I want to say how a hassle it was to develop under the rule of Forge and how much I depended on a library that couldn’t get along with Forge, up to the point we needed to downgrade from Forge for Minecraft 1.8.9 to Minecraft 1.8. And to think that if it was obsolete with 1.8.9, now it is far behind. This happened because when we started developing Minecraft 1.9 was going out in some weeks, and when it was out, it took Forge to update to Minecraft 1.9 more time that we could spare to wait and have the newr versions. This kinda makes me sad, because all the work isn’t truly going to be implemented if the player wants the latest Minecraft version.
It was difficult to understand which methods were needed, because obviously we couldn’t write code and make magic. There wasn’t a complete library documentation, Forge wiki wasn’t a big help either. The most useful resource we had were the Minecraft Forums were I posted some questions, and a basics tutorial by _bedrock_miner.
Now that I’ve finished writing excuses, I will write about the mod itself.
First some links:
- Coldcraft Per Diem 1. (For specifications on Load Order, Blocks-Campfire- and textures)
- Coldcraft Per Diem 2. (For specifications about PlayerData, GUI, Handlers, Events, Sync, Recipes, Lang, TileEntities -Campfire-, Items -Thermometer-, and others)
- Coldcraft Per Diem 3. (Missing)
Coldcraft, as it was written on a previous blog, its a mod for Minecraft(v1.8) using Forge(v11.14.3.1450) and the external library Miner’s Basic(v1.0 – beta build 327). The purpose of the mod is to add temperature to the game. A variable the player needs to consider (And protect itself) when playing, specially if moving trough biomes.
As right now, the mod focuses mostly on cold areas (Still you can die from insolation) and singleplayer only. Every process is made and loaded on the server side (Yes singleplayer has a server side) so it can be adapted fully to multiplayer, but there are several tweaks needed to accomplish fully that capability. The only problem with this during the development (And what delayed us the most) was that we couldn’t show the player any of this data because he is on the client side and everything is managed on the server. We implemented messages between both so everything is synced when a change is registered.
Start and basics
There are 4 types of temperatures in the Mod.
- Hot biomes (Biome temperature above 1.2): Desert, savanna, mesa, plateau, hell and child biomes.
- Warm biomes (Biome temperature above 0.5 and below 1.2): Plains, forest, swampland, jungle, river, beach, mushroom and child biomes.
- Cold biomes (Below 0.5): Extreme hills, taiga, stone beach, the end and child biomes.
- Very cold biomes (Below 0): Ice plains, cold taiga, frozen river, frozen beach and child biomes.
When a player enters a world the default temperature its registered (37.0°C) and it starts to increase or decrease according to the biome where the player is locates.
- Hot: Objective temperature of 43°C. Rate of + 0.003°C per tick.
- Warm: Objective temperature of 37°C. Rate of +/- 0.002°C per tick.
- Cold: Objective of 29°C. Rate of -0.001°C per tick.
- Very cold: Objective 29°C. Rate of -0.005°C per tick.
Either the player gets to 43°C or 29°C it will start to receive damage until he dies, or protects itself from the temperature.
Everything mentioned is mostly present on the PlayerData.class. Visit GitHub if you want to analyze completely the code (It has some pretty comments)
Campfire
A campfire (That’s the name, but it doesn’t look at all as a campfire), it’s a block that provides an area of effect of 4 blocks of heat.
The campfire is crafted with 3 blocks of cobblestone, 2 sticks, 1 flint and steel.
This method of protection is just enough to handle the cold biomes, but in a small area. It’s useful if placed in home or making a path with them.
The rate of heat is 0.0011°C per tick, up to 3°C of cold protection
On code, each time the TileEntity Campfire is set to true, the PlayerData general loop takes it into consideration for at the end of the tick make the final addition to the temperature.
Coat armor
This green armor, if held completely (Helmet, chestplate, boots) kind of protects the player of the very cold biome’s temperature, but not enough to prevent the freeze.
It provides a rate of heat of 0.004°C per tick with a maximum of 5°C. It should be combined with the campfire to prevent the freeze in very cold biomes. It can be used on cold biomes to fully exceed the biome’s temperature.
On code it’s similar to the campfire. If the coat detects its used completely, lets PlayerData take it into consideration for the final sum per tick.
Thermometer
As seen above, the thermometer (Yeah, that blue redstone, such thermometer, very wow), when right clicked displays a GUI that provides to the user information.
The temperature is called from the entity data from the client side, that is obtained from the server side. The same process is used for the biome temperature. This was some of the most difficult tasks to accomplish because of already mentioned reasons. Why they couldn’t make everything on server side? We could have saved some time of coding and a lot of investigation.
Comments
Please, go to GitHub if you want to see more about the code (It’s commented over there) or the Coldcraft Per Diem entries.
Even if the textures have nothing to do with the item, or if the temperature system doesn’t work as well as we would like to, or we didn’t made all of what we proposed at the start (OMG, those are a lot of ors). And apart from all the words I wrote above. We must say that we enjoyed doing this project. I don’t know if we will continue to develop our idea, but the basis is there waiting to be completed.
Oh, and at the moment we figure out how to export the project so it can be used anywhere I will be sharing it.
For more information, you know where to find me… or my team (Santiago Kelley and Arturo Fornes).
Peace.
?