Jump to content

[1.9.4] Custom redstone help (I've already created it but I have problems)


MCrafterzz

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Have you registered your block model with the rendering registry?

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.

Link to comment
Share on other sites

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"));

}

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

Item.getItemFromBlock... gets...the item form of the block...

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.

Link to comment
Share on other sites

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.