Mythruna
April 18, 2024, 03:58:40 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Understanding Groovy file "Default.groovy"  (Read 4656 times)
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« on: August 15, 2012, 01:36:32 PM »

I just read your jar file Mythruna-core.jar and went into scripts and read default.groovy and i am almost completely confused. This is what i understood:
Code:
BlockTypeIndex.addBlockType( 400, "Mineral Vein 1", MaterialType.STONE, 0, 19 ),
BlockTypeIndex.addBlockType( 401, "Mineral Vein 2", MaterialType.STONE, 0, 19 )
That was for the Mineral Vein block correct? and the "MaterialType.STONE" is what you pasted the mineral vein code on;

"0, 19" is the unit thingy
now this code I completely understand:
Code:
scripts.initializeNext( "/scripts/blocks/base-templates.groovy" );
scripts.initializeNext( "/scripts/blocks/base-blocks.groovy" );
That is obviously what script is going to initialize next, then in parenthesis is the location of the scripts.
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #1 on: August 15, 2012, 06:10:49 PM »

First let me say that custom block packs aren't fully supported yet for a few reasons.

I just read your jar file Mythruna-core.jar and went into scripts and read default.groovy and i am almost completely confused. This is what i understood:
Code:
BlockTypeIndex.addBlockType( 400, "Mineral Vein 1", MaterialType.STONE, 0, 19 ),
BlockTypeIndex.addBlockType( 401, "Mineral Vein 2", MaterialType.STONE, 0, 19 )
That was for the Mineral Vein block correct? and the "MaterialType.STONE" is what you pasted the mineral vein code on;

"0, 19" is the unit thingy

Not quite.  First of all, those lines were commented out ... ie: they don't do anything and are just left over from testing something.

There is only one mineral vein in the real game, after all.

401 sets the index number of the material.

"Mineral Vein 2" sets the name as it appears in the current build mode tool.

MaterialType.STONE sets the physical properties... how hard it is, what the mass is, etc..

0 sets the group.  Group 0 is for fully opaque objects.  Non-0 groups say which objects are the same material for merging... for example when two glass blocks are right next to each other you can't see the inner surface between them any more.  Group -1 means that all sides are always drawn no matter what.

19 is the actual texture information used.  These are not named yet so you kind of have to already know what they mean.  This is one of the reasons custom block types are not fully supported.

now this code I completely understand:
Code:
scripts.initializeNext( "/scripts/blocks/base-templates.groovy" );
scripts.initializeNext( "/scripts/blocks/base-blocks.groovy" );
That is obviously what script is going to initialize next, then in parenthesis is the location of the scripts.

Yeah, basically it's a way for one script to say what script should run right after it.  In this case, "default.groovy" is just the base script for the default block pack and then it executes whatever other scripts really define things.

When real block packs are supported, the main script will also include things like pack name, author, etc. necessary for managing that particular plugin.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!