Java Code Examples for net.minecraft.world.World.spawnParticle()

The following are Jave code examples for showing how to use spawnParticle() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: CustomWorldGen   File: BlockFalling.java   Source Code and License Vote up 6 votes
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (rand.nextInt(16) == 0)
    {
        BlockPos blockpos = pos.down();

        if (canFallThrough(worldIn.getBlockState(blockpos)))
        {
            double d0 = (double)((float)pos.getX() + rand.nextFloat());
            double d1 = (double)pos.getY() - 0.05D;
            double d2 = (double)((float)pos.getZ() + rand.nextFloat());
            worldIn.spawnParticle(EnumParticleTypes.FALLING_DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[] {Block.getStateId(stateIn)});
        }
    }
}
 
Example 2
Project: ExSartagine   File: BlockPan.java   Source Code and License Vote up 6 votes
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
	double d0 = (double)pos.getX() + 0.5D;
	double d1 = (double)pos.getY() + 0.15D;
	double d2 = (double)pos.getZ() + 0.5D;
	double d3 = 0.22D;
	double d4 = 0.27D;

	if(worldIn.getTileEntity(pos) instanceof TileEntityPan)
	{
		if(((TileEntityPan)worldIn.getTileEntity(pos)).isCooking())
		{
			worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+(RANDOM.nextDouble()/1.5 - 0.35), d1, d2+(RANDOM.nextDouble()/1.5 - 0.35), 0.0D, 0.0D, 0.0D, new int[0]);
			worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+(RANDOM.nextDouble()/1.5 - 0.35), d1, d2+(RANDOM.nextDouble()/1.5 - 0.35), 0.0D, 0.0D, 0.0D, new int[0]);
		}
	}
}
 
Example 3
Project: BaseClient   File: BlockRedstoneRepeater.java   Source Code and License Vote up 6 votes
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (this.isRepeaterPowered)
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        double d0 = (double)((float)pos.getX() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D;
        double d1 = (double)((float)pos.getY() + 0.4F) + (double)(rand.nextFloat() - 0.5F) * 0.2D;
        double d2 = (double)((float)pos.getZ() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D;
        float f = -5.0F;

        if (rand.nextBoolean())
        {
            f = (float)(((Integer)state.getValue(DELAY)).intValue() * 2 - 1);
        }

        f = f / 16.0F;
        double d3 = (double)(f * (float)enumfacing.getFrontOffsetX());
        double d4 = (double)(f * (float)enumfacing.getFrontOffsetZ());
        worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
Example 4
Project: Infernum   File: MessageSoulDrainFX.java   Source Code and License Vote up 6 votes
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(final MessageSoulDrainFX message, final MessageContext ctx) {
	World world = Minecraft.getMinecraft().world;
	if (world.isRemote) {
		for (double i = 0; i < 8; i++) {
			double xCoord = message.posX + (rand.nextDouble() - 0.5);
			double yCoord = message.posY + (rand.nextDouble() - 0.5);
			double zCoord = message.posZ + (rand.nextDouble() - 0.5);
			world.spawnParticle(EnumParticleTypes.CRIT, true, xCoord, yCoord, zCoord, (rand.nextDouble() - 0.5),
					(rand.nextDouble() - 0.5), (rand.nextDouble() - 0.5));
		}
		ParticleUtils.spawnParticleBeam(world, EnumParticleTypes.CRIT, message.posX, message.posY, message.posZ,
				message.castX, message.castY, message.castZ, 0.2);
	}
	return null;
}
 
Example 5
Project: BaseClient   File: BlockLeaves.java   Source Code and License Vote up 5 votes
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (worldIn.canLightningStrike(pos.up()) && !World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && rand.nextInt(15) == 1)
    {
        double d0 = (double)((float)pos.getX() + rand.nextFloat());
        double d1 = (double)pos.getY() - 0.05D;
        double d2 = (double)((float)pos.getZ() + rand.nextFloat());
        worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
Example 6
Project: pnc-repressurized   File: Debugger.java   Source Code and License Vote up 5 votes
public static void indicateBlock(World world, BlockPos pos) {

        if (world != null) {
            if (world.isRemote) {
                for (int i = 0; i < 5; i++) {
                    double dx = pos.getX() + 0.5;
                    double dy = pos.getY() + 0.5;
                    double dz = pos.getZ() + 0.5;
                    world.spawnParticle(EnumParticleTypes.REDSTONE, dx, dy, dz, 0, 0, 0);
                }
            } else {
                NetworkHandler.sendToAllAround(new PacketDebugBlock(pos), world);
            }
        }
    }
 
Example 7
Project: minecraft-quiverbow   File: Crossbow_Blaze.java   Source Code and License Vote up 5 votes
@Override
public void doSingleFire(ItemStack stack, World world, Entity entity)		// Server side
{
	if (this.getCooldown(stack) != 0) { return; }	// Hasn't cooled down yet

	// SFX
	world.playSoundAtEntity(entity, "random.bow", 1.0F, 0.5F);

	// Firing
	BlazeShot entityarrow = new BlazeShot(world, entity, (float) this.Speed);

	// Random Damage
	int dmg_range = this.DmgMax - this.DmgMin; 	// If max dmg is 20 and min is 10, then the range will be 10
	int dmg = world.rand.nextInt(dmg_range + 1);// Range will be between 0 and 10
	dmg += this.DmgMin;							// Adding the min dmg of 10 back on top, giving us the proper damage range (10-20)

	entityarrow.damage = dmg;
	entityarrow.knockbackStrength = this.Knockback;	// Comes with an inbuild knockback II
	entityarrow.fireDuration = this.FireDur;
	entityarrow.ticksInGroundMax = 200;			// 200 ticks for 10 sec

	world.spawnEntityInWorld(entityarrow);	// pew

	// SFX
	world.playSoundAtEntity(entity, "random.wood_click", 1.0F, 0.5F);
	world.spawnParticle("smoke", entity.posX, entity.posY + 0.5D, entity.posZ, 0.0D, 0.0D, 0.0D);

	this.consumeAmmo(stack, entity, 1);
	this.setCooldown(stack, 10);
}
 
Example 8
Project: CustomWorldGen   File: BlockBrewingStand.java   Source Code and License Vote up 5 votes
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    double d0 = (double)((float)pos.getX() + 0.4F + rand.nextFloat() * 0.2F);
    double d1 = (double)((float)pos.getY() + 0.7F + rand.nextFloat() * 0.3F);
    double d2 = (double)((float)pos.getZ() + 0.4F + rand.nextFloat() * 0.2F);
    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
 
Example 9
Project: Backmemed   File: BlockFurnace.java   Source Code and License Vote up 5 votes
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (this.isBurning)
    {
        EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING);
        double d0 = (double)pos.getX() + 0.5D;
        double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
        double d2 = (double)pos.getZ() + 0.5D;
        double d3 = 0.52D;
        double d4 = rand.nextDouble() * 0.6D - 0.3D;

        if (rand.nextDouble() < 0.1D)
        {
            worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
        }

        switch (enumfacing)
        {
            case WEST:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                break;

            case EAST:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                break;

            case NORTH:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                break;

            case SOUTH:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }
}
 
Example 10
Project: CustomWorldGen   File: BlockLiquid.java   Source Code and License Vote up 5 votes
protected void triggerMixEffects(World worldIn, BlockPos pos)
{
    double d0 = (double)pos.getX();
    double d1 = (double)pos.getY();
    double d2 = (double)pos.getZ();
    worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

    for (int i = 0; i < 8; ++i)
    {
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
Example 11
Project: ExPetrum   File: ItemWateringCan.java   Source Code and License Vote up 5 votes
public void tryHydrateBlock(EntityPlayer player, int tier, BlockPos pos, World w, IBlockState state, IFluidHandlerItem cap, ItemStack is)
{
	while ((state.getMaterial() == Material.PLANTS || w.isAirBlock(pos)) && pos.getY() > 0)
	{
		pos = pos.down();
		state = w.getBlockState(pos);
	}
	
	if (state.getBlock() instanceof IAcceptsWaterCan)
	{
		((IAcceptsWaterCan)state.getBlock()).acceptWatering(player, w, pos, state, cap, is, tier);
	}
	
	w.spawnParticle(EnumParticleTypes.WATER_SPLASH, pos.getX() + w.rand.nextFloat(), pos.getY() + 1, pos.getZ() + w.rand.nextFloat(), 0, 0, 0);
}
 
Example 12
Project: Backmemed   File: BlockEnchantmentTable.java   Source Code and License Vote up 5 votes
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    super.randomDisplayTick(stateIn, worldIn, pos, rand);

    for (int i = -2; i <= 2; ++i)
    {
        for (int j = -2; j <= 2; ++j)
        {
            if (i > -2 && i < 2 && j == -1)
            {
                j = 2;
            }

            if (rand.nextInt(16) == 0)
            {
                for (int k = 0; k <= 1; ++k)
                {
                    BlockPos blockpos = pos.add(i, k, j);

                    if (worldIn.getBlockState(blockpos).getBlock() == Blocks.BOOKSHELF)
                    {
                        if (!worldIn.isAirBlock(pos.add(i / 2, 0, j / 2)))
                        {
                            break;
                        }

                        worldIn.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, (double)pos.getX() + 0.5D, (double)pos.getY() + 2.0D, (double)pos.getZ() + 0.5D, (double)((float)i + rand.nextFloat()) - 0.5D, (double)((float)k - rand.nextFloat() - 1.0F), (double)((float)j + rand.nextFloat()) - 0.5D, new int[0]);
                    }
                }
            }
        }
    }
}
 
Example 13
Project: BaseClient   File: BlockBrewingStand.java   Source Code and License Vote up 5 votes
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    double d0 = (double)((float)pos.getX() + 0.4F + rand.nextFloat() * 0.2F);
    double d1 = (double)((float)pos.getY() + 0.7F + rand.nextFloat() * 0.3F);
    double d2 = (double)((float)pos.getZ() + 0.4F + rand.nextFloat() * 0.2F);
    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
 
Example 14
Project: CustomWorldGen   File: BlockEndRod.java   Source Code and License Vote up 5 votes
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING);
    double d0 = (double)pos.getX() + 0.55D - (double)(rand.nextFloat() * 0.1F);
    double d1 = (double)pos.getY() + 0.55D - (double)(rand.nextFloat() * 0.1F);
    double d2 = (double)pos.getZ() + 0.55D - (double)(rand.nextFloat() * 0.1F);
    double d3 = (double)(0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F);

    if (rand.nextInt(5) == 0)
    {
        worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double)enumfacing.getFrontOffsetX() * d3, d1 + (double)enumfacing.getFrontOffsetY() * d3, d2 + (double)enumfacing.getFrontOffsetZ() * d3, rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, new int[0]);
    }
}
 
Example 15
Project: BaseClient   File: BlockLiquid.java   Source Code and License Vote up 5 votes
protected void triggerMixEffects(World worldIn, BlockPos pos) {
	double d0 = (double) pos.getX();
	double d1 = (double) pos.getY();
	double d2 = (double) pos.getZ();
	worldIn.playSoundEffect(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F,
			2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

	for (int i = 0; i < 8; ++i) {
		worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(),
				0.0D, 0.0D, 0.0D, new int[0]);
	}
}
 
Example 16
Project: Backmemed   File: BlockSponge.java   Source Code and License Vote up 4 votes
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (((Boolean)stateIn.getValue(WET)).booleanValue())
    {
        EnumFacing enumfacing = EnumFacing.random(rand);

        if (enumfacing != EnumFacing.UP && !worldIn.getBlockState(pos.offset(enumfacing)).isFullyOpaque())
        {
            double d0 = (double)pos.getX();
            double d1 = (double)pos.getY();
            double d2 = (double)pos.getZ();

            if (enumfacing == EnumFacing.DOWN)
            {
                d1 = d1 - 0.05D;
                d0 += rand.nextDouble();
                d2 += rand.nextDouble();
            }
            else
            {
                d1 = d1 + rand.nextDouble() * 0.8D;

                if (enumfacing.getAxis() == EnumFacing.Axis.X)
                {
                    d2 += rand.nextDouble();

                    if (enumfacing == EnumFacing.EAST)
                    {
                        ++d0;
                    }
                    else
                    {
                        d0 += 0.05D;
                    }
                }
                else
                {
                    d0 += rand.nextDouble();

                    if (enumfacing == EnumFacing.SOUTH)
                    {
                        ++d2;
                    }
                    else
                    {
                        d2 += 0.05D;
                    }
                }
            }

            worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }
}
 
Example 17
Project: Mods   File: ItemFlameThrower.java   Source Code and License Vote up 4 votes
@Override
public boolean fireTick(ItemStack stack, EntityLivingBase living, World world) {
	if (world.isRemote && living.getCapability(TF2weapons.WEAPONS_CAP, null).fire1Cool <= 50
			&& this.canFire(world, living, stack)) {
		if (living.getCapability(TF2weapons.WEAPONS_CAP, null).startedPress()) {
			SoundEvent playSound = ItemFromData.getSound(stack, PropertyType.FIRE_START_SOUND);
			ClientProxy.playWeaponSound(living, playSound, false, 2, stack);
		}
		if (living.isInsideOfMaterial(Material.WATER))
			world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, living.posX,
					living.posY + living.getEyeHeight() - 0.1, living.posZ, living.motionX, 0.2D + living.motionY,
					living.motionZ, new int[0]);
		else {
			ClientProxy.spawnFlameParticle(world, living, 0f, false);
			ClientProxy.spawnFlameParticle(world, living, 0.5f, false);
		}
		// System.out.println("to:
		// "+ClientProxy.fireSounds.containsKey(living));
		/*
		 * if(ClientProxy.fireSounds.containsKey(living)){
		 * System.out.println("to2: "+Minecraft.getMinecraft().
		 * getSoundHandler().isSoundPlaying(ClientProxy.fireSounds.get(
		 * living))+" "+ClientProxy.fireSounds.get(living).type); }
		 */
		if (TF2Util.calculateCritPre(stack, living) != 2 && (!ClientProxy.fireSounds
				.containsKey(living)
				|| !Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(ClientProxy.fireSounds.get(living))
				|| (ClientProxy.fireSounds.get(living).type != 0 && ClientProxy.fireSounds.get(living).type != 2)))
			ClientProxy.playWeaponSound(living, ItemFromData.getSound(stack, PropertyType.FIRE_LOOP_SOUND), true, 0,
					stack);
		else if (TF2Util.calculateCritPre(stack, living) == 2
				&& (!ClientProxy.fireSounds.containsKey(living)
						|| !Minecraft.getMinecraft().getSoundHandler()
								.isSoundPlaying(ClientProxy.fireSounds.get(living))
						|| (ClientProxy.fireSounds.get(living).type != 1))) {
			ResourceLocation playSoundCrit = new ResourceLocation(
					ItemFromData.getData(stack).getString(PropertyType.FIRE_LOOP_SOUND) + ".crit");

			ClientProxy.playWeaponSound(living, SoundEvent.REGISTRY.getObject(playSoundCrit), true, 1, stack);
		}
	}
	// System.out.println("nie");
	return false;
}
 
Example 18
Project: BaseClient   File: BlockPumpkin.java   Source Code and License Vote up 4 votes
private void trySpawnGolem(World worldIn, BlockPos pos)
{
    BlockPattern.PatternHelper blockpattern$patternhelper;

    if ((blockpattern$patternhelper = this.getSnowmanPattern().match(worldIn, pos)) != null)
    {
        for (int i = 0; i < this.getSnowmanPattern().getThumbLength(); ++i)
        {
            BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(0, i, 0);
            worldIn.setBlockState(blockworldstate.getPos(), Blocks.air.getDefaultState(), 2);
        }

        EntitySnowman entitysnowman = new EntitySnowman(worldIn);
        BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(0, 2, 0).getPos();
        entitysnowman.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.05D, (double)blockpos1.getZ() + 0.5D, 0.0F, 0.0F);
        worldIn.spawnEntityInWorld(entitysnowman);

        for (int j = 0; j < 120; ++j)
        {
            worldIn.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, (double)blockpos1.getX() + worldIn.rand.nextDouble(), (double)blockpos1.getY() + worldIn.rand.nextDouble() * 2.5D, (double)blockpos1.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
        }

        for (int i1 = 0; i1 < this.getSnowmanPattern().getThumbLength(); ++i1)
        {
            BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(0, i1, 0);
            worldIn.notifyNeighborsRespectDebug(blockworldstate1.getPos(), Blocks.air);
        }
    }
    else if ((blockpattern$patternhelper = this.getGolemPattern().match(worldIn, pos)) != null)
    {
        for (int k = 0; k < this.getGolemPattern().getPalmLength(); ++k)
        {
            for (int l = 0; l < this.getGolemPattern().getThumbLength(); ++l)
            {
                worldIn.setBlockState(blockpattern$patternhelper.translateOffset(k, l, 0).getPos(), Blocks.air.getDefaultState(), 2);
            }
        }

        BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
        EntityIronGolem entityirongolem = new EntityIronGolem(worldIn);
        entityirongolem.setPlayerCreated(true);
        entityirongolem.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.05D, (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
        worldIn.spawnEntityInWorld(entityirongolem);

        for (int j1 = 0; j1 < 120; ++j1)
        {
            worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)blockpos.getY() + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
        }

        for (int k1 = 0; k1 < this.getGolemPattern().getPalmLength(); ++k1)
        {
            for (int l1 = 0; l1 < this.getGolemPattern().getThumbLength(); ++l1)
            {
                BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(k1, l1, 0);
                worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air);
            }
        }
    }
}
 
Example 19
Project: CustomWorldGen   File: BlockPumpkin.java   Source Code and License Vote up 4 votes
private void trySpawnGolem(World worldIn, BlockPos pos)
{
    BlockPattern.PatternHelper blockpattern$patternhelper = this.getSnowmanPattern().match(worldIn, pos);

    if (blockpattern$patternhelper != null)
    {
        for (int i = 0; i < this.getSnowmanPattern().getThumbLength(); ++i)
        {
            BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(0, i, 0);
            worldIn.setBlockState(blockworldstate.getPos(), Blocks.AIR.getDefaultState(), 2);
        }

        EntitySnowman entitysnowman = new EntitySnowman(worldIn);
        BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(0, 2, 0).getPos();
        entitysnowman.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.05D, (double)blockpos1.getZ() + 0.5D, 0.0F, 0.0F);
        worldIn.spawnEntityInWorld(entitysnowman);

        for (int j = 0; j < 120; ++j)
        {
            worldIn.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, (double)blockpos1.getX() + worldIn.rand.nextDouble(), (double)blockpos1.getY() + worldIn.rand.nextDouble() * 2.5D, (double)blockpos1.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
        }

        for (int i1 = 0; i1 < this.getSnowmanPattern().getThumbLength(); ++i1)
        {
            BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(0, i1, 0);
            worldIn.notifyNeighborsRespectDebug(blockworldstate1.getPos(), Blocks.AIR);
        }
    }
    else
    {
        blockpattern$patternhelper = this.getGolemPattern().match(worldIn, pos);

        if (blockpattern$patternhelper != null)
        {
            for (int k = 0; k < this.getGolemPattern().getPalmLength(); ++k)
            {
                for (int l = 0; l < this.getGolemPattern().getThumbLength(); ++l)
                {
                    worldIn.setBlockState(blockpattern$patternhelper.translateOffset(k, l, 0).getPos(), Blocks.AIR.getDefaultState(), 2);
                }
            }

            BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
            EntityIronGolem entityirongolem = new EntityIronGolem(worldIn);
            entityirongolem.setPlayerCreated(true);
            entityirongolem.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.05D, (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
            worldIn.spawnEntityInWorld(entityirongolem);

            for (int j1 = 0; j1 < 120; ++j1)
            {
                worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)blockpos.getY() + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
            }

            for (int k1 = 0; k1 < this.getGolemPattern().getPalmLength(); ++k1)
            {
                for (int l1 = 0; l1 < this.getGolemPattern().getThumbLength(); ++l1)
                {
                    BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(k1, l1, 0);
                    worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.AIR);
                }
            }
        }
    }
}