@SubscribeEvent public void waterOverlay(RenderBlockOverlayEvent event){ if(event.getOverlayType() == OverlayType.WATER){ EntityPlayer player = event.getPlayer(); IBlockState state = player.getEntityWorld().getBlockState(event.getBlockPos()); if(state.getBlock() instanceof IFluidBlock){ Fluid fluid = ((IFluidBlock)state.getBlock()).getFluid(); if(fluid !=null){ ResourceLocation res = ModFluids.getOverlayTexture(fluid); if(res !=null){ event.setCanceled(true); renderWaterOverlayTexture(event.getRenderPartialTicks(), res); } } } } }
@SubscribeEvent public void onRenderBlockOverlay(RenderBlockOverlayEvent event) { if (this.mc.thePlayer != null) { PlayerAether player = PlayerAether.get(this.mc.thePlayer); if (player.isWearingPhoenixSet() && event.getOverlayType() == OverlayType.FIRE) { event.setCanceled(true); } } }
/** Replaces water overlay on tar. */ @SubscribeEvent public void renderWaterOverlay(RenderBlockOverlayEvent event) { EntityPlayer player = event.getPlayer(); if (event.getOverlayType() == OverlayType.WATER && player.world.getBlockState(event.getBlockPos()) .getBlock() == GeoBlocks.tar) { Minecraft.getMinecraft().getTextureManager().bindTexture(TAR); Tessellator tess = Tessellator.getInstance(); VertexBuffer vert = tess.getBuffer(); float f = player.getBrightness(event.getRenderPartialTicks()); GlStateManager.color(f, f, f, 0.5F); GlStateManager.enableBlend(); GlStateManager.pushMatrix(); float f7 = -player.rotationYaw / 64.0F; float f8 = player.rotationPitch / 64.0F; vert.begin(7, DefaultVertexFormats.POSITION_TEX); vert.pos(-1.0D, -1.0D, -0.5D).tex(4.0F + f7, 4.0F + f8).endVertex(); vert.pos(1.0D, -1.0D, -0.5D).tex(0.0F + f7, 4.0F + f8).endVertex(); vert.pos(1.0D, 1.0D, -0.5D).tex(0.0F + f7, 0.0F + f8).endVertex(); vert.pos(-1.0D, 1.0D, -0.5D).tex(4.0F + f7, 0.0F + f8).endVertex(); tess.draw(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.1F); GlStateManager.disableBlend(); event.setCanceled(true); } }
public static boolean renderFireOverlay(EntityPlayer player, float renderPartialTicks) { return renderBlockOverlay(player, renderPartialTicks, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player)); }
public static boolean renderWaterOverlay(EntityPlayer player, float renderPartialTicks) { return renderBlockOverlay(player, renderPartialTicks, OverlayType.WATER, Blocks.WATER.getDefaultState(), new BlockPos(player)); }
public static boolean renderBlockOverlay(EntityPlayer player, float renderPartialTicks, OverlayType type, IBlockState block, BlockPos pos) { return MinecraftForge.EVENT_BUS.post(new RenderBlockOverlayEvent(player, renderPartialTicks, type, block, pos)); }