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


Java RenderWorldLastEvent类代码示例

本文整理汇总了Java中net.minecraftforge.client.event.RenderWorldLastEvent的典型用法代码示例。如果您正苦于以下问题:Java RenderWorldLastEvent类的具体用法?Java RenderWorldLastEvent怎么用?Java RenderWorldLastEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onRenderWorld

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
public static void onRenderWorld(RenderWorldLastEvent event) {
//        EntityPlayerSP player = Minecraft.getMinecraft().player;
//        if (player.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) {
//            return;
//        }

//        if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() != ModItems.radiationMonitorItem) {
//            return;
//        }


        if (cleanAir != null) {
            EntityPlayerSP p = Minecraft.getMinecraft().player;
            if (hasGlasses()) {
                int cnt = cleanAir.size();
                if (cnt != prevCnt) {
                    System.out.println("cleanAir = " + cnt);
                    prevCnt = cnt;
                }
                renderHighlightedBlocks(event, p, cleanAir);
            }
        }
    }
 
开发者ID:McJty,项目名称:needtobreath,代码行数:24,代码来源:NTBOverlayRenderer.java

示例2: getPlayer

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
public static EntityPlayer getPlayer(Event event)
{
	if(event instanceof LivingEvent && ((LivingEvent)event).getEntity() instanceof EntityPlayer)
		return (EntityPlayer)((LivingEvent)event).getEntity();
	if(event instanceof RenderGameOverlayEvent || event instanceof RenderWorldLastEvent || event instanceof ClientTickEvent)
		return HarshenCastle.proxy.getPlayer();
	if(event instanceof PlayerTickEvent)
		return ((PlayerTickEvent)event).player;
	if(event instanceof PlayerEvent)
		return ((PlayerEvent)event).player;
	if(event instanceof net.minecraftforge.event.entity.player.PlayerEvent)
		return ((net.minecraftforge.event.entity.player.PlayerEvent)event).getEntityPlayer();
	if(event instanceof PlayerPunchedEvent)
		return ((PlayerPunchedEvent)event).attacker;
	if(event instanceof LivingDropsEvent && isSourceFromPlayer(((LivingDropsEvent)event).getSource()))
		return getPlayerFromSource(((LivingDropsEvent)event).getSource());
	return null;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:19,代码来源:HarshenUtils.java

示例3: renderBlocks

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
private static void renderBlocks(RenderWorldLastEvent evt, Set<BlockPos> blocks) {
    EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());

    double doubleX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks();
    double doubleY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks();
    double doubleZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks();

    GlStateManager.pushMatrix();
    GlStateManager.translate(-doubleX, -doubleY, -doubleZ);

    GlStateManager.disableDepth();
    GlStateManager.enableTexture2D();

    for (BlockPos pos : blocks) {
        renderBoxOutline(pos);
    }

    GlStateManager.enableDepth();

    GlStateManager.popMatrix();
}
 
开发者ID:McJty,项目名称:interactionwheel,代码行数:22,代码来源:RenderHandler.java

示例4: renderGhostAngstrom

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SubscribeEvent
public static void renderGhostAngstrom(RenderWorldLastEvent event) {
	EntityPlayerSP player = Minecraft.getMinecraft().player;
	ItemStack stack = player.getHeldItemMainhand();
	if(stack.isEmpty() || stack.getItem() != ModItems.ANGSTROM) {
		stack = player.getHeldItemOffhand();
	}
	if(!stack.isEmpty() && stack.getItem() == ModItems.ANGSTROM) {
		RayTraceResult result = RayTraceHelper.tracePlayerHighlight(player);
		if(result.typeOfHit != RayTraceResult.Type.BLOCK) {
			Vector3 vec = Vector3.create(player.posX, player.posY + player.getEyeHeight(), player.posZ);
			vec.add(Vector3.create(player.getLookVec()).multiply(2.5D));
			BlockPos pos = new BlockPos(vec.toVec3d());
			IBlockState replaced = player.world.getBlockState(pos);
			if(player.world.isAirBlock(pos) || replaced.getBlock().isReplaceable(player.world, pos)) {
				RenderHelper.renderGhostBlock(pos, ModBlocks.ANGSTROM.getDefaultState());
			}
		}
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:21,代码来源:Events.java

示例5: onRenderLast

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SubscribeEvent
public void onRenderLast(RenderWorldLastEvent event) {
    if(Minecraft.getMinecraft().player == null) return;

    ItemStack held = Minecraft.getMinecraft().player.getHeldItemMainhand();
    if(held.isEmpty()) {
        held = Minecraft.getMinecraft().player.getHeldItemOffhand();
    }
    if(!held.isEmpty() && held.getItem() instanceof ItemConstructTool) {
        PlayerStructureSelectionHelper.StructureSelection sel = PlayerStructureSelectionHelper.clientSelection;
        if(sel != null) {
            List<BlockPos> toRender = sel.getSelectedPositions().stream()
                    .filter((pos) -> pos.distanceSq(Minecraft.getMinecraft().player.getPosition()) <= 1024)
                    .collect(Collectors.toList());
            RenderingUtils.drawWhiteOutlineCubes(toRender, event.getPartialTicks());
        }
    }

    ClientProxy.renderHelper.renderTranslucentBlocks();
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:21,代码来源:SelectionBoxRenderHelper.java

示例6: onWorldRender

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onWorldRender (RenderWorldLastEvent event) {
    
    if (icon == null)
        icon = RenderUtils.getParticleTexture(new ItemStack(Blocks.STAINED_GLASS));
        
    final Minecraft mc = Minecraft.getMinecraft();
    final Frustum camera = RenderUtils.getCamera(mc.getRenderViewEntity(), event.getPartialTicks());
    
    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    
    for (final BlockPos pos : BlockHandler.PROTECTED)
        if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(pos)))
            this.renderPingOverlay(pos);
}
 
开发者ID:Darkhax-Minecraft,项目名称:WorldProtect,代码行数:17,代码来源:RenderingHandler.java

示例7: onRenderWorldLast

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
    // Don't render anything if a GUI is open
    if (this.mc.currentScreen != null)
    {
        return;
    }

    World fakeWorld = TickHandler.getInstance().getFakeWorld();

    if (fakeWorld != null)
    {
        synchronized (fakeWorld)
        {
            if (renderingEnabled && TickHandler.getInstance().isTargetingBlocks() &&
                (Configs.renderAfterDelay == false || System.currentTimeMillis() - TickHandler.getInstance().getHoverStartTime() >= Configs.renderDelay))
            {
                this.renderChangedBlocks(fakeWorld, this.mc.player, event.getPartialTicks());
            }
        }
    }
}
 
开发者ID:maruohon,项目名称:placementpreview,代码行数:24,代码来源:RenderEventHandler.java

示例8: onWorldRenderLast

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
/**
 * The world render last event. This is used for structure rendering.
 * @param event The event object.
 */
@SubscribeEvent
public static void onWorldRenderLast(RenderWorldLastEvent event)
{
	Minecraft mc = Minecraft.getMinecraft();

	if (mc.player != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.player.isSneaking()))
	{
		StructureRenderHandler.renderPlayerLook(mc.player, mc.objectMouseOver);
	}
	
	if (ItemBogus.renderTest)
	{
		ClientEventHandler.RenderTest(mc.world, mc.player);
	}
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:20,代码来源:ClientEventHandler.java

示例9: onRenderWorldLast

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
    @SubscribeEvent(priority = EventPriority.BOTTOM)
    public static void onRenderWorldLast(RenderWorldLastEvent event) {
    	if (true) return;
    	// optifine
//    	Minecraft mc = Minecraft.getMinecraft();
//    	float partialTicks = event.getPartialTicks();
//    	GlStateManager.enableFog();
//    	mc.entityRenderer.enableLightmap();
//        mc.mcProfiler.endStartSection("litParticles");
//        mc.effectRenderer.renderLitParticles(mc.thePlayer, partialTicks);
//        RenderHelper.disableStandardItemLighting();
//        mc.entityRenderer.setupFog(0, partialTicks);
//        mc.mcProfiler.endStartSection("particles");
//        mc.effectRenderer.renderParticles(mc.thePlayer, partialTicks);
//        mc.entityRenderer.disableLightmap();
//        GlStateManager.disableFog();
    }
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:19,代码来源:AlchemyFXType.java

示例10: renderWorldLast

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SubscribeEvent
public void renderWorldLast(RenderWorldLastEvent event) {
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();

	EntityPlayer rootPlayer = Minecraft.getMinecraft().player;
	double x = rootPlayer.lastTickPosX + (rootPlayer.posX - rootPlayer.lastTickPosX) * event.getPartialTicks();
	double y = rootPlayer.lastTickPosY + (rootPlayer.posY - rootPlayer.lastTickPosY) * event.getPartialTicks();
	double z = rootPlayer.lastTickPosZ + (rootPlayer.posZ - rootPlayer.lastTickPosZ) * event.getPartialTicks();
	GlStateManager.translate(-x, -y, -z);

	// vvv actual rendering stuff vvv

	GlStateManager.enableBlend();
	GlStateManager.alphaFunc(GL11.GL_GEQUAL, 1f / 255f);
	RenderLaserUtil.startRenderingLasers();
	for (LaserRenderInfo info : lasers.keySet())
		RenderLaserUtil.renderLaser(info.color, info.start, info.end);
	RenderLaserUtil.finishRenderingLasers();
	GlStateManager.disableBlend();
	GlStateManager.disableAlpha();

	GlStateManager.popMatrix();
	GlStateManager.popAttrib();
}
 
开发者ID:TeamWizardry,项目名称:TMT-Refraction,代码行数:26,代码来源:LaserRenderer.java

示例11: renderWorldLastEvent

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SubscribeEvent
public void renderWorldLastEvent(RenderWorldLastEvent evt)
{
	// Get the player and their held item
	EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
	ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);

	// Check if the held item is an extendo
	if(heldItem == null) return;
	if(heldItem.getItem() instanceof BaseExtendo)
	{
		// Call the highlight on the held extendo
		BaseExtendo extendo = (BaseExtendo) heldItem.getItem();
		extendo.drawHighlight(evt, player, heldItem);
	}
}
 
开发者ID:Arcfalt,项目名称:ExtendAHand,代码行数:17,代码来源:ClientProxy.java

示例12: renderLastEvent

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SubscribeEvent
public void renderLastEvent(RenderWorldLastEvent event) {
    if (NEIClientConfig.isEnabled()) {
        GlStateManager.pushMatrix();
        GlStateTracker.pushState();

        Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
        RenderUtils.translateToWorldCoords(entity, event.getPartialTicks());

        renderChunkBounds(entity);
        renderMobSpawnOverlay(entity);

        GlStateTracker.popState();
        GlStateManager.popMatrix();
    }

}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:18,代码来源:WorldOverlayRenderer.java

示例13: onWorldRender

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SubscribeEvent
public void onWorldRender(final RenderWorldLastEvent event) {
    final List<Trace> traces = TraceHandler.INSTANCE.getTraces();
    if (traces.size() <= 0) {
        return;
    }

    final EntityPlayerSP player = this.minecraft.player;
    if (player == null) {
        return;
    }

    this.playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks());
    this.playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks());
    this.playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks());

    this.minecraft.mcProfiler.startSection("tracer");
    render(traces);
    this.minecraft.mcProfiler.endSection();
}
 
开发者ID:Lunatrius,项目名称:Tracer,代码行数:21,代码来源:TraceRenderer.java

示例14: renderOverlay

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void renderOverlay(RenderWorldLastEvent evt, EntityPlayerSP player, ItemStack wand) {
    MovingObjectPosition mouseOver = Minecraft.getMinecraft().objectMouseOver;
    if (mouseOver != null && mouseOver.getBlockPos() != null && mouseOver.sideHit != null) {
        IBlockState state = player.worldObj.getBlockState(mouseOver.getBlockPos());
        Block block = state.getBlock();
        if (block != null && block.getMaterial() != Material.air) {
            int meta = block.getMetaFromState(state);

            int wandId = Tools.getTagCompound(wand).getInteger("block");
            Block wandBlock = Block.blockRegistry.getObjectById(wandId);
            int wandMeta = Tools.getTagCompound(wand).getInteger("meta");
            if (wandBlock == block && wandMeta == meta) {
                return;
            }

            Set<BlockPos> coordinates = findSuitableBlocks(wand, player.worldObj, mouseOver.sideHit, mouseOver.getBlockPos(), block, meta);
            renderOutlines(evt, player, coordinates, 200, 230, 180);
        }
    }
}
 
开发者ID:romelo333,项目名称:notenoughwands1.8.8,代码行数:23,代码来源:SwappingWand.java

示例15: renderOutlines

import net.minecraftforge.client.event.RenderWorldLastEvent; //导入依赖的package包/类
protected static void renderOutlines(RenderWorldLastEvent evt, EntityPlayerSP p, Set<BlockPos> coordinates, int r, int g, int b) {
    double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.partialTicks;
    double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.partialTicks;
    double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.partialTicks;

    GlStateManager.pushAttrib();
    GlStateManager.disableDepth();
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.depthMask(false);

    GlStateManager.pushMatrix();
    GlStateManager.translate(-doubleX, -doubleY, -doubleZ);

    renderOutlines(coordinates, r, g, b, 4);

    GlStateManager.popMatrix();
    GlStateManager.popAttrib();
}
 
开发者ID:romelo333,项目名称:notenoughwands1.8.8,代码行数:20,代码来源:GenericWand.java


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