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 make a "Overlay" to a block with the normal ...

 

       

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{


            this.Overlay = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlocks/test");
            this.iconArray = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlockOverlay/" + getBlockOverlay);
          }

 

What the block look like

IR6Oruv.png

 

What the Block Should look like

d1DRPpk.png

 

 

U can see i have tried, but the only thing i can see ingame is the "block overlay", the blockbackground i missing...

but i cant find the problem...

 

Please leave an answer... ;)...

 

-Regards TheFjonG^  <3

  • Author

I come so far:

 

[embed=425,349]package com.thefjong.tf.core;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.util.Icon;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class ISidedAnimatedTextureBlock extends Block{

public static String getBlockOverlay;

Icon icons[];

public ISidedAnimatedTextureBlock(int par1, Material par2Material, String GetOverlay ){

super(par1, par2Material);

GetOverlay = getBlockOverlay;

icons = new Icon[2];

}

 

 

 

 

@SideOnly(Side.CLIENT)

public void registerIcons(IconRegister par1IconRegister)

{

 

 

          icons[0] = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlocks/test");

            icons[1] = par1IconRegister.registerIcon("FjonGCraft:AnimatedBlockOverlay/" + getBlockOverlay);

    }

 

public int getRenderBlockPass()

    {

        return icons.length;

    }

 

 

public boolean canRenderInPass(int pass)

    {

        return pass == this.getRenderBlockPass();

    }

}

[/embed]

 

public int getRenderBlockPass()
    {
        return icons.length;
    }


public boolean canRenderInPass(int pass)
    {
        return pass == this.getRenderBlockPass();
    }

There are only two passes for blocks: 0 and 1.

icons.length returns 2, so nothing is rendered.

What you probably want:

public int pass;

public int getRenderBlockPass()
    {
        return this.pass;
    }

@Override
public boolean canRenderInPass(int pass)
    {
        this.pass = pass;
        return true;
    }

The block will be rendered twice, with the pass variable indicating which pass (0 or 1) is occurring.

You can then use this variable in your block renderer.

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.