use of net.minecraft.entity.item.EntityItem in project PneumaticCraft by MineMaarten.
the class BlockPneumaticPlantBase method dropBlockAsItem.
@Override
protected void dropBlockAsItem(World world, int x, int y, int z, ItemStack stack) {
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
if (captureDrops.get()) {
capturedDrops.get().add(stack);
return;
}
float f = 0.7F;
double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, x + d0, y + d1, z + d2, stack);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
ItemPlasticPlants.markInactive(entityitem);
}
}
use of net.minecraft.entity.item.EntityItem in project PneumaticCraft by MineMaarten.
the class BlockRainPlant method executeFullGrownEffect.
@Override
public void executeFullGrownEffect(World world, int x, int y, int z, Random rand) {
if (!world.isRemote && world.isRaining()) {
ItemStack seed = new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.RAIN_PLANT_DAMAGE);
EntityItem plant = new EntityItem(world, x + rand.nextInt(16) - 8, 128, z + rand.nextInt(16) - 8, seed);
plant.lifespan = 300;
ItemPlasticPlants.markInactive(plant);
world.spawnEntityInWorld(plant);
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) - 2, 3);
}
}
use of net.minecraft.entity.item.EntityItem in project PneumaticCraft by MineMaarten.
the class BlockPressureTube method breakBlock.
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
List<ItemStack> drops = getModuleDrops((TileEntityPressureTube) world.getTileEntity(x, y, z));
for (ItemStack drop : drops) {
EntityItem entity = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5);
entity.setEntityItemStack(drop);
world.spawnEntityInWorld(entity);
}
super.breakBlock(world, x, y, z, block, meta);
}
use of net.minecraft.entity.item.EntityItem in project PneumaticCraft by MineMaarten.
the class BlockBurstPlant method executeFullGrownEffect.
@Override
public void executeFullGrownEffect(World world, int x, int y, int z, Random rand) {
if (!world.isRemote) {
ItemStack seed = new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.BURST_PLANT_DAMAGE);
EntityItem plant = new EntityItem(world, x + 0.5D, y + 0.8D, z + 0.5D, seed);
plant.motionX = rand.nextFloat() - 0.5F;
plant.motionY = 1.0F;
plant.motionZ = rand.nextFloat() - 0.5F;
plant.lifespan = 300;
ItemPlasticPlants.markInactive(plant);
world.spawnEntityInWorld(plant);
plant.playSound("mob.newsound.chickenplop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) - 2, 3);
}
}
use of net.minecraft.entity.item.EntityItem in project PneumaticCraft by MineMaarten.
the class SemiBlockManager method breakSemiBlock.
public void breakSemiBlock(World world, int x, int y, int z, EntityPlayer player) {
ISemiBlock semiBlock = getSemiBlock(world, x, y, z);
if (semiBlock != null) {
List<ItemStack> drops = new ArrayList<ItemStack>();
semiBlock.addDrops(drops);
for (ItemStack stack : drops) {
EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack);
world.spawnEntityInWorld(item);
if (player != null)
item.onCollideWithPlayer(player);
}
setSemiBlock(world, x, y, z, null);
}
}
Aggregations