Jump to content

Recommended Posts

Posted

Hello!

 

Sorry to bother with what could be a very simple question, but I'm looking for a point in the right direction to how I can mirror the way Wool blocks are created within Minecraft. I saw the tutorial on the wiki, but instead of being a "copy-paste modder" I'm trying to go through the forge.src and see if I can mimic the way it is done (Still copy-pasting, but I'm learning how it works at the same time)

 

The last time I ever modded Minecraft was... ages ago. I got quite far, simple ore generation, unique sword based off the Dawnfang from Oblivion (Never nailed the ifTimeIsNight = return Duskfang bit, but I wasn't willing to learn Java back then, or not as much as I am now).

 

My goals are simpler this time round, I'm simply making a mod that adds a huge collection of building blocks, mostly mono-colored, but I intend to texture all added blocks into wool. It's a mod for Pixel Artists really.

 

But, I digress. I cannot for the life of me find anything related to BlockCloth. It is as if with 1.8 it's disappeared, unless it's stashed within the Block.class file.

 

As of yet, each block has been painstakingly made individually, and that includes the .json files (Oh dear lord... Thankfully there was a .json generator available) As of right now, the list is :

 

 

public static void registerRenders()
{
	registerRender(rgb_red);
	registerRender(rgb_yellow);
	registerRender(rgb_green);
	registerRender(rgb_cyan);
	registerRender(rgb_blue);
	registerRender(rgb_magenta);

	registerRender(cmyk_red);
	registerRender(cmyk_yellow);
	registerRender(cmyk_green);
	registerRender(cmyk_cyan);
	registerRender(cmyk_blue);
	registerRender(cmyk_magenta);

	registerRender(pastel_red);
	registerRender(pastel_red_orange);
	registerRender(pastel_yellow_orange);
	registerRender(pastel_yellow);
	registerRender(pastel_yellow_green);
	registerRender(pastel_pea_green);
	registerRender(pastel_yellow_green);
	registerRender(pastel_green);
	registerRender(pastel_green_cyan);
	registerRender(pastel_cyan);
	registerRender(pastel_cyan_blue);
	registerRender(pastel_blue);
	registerRender(pastel_blue_violet);
	registerRender(pastel_violet);
	registerRender(pastel_violet_magenta);
	registerRender(pastel_magenta);
	registerRender(pastel_magenta_red);

	registerRender(white);
	registerRender(grey_10);
	registerRender(grey_20);
	registerRender(grey_30);
	registerRender(grey_40);
	registerRender(grey_50);
	registerRender(grey_60);
	registerRender(grey_70);
	registerRender(grey_80);
	registerRender(grey_90);
	registerRender(black);

	//registerRender(test_block1);
}

 

 

* Doesn't include the 51 colors I added with the first attempt at making this. When Eclipse modified both workspaces, each one became corrupt (Shouldn't have tried to be clever...), so this is my third attempt.

 

The reason I want to use metadata subblocks is for efficiency. I could plough on through with what I've done so far until I've broken the .java file because it contains too many lines, or learn to code more efficiently.

 

Put another way, I want the infrastructure to be stronger than it is currently, for ease of use in the future.

 

Any help related to how it works and how exactly i can recreate it would be much appreciated, and I'm also looking for good places over the net to learn Java, so if anyone knows a good place to start, much appreciated.

 

Thanks to everyone who reads this.

 

-Tyraim.

Posted

One thing to consider is that metadata still (in 1.8) exists underneath the new Properties and IBlockState.  However, according to diesieben07 the metadata is still apparently only 4 bits per block, so at most you can have 16 variations.  it makes sense that it is still limited because there are millions of block positions in the world so the storage, memory and process all need to be compact.

 

I believe the approach to use now is to make a PropertyEnum for your block which has a constructor like: PropertyEnum(String name, Class enumerationClass, Collection allowedValues) and also make sure to hook that into the block state and meta data values with the new standard methods.  You might want to check out my brief tutorial on 1.8 Blocks here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-18-block-modding.html (although it seems you've already figured out a lot of the JSON stuff).

 

While you can create a property that has more than 16 values, you have to provide a getStateFromMeta() and a getMetaFromState() methods which I assume need to be limited to 16 values.  I can't find where that limit is enforced though.

 

But otherwise, create an enumerated property up to 16 values and then that property gets mapped in your blockstates JSON files into different models, which in turn can be mapped to different textures.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Having forgotten most of what I learnt from my past experience and modifying Minecraft, starting again at 1.8 has posed me no problem beyond the "I have no idea really what I'm doing" (Which was the case when I did it before xD).

 

I know nothing of the .json system apart from the fact that if I had not found the generator I'd still probably be editing copies of the first one I created :< . If I understand correctly, the .json is a new rendering system that defines what the block looks like (Very vague, I agree.)

 

I found the wool class file, I knew the dataID was 35 and had I bothered to check the Block.class more thoroughly I'd have noticed it's now called BlockColored.class ._.

 

Pastel blocks are a total of 16, so this is perfect! All I need to do is figure out how to do it.

 

Thanks for the quick reply in any case, this place seems cool.

Posted

While you can create a property that has more than 16 values, you have to provide a getStateFromMeta() and a getMetaFromState() methods which I assume need to be limited to 16 values.  I can't find where that limit is enforced though.

 

But otherwise, create an enumerated property up to 16 values and then that property gets mapped in your blockstates JSON files into different models, which in turn can be mapped to different textures.

 

While you're still limited to 16-from-metadata, you can supply additional states that are stored in TileEntity data.

Look at the flower pot.

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.

Posted

MultiBlock tutorial does say something about TileEntity if your block needs more than 15 states. I have no idea how far I want to extend this mod, to start off I'm using the colors from the basic Swatch from PS.

 

Each "category" (Pastel, light, dark, pure, etc) has precisely 16 colors, which is why I thought of making it similar to Wool blocks. 'Cept the RGB/CMYK shades, 6 each, so they were done individually.

 

I'm hoping by nailing this early on I can hopefully just whizz through Eclipse making blocks at the speed of light (If only q_q), even add a customizable 16 colors so if people want they can add their own palette and go further themselves.

 

If I do manage to do it, I'll buy y'all a virtual beer, you guys are awesome.

Posted

The only problem with tile entities is that there is a reason that all blocks don't have them -- performance and memory.  So it really depends on how many of these blocks might exist in a game.  Since you described it as being for pixel art, I suspect there could be quite a few of these if someone decided to do a large scale piece of art.

 

So I think you're on the right track -- create blocks that each have a 16-color palette.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

I got lazy, copy pasterino. Blocks are named such that each color has a prefix, so i could Find/Replace. It's long, but eh for the time being, does the trick. If each block needs 3 .json files to go with it, even with the metadata shortcut, I don't have the necessity to go efficient right now.

Posted

width=800 height=449http://orig05.deviantart.net/d309/f/2015/087/3/d/2015_03_28_10_24_02_by_tyraim-d8nerts.png[/img]

 

Before anyone asks, yes I'm afflicted with some sort of organizational OCD-ism. Each group of colors has a unique tab. If you think that is bad, you should see the code behind this mess.

 

width=800 height=449http://orig12.deviantart.net/91dc/f/2015/087/5/9/2015_03_28_10_36_42_by_tyraim-d8nertx.png[/img]

 

I'm quite proud of myself :3

 

Quick few questions :

 

  - Can you line break a creative tab?

  - Can I make another tab that encompasses all the blocks added by the mod then organize them in a certain way? I read you can use a comparator, but that was to separate items from blocks :<

Posted

I've been meaning to take a peek at MBE for a while now, I'll get onto that now.

 

Built the mod, stuck it into a 1.8 vanilla MC with Forge installed, works a treat. The feeling of accomplishment is great. Thank you all :D

Posted

Yes, you will need some sort of comparator if you want consistent ordering. If you just go by the registry, they will come in order of ID, which may change.

See here: http://www.minecraftforge.net/forum/index.php/topic,23782.0.html

 

What do you mean by "line break in a creative tab"?

 

Just seperate the RGB shades from CMYK, so it looks like :

 

top line : RGB colors

2nd line : CMYK

3rd : grey shades

4th : bunch of browns I need to add that don't equate to 16.

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.