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


Java EntityXPOrb类代码示例

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


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

示例1: onCastTick

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
@Override
public void onCastTick(World world, EntityPlayer player, ItemStack stack) {
	if (!world.isRemote) {
		BlockPos centerPos = player.getPosition();
		AxisAlignedBB area = new AxisAlignedBB(centerPos).expandXyz(3F);
		for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(player, area)) {
			if (entity instanceof EntityLivingBase) {
				WorldServer worldServer = (WorldServer) world;
				if (player.getItemInUseCount() % 10 == 0 && consumePower(player)) {
					MessageSoulDrainFX message = new MessageSoulDrainFX(entity.posX,
							entity.posY + (entity.height / 2.0F), entity.posZ, player.posX,
							player.posY + (player.height / 2.0F), player.posZ);
					PacketHandler.INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(
							player.dimension, player.posX, player.posY, player.posZ, 128));
					entity.attackEntityFrom(DamageSource.magic, 1);
					world.spawnEntity(new EntityXPOrb(world, entity.posX, entity.posY + 0.5, entity.posZ, 1));
				}
			}
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:22,代码来源:SpellSoulDrain.java

示例2: onItemPickup

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
/**
 * Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize
 */
public void onItemPickup(Entity p_71001_1_, int p_71001_2_)
{
    if (!p_71001_1_.isDead && !this.worldObj.isRemote)
    {
        EntityTracker entitytracker = ((WorldServer)this.worldObj).getEntityTracker();

        if (p_71001_1_ instanceof EntityItem)
        {
            entitytracker.sendToAllTrackingEntity(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId()));
        }

        if (p_71001_1_ instanceof EntityArrow)
        {
            entitytracker.sendToAllTrackingEntity(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId()));
        }

        if (p_71001_1_ instanceof EntityXPOrb)
        {
            entitytracker.sendToAllTrackingEntity(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId()));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:EntityLivingBase.java

示例3: handleCollectItem

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
public void handleCollectItem(SPacketCollectItem packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID());
    EntityLivingBase entitylivingbase = (EntityLivingBase)this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entitylivingbase == null)
    {
        entitylivingbase = this.gameController.thePlayer;
    }

    if (entity != null)
    {
        if (entity instanceof EntityXPOrb)
        {
            this.clientWorldController.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F, false);
        }
        else
        {
            this.clientWorldController.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F, false);
        }

        this.gameController.effectRenderer.addEffect(new ParticleItemPickup(this.clientWorldController, entity, entitylivingbase, 0.5F));
        this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID());
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:NetHandlerPlayClient.java

示例4: handleCollectItem

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
public void handleCollectItem(S0DPacketCollectItem packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID());
    EntityLivingBase entitylivingbase = (EntityLivingBase)this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entitylivingbase == null)
    {
        entitylivingbase = this.gameController.thePlayer;
    }

    if (entity != null)
    {
        if (entity instanceof EntityXPOrb)
        {
            this.clientWorldController.playSoundAtEntity(entity, "random.orb", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        }
        else
        {
            this.clientWorldController.playSoundAtEntity(entity, "random.pop", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        }

        this.gameController.effectRenderer.addEffect(new EntityPickupFX(this.clientWorldController, entity, entitylivingbase, 0.5F));
        this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID());
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:NetHandlerPlayClient.java

示例5: handleCollectItem

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
public void handleCollectItem(S0DPacketCollectItem packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID());
	EntityLivingBase entitylivingbase = (EntityLivingBase) this.clientWorldController
			.getEntityByID(packetIn.getEntityID());

	if (entitylivingbase == null) {
		entitylivingbase = this.gameController.thePlayer;
	}

	if (entity != null) {
		if (entity instanceof EntityXPOrb) {
			this.clientWorldController.playSoundAtEntity(entity, "random.orb", 0.2F,
					((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
		} else {
			this.clientWorldController.playSoundAtEntity(entity, "random.pop", 0.2F,
					((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
		}

		this.gameController.effectRenderer
				.addEffect(new EntityPickupFX(this.clientWorldController, entity, entitylivingbase, 0.5F));
		this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID());
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:NetHandlerPlayClient.java

示例6: handleCollectItem

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
public void handleCollectItem(SPacketCollectItem packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID());
    EntityLivingBase entitylivingbase = (EntityLivingBase)this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entitylivingbase == null)
    {
        entitylivingbase = this.gameController.player;
    }

    if (entity != null)
    {
        SoundEvent soundevent = entity instanceof EntityXPOrb ? SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP : SoundEvents.ENTITY_ITEM_PICKUP;
        this.clientWorldController.playSound(entity.posX, entity.posY, entity.posZ, soundevent, SoundCategory.PLAYERS, 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F, false);

        if (entity instanceof EntityItem)
        {
            ((EntityItem)entity).getEntityItem().func_190920_e(packetIn.func_191208_c());
        }

        this.gameController.effectRenderer.addEffect(new ParticleItemPickup(this.clientWorldController, entity, entitylivingbase, 0.5F));
        this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID());
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:26,代码来源:NetHandlerPlayClient.java

示例7: useRecipe

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
@Override
public void useRecipe(MerchantRecipe recipe) {
	recipe.incrementToolUses();
	if (recipe.getItemToBuy().getItem() instanceof ItemWeapon) {
		this.loadout.setStackInSlot(ItemFromData.getData(recipe.getItemToBuy()).getInt(PropertyType.SLOT), recipe.getItemToBuy());
		this.switchSlot(0);
	}

	else if(recipe.getItemToBuy().getItem() instanceof ItemWearable) {
		this.setItemStackToSlot(EntityEquipmentSlot.HEAD, recipe.getItemToBuy());
	}
	this.livingSoundTime = -this.getTalkInterval();
	this.playSound(SoundEvents.ENTITY_VILLAGER_YES, this.getSoundVolume(), this.getSoundPitch());
	int i = 3 + this.rand.nextInt(4);

	this.lastTrader = this.trader;
	this.tradeCount.put(this.trader,
			this.tradeCount.containsKey(trader) ? this.tradeCount.get(this.trader) + 1 : 1);
	this.traderFollowTicks = Math.min(4800, this.tradeCount.get(this.trader) * 250 + 350);
	if (recipe.getRewardsExp())
		this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY + 0.5D, this.posZ, i));

}
 
开发者ID:rafradek,项目名称:Mods,代码行数:24,代码来源:EntityTF2Character.java

示例8: onItemPickup

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
/**
 * Called when the entity picks up an item.
 */
public void onItemPickup(Entity entityIn, int quantity)
{
    if (!entityIn.isDead && !this.worldObj.isRemote)
    {
        EntityTracker entitytracker = ((WorldServer)this.worldObj).getEntityTracker();

        if (entityIn instanceof EntityItem)
        {
            entitytracker.sendToAllTrackingEntity(entityIn, new SPacketCollectItem(entityIn.getEntityId(), this.getEntityId()));
        }

        if (entityIn instanceof EntityArrow)
        {
            entitytracker.sendToAllTrackingEntity(entityIn, new SPacketCollectItem(entityIn.getEntityId(), this.getEntityId()));
        }

        if (entityIn instanceof EntityXPOrb)
        {
            entitytracker.sendToAllTrackingEntity(entityIn, new SPacketCollectItem(entityIn.getEntityId(), this.getEntityId()));
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:EntityLivingBase.java

示例9: protectedUpdate

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
@Override
public void protectedUpdate() {
    super.protectedUpdate();
    this.getWorld().getEntitiesWithinAABB(EntityXPOrb.class, getWorkingArea().expand(2, 2, 2)).stream().filter(entityXPOrb -> !entityXPOrb.isDead).forEach(entityXPOrb -> {
        if (this.outExp.fill(new FluidStack(FluidsRegistry.ESSENCE, (int) (entityXPOrb.getXpValue() * 20 * BlockRegistry.mobRelocatorBlock.getEssenceMultiplier())), false) > 0) {
            this.outExp.fill(new FluidStack(FluidsRegistry.ESSENCE, (int) (entityXPOrb.getXpValue() * 20 * BlockRegistry.mobRelocatorBlock.getEssenceMultiplier())), true);
        }
        entityXPOrb.setDead();
    });
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:11,代码来源:MobRelocatorTile.java

示例10: getEntityTrackingRange

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:38,代码来源:TrackingRange.java

示例11: smeltAndSpawn

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
private void smeltAndSpawn(EntityItem e) {
	ItemStack copy = e.getItem().copy();
	ItemStack is = copy.splitStack(1);
	if (rng.nextDouble() < 0.7d) {
		ItemStack result = FurnaceRecipes.instance().getSmeltingResult(is).copy();
		e.getEntityWorld().spawnEntity(new EntityItem(e.getEntityWorld(), e.posX, e.posY, e.posZ, result));
	} else {
		e.getEntityWorld().spawnEntity(new EntityXPOrb(e.getEntityWorld(), e.posX, e.posY, e.posZ, 2));
	}
	e.setItem(copy);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:12,代码来源:RitualFlames.java

示例12: onCrafting

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
@Override
protected void onCrafting(ItemStack stack) {
    stack.onCrafting(this.player.world, this.player, this.removeCount);

    if (!this.player.world.isRemote) {
        int i = this.removeCount;
        CraftiniumSmelt smelt = CraftiniumSmeltRegistry.findMatchingXp(stack, this.player.world, this.forge);
        float f = smelt == null ? 0 : smelt.experience(stack, this.player.world, this.forge);

        if (f == 0.0F) {
            i = 0;
        } else if (f < 1.0F) {
            int j = MathHelper.floor((float) i * f);

            if (j < MathHelper.ceil((float) i * f) && Math.random() < (double) ((float) i * f - (float) j)) {
                ++j;
            }

            i = j;
        }

        while (i > 0) {
            int k = EntityXPOrb.getXPSplit(i);
            i -= k;
            this.player.world.spawnEntity(new EntityXPOrb(this.player.world, this.player.posX, this.player.posY + 0.5D, this.player.posZ + 0.5D, k));
        }
    }

    this.removeCount = 0;

    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(player, stack);
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:33,代码来源:CraftiniumForgeOutputSlot.java

示例13: onDeathUpdate

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
/**
 * handles entity death timer, experience orb and particle creation
 */
protected void onDeathUpdate()
{
    ++this.deathTime;

    if (this.deathTime == 20)
    {
        if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot"))
        {
            int i = this.getExperiencePoints(this.attackingPlayer);

            while (i > 0)
            {
                int j = EntityXPOrb.getXPSplit(i);
                i -= j;
                this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
            }
        }

        this.setDead();

        for (int k = 0; k < 20; ++k)
        {
            double d2 = this.rand.nextGaussian() * 0.02D;
            double d0 = this.rand.nextGaussian() * 0.02D;
            double d1 = this.rand.nextGaussian() * 0.02D;
            this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d2, d0, d1, new int[0]);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:33,代码来源:EntityLivingBase.java

示例14: useRecipe

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
public void useRecipe(MerchantRecipe recipe)
{
    recipe.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch());
    int i = 3 + this.rand.nextInt(4);

    if (recipe.getToolUses() == 1 || this.rand.nextInt(5) == 0)
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;
        this.isWillingToMate = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }

        i += 5;
    }

    if (recipe.getItemToBuy().getItem() == Items.emerald)
    {
        this.wealth += recipe.getItemToBuy().stackSize;
    }

    if (recipe.getRewardsExp())
    {
        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:36,代码来源:EntityVillager.java

示例15: S11PacketSpawnExperienceOrb

import net.minecraft.entity.item.EntityXPOrb; //导入依赖的package包/类
public S11PacketSpawnExperienceOrb(EntityXPOrb xpOrb)
{
    this.entityID = xpOrb.getEntityId();
    this.posX = MathHelper.floor_double(xpOrb.posX * 32.0D);
    this.posY = MathHelper.floor_double(xpOrb.posY * 32.0D);
    this.posZ = MathHelper.floor_double(xpOrb.posZ * 32.0D);
    this.xpValue = xpOrb.getXpValue();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:S11PacketSpawnExperienceOrb.java


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