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

How can I render blocks and items semi-transparent?

 

I should look like this:

1DNnAxt.png

 

(the right one)

6IiBLfQ.png

 

this.bindTexture(TextureMap.locationBlocksTexture);
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
World world = te.getWorld();
BlockPos blockpos = te.getPos();
IBlockState iblockstate = te.getCover().getStateFromMeta(te.getCoverMeta());

GlStateManager.pushMatrix();
RenderHelper.disableStandardItemLighting();
GlStateManager.translate((float) x, (float) y, (float) z);

Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

int i = blockpos.getX();
int j = blockpos.getY();
int k = blockpos.getZ();

worldrenderer.setTranslation(((-i)), (-j), ((-k)));
worldrenderer.color(1F, 1F, 1F, 1F);
IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, blockpos);
blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, true);

worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();

 

GlStateManager.pushMatrix();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
int j1 = 150;
int k1 = 35;
GlStateManager.colorMask(true, true, true, false);
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.color(1f, 1f, 1f, 1f);
ItemStack result = CraftingManager.getInstance().findMatchingRecipe(((ContainerCrafter) inventorySlots).crafter.getMatrix(), mc.theWorld);
mc.getRenderItem().renderItemAndEffectIntoGUI(result, j1, k1);
RenderHelper.disableStandardItemLighting();
GlStateManager.colorMask(true, true, true, true);
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.popMatrix();

First, your texture needs to have an alpha layer - you can add these via GIMP or PhotoShop pretty easily.

 

Then, when rendering, you need to enable the alpha layer:

// first push attributes, like pushing the matrix, so you don't mess up anything
// that renders after your block
GlStateManager.pushAttrib();

// enable alpha and blend so you can render your alpha layer
GlStateManager.enableAlpha();
GlStateManager.enableBlend();

// render your stuff here

// finally, pop to return the attributes back to their original state
GlStateManager.popAttrib();

  • Author

It's not MY texture.

As you can see in the code I want to render an itemstack in the GUI of an automatic crafter. the itemstack is the crafting result.

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.