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

So first time using forge and the thing is my glass is working BUT in my hand it's not showing as it's texture. It's showing as a full black block. I don't know why. Here are some pics

 

http://gyazo.com/9ae6aac77fd9a4bdaa9f6c9623de98b2

 

here is my code:

 

public class BlockBallisticsGlass extends Block {

public BlockBallisticsGlass() {
	super(Material.glass);
	setBlockName("glass_ballistics");
	setBlockTextureName(DarkPack.MODID + ":" + getUnlocalizedName().substring(5));
	setCreativeTab(CreativeTabs.tabBlock);
	setStepSound(soundTypeGlass);
	setHardness(1.0F);
	setResistance(1000F);
}

public int getBlockTextureFromSideAndMetadata(int i, int j) {
	return 9;
}

public int quantityDropped(Random r) {  
	return 0;
}

@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
	return 1;
}

public boolean isOpaqueCube() {
	return false;
}

public boolean renderAsNormalBlock() {
	return false;
}

protected boolean canSilkHarvest() {
	return true;
}

}

Hi

 

From memory, items in your hand are rendered with alpha blending turned off.  So the partially-transparent parts of your block are rendered as totally opaque.

 

You could get around this by implementing an ISimpleBlockRenderingHandler and drawing your icon with alpha blending enabled

eg

 

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

 

and

    try {
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

     // do your rendering here
    } finally {
      GL11.glPopAttrib();
    }

 

-TGG

Hi

 

From memory, items in your hand are rendered with alpha blending turned off.  So the partially-transparent parts of your block are rendered as totally opaque.

 

You could get around this by implementing an ISimpleBlockRenderingHandler and drawing your icon with alpha blending enabled

eg

 

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

 

and

    try {
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

     // do your rendering here
    } finally {
      GL11.glPopAttrib();
    }

 

-TGG

 

This was the case pre-1.7. Look here: http://puu.sh/8Sq6V.png

Either there's something missing or the vanilla renderer has exceptions for specific blocks (like the stained glass)

 

EDIT: looking at it again, if the renderBlockPass is > 0, it uses blend (look at the doRender method, line 124 in class RenderItem)

 

 

BTW: Always add @Override to methods you intend to override! It shows you errors if you, for example, made a typo somewhere or the method signature changed.

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

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.