Jump to content

Any tutorials for custom block rendering?


Flenix

Recommended Posts

Hey guys,

 

I'm trying to make my first mod right now. Most of the things in the mod are custom shapes though, not standard blocks.

 

I understand the basics of modding and I've done the tutorial here, but I can't find any help at all on getting a custom rendered block!

 

The few guides I did find were all written for Modloader, not Forge. I also found a guide to port from modloader to forge, but that seems like a very long-winded way of doing it.

 

Also, if possible I want to use data values, not tile entites. The block is designed for decoration, and there will be thousands of them on my server, so I don't want the extra memory usage of a tile entity.

 

So, does anyone know of a tutorial?

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

try searching for ISimpleBlockRenderingHandler. it's a long time I used it, but I think you get a render id, implement that handler, register your handler and your block should return the registered render id. without TEs you'll have to implementent your block renderer via tesselator. not sure how much this post will help, but at least it's a start :).

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

Tesselators aren't that bad either.  4 corners of 3D space and some texture UV coordinates and you're golden.

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

Tesselators aren't that bad either.  4 corners of 3D space and some texture UV coordinates and you're golden.

Got any links? Never heard of Tesselators, and google didn't help much either.

 

Also, does anyone know a better modelling program than Techne? It's fine for what I need in this mod, but I want a lot more detail in some ideas I have for other mods...

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

Recently has beeen added support for obj files into Forge, so you can use any 3d editor that can export to a wavefront obj format (maybe Blender?). For a tessellator usage you can take a look at

net.minecraft.client.renderer.RenderBlocks

class.

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

Recently has beeen added support for obj files into Forge, so you can use any 3d editor that can export to a wavefront obj format (maybe Blender?). For a tessellator usage you can take a look at

net.minecraft.client.renderer.RenderBlocks

class.

This sounds rather interesting, do you know how it is done, and what dimensions and complexity the model needs to be? Also can they be used for entities? If so, how would texture mapping work?
Link to comment
Share on other sites

Recently has beeen added support for obj files into Forge, so you can use any 3d editor that can export to a wavefront obj format (maybe Blender?). For a tessellator usage you can take a look at

net.minecraft.client.renderer.RenderBlocks

class.

 

Source please? If this is true, then anyone can feel free to contact me for any modelling requests and I'll get right on it. I can do that bit, it's Java I'm not so good at!

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

Tesselators aren't that bad either.  4 corners of 3D space and some texture UV coordinates and you're golden.

Got any links? Never heard of Tesselators, and google didn't help much either.

 

I'm not sure what it is, exactly, but I know what it does.

 

It draws quads (4-sided polygons in 3D space).

 

Example:

 

tessellator.addVertexWithUV(minX, theY, maxZ, minU, maxV);
tessellator.addVertexWithUV(minX, theY, minZ, minU, minV);
tessellator.addVertexWithUV(maxX, theY, minZ, maxU, minV);
tessellator.addVertexWithUV(maxX, theY, maxZ, maxU, maxV);

 

Draws a single plane on the X/Z plane (i.e. the top of a block).  Flipping the points around (reverse order) will render it upside down (i.e. bottom of a block).  Not sure what the orientation is of those four lines offhand, though.  I think it's the underside, based off a comment in the code referencing the "bottom of the bed" where I got it from.

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

Here are some snippets from how I render one of my blocks. I'll eventually change it to use UVs, but right now it renders a gray block as a placeholder (that's why I'm wastefully creating six new color objects each render pass :P):

 

//Draw monolith
renderPlane(x, y, z, 1, 1, Orientation.North, new Color(128, 128, 128));
renderPlane(x+1, y, z, 1, 1, Orientation.West, new Color(128, 128, 128));
renderPlane(x, y, z, 1, 1, Orientation.East, new Color(128, 128, 128));
renderPlane(x, y, z+1, 1, 1, Orientation.South, new Color(128, 128, 128));
renderPlane(x, y+1, z, 1, 1, Orientation.Up, new Color(128, 128, 128));
renderPlane(x, y, z, 1, 1, Orientation.Down, new Color(128, 128, 128));

 

renderPlane:

private void renderPlane(double x, double y, double z, double width, double height, Orientation orientation, Color color)
{
    tessellator.startDrawingQuads();
    tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
    switch(orientation)
    {
    	case Up:
    	    tessellator.setNormal(0, -1.0f, 0);
    	    tessellator.addVertex(x, y, z);
            tessellator.addVertex(x, y, z+height);
            tessellator.addVertex(x+width, y, z+height);
            tessellator.addVertex(x+width, y, z);
            break;
    	case Down:
            tessellator.setNormal(0, 1.0f, 0);
            tessellator.addVertex(x+width, y, z);
            tessellator.addVertex(x+width, y, z+height);
            tessellator.addVertex(x, y, z+height);
            tessellator.addVertex(x, y, z);
    	    break;
    	case North:
    	    tessellator.setNormal(0, 0, -1.0f);
    	    tessellator.addVertex(x, y, z);
            tessellator.addVertex(x, y+height, z);
            tessellator.addVertex(x+width, y+height, z);
            tessellator.addVertex(x+width, y, z);
            break;
    	case South:
            tessellator.setNormal(0, 0, 1.0f);
            tessellator.addVertex(x+width, y, z);
            tessellator.addVertex(x+width, y+height, z);
            tessellator.addVertex(x, y+height, z);
            tessellator.addVertex(x, y, z);
    	    break;
    	case East:
            tessellator.setNormal(1.0f, 0, 0);
            tessellator.addVertex(x, y, z+width);
            tessellator.addVertex(x, y+height, z+width);
            tessellator.addVertex(x, y+height, z);
            tessellator.addVertex(x, y, z);
    	    break;
    	case West:
    	    tessellator.setNormal(-1.0f, 0, 0);
    	    tessellator.addVertex(x, y, z);
            tessellator.addVertex(x, y+height, z);
            tessellator.addVertex(x, y+height, z+width);
            tessellator.addVertex(x, y, z+width);
            break;
    }
    tessellator.draw();
}

 

I'm sure there are better ways to do it, as renderPlane and another method I wrote, renderDoublePlane, weren't actually written to render small cubes, but it shows you the normals and vertex ordering to get them to render in the right direction.

 

Also, as you noticed, most of the planes are rendered from the Block's origin and are oriented from there, which may or may not confuse you. This is because renderPlane renders things in a positive direction. You can provide a negative width/height to flip the plane, but I have a feeling that'll also flip the orientation/normal.

width=336 height=83http://img836.imageshack.us/img836/1237/cooltext624963071.png[/img]

I make games, minecraft mods/plugins, and some graphic art.

 

Current Project: LoECraft - An industrial minecraft server with its own modpack and custom launcher.

Link to comment
Share on other sites

Recently has beeen added support for obj files into Forge, so you can use any 3d editor that can export to a wavefront obj format (maybe Blender?). For a tessellator usage you can take a look at

net.minecraft.client.renderer.RenderBlocks

class.

This sounds rather interesting, do you know how it is done, and what dimensions and complexity the model needs to be? Also can they be used for entities? If so, how would texture mapping work?

I haven't tried it yet, but it's used in EE3 (it's open source, code is available on github) or you can read this tutorial - looks nice. It can definitely be used for entities (not sure about blocks though, maybe just TE).

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

Recently has beeen added support for obj files into Forge, so you can use any 3d editor that can export to a wavefront obj format (maybe Blender?). For a tessellator usage you can take a look at

net.minecraft.client.renderer.RenderBlocks

class.

This sounds rather interesting, do you know how it is done, and what dimensions and complexity the model needs to be? Also can they be used for entities? If so, how would texture mapping work?

I haven't tried it yet, but it's used in EE3 (it's open source, code is available on github) or you can read this tutorial - looks nice. It can definitely be used for entities (not sure about blocks though, maybe just TE).

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

All very useful information, thanks very much!

 

Those tessilators will be great. I did a load of modelling for a Spout-based mod a while back called MoreMaterials which used quads, that'll make it easy to port things from there should I want to. I'll try that obj thing now though!

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

All very useful information, thanks very much!

 

Those tessilators will be great. I did a load of modelling for a Spout-based mod a while back called MoreMaterials which used quads, that'll make it easy to port things from there should I want to. I'll try that obj thing now though!

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

Recently has beeen added support for obj files into Forge, so you can use any 3d editor that can export to a wavefront obj format (maybe Blender?). For a tessellator usage you can take a look at

net.minecraft.client.renderer.RenderBlocks

class.

This sounds rather interesting, do you know how it is done, and what dimensions and complexity the model needs to be? Also can they be used for entities? If so, how would texture mapping work?

I haven't tried it yet, but it's used in EE3 (it's open source, code is available on github) or you can read this tutorial - looks nice. It can definitely be used for entities (not sure about blocks though, maybe just TE).

 

In 1.5, both net.minecraftforge.client.model.AdvancedModelLoader and net.minecraftforge.client.model.IModelCustom no longer exist. Is it still possible to import .obj files into minecraft?

Link to comment
Share on other sites

Recently has beeen added support for obj files into Forge, so you can use any 3d editor that can export to a wavefront obj format (maybe Blender?). For a tessellator usage you can take a look at

net.minecraft.client.renderer.RenderBlocks

class.

This sounds rather interesting, do you know how it is done, and what dimensions and complexity the model needs to be? Also can they be used for entities? If so, how would texture mapping work?

I haven't tried it yet, but it's used in EE3 (it's open source, code is available on github) or you can read this tutorial - looks nice. It can definitely be used for entities (not sure about blocks though, maybe just TE).

 

In 1.5, both net.minecraftforge.client.model.AdvancedModelLoader and net.minecraftforge.client.model.IModelCustom no longer exist. Is it still possible to import .obj files into minecraft?

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Looking for the best deals and discounts? The Temu coupon code [act200019] or [acp856709] offers fantastic savings for both new and existing customers. Whether you're placing your first order or restocking your favorites, these coupon codes unlock discounts of up to 90% and an additional $100 off on selected items. Plus, enjoy the added benefit of free shipping on select orders. This guide will show you how to make the most of these deals and maximize your savings on Temu. How to Use the Temu Coupon Code [act200019] or [acp856709] Applying the Temu coupon code is quick and easy. Here’s how to redeem it for maximum savings: 1. Visit the Temu Website: Explore Temu’s wide range of products, including fashion, electronics, and home goods. 2. Add Items to Your Cart: Choose the products you want and add them to your shopping cart. 3. Proceed to Checkout: Click on your cart and proceed to checkout when you're ready. 4. Enter the Coupon Code: In the "Coupon Code" field at checkout, enter [act200019] or [acp856709] and click "Apply." 5. Enjoy Your Savings: You’ll instantly see the $100 discount along with additional savings of up to 90%, depending on the items selected. Benefits of Temu Coupon Codes [act200019] or [acp856709] for First-Time Users and Existing Customers Whether you're a new customer or a regular shopper, the Temu coupon code offers unbeatable discounts. Here's how both new and existing users can benefit: • First-Time Users: New customers using the Temu coupon code [act200019] or [acp856709] on their first order get $100 off, along with discounts ranging from 30% to 90% on selected products. It’s the perfect opportunity to try out Temu’s product range without overspending. • Existing Customers: Loyal shoppers can continue to enjoy significant savings by applying the same coupon code on subsequent orders. Restock your favorites or discover new items at discounted prices. • Free Shipping: Using the Temu coupon code [act200019] or [acp856709] can also qualify you for free shipping on selected items, further increasing your overall savings. Breakdown of Discounts with Temu Coupon Code [act200019] or [acp856709] With the Temu coupon code [act200019] or [acp856709], you’re not limited to just $100 off. You can also enjoy varying levels of discounts on a wide range of products. Here’s how it works: • 30% Discount: Perfect for budget-friendly products and everyday essentials. Shop clothing, beauty products, and home goods at 30% off. • 40% Discount: Ideal for mid-range purchases such as electronics, gadgets, and household items. • 50% Discount: Save big on high-end gadgets, designer apparel, and premium beauty products with 50% off. • 70% Discount: Excellent for those looking for luxury items like branded accessories and upscale electronics. • 90% Discount: The ultimate deal for savvy shoppers. Enjoy top-tier products like tech and home goods at a fraction of the price. Maximize Your Savings on First Orders, Free Shipping, and More with Temu Coupon Code [act200019] or [acp856709] Here are some top tips to get the most value from the Temu coupon code [act200019] or [acp856709]: 1. First Order Savings: For first-time users, using the code [act200019] or [acp856709] on your first order guarantees $100 off, making it the perfect way to kickstart your shopping experience at Temu. 2. Look for Free Shipping: Check if your items qualify for free shipping by applying the coupon code at checkout. It’s a great way to save even more on your total purchase. 3. Shop During Major Sales: Combine the coupon code with major sales events like Black Friday or Cyber Monday for even greater savings. 4. Buy in Bulk: Bulk purchases allow you to maximize the value of the $100 discount, especially if you’re buying items across various categories. 5. Check Product Eligibility: Make sure the products you’re adding to your cart qualify for higher percentage discounts. Some items may only offer 30%-50% off, while others can go up to 90%. FAQs About Temu Coupon Code [act200019] or [acp856709] 1. Is the Temu coupon code verified and working?  Yes, the Temu coupon codes [act200019] and [acp856709] are verified and currently active. Both codes offer up to $100 off, along with percentage discounts of up to 90%. 2. How much can I save with the Temu coupon code?  Using the coupon codes [act200019] or [acp856709], you can get $100 off plus additional percentage-based discounts ranging from 30% to 90%, depending on the products you choose. 3. Can both first-time users and existing customers use these coupon codes?  Absolutely! Both new and existing customers can take advantage of the Temu coupon codes [act200019] or [acp856709]. First-time users can apply the code for their first order, while loyal customers can continue saving on subsequent purchases. 4. Does the coupon code apply to free shipping?  In many cases, using the Temu coupon code [act200019] or [acp856709] may qualify you for free shipping, depending on the items and promotions available at the time of purchase. 5. Are there any exclusions with these coupon codes?  While these coupon codes offer excellent discounts, some high-percentage offers may not apply to every item. Be sure to check product eligibility before completing your purchase. Conclusion: Don’t Miss Out on These Massive Savings with Temu Coupon Code [act200019] or [acp856709] The Temu coupon code [act200019] or [acp856709] provides an excellent opportunity to save big on a wide variety of products. Whether you're a first-time user placing your first order or an existing customer looking to restock, these coupon codes guarantee substantial savings. Take advantage of discounts up to 90%, free shipping on select orders, and $100 off when you shop at Temu. Don’t wait—start shopping today and use the coupon codes [act200019] or [acp856709] to unlock the best possible deals! Happy shopping!
    • The office interior in Delhi has been evolving rapidly, blending functionality with modern aesthetics. Here are some key trends: Sustainable Design: Companies are opting for eco-friendly materials like recycled wood, energy-efficient lighting, and green office plants to create environmentally conscious workspaces. Collaborative Spaces: Open layouts and shared workspaces foster teamwork and creativity. Modular furniture and flexible seating arrangements allow for easy reconfiguration. Smart Technology Integration: Smart offices use automation to control lighting, temperature, and even security, offering convenience and energy efficiency. Biophilic Design: Incorporating natural elements like plants, natural light, and organic textures improves employee well-being and productivity. Wellness Zones: Dedicated relaxation areas, ergonomic furniture, and quiet zones are gaining popularity to promote a healthier work environment. Minimalist and Clean Aesthetics: Sleek, clutter-free designs with neutral color palettes are favored to create calm and professional atmospheres. These trends reflect a growing focus on creating efficient, healthy, and flexible office environments in Delhi.    
    • Make a test with deleting the config of tempad-forge (config folder) If there is no change, remove this mod
    • There is an invalid entry in your level.dat   Create a copy of this world and open it in singleplayer - if this works, upload this world to the server If not, add the latest.log from the singleplayer test
  • Topics

×
×
  • Create New...

Important Information

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