From the Ground Up

From the Ground Up

41k Downloads

Possible Code Tutorial?

ChipsAhoyMcCoy16 opened this issue ยท 2 comments

commented

Hey, me again.

Now i am dead set on using this mod. But like before, i have no idea what i am doing... at all.
This isn't exactly an issue. I would like it for some of the code from here:
https://github.com/TheRActivator/From-the-Ground-Up/wiki/CraftTweaker-Support

to be explained to me. The last issue i had was here:
#26

which involved me trying to add test pages. Now i am trying to get more technologies, adding items, adding idea and research recipes, with some scrambles.

Any help would be awesome. This mod is amazing, just not user friendly to non coders like myself.

Thanks!

commented

If you have any questions, feel free to ask

commented

When coding, you use these things called functions, also known as methods or commands in other programming languages. Each function has a name and a fixed set of arguments (also called parameters, more about them later).

To call a function, you first type their name, an opening bracket (, arguments separated by commas, and a closing bracket ). To say that you finished coding a line, you type a semicolon ;.

For example: mods.ftgu.Idea.addIdea("example_tech", [<minecraft:dirt>]);

  • mods.ftgu.Idea.addIdea
  • (
  • "example_tech", [minecraft:dirt]
  • )
  • ;

What are arguments?
Sometimes functions need information to execute. You can specify this information in their arguments.
In MineTweaker there are multiple types of arguments. Here is a list of the most important ones:

Argument type How to type it Examples
Boolean true or false true, false
Number Type the number, but don't use any commas 12000, 4.16
Text / String Start with ", type your text, end with " again "Hello world!"
Item / Block Start with <, type the mod id, seperate with : and type the item id, seperate with : and type the metadata (optional), end with > <minecraft:stone:1>, <ftgumod:idea_table>
Oredictionary Items Start with <ore:, type the oredict name, end with > <ore:ingotCopper>
Arrays Start with [, type your objects seperated by commas, end with ] [1, 5, 8.3], [<minecraft:stone>, <minecraft:sand>]

What are arrays?
An array is a list of arguments, but inside an array they are usually referred to as objects.
Arrays are often used for recipes, like how you would add recipes to the idea table. They can also store other arrays, which is how you would form a crafting recipe or a research table recipe. This is an array containing 3 other arrays (each array represents a row) and those arrays contain 3 items.

For example: [[<minecraft:cobblestone>, <minecraft:cobblestone>, <minecraft:cobblestone>], [null, <minecraft:stick>, null], [null, <minecraft:stick>, null]]

Each sub-array represents a row in the crafting table:

  • [<minecraft:cobblestone>, <minecraft:cobblestone>, <minecraft:cobblestone>]
  • [null, <minecraft:stick>, null]
  • [null, <minecraft:stick>, null]

In this case, this is the recipe for a stone pickaxe. null represents no item.

The CraftTweaker Support page
In the wiki page, there are a few terms I have not explained here:

  • IItemStack: An item with metadata
  • IIngredient: An item or block without metadata
  • int: A whole number
  • ___[]: An array containing ___'s