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


Java EntityXPOrb.getXPSplit方法代码示例

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


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

示例1: dropExperience

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
private void dropExperience(int p_184668_1_)
{
    while (p_184668_1_ > 0)
    {
        int i = EntityXPOrb.getXPSplit(p_184668_1_);
        p_184668_1_ -= i;
        this.world.spawnEntityInWorld(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, i));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:EntityDragon.java

示例2: 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.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")))
        {
            int i = this.getExperiencePoints(this.attackingPlayer);
            i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i);
            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:F1r3w477,项目名称:CustomWorldGen,代码行数:33,代码来源:EntityLivingBase.java

示例3: dropXpOnBlockBreak

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
/**
 * Spawns the given amount of experience into the World as XP orb entities
 */
protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount)
{
    if (!worldIn.isRemote)
    {
        while (amount > 0)
        {
            int i = EntityXPOrb.getXPSplit(amount);
            amount -= i;
            worldIn.spawnEntityInWorld(new EntityXPOrb(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, i));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:Block.java

示例4: 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

示例5: dropExperience

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
private void dropExperience(int p_184668_1_)
{
    while (p_184668_1_ > 0)
    {
        int i = EntityXPOrb.getXPSplit(p_184668_1_);
        p_184668_1_ -= i;
        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, i));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:EntityDragon.java

示例6: 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.world.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.world.getGameRules().getBoolean("doMobLoot")))
        {
            int i = this.getExperiencePoints(this.attackingPlayer);

            while (i > 0)
            {
                int j = EntityXPOrb.getXPSplit(i);
                i -= j;
                this.world.spawnEntityInWorld(new EntityXPOrb(this.world, 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.world.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:sudofox,项目名称:Backmemed,代码行数:33,代码来源:EntityLivingBase.java

示例7: dropXpOnBlockBreak

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
/**
 * Spawns the given amount of experience into the World as XP orb entities
 */
protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) {
	if (!worldIn.isRemote) {
		while (amount > 0) {
			int i = EntityXPOrb.getXPSplit(amount);
			amount -= i;
			worldIn.spawnEntityInWorld(new EntityXPOrb(worldIn, (double) pos.getX() + 0.5D,
					(double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, i));
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:Block.java

示例8: dropXpOnBlockBreak

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
/**
 * Spawns the given amount of experience into the World as XP orb entities
 */
protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount)
{
    if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops"))
    {
        while (amount > 0)
        {
            int i = EntityXPOrb.getXPSplit(amount);
            amount -= i;
            worldIn.spawnEntityInWorld(new EntityXPOrb(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, i));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:Block.java

示例9: onCrafting

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.player.world, this.player, this.removeCount);

    if (!this.player.world.isRemote)
    {
        int i = this.removeCount;
        float f = FurnaceRecipes.instance().getSmeltingExperience(stack);

        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:cubex2,项目名称:morefurnaces,代码行数:40,代码来源:SlotOutput.java

示例10: onCrafting

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.removeCount);

    if (!this.thePlayer.worldObj.isRemote)
    {
        int i = this.removeCount;
        float f = FurnaceRecipes.instance().getSmeltingExperience(stack);

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

            if (j < MathHelper.ceiling_float_int((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.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, k));
        }
    }

    this.removeCount = 0;

    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack);

    if (stack.getItem() == Items.IRON_INGOT)
    {
        this.thePlayer.addStat(AchievementList.ACQUIRE_IRON);
    }

    if (stack.getItem() == Items.COOKED_FISH)
    {
        this.thePlayer.addStat(AchievementList.COOK_FISH);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:51,代码来源:SlotFurnaceOutput.java

示例11: onDeathUpdate

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

    if (this.deathTicks >= 180 && this.deathTicks <= 200)
    {
        float f = (this.rand.nextFloat() - 0.5F) * 8.0F;
        float f1 = (this.rand.nextFloat() - 0.5F) * 4.0F;
        float f2 = (this.rand.nextFloat() - 0.5F) * 8.0F;
        this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.posX + (double)f, this.posY + 2.0D + (double)f1, this.posZ + (double)f2, 0.0D, 0.0D, 0.0D, new int[0]);
    }

    boolean flag = this.worldObj.getGameRules().getBoolean("doMobLoot");

    if (!this.worldObj.isRemote)
    {
        if (this.deathTicks > 150 && this.deathTicks % 5 == 0 && flag)
        {
            int i = 1000;

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

        if (this.deathTicks == 1)
        {
            this.worldObj.playBroadcastSound(1018, new BlockPos(this), 0);
        }
    }

    this.moveEntity(0.0D, 0.10000000149011612D, 0.0D);
    this.renderYawOffset = this.rotationYaw += 20.0F;

    if (this.deathTicks == 200 && !this.worldObj.isRemote)
    {
        if (flag)
        {
            int j = 2000;

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

        this.generatePortal(new BlockPos(this.posX, 64.0D, this.posZ));
        this.setDead();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:59,代码来源:EntityDragon.java

示例12: onCrafting

import net.minecraft.entity.item.EntityXPOrb; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75228_b);

    if (!this.thePlayer.worldObj.isRemote)
    {
        int i = this.field_75228_b;
        float f = FurnaceRecipes.instance().getSmeltingExperience(stack);

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

            if (j < MathHelper.ceiling_float_int((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.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, k));
        }
    }

    this.field_75228_b = 0;

    if (stack.getItem() == Items.iron_ingot)
    {
        this.thePlayer.triggerAchievement(AchievementList.acquireIron);
    }

    if (stack.getItem() == Items.cooked_fish)
    {
        this.thePlayer.triggerAchievement(AchievementList.cookFish);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:49,代码来源:SlotFurnaceOutput.java


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