diff --git a/lang b/lang index 080830fa7..1d7ce399b 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 080830fa73f563683c1dc7c266ac9d9a422b2bf7 +Subproject commit 1d7ce399ba947ec3921c0c2069fa6ee18264144b diff --git a/src/main/java/forestry/core/items/ItemArmorNaturalist.java b/src/main/java/forestry/core/items/ItemArmorNaturalist.java index e8c0c4946..d9335652c 100755 --- a/src/main/java/forestry/core/items/ItemArmorNaturalist.java +++ b/src/main/java/forestry/core/items/ItemArmorNaturalist.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.core.items; +import java.util.List; + import javax.annotation.Nullable; import forestry.api.arboriculture.ArboricultureCapabilities; @@ -17,7 +19,9 @@ import forestry.api.core.IItemModelRegister; import forestry.api.core.IModelManager; import forestry.core.CreativeTabForestry; import forestry.core.config.Constants; +import forestry.core.utils.ItemTooltipUtil; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; @@ -52,6 +56,11 @@ public class ItemArmorNaturalist extends ItemArmor implements IItemModelRegister public boolean hasColor(ItemStack itemstack) { return false; } + + @Override + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) { + ItemTooltipUtil.addInformation(stack, playerIn, tooltip, advanced); + } @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { diff --git a/src/main/java/forestry/core/multiblock/MultiblockEventHandlerClient.java b/src/main/java/forestry/core/multiblock/MultiblockEventHandlerClient.java index c88b73b47..071d66939 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockEventHandlerClient.java +++ b/src/main/java/forestry/core/multiblock/MultiblockEventHandlerClient.java @@ -4,6 +4,7 @@ import java.util.Set; import forestry.api.multiblock.IMultiblockComponent; import forestry.api.multiblock.IMultiblockController; +import forestry.core.utils.GeneticsUtil; import forestry.core.utils.Log; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -29,65 +30,69 @@ public class MultiblockEventHandlerClient { @SubscribeEvent public void onGameOverlay(RenderGameOverlayEvent.Post event){ - if(event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null){ - Minecraft minecraft = Minecraft.getMinecraft(); - RayTraceResult posHit = minecraft.objectMouseOver; - FontRenderer font = minecraft.fontRendererObj; - ScaledResolution resolution = event.getResolution(); - - if(posHit != null && posHit.getBlockPos() != null){ - TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); - if(tile instanceof IMultiblockComponent){ - IMultiblockComponent component = (IMultiblockComponent) tile; - IMultiblockController controller = component.getMultiblockLogic().getController(); - String lastValidationError = controller.getLastValidationError(); - if(lastValidationError != null){ - lastValidationError = TextFormatting.DARK_RED.toString() + TextFormatting.ITALIC.toString() + lastValidationError; - minecraft.fontRendererObj.drawSplitString(lastValidationError, resolution.getScaledWidth() / 2 + 35, resolution.getScaledHeight() / 2 - 25, 128, 16777215); - } - } - } + if(GeneticsUtil.hasNaturalistEye(Minecraft.getMinecraft().player)){ + if(event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null){ + Minecraft minecraft = Minecraft.getMinecraft(); + RayTraceResult posHit = minecraft.objectMouseOver; + FontRenderer font = minecraft.fontRendererObj; + ScaledResolution resolution = event.getResolution(); + + if(posHit != null && posHit.getBlockPos() != null){ + TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); + if(tile instanceof IMultiblockComponent){ + IMultiblockComponent component = (IMultiblockComponent) tile; + IMultiblockController controller = component.getMultiblockLogic().getController(); + String lastValidationError = controller.getLastValidationError(); + if(lastValidationError != null){ + lastValidationError = TextFormatting.DARK_RED.toString() + TextFormatting.ITALIC.toString() + lastValidationError; + minecraft.fontRendererObj.drawSplitString(lastValidationError, resolution.getScaledWidth() / 2 + 35, resolution.getScaledHeight() / 2 - 25, 128, 16777215); + } + } + } + } } } @SubscribeEvent public void onWorldRenderLast(RenderWorldLastEvent event){ - try{ - World world = Minecraft.getMinecraft().world; - Set controllers = MultiblockRegistry.getControllersFromWorld(world); - if(!controllers.isEmpty()){ - float partialTicks = event.getPartialTicks(); - EntityPlayer player = Minecraft.getMinecraft().player; - double playerX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; - double playerY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; - double playerZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; - - GlStateManager.pushMatrix(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.disableTexture2D(); - GlStateManager.glLineWidth(2.0F); - GlStateManager.depthMask(false); - for(IMultiblockController controller : controllers){ - if(controller != null){ - BlockPos lastErrorPosition = controller.getLastValidationErrorPosition(); - if(lastErrorPosition != null){ - if(world.isBlockLoaded(lastErrorPosition) && player.getDistanceSq(lastErrorPosition) < 64F){ - AxisAlignedBB box = Block.FULL_BLOCK_AABB.offset(lastErrorPosition.getX() - playerX, lastErrorPosition.getY() - playerY, lastErrorPosition.getZ() - playerZ); - RenderGlobal.drawSelectionBoundingBox(box, 1.0F, 0.0F, 0.0F, 0.25F); - RenderGlobal.renderFilledBox(box, 1.0F, 0.0F, 0.0F, 0.125F); + if(GeneticsUtil.hasNaturalistEye(Minecraft.getMinecraft().player)){ + try{ + World world = Minecraft.getMinecraft().world; + Set controllers = MultiblockRegistry.getControllersFromWorld(world); + if(!controllers.isEmpty()){ + float partialTicks = event.getPartialTicks(); + EntityPlayer player = Minecraft.getMinecraft().player; + double playerX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; + double playerY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; + double playerZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; + + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.disableTexture2D(); + GlStateManager.glLineWidth(2.0F); + GlStateManager.depthMask(false); + for(IMultiblockController controller : controllers){ + if(controller != null){ + BlockPos lastErrorPosition = controller.getLastValidationErrorPosition(); + if(lastErrorPosition != null){ + if(world.isBlockLoaded(lastErrorPosition) && player.getDistanceSq(lastErrorPosition) < 64F){ + AxisAlignedBB box = Block.FULL_BLOCK_AABB.offset(lastErrorPosition.getX() - playerX, lastErrorPosition.getY() - playerY, lastErrorPosition.getZ() - playerZ); + RenderGlobal.drawSelectionBoundingBox(box, 1.0F, 0.0F, 0.0F, 0.25F); + RenderGlobal.renderFilledBox(box, 1.0F, 0.0F, 0.0F, 0.125F); + } } } } + + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); } - - GlStateManager.depthMask(true); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); + }catch(Exception e){ + Log.error("Failed to render the position of a multiblock exeption.", e); } - }catch(Exception e){ - Log.error("Failed to render the position of a multiblock exeption.", e); } } }