MCrafterzz Posted May 30, 2016 Posted May 30, 2016 Hello I'm trying to make custom redstone called bluestone. This is what I've done so far: public class ModBluestone extends BlockRedstoneWire { public ModBluestone() { this.setSoundType(SoundType.STONE); this.setResistance(1F); this.setHardness(3F); } public static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos) { Block block = blockState.getBlock(); if (block == ModElements.bluestone_wire) { return true; } else if (Blocks.UNPOWERED_REPEATER.isSameDiode(blockState)) { EnumFacing enumfacing = (EnumFacing) blockState.getValue(BlockRedstoneRepeater.FACING); return enumfacing == side || enumfacing.getOpposite() == side; } else { return blockState.getBlock().canConnectRedstone(blockState, world, pos, side); } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(ModElements.bluestone_wire); } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(Item.getItemFromBlock(ModElements.bluestone_wire)); } @SideOnly(Side.CLIENT) public static int colorMultiplier(int p_176337_0_) { return 0; } public int getRenderType() { return 1; } } I've registered it and everything like a normal block. blockstates: { "multipart": [ { "when": { "OR": [ {"north": "none", "east": "none", "south": "none", "west": "none"}, {"north": "side|up", "east": "side|up" }, {"east": "side|up", "south": "side|up" }, {"south": "side|up", "west": "side|up"}, {"west": "side|up", "north": "side|up"} ]}, "apply": { "model": "mm:bluestone_dot" } }, { "when": { "OR": [ { "north": "side|up" }, { "north": "none", "east": "none", "south": "side|up", "west": "none" } ]}, "apply": { "model": "mm:bluestone_side0" } }, { "when": { "OR": [ { "south": "side|up" }, { "north": "side|up", "east": "none", "south": "none", "west": "none" } ]}, "apply": { "model": "mm:bluestone_side_alt0" } }, { "when": { "OR": [ { "east": "side|up" }, { "north": "none", "east": "none", "south": "none", "west": "side|up" } ]}, "apply": { "model": "mm:bluestone_side_alt1", "y": 270 } }, { "when": { "OR": [ { "west": "side|up" }, { "north": "none", "east": "side|up", "south": "none", "west": "none" } ]}, "apply": { "model": "mm:bluestone_side1", "y": 270 } }, { "when": { "north": "up" }, "apply": { "model": "mm:bluestone_up" } }, { "when": { "east": "up" }, "apply": { "model": "mm:bluestone_up", "y": 90 } }, { "when": { "south": "up" }, "apply": { "model": "mm:bluestone_up", "y": 180 } }, { "when": { "west": "up" }, "apply": { "model": "mm:bluestone_up", "y": 270 } } ] } It's copyed from redstone. I've created all those block models a example (bluestone_up): { "ambientocclusion": false, "textures": { "particle": "mm:blocks/bluestone_dust_dot", "line": "mm:blocks/bluestone_dust_line0", "overlay": "mm:blocks/bluestone_dust_overlay" }, "elements": [ { "from": [ 0, 0, 0.25 ], "to": [ 16, 16, 0.25 ], "shade": false, "faces": { "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#line", "tintindex": 0 } } }, { "from": [ 0, 0, 0.25 ], "to": [ 16, 16, 0.25 ], "shade": false, "faces": { "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay" } } } ] } They are also copyed from redstone. The problem is that it doesn't render when placed. I think it needs some sort of custom renderer, but I can't find any for redstone so I don't know. Please help if you know a sullution. Sorry for my English it's not my first language Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
MCrafterzz Posted May 30, 2016 Author Posted May 30, 2016 Hello I'm trying to make custom redstone called bluestone. This is what I've done so far: public class ModBluestone extends BlockRedstoneWire { public ModBluestone() { this.setSoundType(SoundType.STONE); this.setResistance(1F); this.setHardness(3F); } public static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos) { Block block = blockState.getBlock(); if (block == ModElements.bluestone_wire) { return true; } else if (Blocks.UNPOWERED_REPEATER.isSameDiode(blockState)) { EnumFacing enumfacing = (EnumFacing) blockState.getValue(BlockRedstoneRepeater.FACING); return enumfacing == side || enumfacing.getOpposite() == side; } else { return blockState.getBlock().canConnectRedstone(blockState, world, pos, side); } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(ModElements.bluestone_wire); } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(Item.getItemFromBlock(ModElements.bluestone_wire)); } @SideOnly(Side.CLIENT) public static int colorMultiplier(int p_176337_0_) { return 0; } public int getRenderType() { return 1; } } I've registered it and everything like a normal block. blockstates: { "multipart": [ { "when": { "OR": [ {"north": "none", "east": "none", "south": "none", "west": "none"}, {"north": "side|up", "east": "side|up" }, {"east": "side|up", "south": "side|up" }, {"south": "side|up", "west": "side|up"}, {"west": "side|up", "north": "side|up"} ]}, "apply": { "model": "mm:bluestone_dot" } }, { "when": { "OR": [ { "north": "side|up" }, { "north": "none", "east": "none", "south": "side|up", "west": "none" } ]}, "apply": { "model": "mm:bluestone_side0" } }, { "when": { "OR": [ { "south": "side|up" }, { "north": "side|up", "east": "none", "south": "none", "west": "none" } ]}, "apply": { "model": "mm:bluestone_side_alt0" } }, { "when": { "OR": [ { "east": "side|up" }, { "north": "none", "east": "none", "south": "none", "west": "side|up" } ]}, "apply": { "model": "mm:bluestone_side_alt1", "y": 270 } }, { "when": { "OR": [ { "west": "side|up" }, { "north": "none", "east": "side|up", "south": "none", "west": "none" } ]}, "apply": { "model": "mm:bluestone_side1", "y": 270 } }, { "when": { "north": "up" }, "apply": { "model": "mm:bluestone_up" } }, { "when": { "east": "up" }, "apply": { "model": "mm:bluestone_up", "y": 90 } }, { "when": { "south": "up" }, "apply": { "model": "mm:bluestone_up", "y": 180 } }, { "when": { "west": "up" }, "apply": { "model": "mm:bluestone_up", "y": 270 } } ] } It's copyed from redstone. I've created all those block models a example (bluestone_up): { "ambientocclusion": false, "textures": { "particle": "mm:blocks/bluestone_dust_dot", "line": "mm:blocks/bluestone_dust_line0", "overlay": "mm:blocks/bluestone_dust_overlay" }, "elements": [ { "from": [ 0, 0, 0.25 ], "to": [ 16, 16, 0.25 ], "shade": false, "faces": { "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#line", "tintindex": 0 } } }, { "from": [ 0, 0, 0.25 ], "to": [ 16, 16, 0.25 ], "shade": false, "faces": { "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay" } } } ] } They are also copyed from redstone. The problem is that it doesn't render when placed. I think it needs some sort of custom renderer, but I can't find any for redstone so I don't know. Please help if you know a sullution. Sorry for my English it's not my first language Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
MCrafterzz Posted May 31, 2016 Author Posted May 31, 2016 None has a sollution?? Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Draco18s Posted May 31, 2016 Posted May 31, 2016 Have you registered your block model with the rendering registry? Quote 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.
MCrafterzz Posted May 31, 2016 Author Posted May 31, 2016 You mean "register renders"? Ive done this: registerRenderBlock(bluestone_wire); public static void registerRenderBlock(Block block) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation( Reference.modid + ":" + Item.getItemFromBlock(block).getUnlocalizedName().substring(5), "inventory")); } Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Draco18s Posted May 31, 2016 Posted May 31, 2016 You gave it a model for the item but not the block. Also: Don't use item.getUnlocalizedName().substring(5) , use getRegistryName . Then go punch whoever told you to use getUnlocalizedName. Unlocalized name isn't bad, it's just not the right tool for the job. The unlocalized name is for determining what your block is called, nothing else. Quote 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.
MCrafterzz Posted May 31, 2016 Author Posted May 31, 2016 What? I gavs it a model for a block. It works for my other blocks. Isn't Item.getItemFromBlock the best thing to use? Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Draco18s Posted May 31, 2016 Posted May 31, 2016 Item.getItemFromBlock... gets...the item form of the block... Quote 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.
MCrafterzz Posted June 1, 2016 Author Posted June 1, 2016 Ok How should i register a block then? Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Recommended Posts
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.