Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

  • Author

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

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.

  • Author

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

}

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.

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.

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.