本文整理汇总了Java中net.minecraftforge.client.event.RenderBlockOverlayEvent.getOverlayType方法的典型用法代码示例。如果您正苦于以下问题:Java RenderBlockOverlayEvent.getOverlayType方法的具体用法?Java RenderBlockOverlayEvent.getOverlayType怎么用?Java RenderBlockOverlayEvent.getOverlayType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.client.event.RenderBlockOverlayEvent
的用法示例。
在下文中一共展示了RenderBlockOverlayEvent.getOverlayType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
}
示例2: onRenderBlockOverlay
import net.minecraftforge.client.event.RenderBlockOverlayEvent; //导入方法依赖的package包/类
@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);
}
}
}
示例3: 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);
}
}
示例4: 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();
}
}