當前位置: 首頁>>代碼示例>>Java>>正文


Java DrawBlockHighlightEvent類代碼示例

本文整理匯總了Java中net.minecraftforge.client.event.DrawBlockHighlightEvent的典型用法代碼示例。如果您正苦於以下問題:Java DrawBlockHighlightEvent類的具體用法?Java DrawBlockHighlightEvent怎麽用?Java DrawBlockHighlightEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DrawBlockHighlightEvent類屬於net.minecraftforge.client.event包,在下文中一共展示了DrawBlockHighlightEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBlockHilight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void onBlockHilight(DrawBlockHighlightEvent event)
{
    if (!TombManyGravesConfigs.DISPLAY_GRAVE_NAME)
    {
        return;
    }
    RayTraceResult trace = event.getTarget();
    if (trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK)
    {
        World world = mc.theWorld;
        IBlockState state = world.getBlockState(trace.getBlockPos());

        if (state.getBlock() == ModBlocks.blockDeath)
        {
            TileEntity tileEntity = world.getTileEntity(trace.getBlockPos());
            if (tileEntity != null && tileEntity instanceof TileDeathBlock)
            {
                String name = ((TileDeathBlock) tileEntity).getPlayerName();
                boolean giveGravePriority = ((TileDeathBlock) tileEntity).areGraveItemsForced();
                this.renderPlayerName(trace.getBlockPos(), event.getPartialTicks(), name, giveGravePriority);
            }
        }
    }
}
 
開發者ID:M4thG33k,項目名稱:TombManyGraves,代碼行數:26,代碼來源:TombManyGravesRenderEventHandler.java

示例2: highlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void highlight( DrawBlockHighlightEvent event )
{
	ItemStack held = event.player.getHeldItem();
	if ( held == null || held.getItem() != BiomeWandMod.items.wand )
	{
		return;
	}
	NBTTagCompound tag = held.getTagCompound();
	if ( tag == null ) tag = new NBTTagCompound();
	
	if ( !tag.hasKey( WandItem.SAMPLED_BIOME_TAG ) )
	{
		return;
	}
	
	int size = tag.hasKey( WandItem.ACTION_SIZE_TAG ) ? tag.getInteger( WandItem.ACTION_SIZE_TAG ) : 7;
	drawSelectionBox( size, event.context, event.player, event.target, 0, event.partialTicks );
	//event.setCanceled( true );
}
 
開發者ID:spacechase0,項目名稱:BiomeWand,代碼行數:21,代碼來源:ClientProxy.java

示例3: onBlockHighlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void onBlockHighlight(DrawBlockHighlightEvent e) {
	GL11.glPushMatrix();
	if (e.player.getCurrentEquippedItem() != null) {
		Item i = e.player.getCurrentEquippedItem().getItem();
		if (Block.getBlockFromItem(i) instanceof RLMBlockContainer && e.target.getBlockPos() != null) {
			if (e.player.worldObj.getBlockState(e.target.getBlockPos()).getBlock() != Blocks.air) {
				if (TileEntityRendererDispatcher.instance != null) {
					RLMBlockContainer b = (RLMBlockContainer) Block.getBlockFromItem(i);
					if (b != null) {
						BlockPos p = e.target.getBlockPos();
						GL11.glTranslated(p.getX(), p.getY(), p.getZ());
						// if
						// (b.createNewTileEntity(Minecraft.getMinecraft().theWorld,
						// 0) != null);
						// TileEntityRendererDispatcher.instance.renderTileEntity(b.createNewTileEntity(Minecraft.getMinecraft().theWorld,
						// 0),0.0f,1);
					}
				}
			}
		}
	}
	GL11.glPopMatrix();
}
 
開發者ID:ItsAMysterious,項目名稱:Real-Life-Mod-1.8,代碼行數:25,代碼來源:ClientHandler.java

示例4: handleDrawBlockHighlightEvent

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
/**
 * Check for blocks that need a custom block highlight and draw if checked.
 * Adapted from the vanilla highlight code.
 */
public static void handleDrawBlockHighlightEvent(DrawBlockHighlightEvent event) 
{
       BlockPos pos = event.getTarget().getBlockPos();
       if(pos != null && event.getPlayer() != null)
       {
           World world = event.getPlayer().world;
   		IBlockState bs = world.getBlockState(pos);
   		if (bs != null && bs.getBlock() instanceof SuperBlock) 
   		{
   		    SuperBlock block = (SuperBlock) bs.getBlock();
   		    ModelState modelState = block.getModelStateAssumeStateIsCurrent(bs, world, pos, true);
   		    drawBlockHighlight(modelState, pos, event.getPlayer(), event.getPartialTicks(), false);
			event.setCanceled(true);
   		}
	}
}
 
開發者ID:grondag,項目名稱:Hard-Science,代碼行數:21,代碼來源:BlockHighlighter.java

示例5: onBlockHighlightEvent

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void onBlockHighlightEvent(DrawBlockHighlightEvent highlightEvent) {
	MovingObjectPosition target = highlightEvent.target;
	//We're only interested in blocks...
	if (target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
		World world = highlightEvent.player.worldObj;
		TileEntity tileEntity = world.getTileEntity(target.blockX, target.blockY, target.blockZ);
		//...From my mod
		if (tileEntity instanceof BaseRobotPlatesTileEntity) {
			//TODO: Recalculate the vector used to intersect the block so I can be more accurate with SubBlock detection.
			BaseRobotPlatesTileEntity rpTileEntity = (BaseRobotPlatesTileEntity)tileEntity;
			Vec3 targetBlockVec = Vec3.createVectorHelper(target.blockX, target.blockY, target.blockZ);
			Vec3 vec = targetBlockVec.subtract(target.hitVec);
			SubObject subObject = rpTileEntity.getSubObject(vec);
			//... and we're hovering over one of my Sub-Objects.
			if (subObject != null) {
				subObject.RenderBoundingBox(highlightEvent.player, rpTileEntity, highlightEvent.partialTicks);
				//Don't draw the block's highlight.
				highlightEvent.setCanceled(true);
			}
		}
	}
}
 
開發者ID:AtomicBlom,項目名稱:RobotPlates,代碼行數:24,代碼來源:DrawBlockHighlightEventHandler.java

示例6: onDrawBlockhightlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
	@SubscribeEvent
	public void onDrawBlockhightlight(DrawBlockHighlightEvent event){
		ItemStack is = event.player.getCurrentEquippedItem();
		if(is == null || !(is.getItem() instanceof ChiselItem))return;
		
		int x = event.target.blockX, y = event.target.blockY,z = event.target.blockZ;		
		Block sculpture = event.player.worldObj.getBlock(x,y,z);
		
		int[] pos = Operations.raytrace(x,y,z, event.player);
		if(pos[0] == -1)return;
		
		ChiselItem ci = Utils.getItem(is);
		int flags = ci.getChiselFlags(event.player);
		if(!Operations.validOperation(event.player.worldObj, x,y,z, pos, flags))return;
		
		Operations.setBlockBoundsFromRaytrace(pos, sculpture, flags);
		event.context.drawSelectionBox(event.player, event.target, 0, event.partialTicks);
		sculpture.setBlockBounds(0, 0, 0, 1, 1, 1);
		
//		event.setCanceled(true);
	}
 
開發者ID:hypercross,項目名稱:minepainter,代碼行數:23,代碼來源:EventHandler.java

示例7: onBlockHilight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void onBlockHilight(DrawBlockHighlightEvent event)
{
    RayTraceResult trace = event.getTarget();

    if (trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK)
    {
        World world = this.mc.world;
        BlockPos pos = trace.getBlockPos();
        IBlockState state = world.getBlockState(pos);
        Block block = state.getBlock();

        if (block == EnderUtilitiesBlocks.PORTAL_PANEL || block == EnderUtilitiesBlocks.INSERTER)
        {
            state = state.getActualState(world, pos);
            this.updatePointedBlockHilight(world, trace.getBlockPos(), state, (BlockEnderUtilities) block, event.getPartialTicks());
        }

        if (block == EnderUtilitiesBlocks.PORTAL_PANEL)
        {
            this.renderPortalPanelText(this.mc.world, trace.getBlockPos(), (BlockEnderUtilities) block, this.mc.player, event.getPartialTicks());
        }
    }
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:25,代碼來源:RenderEventHandler.java

示例8: onDrawHighlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGHEST)
@SideOnly(Side.CLIENT)
public void onDrawHighlight(DrawBlockHighlightEvent event) {

    try {
        if (!(event.player.worldObj.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ) instanceof BlockMultipart))
            return;

        QMovingObjectPosition mop = retrace(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ,
                RayTracer.instance().getStartVector(event.player), RayTracer.instance().getEndVector(event.player));
        if (mop == null)
            return;
        if (mop.getPart() == null || !(mop.getPart() instanceof IPartSelectableCustom))
            return;
        if (((IPartSelectableCustom) mop.getPart()).drawHighlight(mop, event.player, event.partialTicks))
            event.setCanceled(true);
    } catch (Exception ex) {
    }
}
 
開發者ID:Qmunity,項目名稱:QmunityLib,代碼行數:20,代碼來源:BlockMultipart.java

示例9: onDrawBlockHighlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void onDrawBlockHighlight(DrawBlockHighlightEvent event) {
	int x = event.target.blockX;
	int y = event.target.blockY;
	int z = event.target.blockZ;
	
	World world = event.player.worldObj;
	
	if (world != null) {
		Block block = world.getBlock(x, y, z);
		if (block == Blocks.jukebox) {
			TileEntity te = world.getTileEntity(x, y, z);
			if (te instanceof BlockJukebox.TileEntityJukebox) {
				//BlockJukebox.TileEntityJukebox jb = (BlockJukebox.TileEntityJukebox) te;
				
				Physis.logger.info("test");
			}
		}
	}
}
 
開發者ID:TTFTCUTS,項目名稱:ShadowsOfPhysis,代碼行數:21,代碼來源:BlockHighlightHandler.java

示例10: onHighlightDraw

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void onHighlightDraw(DrawBlockHighlightEvent evt) {
	final RayTraceResult mop = evt.getTarget();

	if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) {

		final World world = evt.getPlayer().world;
		final BlockPos blockPos = mop.getBlockPos();
		final Block block = world.getBlockState(blockPos).getBlock();

		if (block instanceof ISelectionAware) {
			final boolean result = ((ISelectionAware)block).onSelected(world, blockPos, evt);
			evt.setCanceled(result);
		}
	}
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:17,代碼來源:BlockSelectionHandler.java

示例11: BuildersWandRender

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void BuildersWandRender(final DrawBlockHighlightEvent event) {
    if (event.currentItem != null && event.currentItem.getItem() instanceof ItemBuildersWand) {
        final List<ChunkPos> blocks = ((ItemBuildersWand)event.currentItem.getItem()).getPotentialBlocks(event.player, event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit);
        final Block blockId = event.player.worldObj.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ);
        if (blockId != Blocks.air & blocks.size() > 0) {
            GL11.glEnable(3042);
            GL11.glBlendFunc(770, 771);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.35f);
            GL11.glLineWidth(3.0f);
            GL11.glDisable(3553);
            GL11.glDisable(2929);
            GL11.glDepthMask(false);
            final double px = event.player.lastTickPosX + (event.player.posX - event.player.lastTickPosX) * event.partialTicks;
            final double py = event.player.lastTickPosY + (event.player.posY - event.player.lastTickPosY) * event.partialTicks;
            final double pz = event.player.lastTickPosZ + (event.player.posZ - event.player.lastTickPosZ) * event.partialTicks;
            GL11.glTranslated(-px, -py, -pz);
            for (final ChunkPos temp : blocks) {
                this.drawOutlinedBoundingBox(AxisAlignedBB.getBoundingBox((double)temp.x, (double)temp.y, (double)temp.z, (double)(temp.x + 1), (double)(temp.y + 1), (double)(temp.z + 1)));
            }
            GL11.glDepthMask(true);
            GL11.glEnable(3553);
            GL11.glDisable(3042);
            GL11.glEnable(2929);
            GL11.glTranslated(px, py, pz);
            event.setCanceled(true);
        }
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:30,代碼來源:EventHandlerClient.java

示例12: onBlockHighlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SideOnly (Side.CLIENT)
@SubscribeEvent (priority = EventPriority.LOW)
public void onBlockHighlight(DrawBlockHighlightEvent event) {
    BlockPos pos = event.getTarget().getBlockPos();

    //We have found a CuboidRayTraceResult, Lets render it properly..
    RayTraceResult hit = event.getTarget();
    if (hit.typeOfHit == Type.BLOCK && hit instanceof CuboidRayTraceResult) {
        event.setCanceled(true);
        RenderUtils.renderHitBox(event.getPlayer(), ((CuboidRayTraceResult) event.getTarget()).cuboid6.copy().add(pos), event.getPartialTicks());
    }
}
 
開發者ID:TheCBProject,項目名稱:CodeChickenLib,代碼行數:13,代碼來源:CCRenderEventHandler.java

示例13: highlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
public void highlight(DrawBlockHighlightEvent event) {
	if (event.getTarget() != null && event.getTarget().typeOfHit == RayTraceResult.Type.BLOCK) {
		BlockPos hit = event.getTarget().getBlockPos();
		IBlockState target = event.getPlayer().getEntityWorld().getBlockState(hit);
		if (target.getBlock() instanceof IPrecision) {
			highlighting = hit;
		} else highlighting = null;
	}
}
 
開發者ID:TeamWizardry,項目名稱:TMT-Refraction,代碼行數:11,代碼來源:ScrewdriverOverlay.java

示例14: onBlockHighlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onBlockHighlight(DrawBlockHighlightEvent event) {
    if (event.target.typeOfHit == MovingObjectType.BLOCK) {
        Block b = event.player.worldObj.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ);

        if (b == BlockStation.instance || b == BlockStationHorizontal.instance || b == BlockTube.instance)
            RayTracer.retraceBlock(event.player.worldObj, event.player, event.target.blockX, event.target.blockY, event.target.blockZ);

        ItemStack stack = event.player.inventory.mainInventory[event.player.inventory.currentItem];

        if (stack != null && stack.getItem() == ItemTube.instance)
            proxy.lastSideHit = event.target.sideHit;
    }
}
 
開發者ID:enhancedportals,項目名稱:TubeTransportSystem,代碼行數:16,代碼來源:TubeTransportSystem.java

示例15: onDrawBlockhightlight

import net.minecraftforge.client.event.DrawBlockHighlightEvent; //導入依賴的package包/類
@SubscribeEvent
  public void onDrawBlockhightlight(DrawBlockHighlightEvent event) {
    final ItemStack is = event.player.getCurrentEquippedItem();
    if (is == null) {
      return;
    }
    final Item item = is.getItem();
    if ((item == null) || !(item instanceof ChiselItem)) {
      return;
    }
    final ChiselItem ci = (ChiselItem) item;

    final int x = event.target.blockX;
    final int y = event.target.blockY;
    final int z = event.target.blockZ;
    final Block sculpture = event.player.worldObj.getBlock(x, y, z);

    final int[] pos = Operations.raytrace(x, y, z, event.player);
    if (pos[0] == -1) {
      return;
    }

    int flags = ci.getChiselFlags(event.player);
    if (!Operations.validOperation(event.player.worldObj, x, y, z, pos, flags)) {
      return;
    }

    Operations.setBlockBoundsFromRaytrace(pos, sculpture, flags);
    event.context.drawSelectionBox(event.player, event.target, 0, event.partialTicks);
    sculpture.setBlockBounds(0, 0, 0, 1, 1, 1);

//		event.setCanceled(true);
  }
 
開發者ID:twothe,項目名稱:DaVincing,代碼行數:34,代碼來源:ProxyClient.java


注:本文中的net.minecraftforge.client.event.DrawBlockHighlightEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。