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.

Featured Replies

Posted

As far as I can tell, there's no up-to-date tutorials for this. I know it has something to do with Multi-Pass Rendering, but the tutorial on the wiki doesn't work. Could someone help me?

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Hi

 

This link might help.

 

http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-transparent-blocks.html

 

It shows you the basics, and there is a link to another tutorial on how to render a block in both pass 1 and path 2 (although - that might be the one you're talking about?)

 

If you give your block an ISimpleBlockRenderingHandler you can render as many layers of texture as you want.

 

-TGG

 

 

  • Author

I like the effort you put into your tutorials, but I want to render a texture that requires multiple images that come together to form a single texture. Example for items: Tinkers' Construct's special tools.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

This is just a 1.6 code I used for a mod back in the old days.

I have not tested it in 1.7, but you can modify it and make it into what you need.

These methodes can make it multi layer (in 1.6)

public class PotionSword extends ItemSword{

Random rand = new Random();

private Icon sword;
private Icon overlay;

public PotionSword(int id, int pot, int length, EnumToolMaterial mat)
{
	super(id, mat);
	potionID = pot;
	Length = length;
	Mat = mat;
	this.setCreativeTab(Core.tabBlades);
	this.setUnlocalizedName(getTexture() + "_" + potion[potionID]);
}

private String getTexture()
{

	if(this.Mat == EnumToolMaterial.WOOD){ return "wood_sword";}
	if(this.Mat == EnumToolMaterial.STONE){ return "stone_sword";}
	if(this.Mat == EnumToolMaterial.IRON){ return "iron_sword";}
	if(this.Mat == EnumToolMaterial.GOLD){ return "gold_sword";}
	if(this.Mat == EnumToolMaterial.EMERALD){ return "diamond_sword";}
	else{ return "wood_sword";}
}



@Override
public Icon getIconFromDamageForRenderPass(int damage, int pass) {
	if(pass == 0) {
		return this.sword;
	}
	else {
		return this.overlay;
	}
}

@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses()
{
	return true;
}

@Override 
public void registerIcons(IconRegister i) {

	this.sword = i.registerIcon(this.getTexture());	
	this.overlay = i.registerIcon(Core.getModid() + ":" + "overlay_" + potion[potionID]);

}
}

I hoped this helped you out,

Coding, Testing, Smiling, Publishing!

I like the effort you put into your tutorials, but I want to render a texture that requires multiple images that come together to form a single texture. Example for items: Tinkers' Construct's special tools.

 

Hi

 

I'm not sure exactly what you want to do, but if you use an ISimpleBlockRenderingHandler, you can use the Tessellator to render however you like.

 

For example - if you want to render three textures one on top of the other, your handler render code just draws the same rectangle three times with different textures, using an appropriate blending function or transparent sections or however you want to overlay them.  The hardest part is blending the images properly; you can get some strange banding patterns if you render two rectangles almost exactly in the same position.  You can usually fix that by offsetting them slightly or by alpha blending.  It's also possible to combine your multiple textures to a single texture, then apply this texture to your image (for example - the light map texture does this, see EntityRenderer.updateLightMap()), this is a bit more complicated but (I'm told) not too hard once you get the hang of it; some more info in here

http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/

 

-TGG

 

 

 

 

 

 

I think the topic author is asking for the ability to "stitch" textures together, not render multiple layers on top of each other. Since TiCon is open-source, why don't you go give it a looksey. :)

  • Author

This is just a 1.6 code I used for a mod back in the old days.

I have not tested it in 1.7, but you can modify it and make it into what you need.

These methodes can make it multi layer (in 1.6)

public class PotionSword extends ItemSword{

Random rand = new Random();

private Icon sword;
private Icon overlay;

public PotionSword(int id, int pot, int length, EnumToolMaterial mat)
{
	super(id, mat);
	potionID = pot;
	Length = length;
	Mat = mat;
	this.setCreativeTab(Core.tabBlades);
	this.setUnlocalizedName(getTexture() + "_" + potion[potionID]);
}

private String getTexture()
{

	if(this.Mat == EnumToolMaterial.WOOD){ return "wood_sword";}
	if(this.Mat == EnumToolMaterial.STONE){ return "stone_sword";}
	if(this.Mat == EnumToolMaterial.IRON){ return "iron_sword";}
	if(this.Mat == EnumToolMaterial.GOLD){ return "gold_sword";}
	if(this.Mat == EnumToolMaterial.EMERALD){ return "diamond_sword";}
	else{ return "wood_sword";}
}



@Override
public Icon getIconFromDamageForRenderPass(int damage, int pass) {
	if(pass == 0) {
		return this.sword;
	}
	else {
		return this.overlay;
	}
}

@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses()
{
	return true;
}

@Override 
public void registerIcons(IconRegister i) {

	this.sword = i.registerIcon(this.getTexture());	
	this.overlay = i.registerIcon(Core.getModid() + ":" + "overlay_" + potion[potionID]);

}
}

I hoped this helped you out,

 

Thank you. This is exactly what I needed.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

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.