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


Java MovingObjectType.BLOCK属性代码示例

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


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

示例1: onItemRightClick

@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

    if (mop == null)
        return is;

    if (mop.typeOfHit == MovingObjectType.BLOCK)
    {
        int x = mop.blockX;
        int y = mop.blockY;
        int z = mop.blockZ;

        if (!world.canMineBlock(player, x, y, z))
            return is;

        return new ItemStack(TFCItems.woodenBucketEmpty);
    }

    return is;
}
 
开发者ID:Wahazar,项目名称:TFCPrimitiveTech,代码行数:22,代码来源:WoodenBucket_BasePotashLiquor.java

示例2: rayTraceCuboids

public void rayTraceCuboids(Vector3 start, Vector3 end, List<IndexedCuboid6> cuboids, BlockCoord pos, Block block, List<ExtendedMOP> hitList)
{
    for(IndexedCuboid6 cuboid : cuboids)
    {
        MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
        if(mop != null)
        {
            ExtendedMOP emop = new ExtendedMOP(mop, cuboid.data, s_dist);
            emop.typeOfHit = MovingObjectType.BLOCK;
            emop.blockX = pos.x;
            emop.blockY = pos.y;
            emop.blockZ = pos.z;
            hitList.add(emop);
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:16,代码来源:RayTracer.java

示例3: renderOverlay

public static void renderOverlay() {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.currentScreen == null &&
            mc.theWorld != null &&
            !mc.gameSettings.keyBindPlayerList.getIsKeyPressed() &&
            NEIClientConfig.getBooleanSetting("world.highlight_tips") &&
            mc.objectMouseOver != null &&
            mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
        World world = mc.theWorld;
        ArrayList<ItemStack> items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver);
        if (items.isEmpty())
            return;

        int minDamage = Integer.MAX_VALUE;
        ItemStack stack = null;
        for(ItemStack astack : items) {
            if(astack.getItem() != null && astack.getItemDamage() < minDamage) {
                stack = astack;
                minDamage = stack.getItemDamage();
            }
        }

        renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning());
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:25,代码来源:HUDRenderer.java

示例4: renderOverlay

public static void renderOverlay() {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.currentScreen == null &&
            mc.theWorld != null &&
            !mc.gameSettings.keyBindPlayerList.isKeyDown() &&
            NEIClientConfig.getBooleanSetting("world.highlight_tips") &&
            mc.objectMouseOver != null &&
            mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
        World world = mc.theWorld;
        ArrayList<ItemStack> items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver);
        if (items.isEmpty())
            return;

        int minDamage = Integer.MAX_VALUE;
        ItemStack stack = null;
        for(ItemStack astack : items) {
            if(astack.getItem() != null && astack.getItemDamage() < minDamage) {
                stack = astack;
                minDamage = stack.getItemDamage();
            }
        }

        renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning());
    }
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:25,代码来源:HUDRenderer.java

示例5: onItemRightClick

@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) {
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

    if (mop == null)
        return is;

    if (mop.typeOfHit == MovingObjectType.BLOCK) {
        int x = mop.blockX;
        int y = mop.blockY;
        int z = mop.blockZ;

        if (!world.canMineBlock(player, x, y, z))
            return is;

        return new ItemStack(this);
    }
    return is;

}
 
开发者ID:AnodeCathode,项目名称:TechNodefirmacraftMod,代码行数:20,代码来源:ModItemBottle.java

示例6: onItemRightClick

/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

    if (mop == null)
        return is;

    if (mop.typeOfHit == MovingObjectType.BLOCK)
    {
        int x = mop.blockX;
        int y = mop.blockY;
        int z = mop.blockZ;

        if (!world.canMineBlock(player, x, y, z))
            return is;

        return new ItemStack(TFCItems.woodenBucketEmpty);
    }

    return is;
}
 
开发者ID:Aleksey-Terzi,项目名称:DecorationsTFC,代码行数:25,代码来源:ItemPlaster.java

示例7: onEntitySwing

/**
 * Called when the player left-clicks
 */
@Override
public boolean onEntitySwing( final EntityLivingBase entity, final ItemStack wandStack )
{
	// Is the entity a player?
	if( entity instanceof EntityPlayer )
	{
		// Cast to player
		EntityPlayer player = (EntityPlayer)entity;

		// Ray trace
		MovingObjectPosition position = this.getMovingObjectPositionFromPlayer( player.worldObj, player, true );

		// Was a block hit?
		if( ( position != null ) && ( position.typeOfHit == MovingObjectType.BLOCK ) )
		{
			// Use the focus
			return this.onUse( player.worldObj, player, position, wandStack, Action.LEFT_CLICK_BLOCK );
		}
	}

	return false;

}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:26,代码来源:ItemFocusAEWrench.java

示例8: onImpact

@Override
protected void onImpact(MovingObjectPosition mop)
{

	if(mop.typeOfHit == MovingObjectType.BLOCK)
	{
		this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);
	}
	if (mop.entityHit != null)
       {
           this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);         
       }
	if (!this.worldObj.isRemote)
	{
		this.setDead();
	}
}
 
开发者ID:RamiLego4Game,项目名称:GalacticraftPixelGalaxy,代码行数:17,代码来源:EntitySeedShot.java

示例9: onUse

@Override
public void onUse(World world, EntityPlayer player, IPlayerSession session, ItemStack stack, int boost, int cost) {
    if (session.hasEnoughMana(cost())) {
        MovingObjectPosition mop = SimpleUtil.rayTrace(player, world, 43);
        if (mop != null) {
            if (mop.typeOfHit == MovingObjectType.BLOCK) {
                int blockX = mop.blockX;
                int blockY = mop.blockY;
                int blockZ = mop.blockZ;
                Block block = world.getBlock(blockX, blockY, blockZ);
                if (block != null && !world.isAirBlock(blockX, blockY, blockZ)) {
                    EntityLightningBolt light = new EntityLightningBolt(world, blockX, blockY, blockZ);
                    world.spawnEntityInWorld(light);
                    session.adjustMana(-cost(), false);
                }
            }
        }
    }
}
 
开发者ID:Lomeli12,项目名称:MagicalRings,代码行数:19,代码来源:HeavenStrike.java

示例10: onImpact

/**
 * Called when this EntityThrowable hits a block or entity.
 */
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
	if (par1MovingObjectPosition.entityHit != null)
	{
		par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 6F);
	}
	else if (par1MovingObjectPosition.typeOfHit == MovingObjectType.BLOCK)
	{
		if(!(worldObj.getBlock(par1MovingObjectPosition.blockX, par1MovingObjectPosition.blockY, par1MovingObjectPosition.blockZ) == Blocks.ice) && !(worldObj.getBlock(par1MovingObjectPosition.blockX, par1MovingObjectPosition.blockY, par1MovingObjectPosition.blockZ) == ModBlocks.boltObsidian))
			worldObj.setBlock(par1MovingObjectPosition.blockX, par1MovingObjectPosition.blockY, par1MovingObjectPosition.blockZ, Blocks.ice);
	}

	for (int i = 0; i < 4; ++i)
	{
		if (worldObj.isRemote)
			FrozenParticles.spawnParticle("iceBolt", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
	}

	setDead();
	
	//send package for player removal
	FrozenCraft.frozenCraftNetworkManager.sendToServer(new FrozenIceBoltRemoveMessage());
}
 
开发者ID:wuppy29,项目名称:WuppyMods,代码行数:27,代码来源:EntityIceBoltPlayer.java

示例11: onItemRightClick

@Override
 public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
 {
     MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

     if (mop == null)
         return is;

     if (mop.typeOfHit == MovingObjectType.BLOCK)
     {
         int x = mop.blockX;
         int y = mop.blockY;
         int z = mop.blockZ;

         if (!world.canMineBlock(player, x, y, z))
             return is;
if (mop.sideHit == 0) --y;
if (mop.sideHit == 1) ++y;
if (mop.sideHit == 2) --z;
if (mop.sideHit == 3) ++z;
if (mop.sideHit == 4) --x;
if (mop.sideHit == 5) ++x;

         tryPlaceContainedLiquid(world, x, y, z);
         return new ItemStack(TFCItems.redSteelBucketEmpty);
     }

     return is;
 }
 
开发者ID:Wahazar,项目名称:TerraFirmaProgressivePack,代码行数:29,代码来源:RedSteelBucket_LeachedUranite.java

示例12: impactSprout

private void impactSprout(MovingObjectPosition mop, boolean enhanced) {
   if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
      int itemEntity1 = mop.blockX;
      int newBrewStack1 = mop.blockY;
      int posZ = mop.blockZ;
      World world = super.worldObj;
      int sideHit = mop.sideHit;
      growBranch(itemEntity1, newBrewStack1, posZ, world, sideHit, enhanced?20:15, super.boundingBox);
   } else {
      EntityItem itemEntity = null;
      if(mop != null) {
         ItemStack newBrewStack = Witchery.Items.GENERIC.itemBrewOfSprouting.createStack();
         switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
         case 1:
            itemEntity = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack);
            break;
         case 2:
            itemEntity = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack);
         }
      }

      this.skipFX = true;
      if(itemEntity != null) {
         super.worldObj.spawnEntityInWorld(itemEntity);
      }
   }

}
 
开发者ID:lerion13,项目名称:witchery,代码行数:28,代码来源:EntityWitchProjectile.java

示例13: rayTraceCuboid

public MovingObjectPosition rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid, BlockCoord pos)
{
    MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
    if(mop != null)
    {
        mop.typeOfHit = MovingObjectType.BLOCK;
        mop.blockX = pos.x;
        mop.blockY = pos.y;
        mop.blockZ = pos.z;
    }
    return mop;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:12,代码来源:RayTracer.java

示例14: getPlayerLookingAtBlock

public ChunkPosition getPlayerLookingAtBlock(EntityPlayerMP player, float reach)
{
    Vec3 vec3d = Vec3.createVectorHelper(player.posX, (player.posY + 1.6200000000000001D) - player.yOffset, player.posZ);
    Vec3 vec3d1 = player.getLook(1.0F);
    Vec3 vec3d2 = vec3d.addVector(vec3d1.xCoord * reach, vec3d1.yCoord * reach, vec3d1.zCoord * reach);
    MovingObjectPosition hit = player.worldObj.rayTraceBlocks(vec3d, vec3d2);
    if(hit == null || hit.typeOfHit != MovingObjectType.BLOCK)
    {
        return null;
    }
    
    return new ChunkPosition(hit.blockX, hit.blockY, hit.blockZ);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:13,代码来源:PlayerCommand.java

示例15: onItemRightClick

@Override
 public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
 {
     MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

     if (mop == null)
         return is;

     if (mop.typeOfHit == MovingObjectType.BLOCK)
     {
         int x = mop.blockX;
         int y = mop.blockY;
         int z = mop.blockZ;

         if (!world.canMineBlock(player, x, y, z))
             return is;
if (mop.sideHit == 0) --y;
if (mop.sideHit == 1) ++y;
if (mop.sideHit == 2) --z;
if (mop.sideHit == 3) ++z;
if (mop.sideHit == 4) --x;
if (mop.sideHit == 5) ++x;

         tryPlaceContainedLiquid(world, x, y, z);
         return new ItemStack(TFCItems.blueSteelBucketEmpty);
     }

     return is;
 }
 
开发者ID:Wahazar,项目名称:TerraFirmaProgressivePack,代码行数:29,代码来源:BlueSteelBucket_WeakBlackSteel.java


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