Jump to content

How do I make my block have a custom render> (EG Chest, signs ect)


Recommended Posts

Posted

Extend your block class as BlockContainer, make a TileEntity and TileEntitRenderer classes, then put the code in to

your block class

public boolean renderAsNormalBlock()
    {
        return false;
    }

public boolean isOpaqueCube()
    {
        return false;
    }

public int getRenderType()
    {
        return 0;
    }

public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
        return false;
}
public TileEntity createNewTileEntity(World world) {
	return new TileEntityYourBlock();
}

your main class load method

ModLoader.registerTileEntity(net.yourpackage.src.TileEntityYourBlock.class, "Name", new TileEntityYourBlockRenderer());

 

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Posted

Extend your block class as BlockContainer, make a TileEntity and TileEntitRenderer classes, then put the code in to

your block class

public boolean renderAsNormalBlock()
    {
        return false;
    }

public boolean isOpaqueCube()
    {
        return false;
    }

public int getRenderType()
    {
        return 0;
    }

public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
        return false;
}
public TileEntity createNewTileEntity(World world) {
	return new TileEntityYourBlock();
}

your main class load method

ModLoader.registerTileEntity(net.yourpackage.src.TileEntityYourBlock.class, "Name", new TileEntityYourBlockRenderer());

 

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Posted

Extend your block class as BlockContainer, make a TileEntity and TileEntitRenderer classes, then put the code in to

your block class

public boolean renderAsNormalBlock()
    {
        return false;
    }

public boolean isOpaqueCube()
    {
        return false;
    }

public int getRenderType()
    {
        return 0;
    }

public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
        return false;
}
public TileEntity createNewTileEntity(World world) {
	return new TileEntityYourBlock();
}

your main class load method

ModLoader.registerTileEntity(net.yourpackage.src.TileEntityYourBlock.class, "Name", new TileEntityYourBlockRenderer());

 

 

Using ModLoader classes is bad practice when coding with Forge!

 

Modloader.    ?

 

Use this:

GameRegistry.registerTileEntity(

 

 

PS: If you find something which you can use with a ModLoader class, look into that class and you'll see the forge equivalent. Basically all ModLoader classes are just wrappers to accomplish compatibility with ModLoader mods.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Extend your block class as BlockContainer, make a TileEntity and TileEntitRenderer classes, then put the code in to

your block class

public boolean renderAsNormalBlock()
    {
        return false;
    }

public boolean isOpaqueCube()
    {
        return false;
    }

public int getRenderType()
    {
        return 0;
    }

public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
        return false;
}
public TileEntity createNewTileEntity(World world) {
	return new TileEntityYourBlock();
}

your main class load method

ModLoader.registerTileEntity(net.yourpackage.src.TileEntityYourBlock.class, "Name", new TileEntityYourBlockRenderer());

 

 

Using ModLoader classes is bad practice when coding with Forge!

 

Modloader.    ?

 

Use this:

GameRegistry.registerTileEntity(

 

 

PS: If you find something which you can use with a ModLoader class, look into that class and you'll see the forge equivalent. Basically all ModLoader classes are just wrappers to accomplish compatibility with ModLoader mods.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

If ModLoader classes are just wrappers to accomplish compatibility, there's no difference what to use. I just took my old code, find out it's still working and continued using it.

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Posted

If ModLoader classes are just wrappers to accomplish compatibility, there's no difference what to use. I just took my old code, find out it's still working and continued using it.

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Posted

If ModLoader classes are just wrappers to accomplish compatibility, there's no difference what to use. I just took my old code, find out it's still working and continued using it.

 

That is not the point! Always use Forge methods! Why? ModLoader is client-only. What if you have loads of ModLoader stuff and want to use your mod on a server or make it compatible with it? You simply have to use the Forge methods, because ModLoader is simply not there, since it's client-only.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

If ModLoader classes are just wrappers to accomplish compatibility, there's no difference what to use. I just took my old code, find out it's still working and continued using it.

 

That is not the point! Always use Forge methods! Why? ModLoader is client-only. What if you have loads of ModLoader stuff and want to use your mod on a server or make it compatible with it? You simply have to use the Forge methods, because ModLoader is simply not there, since it's client-only.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

If ModLoader classes are just wrappers to accomplish compatibility, there's no difference what to use. I just took my old code, find out it's still working and continued using it.

 

That is not the point! Always use Forge methods! Why? ModLoader is client-only. What if you have loads of ModLoader stuff and want to use your mod on a server or make it compatible with it? You simply have to use the Forge methods, because ModLoader is simply not there, since it's client-only.

Okay, i see your point. But there's no registerTileEntity method in GameRegistry.

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Posted

If ModLoader classes are just wrappers to accomplish compatibility, there's no difference what to use. I just took my old code, find out it's still working and continued using it.

 

That is not the point! Always use Forge methods! Why? ModLoader is client-only. What if you have loads of ModLoader stuff and want to use your mod on a server or make it compatible with it? You simply have to use the Forge methods, because ModLoader is simply not there, since it's client-only.

Okay, i see your point. But there's no registerTileEntity method in GameRegistry.

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Posted

If ModLoader classes are just wrappers to accomplish compatibility, there's no difference what to use. I just took my old code, find out it's still working and continued using it.

 

That is not the point! Always use Forge methods! Why? ModLoader is client-only. What if you have loads of ModLoader stuff and want to use your mod on a server or make it compatible with it? You simply have to use the Forge methods, because ModLoader is simply not there, since it's client-only.

Okay, i see your point. But there's no registerTileEntity method in GameRegistry.

 

Yes there is, look at the class itself. It's in there, most of my mods use it:

public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • 2 weeks later...
Posted

Related to this discussion on ModLoader vs Forge commands, I have the method

 

public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)

 

But I am unsure on how this will connect to my TileEntityRenderer class. My block works except I can't seem to attach the proper rendering to it.

How do I connect my TileEntityRenderer class to the block to make sure my rendering gets used?

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Posted

Related to this discussion on ModLoader vs Forge commands, I have the method

 

public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)

 

But I am unsure on how this will connect to my TileEntityRenderer class. My block works except I can't seem to attach the proper rendering to it.

How do I connect my TileEntityRenderer class to the block to make sure my rendering gets used?

 

You do this with ClientRegistry.bindTileEntitySpecialRenderer. Put that in your Proxy to avoid crashes with the server.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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.