Java 类net.minecraftforge.client.event.RenderBlockOverlayEvent 实例源码

项目:CrystalMod    文件:ClientEventHandler.java   
@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);
            }
        }
    }
    }
}
项目:GaiaMod    文件:GaiaModEventHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void EntityViewRenderEvent(RenderBlockOverlayEvent event) {
    EntityLivingBase entityLiving = event.player;

    if (hasEquippedSet(entityLiving, ModArmor.fireHelmet,
            ModArmor.fireChest, ModArmor.fireLeggings, ModArmor.fireBoots)
            || hasEquippedSet(entityLiving, ModArmor.chaosHelmet,
                    ModArmor.chaosChest, ModArmor.chaosLeggings,
                    ModArmor.chaosBoots)
            || hasEquippedSet(entityLiving, ModArmor.orderHelmet,
                    ModArmor.orderChest, ModArmor.orderLeggings,
                    ModArmor.orderBoots)) {
        if (event.player.isInsideOfMaterial(Material.lava)) {
            event.setCanceled(true);

        }
    }
}
项目:Aether-Legacy    文件:GuiAetherInGame.java   
@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);
        }
    }
}
项目:geomastery    文件:ClientEvents.java   
/** 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);
    }
}
项目:mc-watercolor    文件:Watercolor.java   
@SubscribeEvent
public void renderOverlay(RenderBlockOverlayEvent event)
{
    if (event.overlayType != RenderBlockOverlayEvent.OverlayType.WATER)
        return;

    Block target = event.player.worldObj.getBlock(event.blockX, event.blockY, event.blockZ);
    if (target == wrappedBlock)
        event.setCanceled(true);
}
项目:Realms-of-Chaos    文件:OverlayEvent.java   
@SubscribeEvent
public void addOverlay(RenderBlockOverlayEvent evt){
    if(evt.overlayType == evt.overlayType.WATER && ArmorBonusEvent.getAquatic()){
        evt.setCanceled(true);
    }
    else if (evt.overlayType == evt.overlayType.FIRE && ArmorBonusEvent.hasFlamestone){
        evt.setCanceled(true);
    }
}
项目:iChunUtil    文件:EventHandlerWorldPortalClient.java   
@SubscribeEvent
public void onRenderBlockOverlay(RenderBlockOverlayEvent event)
{
    if(WorldPortals.eventHandler.isInPortal(event.getPlayer()))
    {
        event.setCanceled(true);
    }
}
项目:CustomWorldGen    文件:ForgeEventFactory.java   
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));
}
项目:Extra-Food    文件:ClientProxy.java   
@SubscribeEvent
public void renderzoverlay(RenderBlockOverlayEvent e){
    if(e.getOverlayType() == RenderBlockOverlayEvent.OverlayType.WATER && (Minecraft.getMinecraft().theWorld.getBlockState(e.getBlockPos()).getBlock() instanceof GeneralFluid)) {
        float[] nums = JuiceRegistry.instance.getColor(((GeneralFluid)Minecraft.getMinecraft().theWorld.getBlockState(e.getBlockPos()).getBlock()).getFluid());
        if (nums == null) {
            return;
        }
        e.setCanceled(true);
        Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/misc/underwater.png"));
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer worldrenderer = tessellator.getBuffer();
        float f = e.getPlayer().getBrightness(e.getRenderPartialTicks());
        GlStateManager.color(f, f, f, 0.5F);
        //float[] nums = JuiceRegistry.instance.getColor(((GeneralFluid)Minecraft.getMinecraft().theWorld.getBlockState(e.blockPos).getBlock()).getFluid());
        GlStateManager.color(nums[0], nums[1], nums[2], 0.5f);


        GlStateManager.setFog(GlStateManager.FogMode.EXP);

        if (((EntityLivingBase)e.getPlayer()).isPotionActive(MobEffects.WATER_BREATHING))
           {
               GlStateManager.setFogDensity(0.01F);
           }
           else
           {
               GlStateManager.setFogDensity(0.1F - (float)EnchantmentHelper.getRespirationModifier((EntityLivingBase)e.getPlayer()) * 0.03F);
           }
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        GlStateManager.pushMatrix();
        float f7 = -e.getPlayer().rotationYaw / 64.0F;
        float f8 = e.getPlayer().rotationPitch / 64.0F;
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
        worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex((double) (4.0F + f7), (double) (4.0F + f8)).endVertex();
        worldrenderer.pos(1.0D, -1.0D, -0.5D).tex((double) (0.0F + f7), (double) (4.0F + f8)).endVertex();
        worldrenderer.pos(1.0D, 1.0D, -0.5D).tex((double) (0.0F + f7), (double) (0.0F + f8)).endVertex();
        worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex((double) (4.0F + f7), (double) (0.0F + f8)).endVertex();
        tessellator.draw();
        GlStateManager.popMatrix();
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.disableBlend();
    }
}
项目:ForgeHax    文件:AntiOverlayMod.java   
/**
 * Disables screen overlays
 */
@SubscribeEvent
public void onRenderBlockOverlay(RenderBlockOverlayEvent event) { event.setCanceled(true); }