Java Code Examples for net.minecraft.entity.item.EntityXPOrb#getXPSplit()
The following examples show how to use
net.minecraft.entity.item.EntityXPOrb#getXPSplit() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityTofuGandlem.java From TofuCraftReload with MIT License | 5 votes |
@Override protected void onDeathUpdate() { this.renderYawOffset = this.rotationYaw; ++this.deathTicks; if (this.deathTicks >= 60 && this.deathTicks <= 80) { float f = (this.rand.nextFloat() - 0.5F) * 4.0F; float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F; float f2 = (this.rand.nextFloat() - 0.5F) * 4.0F; this.world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.posX + (double) f, this.posY + 2.0D + (double) f1, this.posZ + (double) f2, 0.0D, 0.0D, 0.0D); } if (this.deathTicks == 80) { if (!this.world.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.world.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.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j)); } } this.setDead(); } }
Example 2
Source File: SlotItemHandlerFurnaceOutput.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void onCrafting(ItemStack stack) { stack.onCrafting(this.player.getEntityWorld(), this.player, this.amountCrafted); if (this.player.getEntityWorld().isRemote == false) { int i = this.amountCrafted; 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.getEntityWorld().spawnEntity(new EntityXPOrb(this.player.getEntityWorld(), this.player.posX, this.player.posY + 0.5D, this.player.posZ + 0.5D, k)); } } this.amountCrafted = 0; net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(player, stack); }
Example 3
Source File: SlotSaltFurnace.java From TofuCraftReload with MIT License | 4 votes |
/** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ @Override protected void onCrafting(ItemStack par1ItemStack) { par1ItemStack.onCrafting(this.thePlayer.world, this.thePlayer, this.field_75228_b); if (!this.thePlayer.world.isRemote) { int i = this.field_75228_b; float f = par1ItemStack.getItem() == ItemLoader.material ? 0.2f : par1ItemStack.getItem() == ItemLoader.nigari ? 0.3f : 0.0f; int j; if (f == 0.0F) { i = 0; } else if (f < 1.0F) { j = MathHelper.floor(i * f); if (j < MathHelper.ceil(i * f) && (float)Math.random() < i * f - j) { ++j; } i = j; } while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; this.thePlayer.world.spawnEntity(new EntityXPOrb(this.thePlayer.world, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, j)); } } this.field_75228_b = 0; if (par1ItemStack.getItem() == ItemLoader.material) { TofuAdvancements.grantAdvancement(this.thePlayer, "getsalt"); } else if (par1ItemStack.getItem() == ItemLoader.nigari) { TofuAdvancements.grantAdvancement(this.thePlayer, "getnigari"); } }
Example 4
Source File: EntityRespawnedDragon.java From Et-Futurum with The Unlicense | 4 votes |
@Override protected void onDeathUpdate() { deathTicks++; if (deathTicks >= 180 && deathTicks <= 200) { float f = (rand.nextFloat() - 0.5F) * 8.0F; float f1 = (rand.nextFloat() - 0.5F) * 4.0F; float f2 = (rand.nextFloat() - 0.5F) * 8.0F; worldObj.spawnParticle("hugeexplosion", posX + f, posY + 2.0D + f1, posZ + f2, 0.0D, 0.0D, 0.0D); } int i; int j; if (!worldObj.isRemote) { if (deathTicks > 150 && deathTicks % 5 == 0) { i = 1000; while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; worldObj.spawnEntityInWorld(new EntityXPOrb(worldObj, posX, posY, posZ, j)); } } if (deathTicks == 1) worldObj.playBroadcastSound(1018, (int) posX, (int) posY, (int) posZ, 0); } moveEntity(0.0D, 0.10000000149011612D, 0.0D); renderYawOffset = rotationYaw += 20.0F; if (deathTicks == 200 && !worldObj.isRemote) { i = 2000; while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; worldObj.spawnEntityInWorld(new EntityXPOrb(worldObj, posX, posY, posZ, j)); } setDead(); } }
Example 5
Source File: SlotFirepitOutput.java From TFC2 with GNU General Public License v3.0 | 4 votes |
/** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ @Override 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); if (stack.getItem() == Items.IRON_INGOT) { this.player.addStat(AchievementList.ACQUIRE_IRON); } if (stack.getItem() == Items.COOKED_FISH) { this.player.addStat(AchievementList.COOK_FISH); } }