Posted April 11, 20187 yr Hello, I have created a custom grass block and want it to be coloured like the normal one. How can I implement this? Currently I just have a normal block which uses the grass texture and thefor like exspected is gray. http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
April 11, 20187 yr Firstly your model for the block must use the tintindex and set it to non-negative value. You'll see in the grass.json that the tintindex is set to 0. Next you need to create a class the implements IBlockColor. In that class you'll implement a method for the color multiplier (you can base this on biome, but can also use other things). Lastly you'll need to register blocks to your IBlockColor class in your ClientProxy's init loading handling method using Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler() method. I have an example of my IBlockColor implementation: https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/init/ModBlockColors.java Check out my tutorials here: http://jabelarminecraft.blogspot.com/
April 13, 20187 yr Author Got it working with: return worldIn.getBiome(pos).getGrassColorAtPos(pos); Thanks for pointing me in the right direction EDIT: It doesn't seem to work for the itemblock in the inventory, how can I fix this? Edited April 13, 20187 yr by MCrafterzz http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
April 13, 20187 yr You need to register the item for having a color tint as well. 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.
April 14, 20187 yr Author How? The register methoud only accepts blocks. http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
April 14, 20187 yr You need to create an IItemColor implementation that gets the colour from BlockColors and then register that with ItemColors. You can see an example of this here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
April 14, 20187 yr Author Thanks everyone for you're help. It's now all working. One last quick question, is there any forge hook/event for grass spreading or is that still hardcoded like it is in the default BlockGrass class? http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
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.