Coldcraft!

Here we are now. One day before the final “exam”, doing the blog that needs to be blogged.

Coldcraft! You can see a trailer here.

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:

  1. Coldcraft Per Diem 1. (For specifications on Load Order, Blocks-Campfire- and textures)
  2. Coldcraft Per Diem 2. (For specifications about PlayerData, GUI, Handlers, Events, Sync, Recipes, Lang, TileEntities -Campfire-, Items -Thermometer-, and others)
  3. 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

Animation.gif

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.

Image 3

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

Animation2.gif

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.

Image 9

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.

😀

 

Anuncios

Coldcraft Per Diem 2

I got to say… the project had a lot of progress since the last post about it. In fact, I need to see what was included the last time I wrote. Wait please… I’m ready.

As always, the full project is available in GitHub

  • Well lets start it simple. A .lang archive was made to give proper names for our blocks in game. This was needed because the previous test_block did evolve to a campfire, and we didn’t like the in-game name was coldcraft.blocks.tile… and it displays just Campfire.
    Screenshot from 2016-04-25 11-24-39
  • A recipe to the block was added, called ModCrafting.class. It’s simple. The recipe is defined in a pattern. Everything is added to the common load order in the Init phase.
    Screenshot from 2016-04-25 12-10-15
  • The PlayerData.class was made with the objective to create the attribute Temperature. This is a very long class to post and image of everything, so if you want, please click on the link to GitHub to see it all. Still, I will explain it.
    Basically, first some properties of the class are stated, along with the constructor of the extended data of the player, and methods to assign the properties to the player. When calling a method of this class, the id of the entity holding the properties must be provided using: public static PlayerData get(EntityPlayer player)
    Screenshot from 2016-04-25 11-51-34Then we have some methods that save the properties as NBT Data (Where the data regarding of Minecraft is saved). Sadly those doesn’t work as expected or maybe we don’t now what we are doing.
    Then, the interactions are stated. I’m just going to write about the first one (The other hasn’t been tested). campTemperature it’s called by the campfire (Explained below), it increases the temperature by 0.001 per tick until a limit of 6.
    Screenshot from 2016-04-25 11-56-10
    Lastly, setTemperature and getTemperature methods. SyncTemperature is used everytime the temperature is setted. This is needed to actually display and save the temperature. The syncing is handled by a handler (Too complex, I just need to say that is works)
    Screenshot from 2016-04-25 12-00-42
  • The Campfire (Previously named test_block), now it isn’t just a block, is a Tile Entity. This makes available a whole lot of functionality to the block, making available the update() method, which is called every in-game tick so it can do stuff. One important thing is that the block class still exists. This happens on the ModTileEntity.class (Its unique at the moment, thats why the generic name)
    Screenshot from 2016-04-25 11-31-59.pngBasically, each tick Minecraft gets the location of the block, creates an area with a “apothem” of 4 blocks, checks if and entity of the type EntityPlayer (This means it looks for players) is in that area, and if true, calls the campTemperature() method in the Player Extended Properties, which as explained, increases the temperature.
    Screenshot from 2016-04-25 11-36-44And well, as always, the tile (Or anything) must be registered into Forge and Minecraft in the ModTileEntities.class… and into the Forge loading order: The TileEntity is added to the Common Proxy in the preInit, and the regular block and textures stayed the same.
  • A GUI was made to display information about the temperature (GuiTempBar.class), we can call it thermometer. Currently it displays on real-time the temperature, and has a button that closes the interface.
    Screenshot from 2016-04-25 12-25-10.pngScreenshot from 2016-04-25 12-26-24There is also the ModGuiHandler.class (Basically is gives permission to the server and client to display things) and everything is added to the common load order in the Init phase.
  • 4 items were made (3 for testing) in the ModItems.class. The important one is the one that opens the Thermometer/Temperature GUI for the player. Those are added to the common load order in the preInit phase and their textures (which are none) to the client load order in the init phase.
    Screenshot from 2016-04-25 12-14-35.png
    The item uses the event onItemRightClick to do stuff. (More events things explained below)
  • Finally, the EventHandlerCommon.class , here when the player joins to world or changes of map (Ender, Nether or regular) loads the temperature attribute, but it doesn’t quite work, we guess is because the playerID changes sometimes the game starts.
    LivingUpdateEvent.class is an event that happens every tick if a living entity exist. This will be used to update the temperature of the player depending on the biome he exists, for each tick.

I guess it would be nice a photo of the common load order CommomProxy.class:

Screenshot from 2016-04-25 12-40-13.png

And, that is all for now. We are currently working on:

  • Updating the temperature of the player according to the biome.
  • Deal damage
  • Do some armor/sweaters

For more information, you know where to find me… or my team (Santiago Kelley and Arturo Fornes).

Peace.

😀

WSQGraphicsExtra

Well, now into some Graphing basics. I’ve done the MIT exercises that Ken previously had shown us. You should know, dear reader, that my art it’s just going to be as good as that bear of the Flickr artist Orin Zebest ( ;-; )

As always, my code can be found on GitHub. This time just one class, the DrawGraphics, was modified, because the objective of this activity was mainly to teach how to insert objects into the drawing surface, how do the parameters work and how to animate an object. Further I’ve revised the code of the other two classes, it is very similar to previous work I’ve done in Python or JavaScript, so nothing scary there.

Now, here it is the code:

Screenshot from 2016-04-03 23-48-24.png

And the result (OMG a gif!)

optimised.gif

You know how to get in touch, I hope…

Like a dear YouTuber would say (Jake Roper Vsauce3’s host):

“But remember my dear friend: Its not good-bye, oh no, its never good-bye, its see you later (you’re pretty darn awesome)”

2110547610_831a653a7c_b
flickr photo by orinrobertjohn https://www.flickr.com/photos/orinrobertjohn/2110547610 obtained under a Creative Commons (BY)

Coldcraft Per Diem 1

OMG… I’m doing this so late. If you want to read about the basic ideas of this mod, go to my partner’s blog. Also, I can’t recommend enough BedrockMiner’s blog/tutorial about modding minecraft.

Now, about the things that I’ve been working on. Everything can be found on GitHub.
First I’ve established the Main class, along with the Client Proxy (Where the things the clients need to initialize), the Server Proxy (Just Server), and the Common Proxy (Where the thing both need to initialize). Every time a new category of blocks, items, new classes is created we need to decide who will make the initialization.

A block, named TestBlock, -I hope this useless block can evolve to a campfire or something, I just need the textures and a crafting recipe, that I’m currently working on (just the textures)-. The first thing necessary for the creation of blocks is to create a Basic Block Class, where all the little cute blocks -like Test Block- go to get created. This is a basic template for all blocks.Screenshot from 2016-04-03 15-58-34

Then we create the object (block) in particular in the class ModBlocks. Here the object testBlock is created with the only special attribute of emitting 1 point of light, that is equivalent to daylight.

Screenshot from 2016-04-03 15-59-18

Finally we need to register the block into Forge and Minecraft, here is where the texture and icon is assigned. The characteristics of both are explicitly given on some jsons in the folder of resources. Forge know what to assign to what because the Unlocalized Name given to each block (Just 1 in this case).

Screenshot from 2016-04-03 16-00-19

BTW, the rendering is only initialized on the client side, while the block per se is needed on client and server side.

Now, things I will focus:

  • Give this block a recipe, and more attributes, like a harvesting level and tool, sound when stepped on, assign it to the correct material category, so it can have proper physics.
  • Give it a new texture, if possible a changing texture (I need to research more into that topic)
  • Try to get into the armor/robes theme.

For more information, you know where to find me… or my team (Santiago Kelley and Arturo Fornes).

Peace.

😀