Jump to content

Recommended Posts

Posted

Hello,

 

I'm making mod, in which there are trees.I need to know how the integer of map color generates?.

There are few example in the MapColor but I'm trying to figure out how to add new ones for leaves.

 

Thanks in advance.

Posted

Not sure what you mean?

 

Map colour is a property of the material the block is made of.

 

For example:

BlockLeaves has material = Material.leaves

Material.leaves has MapColor.foliageColor

MapColor.foliageColor is MapColor(7, 31744);

 

you can also override

Block::

    public MapColor getMapColor(IBlockState state)

 

 

31744 is a number for the green, red, blue components of the colour; see here

http://www.rapidtables.com/web/color/RGB_Color.htm

 

normally it's written in hexadecimal; you can also use

java.awt.Color to work with colour more easily

package java.awt;

/**
* The <code>Color</code> class is used to encapsulate colors in the default
* sRGB color space or colors in arbitrary color spaces identified by a
* {@link ColorSpace}.  Every color has an implicit alpha value of 1.0 or
* an explicit one provided in the constructor.  The alpha value
* defines the transparency of a color and can be represented by
* a float value in the range 0.0 - 1.0 or 0 - 255.
* An alpha value of 1.0 or 255 means that the color is completely
* opaque and an alpha value of 0 or 0.0 means that the color is
* completely transparent.
* When constructing a <code>Color</code> with an explicit alpha or
* getting the color/alpha components of a <code>Color</code>, the color
* components are never premultiplied by the alpha component.
* <p>
* The default color space for the Java 2D(tm) API is sRGB, a proposed
* standard RGB color space.  For further information on sRGB,
* see <A href="http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html">
* http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html
* </A>.
* <p>
* @version     10 Feb 1997
* @author      Sami Shaio
* @author      Arthur van Hoff
* @see         ColorSpace
* @see         AlphaComposite
*/
public class Color implements Paint, java.io.Serializable {

 

For example

new MapColor(newID, Color.WHITE.getRGB());

or

myCustomColour = new Color(red, green, blue);

    * Creates an opaque sRGB color with the specified red, green,

    * and blue values in the range (0 - 255).

 

-TGG

Posted

Well... I tried RGB but it came up with different color. I don't know, is it really just rgb values?

 

...in decimal.

 

████ = 7427071  (0x7153FF)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.