use of net.minecraft.entity.item.EntityXPOrb in project Gaia-Dimension by Andromander.
the class SlotPurify method onCrafting.
@Override
protected void onCrafting(ItemStack par1ItemStack) {
par1ItemStack.onCrafting(thePlayer.world, thePlayer, stackSize);
if (!thePlayer.world.isRemote) {
int i = stackSize;
float f = PurifierRecipes.instance().getExperience(par1ItemStack);
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;
thePlayer.world.spawnEntity(new EntityXPOrb(thePlayer.world, thePlayer.posX, thePlayer.posY + 0.5D, thePlayer.posZ + 0.5D, j));
}
}
stackSize = 0;
MinecraftForge.EVENT_BUS.post(new GDEvents.ItemPurifiedEvent(thePlayer, par1ItemStack));
}
use of net.minecraft.entity.item.EntityXPOrb in project DefiledLands by Lykrast.
the class EntityDestroyer method dropExperience.
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.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, i));
}
}
use of net.minecraft.entity.item.EntityXPOrb in project DefiledLands by Lykrast.
the class EntityMourner method dropExperience.
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.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, i));
}
}
use of net.minecraft.entity.item.EntityXPOrb in project Galacticraft by micdoodle8.
the class EntityBossBase method onDeathUpdate.
@Override
protected void onDeathUpdate() {
++this.deathTicks;
if (this.deathTicks >= 180 && this.deathTicks <= 200) {
final float x = (this.rand.nextFloat() - 0.5F) * this.width;
final float y = (this.rand.nextFloat() - 0.5F) * (this.height / 2.0F);
final float z = (this.rand.nextFloat() - 0.5F) * this.width;
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.posX + x, this.posY + 2.0D + y, this.posZ + z, 0.0D, 0.0D, 0.0D);
}
int i;
int j;
if (!this.world.isRemote) {
if (this.deathTicks >= 180 && this.deathTicks % 5 == 0) {
GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(PacketSimple.EnumSimplePacket.C_PLAY_SOUND_EXPLODE, GCCoreUtil.getDimensionID(this.world), new Object[] {}), new NetworkRegistry.TargetPoint(GCCoreUtil.getDimensionID(this.world), this.posX, this.posY, this.posZ, 40.0D));
}
if (this.deathTicks > 150 && this.deathTicks % 5 == 0) {
i = 30;
while (i > 0) {
j = EntityXPOrb.getXPSplit(i);
i -= j;
this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j));
}
}
}
if (this.deathTicks == 200 && !this.world.isRemote) {
i = 20;
while (i > 0) {
j = EntityXPOrb.getXPSplit(i);
i -= j;
this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j));
}
TileEntityTreasureChest chest = null;
if (this.spawner != null && this.spawner.getChestPos() != null) {
TileEntity chestTest = this.world.getTileEntity(this.spawner.getChestPos());
if (chestTest != null && chestTest instanceof TileEntityTreasureChest) {
chest = (TileEntityTreasureChest) chestTest;
}
}
if (chest == null) {
// Fallback to finding closest chest
chest = TileEntityTreasureChest.findClosest(this, this.getChestTier());
}
if (chest != null) {
double dist = this.getDistanceSq(chest.getPos().getX() + 0.5, chest.getPos().getY() + 0.5, chest.getPos().getZ() + 0.5);
if (dist < 1000 * 1000) {
if (!chest.locked) {
chest.locked = true;
}
for (int k = 0; k < chest.getSizeInventory(); k++) {
chest.setInventorySlotContents(k, ItemStack.EMPTY);
}
chest.fillWithLoot(null);
// ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
//
// // Generate twice, since it's an extra special chest
// WeightedRandomChestContent.generateChestContents(this.rand, info.getItems(this.rand), chest, info.getCount(this.rand));
// WeightedRandomChestContent.generateChestContents(this.rand, info.getItems(this.rand), chest, info.getCount(this.rand));
ItemStack schematic = this.getGuaranteedLoot(this.rand);
int slot = this.rand.nextInt(chest.getSizeInventory());
chest.setInventorySlotContents(slot, schematic);
}
}
this.dropKey();
super.setDead();
if (this.spawner != null) {
// Note: spawner.isBossDefeated is true, so it's properly dead
this.spawner.isBossDefeated = true;
this.spawner.boss = null;
this.spawner.spawned = false;
if (!this.world.isRemote) {
this.spawner.lastKillTime = MinecraftServer.getCurrentTimeMillis();
}
}
}
}
use of net.minecraft.entity.item.EntityXPOrb in project NetherEx by LogicTechCorp.
the class EntityPigtificate method useRecipe.
@Override
public void useRecipe(MerchantRecipe recipe) {
recipe.incrementToolUses();
livingSoundTime = -getTalkInterval();
int i = 3 + rand.nextInt(4);
if (recipe.getToolUses() == 1 || rand.nextInt(5) == 0) {
timeUntilRestock = 40;
needsInitialization = true;
willingToMate = true;
if (getCustomer() != null) {
lastCustomer = getCustomer().getUniqueID();
} else {
lastCustomer = null;
}
i += 5;
}
if (recipe.getRewardsExp()) {
world.spawnEntity(new EntityXPOrb(world, posX, posY + 0.5D, posZ, i));
}
}
Aggregations