use of net.minecraft.entity.item.EntityXPOrb in project MorePlanets by SteveKunG.
the class EntityVeinFloater method onDeathUpdate.
@Override
protected void onDeathUpdate() {
++this.deathTicks;
if (this.deathTicks >= 180 && this.deathTicks <= 200) {
float f = (this.rand.nextFloat() - 0.5F) * 5.5F;
float f1 = (this.rand.nextFloat() - 0.5F) * 28.0F;
float f2 = (this.rand.nextFloat() - 0.5F) * 5.5F;
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.posX + f, this.posY + 2.0D + f1, this.posZ + f2, 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(EnumSimplePacket.C_PLAY_SOUND_EXPLODE, GCCoreUtil.getDimensionID(this.world), new Object[] {}), new TargetPoint(GCCoreUtil.getDimensionID(this.world), this.posX, this.posY, this.posZ, 40.0D));
}
if (this.deathTicks > 150 && this.deathTicks % 5 == 0) {
i = 200;
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 == 40) {
GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_PLAY_SOUND_BOSS_DEATH, GCCoreUtil.getDimensionID(this.world), new Object[] { this.getSoundPitch() - 0.1F }), new TargetPoint(GCCoreUtil.getDimensionID(this.world), this.posX, this.posY, this.posZ, 40.0D));
}
}
if (this.deathTicks == 200 && !this.world.isRemote) {
i = 200;
while (i > 0) {
j = EntityXPOrb.getXPSplit(i);
i -= j;
this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j));
}
this.entityDropItem(new ItemStack(MPItems.NIBIRU_DUNGEON_KEY_BLADE), 0.5F);
this.setDead();
if (this.spawner != null) {
this.spawner.isBossDefeated = true;
this.spawner.boss = null;
this.spawner.spawned = false;
}
}
}
use of net.minecraft.entity.item.EntityXPOrb in project BetterWithAddons by DaedalusGame.
the class SoulSandHandler method handleXP.
private void handleXP() {
if (TrackedItemsIterator == null || !TrackedItemsIterator.hasNext()) {
TrackedItems.addAll(TrackedItemsAdd);
TrackedItemsAdd.clear();
TrackedItemsIterator = TrackedItems.iterator();
} else {
EntityXPOrb entity = TrackedItemsIterator.next();
World world = entity.world;
int xpValue = entity.getXpValue();
BlockPos pos = entity.getPosition();
boolean remove = false;
if (entity.isDead)
remove = true;
else {
IBlockState state = world.getBlockState(pos);
if (state.getBlock() != BWMBlocks.AESTHETIC || state.getValue(BlockAesthetic.blockType) != BlockAesthetic.EnumType.DUNG)
return;
if (!isValidInfusionWall(world, pos.up(), EnumFacing.DOWN) || !isValidInfusionWall(world, pos.down(), EnumFacing.UP) || !isValidInfusionWall(world, pos.south(), EnumFacing.NORTH) || !isValidInfusionWall(world, pos.north(), EnumFacing.SOUTH) || !isValidInfusionWall(world, pos.west(), EnumFacing.EAST) || !isValidInfusionWall(world, pos.east(), EnumFacing.WEST))
return;
AxisAlignedBB aabb = new AxisAlignedBB(pos);
List<EntityXPOrb> orbs = world.getEntitiesWithinAABB(EntityXPOrb.class, aabb);
int totalxp = 0;
for (EntityXPOrb orb : orbs) {
totalxp += orb.getXpValue();
orb.setDead();
}
if (world.rand.nextInt(50) < totalxp) {
world.setBlockState(pos, Blocks.SOUL_SAND.getDefaultState());
for (int i = 0; i < 3; i++) world.playEvent(2004, pos, 0);
// TODO: burn everybody
}
}
if (remove)
TrackedItemsIterator.remove();
}
}
use of net.minecraft.entity.item.EntityXPOrb in project RFTools by McJty.
the class BuilderTileEntity method collectItems.
private void collectItems(World world) {
// Collect item mode
collectCounter--;
if (collectCounter > 0) {
return;
}
collectCounter = BuilderConfiguration.collectTimer;
if (!loopMode) {
scan = null;
}
int rf = getEnergyStored();
float area = (maxBox.getX() - minBox.getX() + 1) * (maxBox.getY() - minBox.getY() + 1) * (maxBox.getZ() - minBox.getZ() + 1);
float infusedFactor = (4.0f - getInfusedFactor()) / 4.0f;
int rfNeeded = (int) (BuilderConfiguration.collectRFPerTickPerArea * area * infusedFactor) * BuilderConfiguration.collectTimer;
if (rfNeeded > rf) {
// Not enough energy.
return;
}
consumeEnergy(rfNeeded);
AxisAlignedBB bb = new AxisAlignedBB(minBox.getX() - .8, minBox.getY() - .8, minBox.getZ() - .8, maxBox.getX() + .8, maxBox.getY() + .8, maxBox.getZ() + .8);
List<Entity> items = world.getEntitiesWithinAABB(Entity.class, bb);
for (Entity entity : items) {
if (entity instanceof EntityItem) {
if (collectItem(world, infusedFactor, (EntityItem) entity)) {
return;
}
} else if (entity instanceof EntityXPOrb) {
if (collectXP(world, infusedFactor, (EntityXPOrb) entity)) {
return;
}
}
}
}
use of net.minecraft.entity.item.EntityXPOrb in project Random-Things by lumien231.
the class ItemIngredient method onItemUseFinish.
@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
if (getIngredient(stack) == ItemIngredient.INGREDIENT.LOTUS_BLOSSOM) {
if (entityLiving instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entityLiving;
if (!worldIn.isRemote) {
int i = 3 + worldIn.rand.nextInt(5) + worldIn.rand.nextInt(5);
while (i > 0) {
int j = EntityXPOrb.getXPSplit(i);
i -= j;
worldIn.spawnEntity(new EntityXPOrb(worldIn, entityplayer.posX, entityplayer.posY, entityplayer.posZ, j));
}
}
}
stack.shrink(1);
return stack;
}
return super.onItemUseFinish(stack, worldIn, entityLiving);
}
use of net.minecraft.entity.item.EntityXPOrb in project Pearcel-Mod by MiningMark48.
the class TileEntityPedestal method update.
@Override
public void update() {
World world = getWorld();
BlockPos pos = getPos();
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
int range = ConfigurationHandler.pearcelMagnetRange;
float pullSpeed = ConfigurationHandler.pearcelMagnetPullSpeed;
if (world.getBlockState(pos.up()).getBlock().equals(ModBlocks.ender_pearcel_block)) {
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
List<EntityXPOrb> xp = world.getEntitiesWithinAABB(EntityXPOrb.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
for (EntityItem e : items) {
// Attracts
e.addVelocity((x - e.posX + 0.5) * pullSpeed, (y - e.posY + 0.5) * pullSpeed, (z - e.posZ + 0.5) * pullSpeed);
if (ConfigurationHandler.pearcelMagnetParticles) {
world.spawnParticle(EnumParticleTypes.SPELL_INSTANT, e.posX, e.posY + 0.3, e.posZ, 0.0D, 0.0D, 0.0D);
}
}
for (EntityXPOrb e : xp) {
// Attracts
e.addVelocity((x - e.posX + 0.5) * pullSpeed, (y - e.posY + 0.5) * pullSpeed, (z - e.posZ + 0.5) * pullSpeed);
}
}
}
Aggregations