Search in sources :

Example 6 with PacketSpawnParticle

use of pneumaticCraft.common.network.PacketSpawnParticle in project PneumaticCraft by MineMaarten.

the class ModuleAirGrate method checkForPlantsAndFarm.

private void checkForPlantsAndFarm(World worldObj, int x, int y, int z, int plantCheckRange) {
    if (grateRange > 0 && worldObj.getTotalWorldTime() % 5 == 0) {
        if (plantCheckX < x - plantCheckRange || plantCheckZ < z - plantCheckRange) {
            plantCheckX = x - plantCheckRange;
            plantCheckZ = z - plantCheckRange;
        }
        if (plantCheckX != x || plantCheckZ != z) {
            // we know that we're no plant, avoid getBlock
            Block b = worldObj.getBlock(plantCheckX, y, plantCheckZ);
            NetworkHandler.sendToAllAround(new PacketSpawnParticle("reddust", plantCheckX + 0.5, y + 0.5, plantCheckZ + 0.5, 0, 0, 0), worldObj);
            if (b instanceof BlockPneumaticPlantBase) {
                ((BlockPneumaticPlantBase) b).attemptFarmByAirGrate(worldObj, plantCheckX, y, plantCheckZ);
            }
        }
        if (plantCheckZ++ >= z + plantCheckRange) {
            plantCheckZ = z - plantCheckRange;
            if (plantCheckX++ >= x + plantCheckRange) {
                plantCheckX = x - plantCheckRange;
            }
        }
    }
}
Also used : PacketSpawnParticle(pneumaticCraft.common.network.PacketSpawnParticle) BlockPneumaticPlantBase(pneumaticCraft.common.block.pneumaticPlants.BlockPneumaticPlantBase) Block(net.minecraft.block.Block)

Example 7 with PacketSpawnParticle

use of pneumaticCraft.common.network.PacketSpawnParticle in project PneumaticCraft by MineMaarten.

the class HeatBehaviourLiquidTransition method onLiquidTransition.

protected void onLiquidTransition(int x, int y, int z) {
    NetworkHandler.sendToAllAround(new PacketPlaySound("random.fizz", x + 0.5, y + 0.5, z + 0.5, 0.5F, 2.6F + (getWorld().rand.nextFloat() - getWorld().rand.nextFloat()) * 0.8F, true), getWorld());
    for (int i = 0; i < 8; i++) {
        double randX = x + getWorld().rand.nextDouble();
        double randZ = z + getWorld().rand.nextDouble();
        NetworkHandler.sendToAllAround(new PacketSpawnParticle("largesmoke", randX, y + 1, randZ, 0, 0, 0), getWorld());
    }
}
Also used : PacketSpawnParticle(pneumaticCraft.common.network.PacketSpawnParticle) PacketPlaySound(pneumaticCraft.common.network.PacketPlaySound)

Aggregations

PacketSpawnParticle (pneumaticCraft.common.network.PacketSpawnParticle)7 PacketPlaySound (pneumaticCraft.common.network.PacketPlaySound)4 Random (java.util.Random)2 Block (net.minecraft.block.Block)2 EntityItem (net.minecraft.entity.item.EntityItem)2 TargetPoint (cpw.mods.fml.common.network.NetworkRegistry.TargetPoint)1 Entity (net.minecraft.entity.Entity)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 EntityFireball (net.minecraft.entity.projectile.EntityFireball)1 ItemStack (net.minecraft.item.ItemStack)1 PathPoint (net.minecraft.pathfinding.PathPoint)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPneumaticPlantBase (pneumaticCraft.common.block.pneumaticPlants.BlockPneumaticPlantBase)1 PacketSetEntityMotion (pneumaticCraft.common.network.PacketSetEntityMotion)1