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

Have you looked how vanilla leaves do it? Otherwise you could just check the graphics settings on each block tick and change the texture accordingly.

  • Author

At the moment I do check graphics settings on each tick and change it - which is why when I force the blocks to update they change. I change the graphics type on the leaves but they dont reflect the changes until the block has been updated

I don't have access to the Minecraft source right now so I can't check if what i'm saying is going to work. Right now it seems that your block checks for an update on each block update (which seems to occur when the block is moved or a adjacent block is modified), rather than on each game tick. Are you using a separate tick handler or are you using the onUpdate() or similar method in your block class?

you need to have them change on tick,

 

here's what i used when i made my leaves:

 

 

package <your package>

 

import java.util.EnumSet;

 

import net.minecraft.client.Minecraft;

import net.minecraft.src.GuiScreen;

 

import cpw.mods.fml.client.FMLClientHandler;

import cpw.mods.fml.common.ITickHandler;

import cpw.mods.fml.common.TickType;

 

public class ClientTickHandler implements ITickHandler

{

    @Override

    public void tickStart(EnumSet<TickType> type, Object... tickData) {}

 

    @Override

    public void tickEnd(EnumSet<TickType> type, Object... tickData)

    {

        if (type.equals(EnumSet.of(TickType.RENDER)))

        {

            onRenderTick();

        }

        else if (type.equals(EnumSet.of(TickType.CLIENT)))

        {

            GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen;

            if (guiscreen != null)

            {

                onTickInGUI(guiscreen);

            } else {

                onTickInGame();

            }

        }

    }

 

    @Override

    public EnumSet<TickType> ticks()

    {

        return EnumSet.of(TickType.RENDER, TickType.CLIENT);

        // In my testing only RENDER, CLIENT, & PLAYER did anything on the client side.

        // Read 'cpw.mods.fml.common.TickType.java' for a full list and description of available types

    }

 

    @Override

    public String getLabel() { return null; }

 

 

    private void onRenderTick() {

      if(Minecraft.getMinecraft().theWorld != null)

      {

      <Your Block>.setGraphicsLevel(Minecraft.getMinecraft().gameSettings.fancyGraphics);

      }

    }

 

    public void onTickInGUI(GuiScreen guiscreen)

    {

    if(Minecraft.getMinecraft().theWorld != null)

    {

    <Your Block>.setGraphicsLevel(Minecraft.getMinecraft().gameSettings.fancyGraphics);

    }

    }

 

    public void onTickInGame()

    {

    if(Minecraft.getMinecraft().theWorld != null)

    {

    <Your Block>.setGraphicsLevel(Minecraft.getMinecraft().gameSettings.fancyGraphics);

    }

    }

}

 

 

 

this will make them change as soon as you change the graphics from fast to fancy and visa versa

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.