thaumcraft.common.lib.utils.Utils Java Examples

The following examples show how to use thaumcraft.common.lib.utils.Utils. 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: ExplosionHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void taintplosion(World world, int x, int y, int z, boolean taintBiome, int chanceToTaint, float str, int size, int blocksAffected) {
    if(chanceToTaint < 1) chanceToTaint = 1;
    world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, str, false);
    for (int a = 0; a < blocksAffected; a++) {
        int xx = x + world.rand.nextInt(size) - world.rand.nextInt(size);
        int yy = y + world.rand.nextInt(size) - world.rand.nextInt(size);
        int zz = z + world.rand.nextInt(size) - world.rand.nextInt(size);
        if (world.isAirBlock(xx, yy, zz)) {
            if (yy < y) {
                world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGoo, 8, 3);
            } else {
                world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGas, 8, 3);
            }
        }
        if(!Config.genTaint) continue;

        if(taintBiome && world.rand.nextInt(chanceToTaint) == 0) {
            Utils.setBiomeAt(world, xx, zz, ThaumcraftWorldGenerator.biomeTaint);
        }
    }
}
 
Example #2
Source File: ItemStreamChainsaw.java    From Electro-Magic-Tools with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
    Block bi = world.getBlock(x, y, z);
    if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z))) {
        if (!world.isRemote) {
            if (BlockUtils.breakFurthestBlock(world, x, y, z, bi, player)) {
                world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F);
                ElectricItem.manager.use(itemstack, cost, player);
                this.alternateServer = (!this.alternateServer);
            }
        } else {
            player.swingItem();
            ElectricItem.manager.use(itemstack, cost, player);
            this.alternateClient = (!this.alternateClient);
        }
    }
    return super.onItemUse(itemstack, player, world, x, y, z, par7, par8, par9, par10);
}
 
Example #3
Source File: ItemStreamChainsaw.java    From Electro-Magic-Tools with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) {
    World world = player.worldObj;
    Block bi = world.getBlock(x, y, z);
    if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z))) {
        if (!world.isRemote) {
            BlockUtils.breakFurthestBlock(world, x, y, z, bi, player);
            PacketHandler.INSTANCE.sendToAllAround(new PacketFXBlockBubble(x, y, z, new Color(0.33F, 0.33F, 1.0F).getRGB()), new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D));

            world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F);
        }
        ElectricItem.manager.use(itemstack, cost, player);
        return true;
    }
    return super.onBlockStartBreak(itemstack, x, y, z, player);
}
 
Example #4
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
    if(!Config.genTaint) return;
    int x = selectedBlock.posX;
    int y = selectedBlock.posY;
    int z = selectedBlock.posZ;
    BlockTaintFibres.spreadFibres(world, x, y, z);
    if(world.rand.nextInt(12) == 0) {
        Utils.setBiomeAt(world, x, z, ThaumcraftWorldGenerator.biomeTaint);
        world.addBlockEvent(x, y, z, world.getBlock(x, y, z), 1, 0);
    }
}