net.minecraft.particle.ParticleTypes Java Examples

The following examples show how to use net.minecraft.particle.ParticleTypes. 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: WitchWaterBubbleColumnBlock.java    From the-hallow with MIT License 7 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
	BlockState state2 = world.getBlockState(pos.up());
	if (state2.isAir()) {
		entity.onBubbleColumnSurfaceCollision(state.get(DRAG));
		if (!world.isClient) {
			ServerWorld serverworld = (ServerWorld) world;
			
			for (int i = 0; i < 2; i++) {
				serverworld.spawnParticles(ParticleTypes.SPLASH, (float) pos.getX() + world.random.nextFloat(), pos.getY() + 1, (float) pos.getZ() + world.random.nextFloat(), 1, 0.0D, 0.0D, 0.0D, 1.0D);
				serverworld.spawnParticles(ParticleTypes.BUBBLE, (float) pos.getX() + world.random.nextFloat(), pos.getY() + 1, (float) pos.getZ() + world.random.nextFloat(), 1, 0.0D, 0.01D, 0.0D, 0.2D);
			}
		}
	} else {
		entity.onBubbleColumnCollision(state.get(DRAG));
	}
}
 
Example #2
Source File: PlayerSeaponyRenderer.java    From MineLittlePony with MIT License 6 votes vote down vote up
@Override
public IPony getEntityPony(AbstractClientPlayerEntity player) {
    IPony pony = super.getEntityPony(player);

    boolean wet = pony.isPartiallySubmerged(player);

    model = manager.setModel(wet ? seapony : normalPony).getBody();

    float state = wet ? 100 : 0;
    float interpolated = pony.getMetadata().getInterpolator(player.getUuid()).interpolate("seapony_state", state, 5);

    if (!MathUtil.compareFloats(interpolated, state)) {
        double x = player.getX() + (player.getEntityWorld().getRandom().nextFloat() * 2) - 1;
        double y = player.getY() + (player.getEntityWorld().getRandom().nextFloat() * 2);
        double z = player.getZ() + (player.getEntityWorld().getRandom().nextFloat() * 2) - 1;

        player.getEntityWorld().addParticle(ParticleTypes.END_ROD, x, y, z, 0, 0, 0);
    }

    return pony;
}
 
Example #3
Source File: Criticals.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void sendPacket(EventSendPacket event) {
    if (event.getPacket() instanceof PlayerInteractEntityC2SPacket) {
        PlayerInteractEntityC2SPacket packet = (PlayerInteractEntityC2SPacket) event.getPacket();
        if (packet.getType() == PlayerInteractEntityC2SPacket.InteractionType.ATTACK) {
        	this.doCritical();
        	
        	/* Lets fake some extra paricles to make the player feel good */
        	Entity e = packet.getEntity(mc.world);
        	Random r = new Random();
            for (int i = 0; i < 10; i++) {
            	mc.particleManager.addParticle(ParticleTypes.CRIT, e.getX(), e.getY() + e.getHeight() / 2, e.getZ(),
            			r.nextDouble() - 0.5, r.nextDouble() - 0.5, r.nextDouble() - 0.5);
            }
        }
    }
}
 
Example #4
Source File: Criticals.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void sendPacket(EventSendPacket event) {
    if (event.getPacket() instanceof PlayerInteractEntityC2SPacket) {
        PlayerInteractEntityC2SPacket packet = (PlayerInteractEntityC2SPacket) event.getPacket();
        if (packet.getType() == PlayerInteractEntityC2SPacket.InteractionType.ATTACK) {
        	this.doCritical();
        	
        	/* Lets fake some extra paricles to make the player feel good */
        	Entity e = packet.getEntity(mc.world);
        	Random r = new Random();
            for (int i = 0; i < 10; i++) {
            	mc.particleManager.addParticle(ParticleTypes.CRIT, e.getX(), e.getY() + e.getHeight() / 2, e.getZ(),
            			r.nextDouble() - 0.5, r.nextDouble() - 0.5, r.nextDouble() - 0.5);
            }
        }
    }
}
 
Example #5
Source File: Criticals.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void sendPacket(EventSendPacket event) {
    if (event.getPacket() instanceof PlayerInteractEntityC2SPacket) {
        PlayerInteractEntityC2SPacket packet = (PlayerInteractEntityC2SPacket) event.getPacket();
        if (packet.getType() == PlayerInteractEntityC2SPacket.InteractionType.ATTACK) {
        	this.doCritical();
        	
        	/* Lets fake some extra paricles to make the player feel good */
        	Entity e = packet.getEntity(mc.world);
        	Random r = new Random();
            for (int i = 0; i < 10; i++) {
            	mc.particleManager.addParticle(ParticleTypes.CRIT, e.x, e.y + e.getHeight() / 2, e.z,
            			r.nextDouble() - 0.5, r.nextDouble() - 0.5, r.nextDouble() - 0.5);
            }
        }
    }
}
 
Example #6
Source File: WitchWaterBubbleColumnBlock.java    From the-hallow with MIT License 6 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
	double x = pos.getX();
	double y = pos.getY();
	double z = pos.getZ();
	if (state.get(DRAG)) {
		world.addImportantParticle(ParticleTypes.CURRENT_DOWN, x + 0.5D, y + 0.8D, z, 0.0D, 0.0D, 0.0D);
		if (rand.nextInt(200) == 0) {
			world.playSound(x, y, z, SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
		}
	} else {
		world.addImportantParticle(ParticleTypes.BUBBLE_COLUMN_UP, x + 0.5D, y, z + 0.5D, 0.0D, 0.04D, 0.0D);
		world.addImportantParticle(ParticleTypes.BUBBLE_COLUMN_UP, x + (double) rand.nextFloat(), y + (double) rand.nextFloat(), z + (double) rand.nextFloat(), 0.0D, 0.04D, 0.0D);
		if (rand.nextInt(200) == 0) {
			world.playSound(x, y, z, SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
		}
	}
}
 
Example #7
Source File: WitchWaterFluid.java    From the-hallow with MIT License 6 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(World world, BlockPos blockPos, FluidState fluidState, Random random) {
	if (random.nextInt(10) == 0) {
		world.addParticle(ParticleTypes.BUBBLE_POP,
			(double) blockPos.getX() + 0.5D + (random.nextFloat() - 0.5F),
			(double) blockPos.getY() + (fluidState.getHeight(world, blockPos) * (1F / 7F)) + 1F,
			(double) blockPos.getZ() + 0.5D + (random.nextFloat() - 0.5F),
			0.0D, 0.0D, 0.0D
		);
	}
	
	if (random.nextInt(15) == 0) {
		world.addParticle(ParticleTypes.BUBBLE,
			(double) blockPos.getX() + 0.5D + (random.nextFloat() - 0.5F),
			(double) blockPos.getY() + (fluidState.getHeight(world, blockPos) * (1F / 7F)) + 1F,
			(double) blockPos.getZ() + 0.5D + (random.nextFloat() - 0.5F),
			0.0D, 0.0D, 0.0D
		);
	}
}
 
Example #8
Source File: HallowedTreasureChestEntity.java    From the-hallow with MIT License 6 votes vote down vote up
private void spawnDeathParticles() {
	ParticleEffect particle = ParticleTypes.WITCH;
	double velX = 0;
	double velY = 1;
	double velZ = 0;
	
	double startX = getX() - .275f;
	double startY = getY();
	double startZ = getZ() - .275f;
	
	for (int i = 0; i < 10; i++) {
		double frontX = .5f * random.nextDouble();
		world.addParticle(particle, startX + frontX, startY + random.nextDouble() * .5, startZ + .5f, velX, velY, velZ);
		
		double backX = .5f * random.nextDouble();
		world.addParticle(particle, startX + backX, startY + random.nextDouble() * .5, startZ, velX, velY, velZ);
		
		double leftZ = .5f * random.nextDouble();
		world.addParticle(particle, startX, startY + random.nextDouble() * .5, startZ + leftZ, velX, velY, velZ);
		
		double rightZ = .5f * random.nextDouble();
		world.addParticle(particle, startX + .5f, startY + random.nextDouble() * .5, startZ + rightZ, velX, velY, velZ);
	}
}
 
Example #9
Source File: CoalGeneratorBlock.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
@Environment(EnvType.CLIENT)
@Override
public void randomDisplayTick(BlockState state, World world, BlockPos blockPos_1, Random rand) {
    if (world.getBlockEntity(blockPos_1) instanceof CoalGeneratorBlockEntity && ((CoalGeneratorBlockEntity) world.getBlockEntity(blockPos_1)).status == CoalGeneratorBlockEntity.CoalGeneratorStatus.ACTIVE || ((CoalGeneratorBlockEntity) world.getBlockEntity(blockPos_1)).status == CoalGeneratorBlockEntity.CoalGeneratorStatus.WARMING) {
        double x = (double) blockPos_1.getX() + 0.5D;
        double y = blockPos_1.getY();
        double z = (double) blockPos_1.getZ() + 0.5D;
        if (rand.nextDouble() < 0.1D) {
            world.playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
        }

        Direction direction_1 = state.get(FACING);
        Direction.Axis direction$Axis_1 = direction_1.getAxis();
        double d = rand.nextDouble() * 0.6D - 0.3D;
        double xo = direction$Axis_1 == Direction.Axis.X ? (double) direction_1.getOffsetX() * 0.52D : d;
        double yo = rand.nextDouble() * 6.0D / 16.0D;
        double zo = direction$Axis_1 == Direction.Axis.Z ? (double) direction_1.getOffsetZ() * 0.52D : d;
        world.addParticle(ParticleTypes.SMOKE, x + xo, y + yo, z + zo, 0.0D, 0.0D, 0.0D);
        world.addParticle(ParticleTypes.FLAME, x + xo, y + yo, z + zo, 0.0D, 0.0D, 0.0D);

    }
}
 
Example #10
Source File: VillagerEntity_aiMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Inject(method = "summonGolem", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/util/math/Box;expand(DDD)Lnet/minecraft/util/math/Box;",
        shift = At.Shift.AFTER
))
private void particleIt(long long_1, int int_1, CallbackInfo ci)
{
    if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING))
    {
        ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, getX(), getY()+3, getZ(), 1, 0.1, 0.1, 0.1, 0.0);
    }
}
 
Example #11
Source File: HallowCharmItem.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
public void usageTick(World world, LivingEntity user, ItemStack stack, int ticksLeft) {
	Random random = new Random();
	BlockPos pos = user.getBlockPos();
	double x = pos.getX() + random.nextFloat();
	double y = pos.getY() + random.nextFloat();
	double z = pos.getZ() + random.nextFloat();
	double velX = (random.nextFloat() - 0.5D) * 0.5D;
	double velY = (random.nextFloat() - 0.5D) * 0.5D;
	double velZ = (random.nextFloat() - 0.5D) * 0.5D;
	world.addParticle(ParticleTypes.PORTAL, x, y, z, velX, velY, velZ);
}
 
Example #12
Source File: BleedingBlock.java    From the-hallow with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos1, Random rand) {
	BlockPos pos2 = pos1.up();
	if (world.getFluidState(pos1).matches(HallowedTags.Fluids.WITCH_WATER)) {
		world.playSound(null, pos1, SoundEvents.ENTITY_DROWNED_HURT_WATER, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
		world.spawnParticles(ParticleTypes.CURRENT_DOWN, (double) pos2.getX() + 0.5D, (double) pos2.getY() + 0.25D, (double) pos2.getZ() + 0.5D, 8, 0.5D, 0.25D, 0.5D, 0.0D);
	}
}
 
Example #13
Source File: ScorchedRockBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
    double x = (double) pos.getX() + random.nextDouble() * 0.10000000149011612D;
    double y = (double) pos.getY() + random.nextDouble();
    double z = (double) pos.getZ() + random.nextDouble();

    world.addParticle(ParticleTypes.LARGE_SMOKE, x, y, z, 0.0D, 0.0D, 0.0D);
}
 
Example #14
Source File: TorchBlockMixin.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
@Deprecated
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean moved) {
    super.onBlockAdded(state, world, pos, oldState, moved);
    if (CelestialBodyType.getByDimType(world.getRegistryKey()).isPresent() && !CelestialBodyType.getByDimType(world.getRegistryKey()).get().getAtmosphere().getComposition().containsKey(AtmosphericGas.OXYGEN)) {
        if (state.getBlock() == Blocks.TORCH) {
            world.setBlockState(pos, GalacticraftBlocks.UNLIT_TORCH.getDefaultState());
        } else if (state.getBlock() == Blocks.WALL_TORCH) {
            world.setBlockState(pos, GalacticraftBlocks.UNLIT_WALL_TORCH.getDefaultState().with(WallTorchBlock.FACING, state.get(WallTorchBlock.FACING)));
        }
        world.addParticle(ParticleTypes.SMOKE, pos.getX(), pos.getY(), pos.getZ(), 0.0D, 0.0D, 0.0D);
        world.playSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, SoundCategory.BLOCKS, 1.0F, 0.9F, false);
    }
}
 
Example #15
Source File: LivingEntityMixin.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Inject(method = "baseTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;tickStatusEffects()V", shift = At.Shift.BEFORE))
private void doOxygenChecks(CallbackInfo ci) {
    LivingEntity entity = (LivingEntity) (Object) this;
    //noinspection ConstantConditions
    if (this.isAlive() && !(entity instanceof PlayerEntity && ((PlayerEntity) entity).abilities.invulnerable)) {
        if (CelestialBodyType.getByDimType(world.getRegistryKey()).isPresent() && !CelestialBodyType.getByDimType(world.getRegistryKey()).get().getAtmosphere().getComposition().containsKey(AtmosphericGas.OXYGEN)) {
            updateAir(this);
        } else {
            if (this.isSubmergedIn(FluidTags.WATER) && this.world.getBlockState(new BlockPos(this.getX(), this.getEyeY(), this.getZ())).getBlock() != Blocks.BUBBLE_COLUMN) {
                if (!this.canBreatheInWater() && !StatusEffectUtil.hasWaterBreathing((LivingEntity) (Object) this) && !isInvulnerableTo(DamageSource.DROWN)) {
                    this.setAir(this.getNextAirUnderwater(this.getAir()));
                }
            }
        }

        if (this.getAir() == -20) {
            this.setAir(0);

            if (this.isSubmergedIn(FluidTags.WATER) && this.world.getBlockState(new BlockPos(this.getX(), this.getEyeY(), this.getZ())).getBlock() != Blocks.BUBBLE_COLUMN) {
                if (!this.canBreatheInWater() && !StatusEffectUtil.hasWaterBreathing((LivingEntity) (Object) this) && !isInvulnerableTo(DamageSource.DROWN)) {
                    Vec3d vec3d = this.getVelocity();

                    for (int i = 0; i < 8; ++i) {
                        float f = this.random.nextFloat() - this.random.nextFloat();
                        float g = this.random.nextFloat() - this.random.nextFloat();
                        float h = this.random.nextFloat() - this.random.nextFloat();
                        this.world.addParticle(ParticleTypes.BUBBLE, this.getX() + (double) f, this.getY() + (double) g, this.getZ() + (double) h, vec3d.x, vec3d.y, vec3d.z);
                    }
                }
            }

            this.damage(GalacticraftDamageSource.SUFFOCATION, 2.0F);
        }
    }
}
 
Example #16
Source File: Protocol_1_15_2.java    From multiconnect with MIT License 5 votes vote down vote up
private void mutateParticleTypeRegistry(ISimpleRegistry<ParticleType<?>> registry) {
    registry.unregister(ParticleTypes.ASH);
    registry.unregister(ParticleTypes.CRIMSON_SPORE);
    registry.unregister(ParticleTypes.SOUL_FIRE_FLAME);
    registry.unregister(ParticleTypes.SOUL);
    registry.unregister(ParticleTypes.WARPED_SPORE);
    registry.unregister(ParticleTypes.DRIPPING_OBSIDIAN_TEAR);
    registry.unregister(ParticleTypes.FALLING_OBSIDIAN_TEAR);
    registry.unregister(ParticleTypes.LANDING_OBSIDIAN_TEAR);
    registry.unregister(ParticleTypes.REVERSE_PORTAL);
    registry.unregister(ParticleTypes.WHITE_ASH);
}
 
Example #17
Source File: Protocol_1_13_2.java    From multiconnect with MIT License 5 votes vote down vote up
private void mutateParticleTypeRegistry(ISimpleRegistry<ParticleType<?>> registry) {
    registry.unregister(ParticleTypes.FALLING_LAVA);
    registry.unregister(ParticleTypes.LANDING_LAVA);
    registry.unregister(ParticleTypes.FALLING_WATER);
    registry.unregister(ParticleTypes.FLASH);
    registry.unregister(ParticleTypes.COMPOSTER);
    registry.unregister(ParticleTypes.CAMPFIRE_COSY_SMOKE);
    registry.unregister(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE);
    registry.unregister(ParticleTypes.SNEEZE);
}
 
Example #18
Source File: MixinMooshroomEntity.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public List<ItemStack> onSheared(ItemStack item, IWorld world, BlockPos pos, int fortune) {
	List<ItemStack> drops = new ArrayList<>();
	this.world.addParticle(ParticleTypes.EXPLOSION, this.x, this.y + (double) (this.getHeight() / 2.0F), this.z, 0.0D, 0.0D, 0.0D);

	if (!this.world.isClient) {
		this.remove();

		CowEntity cow = EntityType.COW.create(this.world);
		cow.refreshPositionAndAngles(this.x, this.y, this.z, this.yaw, this.pitch);
		cow.setHealth(this.getHealth());
		cow.field_6283 = this.field_6283;

		if (this.hasCustomName()) {
			cow.setCustomName(this.getCustomName());
		}

		this.world.spawnEntity(cow);
		Block mushroom = this.getMooshroomType().getMushroomState().getBlock();

		// TODO: Fixes forge bug where shearing brown mooshrooms always drop red mushrooms (Fixed in 1.15)
		for (int i = 0; i < 5; ++i) {
			drops.add(new ItemStack(mushroom));
		}

		this.playSound(SoundEvents.ENTITY_MOOSHROOM_SHEAR, 1.0F, 1.0F);
	}

	return drops;
}
 
Example #19
Source File: VaporSpoutBlock.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
public void spawnSmokeParticle(World world_1, BlockPos blockPos_1) {
    Random random_1 = world_1.getRandom();
    world_1.addImportantParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE, true, (double) blockPos_1.getX() + 0.5D + random_1.nextDouble() / 3.0D * (double) (random_1.nextBoolean() ? 1 : -1), (double) blockPos_1.getY() + random_1.nextDouble() + random_1.nextDouble(), (double) blockPos_1.getZ() + 0.5D + random_1.nextDouble() / 3.0D * (double) (random_1.nextBoolean() ? 1 : -1), 0.0D, 0.07D, 0.0D);
}
 
Example #20
Source File: HallowedTreasureChestEntity.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public void tick() {
	if (shouldReplace && !hasReplaced) {
		world.setBlockState(getBlockPos(), Blocks.AIR.getDefaultState(), 3);
		hasReplaced = true;
	}
	
	if (isSpinningUp) {
		spinProgress++;
		
		previousRotation = rotation;
		rotation += ROTATION_PER_TICK;
		this.move(MovementType.SELF, new Vec3d(0, 0.01f, 0));
		
		if (spinProgress >= MAX_SPIN_PROGRESS) {
			isSpinningUp = false;
			isEnding = true;
		}
	}
	
	
	// stationary pause + wiggle after spin
	if (isEnding) {
		endProgress++;
		
		if (endProgress >= MAX_END_PROGRESS) {
			isEnding = false;
			isOpeningHinge = true;
		}
	}
	
	// hinge opening
	if (isOpeningHinge) {
		hingeProgress++;
		
		if (hingeProgress >= MAX_HINGE_PROGRESS * .8) {
			spawnDeathParticles();
		}
		
		if (hingeProgress >= MAX_HINGE_PROGRESS) {
			this.kill();
			
			if (!world.isClient) {
				dropLoot((ServerWorld) world);
			}
		}
	}
	
	// particles to ground
	world.addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), 0, -.1, 0);
}
 
Example #21
Source File: VillagerEntity_aiMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
private void onInteract(PlayerEntity playerEntity_1, Hand hand_1, CallbackInfoReturnable<Boolean> cir)
{
    if (MobAI.isTracking(this, MobAI.TrackingType.VILLAGER_BREEDING))
    {
        ItemStack itemStack_1 = playerEntity_1.getStackInHand(hand_1);
        if (itemStack_1.getItem() == Items.EMERALD)
        {
            GlobalPos bedPos = this.brain.getOptionalMemory(MemoryModuleType.HOME).orElse(null);
            if (bedPos == null || bedPos.getDimension() != dimension)
            {
                sayNo();
                ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, getX(), getY() + getStandingEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0);
            }
            else
            {

                ParticleDisplay.drawParticleLine((ServerPlayerEntity) playerEntity_1, getPos(), new Vec3d(bedPos.getPos()).add(0.5, 0.5, 0.5), "dust 0 0 0 1", "happy_villager", 100, 0.2);
            }
        }
        else if (itemStack_1.getItem() == Items.ROTTEN_FLESH)
        {
            while(getAvailableFood() >= 12) eatForBreeding();

        }
        else if (itemStack_1.getItem() instanceof BedItem)
        {
            List<PointOfInterest> list_1 = ((ServerWorld) getEntityWorld()).getPointOfInterestStorage().get(
                    type -> type == PointOfInterestType.HOME,
                    getBlockPos(),
                    48, PointOfInterestStorage.OccupationStatus.ANY).collect(Collectors.toList());
            for (PointOfInterest poi : list_1)
            {
                Vec3d pv = new Vec3d(poi.getPos()).add(0.5, 0.5, 0.5);
                if (!poi.hasSpace())
                {
                    ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.HAPPY_VILLAGER,
                            pv.x, pv.y+1.5, pv.z,
                            50, 0.1, 0.3, 0.1, 0.0);
                }
                else if (canReachHome((VillagerEntity)(Object)this, poi.getPos()))
                    ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.END_ROD,
                            pv.x, pv.y+1, pv.z,
                            50, 0.1, 0.3, 0.1, 0.0);
                else
                    ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER,
                            pv.x, pv.y+1, pv.z,
                            1, 0.1, 0.1, 0.1, 0.0);
            }
        }
        cir.setReturnValue(false);
        cir.cancel();
    }
}
 
Example #22
Source File: Protocol_1_14_4.java    From multiconnect with MIT License 4 votes vote down vote up
private void mutateParticleTypeRegistry(ISimpleRegistry<ParticleType<?>> registry) {
    registry.unregister(ParticleTypes.DRIPPING_HONEY);
    registry.unregister(ParticleTypes.FALLING_HONEY);
    registry.unregister(ParticleTypes.LANDING_HONEY);
    registry.unregister(ParticleTypes.FALLING_NECTAR);
}
 
Example #23
Source File: Protocol_1_10.java    From multiconnect with MIT License 4 votes vote down vote up
private void mutateParticleTypeRegistry(ISimpleRegistry<ParticleType<?>> registry) {
    registry.purge(ParticleTypes.SPIT);
    registry.purge(ParticleTypes.TOTEM_OF_UNDYING);
}
 
Example #24
Source File: InfusionAltarBlock.java    From the-hallow with MIT License 4 votes vote down vote up
public void createParticles(InfusionAltarBlockEntity altarEntity) {
	altarEntity.linkedPillars.forEach((pos, entity) -> {
		altarEntity.getWorld().addParticle(ParticleTypes.EXPLOSION, entity.getPos().getX(), entity.getPos().getY(), entity.getPos().getZ(), 0.0D, 0.0D, 0.0D);
	});
}
 
Example #25
Source File: EatBreadcrumbsGoal.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public void tick() {
	super.tick();
	World world = this.stepAndDestroyMob.world;
	BlockPos blockPos = new BlockPos(this.stepAndDestroyMob);
	BlockPos blockPos2 = this.tweakToProperPos(blockPos, world);
	Random random = this.stepAndDestroyMob.getRandom();
	if (this.hasReached() && blockPos2 != null) {
		Vec3d vec3d2;
		double double2;
		if (this.counter > 0) {
			vec3d2 = this.stepAndDestroyMob.getVelocity();
			this.stepAndDestroyMob.setVelocity(vec3d2.x, 0.3D, vec3d2.z);
			if (!world.isClient) {
				double2 = 0.08D;
				((ServerWorld) world).spawnParticles(new ItemStackParticleEffect(ParticleTypes.ITEM, new ItemStack(HallowedBlocks.BREAD_CRUMBS)), (double) blockPos2.getX() + 0.5D, (double) blockPos2.getY() + 0.7D, (double) blockPos2.getZ() + 0.5D, 3, ((double) random.nextFloat() - 0.5D) * 0.08D, ((double) random.nextFloat() - 0.5D) * 0.08D, ((double) random.nextFloat() - 0.5D) * 0.08D, 0.15000000596046448D);
			}
		}
		
		if (this.counter % 2 == 0) {
			vec3d2 = this.stepAndDestroyMob.getVelocity();
			this.stepAndDestroyMob.setVelocity(vec3d2.x, -0.3D, vec3d2.z);
			if (this.counter % 6 == 0) {
				this.tickStepping(world, this.targetPos);
			}
		}
		
		if (this.counter > 60) {
			world.removeBlock(blockPos2, false);
			if (!world.isClient) {
				for (int i = 0; i < 20; ++i) {
					double2 = random.nextGaussian() * 0.02D;
					double double3 = random.nextGaussian() * 0.02D;
					double double4 = random.nextGaussian() * 0.02D;
					((ServerWorld) world).spawnParticles(ParticleTypes.POOF, (double) blockPos2.getX() + 0.5D, blockPos2.getY(), (double) blockPos2.getZ() + 0.5D, 1, double2, double3, double4, 0.15000000596046448D);
				}
				
				this.onDestroyBlock(world, blockPos2);
			}
		}
		
		++this.counter;
	}
	
}
 
Example #26
Source File: BloodFluid.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public ParticleEffect getParticle() {
	return ParticleTypes.DRIPPING_WATER;
}
 
Example #27
Source File: PumpcownEntity.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public boolean interactMob(PlayerEntity player, Hand hand) {
	ItemStack stack = player.getStackInHand(hand);
	if (stack.getItem() == Items.SHEARS && this.getBreedingAge() >= 0) {
		this.world.addParticle(ParticleTypes.EXPLOSION, this.getX(), this.getY() + (double) (this.getHeight() / 2.0F), this.getZ(), 0.0D, 0.0D, 0.0D);
		if (!this.world.isClient) {
			this.remove();
			
			if (this.world.getDimension().getType() == HallowedDimensions.THE_HALLOW) {
				this.world.createExplosion(this, this.getX(), this.getY(), this.getZ(), 3.0F, Explosion.DestructionType.BREAK);
			} else {
				CowEntity cow = EntityType.COW.create(this.world);
				cow.updatePositionAndAngles(this.getX(), this.getY(), this.getZ(), this.yaw, this.pitch);
				cow.setHealth(this.getHealth());
				cow.bodyYaw = this.bodyYaw;
				if (this.hasCustomName()) {
					cow.setCustomName(this.getCustomName());
				}
				this.world.spawnEntity(cow);
			}
			
			for (int i = 0; i < 5; ++i) {
				this.world.spawnEntity(new ItemEntity(this.world, this.getX(), this.getY() + (double) this.getHeight(), this.getZ(), new ItemStack(STEM_FEATURE.getBlock())));
			}
			
			stack.damage(1, player, ((player_1) -> {
				player_1.sendToolBreakStatus(hand);
			}));
			this.playSound(SoundEvents.ENTITY_MOOSHROOM_SHEAR, 1.0F, 1.0F);
		}
		return true;
	} else if (stack.getItem() == Items.BOWL && this.getBreedingAge() >= 0 && !player.abilities.creativeMode) {
		stack.decrement(1);
		ItemStack stew = new ItemStack(HallowedItems.PUMPKIN_STEW);
		
		if (stack.isEmpty()) {
			player.setStackInHand(hand, stew);
		} else if (!player.inventory.insertStack(stew)) {
			player.dropItem(stew, false);
		}
		
		this.playSound(SoundEvents.ENTITY_MOOSHROOM_MILK, 1.0F, 1.0F);
		
		return true;
	} else {
		return super.interactMob(player, hand);
	}
}
 
Example #28
Source File: WitchWaterFluid.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public ParticleEffect getParticle() {
	return ParticleTypes.DRIPPING_WATER;
}