Transmutation overly no longer will render when the game is paused or the GUI turned off (nice screenshots possible again :) )

This commit is contained in:
pahimar 2013-04-27 12:34:23 -04:00
parent 451c2d6e8d
commit a1de8c660f
3 changed files with 19 additions and 5 deletions

View file

@ -100,7 +100,6 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHTING);
} }
} }

View file

@ -1,5 +1,6 @@
package com.pahimar.ee3.core.handlers; package com.pahimar.ee3.core.handlers;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.EnumMovingObjectType;
import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.DrawBlockHighlightEvent;
@ -15,6 +16,10 @@ import com.pahimar.ee3.item.IChargeable;
import com.pahimar.ee3.item.ITransmutationStone; import com.pahimar.ee3.item.ITransmutationStone;
import com.pahimar.ee3.lib.Textures; import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** /**
* Equivalent-Exchange-3 * Equivalent-Exchange-3
* *
@ -24,6 +29,7 @@ import com.pahimar.ee3.lib.Textures;
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
* *
*/ */
@SideOnly(Side.CLIENT)
public class DrawBlockHighlightHandler { public class DrawBlockHighlightHandler {
private static int pulse = 0; private static int pulse = 0;
@ -32,13 +38,17 @@ public class DrawBlockHighlightHandler {
@ForgeSubscribe @ForgeSubscribe
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) { public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
Minecraft minecraft = FMLClientHandler.instance().getClient();
if (event.currentItem != null) { if (event.currentItem != null) {
if (event.currentItem.getItem() instanceof ITransmutationStone) { if (event.currentItem.getItem() instanceof ITransmutationStone) {
if (event.target.typeOfHit == EnumMovingObjectType.TILE) { if (event.target.typeOfHit == EnumMovingObjectType.TILE) {
TransmutationHelper.updateTargetBlock(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ); TransmutationHelper.updateTargetBlock(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ);
if (ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) { if (minecraft.isGuiEnabled() && minecraft.inGameHasFocus) {
drawInWorldTransmutationOverlay(event); if (ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) {
drawInWorldTransmutationOverlay(event);
}
} }
} }
} }

View file

@ -21,6 +21,8 @@ import com.pahimar.ee3.lib.Reference;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.TickType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** /**
* Equivalent-Exchange-3 * Equivalent-Exchange-3
@ -31,6 +33,7 @@ import cpw.mods.fml.common.TickType;
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
* *
*/ */
@SideOnly(Side.CLIENT)
public class TransmutationTargetOverlayHandler implements ITickHandler { public class TransmutationTargetOverlayHandler implements ITickHandler {
@Override @Override
@ -49,8 +52,10 @@ public class TransmutationTargetOverlayHandler implements ITickHandler {
if (player != null) { if (player != null) {
currentItemStack = player.inventory.getCurrentItem(); currentItemStack = player.inventory.getCurrentItem();
if (currentItemStack != null && minecraft.inGameHasFocus && currentItemStack.getItem() instanceof ITransmutationStone && ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) { if (minecraft.isGuiEnabled() && minecraft.inGameHasFocus) {
renderStoneHUD(minecraft, player, currentItemStack, (Float) tickData[0]); if (currentItemStack != null && currentItemStack.getItem() instanceof ITransmutationStone && ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) {
renderStoneHUD(minecraft, player, currentItemStack, (Float) tickData[0]);
}
} }
} }
} }