當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。