Jump to content

Problem with Leaf Block transparency updating when fancy/fast is toggled


frizkie

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.