当前位置: 首页>>代码示例>>Java>>正文


Java RenderBlockOverlayEvent.getPlayer方法代码示例

本文整理汇总了Java中net.minecraftforge.client.event.RenderBlockOverlayEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java RenderBlockOverlayEvent.getPlayer方法的具体用法?Java RenderBlockOverlayEvent.getPlayer怎么用?Java RenderBlockOverlayEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.client.event.RenderBlockOverlayEvent的用法示例。


在下文中一共展示了RenderBlockOverlayEvent.getPlayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waterOverlay

import net.minecraftforge.client.event.RenderBlockOverlayEvent; //导入方法依赖的package包/类
@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);
 			}
 		}
 	}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:18,代码来源:ClientEventHandler.java

示例2: renderWaterOverlay

import net.minecraftforge.client.event.RenderBlockOverlayEvent; //导入方法依赖的package包/类
/** 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);
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:32,代码来源:ClientEvents.java

示例3: renderzoverlay

import net.minecraftforge.client.event.RenderBlockOverlayEvent; //导入方法依赖的package包/类
@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();
	}
}
 
开发者ID:TeamDmfMM,项目名称:Extra-Food,代码行数:44,代码来源:ClientProxy.java


注:本文中的net.minecraftforge.client.event.RenderBlockOverlayEvent.getPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。