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.