Posted September 4, 20196 yr Okay, this is how I registered it: public static final Block MARBLEGRASS = new GrassBlock(Block.Properties.create(Material.ORGANIC) .tickRandomly().hardnessAndResistance(4.0F).sound(SoundType.PLANT)).setRegistryName("marble_grass"); event.getRegistry().register(MoreStuff.MARBLEGRASS); event.getRegistry().register(new MarbleDirt_BlockItem(MoreStuff.MARBLEGRASS, properties.group(MoreStuff.morestuff_rock.GroupRock).maxStackSize(32)).setRegistryName("marble_grass")); I made the model files just like the vanilla ones, the BlockItem has a texture where the "grass" part is grey, just like the texture file. When I place my block it has the error texture and I have no idea why, could you help me or give me any reference? Here are my model files: morestuff/blockstates/marble_grass { "variants": { "snowy=false": [ { "model": "morestuff:block/soil/marble_grass" }, { "model": "morestuff:block/soil/marble_grass", "y": 90 }, { "model": "morestuff:block/soil/marble_grass", "y": 180 }, { "model": "morestuff:block/soil/marble_grass", "y": 270 } ], "snowy=true": { "model": "morestuff:block/soil/marble_grass_snowy" } } } morestuff/models/block/soil/marble_grass { "parent": "block/block", "textures": { "particle": "morestuff:block/soil/dirt_marble", "bottom": "morestuff:block/soil/dirt_marble", "top": "block/grass_block_top", "side": "morestuff:block/soil/dirt_marble", "overlay": "block/grass_block_side_overlay" }, "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up", "tintindex": 0 }, "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "east" } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" } } } ] } morestuff/models/block/soil/marble_grass_snowy { "parent": "block/cube_bottom_top", "textures": { "particle": "morestuff:block/soil/dirt_marble", "bottom": "morestuff:block/soil/dirt_marble", "top": "block/grass_block_top", "side": "morestuff:block/soil/marble_grass_snowy" } } morestuff/models/item/marble_grass { "parent": "morestuff:block/soil/marble_grass" }
September 4, 20196 yr Could you post the log? In the meantime, you can try and use vanilla Minecraft's grass model and see if that works (minecraft:block/grass_block). And I would recommend creating a different block class for your grass block if you are going to add more blocks in your mod, it can get cluttered pretty easily.
September 4, 20196 yr Author 2 minutes ago, Simon_kungen said: Could you post the log? In the meantime, you can try and use vanilla Minecraft's grass model and see if that works (minecraft:block/grass_block). And I would recommend creating a different block class for your grass block if you are going to add more blocks in your mod, it can get cluttered pretty easily. I found out what the problem is, I need a ColorHandler. Edited September 4, 20196 yr by MatsCraft1
September 4, 20196 yr Author Okay, I got this far now package com.aug15.morestuff.blocks; import com.aug15.morestuff.MoreStuff; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.item.BlockItem; import net.minecraft.world.GrassColors; import net.minecraft.world.biome.BiomeColors; import net.minecraftforge.client.event.ColorHandlerEvent; import net.minecraftforge.event.terraingen.BiomeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = MoreStuff.MODID) public class ModColourManager { @SubscribeEvent public static void registerBlockColourHandlers(final ColorHandlerEvent.Block event) { final BlockColors blockColors = event.getBlockColors(); final IBlockColor grassColourHandler = (state, blockAccess, pos, tintIndex) -> { if (blockAccess != null && pos != null) { return BiomeEvent.BiomeColor.GetGrassColor(biome, original); } return GrassColors.get(0.5D, 1.0D); }; blockColors.register(grassColourHandler, MoreStuff.MARBLEGRASS); } @SubscribeEvent public static void registerItemColourHandlers(final ColorHandlerEvent.Item event) { final BlockColors blockColors = event.getBlockColors(); final ItemColors itemColors = event.getItemColors(); final IItemColor itemBlockColourHandler = (stack, tintIndex) -> { @SuppressWarnings("deprecation") final BlockState state = ((BlockItem) stack.getItem()).getBlock().getDefaultState(); return blockColors.getColor(state, null, null, tintIndex); }; itemColors.register(itemBlockColourHandler, MoreStuff.MARBLEGRASS); } } but I have no idea what to put here return BiomeEvent.BiomeColor.GetGrassColor(biome, original); "biome, original" is marked as wrong "cannot resolve symbol"
September 4, 20196 yr Author 2 hours ago, diesieben07 said: I don't know what you are trying to achieve there. You need to reigster an instance of IBlockColor to the instance of BlockColors thats provided to you by the event. IBlockColor is a simple interface that takes in information about a block position and produces the color that that block si supposed to have. like this? @OnlyIn(Dist.CLIENT) @SubscribeEvent public static void registerBlockColorHandlers(final ColorHandlerEvent.Block event) { event.getBlockColors().register((x, reader, pos, u) -> reader != null && pos != null ? BiomeColors.getGrassColor(reader, pos) : GrassColors.get(0.5D, 1.0D), MoreStuff.MARBLEGRASS); }
September 4, 20196 yr Author 1 minute ago, diesieben07 said: Looks right. My block still has the error texture ':)
September 4, 20196 yr Author 9 minutes ago, diesieben07 said: If it has an error texture that is not related to IBlockColor. Post the console log. log on dropbox, was too big lol
September 4, 20196 yr Author 6 minutes ago, diesieben07 said: For a start you should not be creating your block in a static intializer. Use the proper registry event. If I did that, how would I make it have its own custom BlockItem? Edited September 4, 20196 yr by MatsCraft1
September 4, 20196 yr Author 27 minutes ago, diesieben07 said: For a start you should not be creating your block in a static intializer. Use the proper registry event. Oh my god, thank you! That was the problem! Edited September 4, 20196 yr by MatsCraft1
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.