use of com.minecolonies.coremod.network.messages.client.VanillaParticleMessage in project minecolonies by ldtteam.
the class ItemScrollBuff method onItemUseSuccess.
@Override
protected ItemStack onItemUseSuccess(final ItemStack itemStack, final World world, final ServerPlayerEntity player) {
if (world.random.nextInt(8) > 0) {
for (final LivingEntity entity : world.getLoadedEntitiesOfClass(EntityCitizen.class, player.getBoundingBox().inflate(15, 2, 15))) {
addRegenerationWithParticles(entity);
}
addRegenerationWithParticles(player);
// Send to player additionally, as players do not track themselves
Network.getNetwork().sendToPlayer(new VanillaParticleMessage(player.getX(), player.getY(), player.getZ(), ParticleTypes.HEART), player);
SoundUtils.playSoundForPlayer(player, SoundEvents.PLAYER_LEVELUP, 0.2f, 1.0f);
} else {
player.displayClientMessage(new TranslationTextComponent("minecolonies.scroll.failed" + (world.random.nextInt(FAIL_RESPONSES_TOTAL) + 1)).setStyle(Style.EMPTY.withColor(TextFormatting.GOLD)), true);
player.addEffect(new EffectInstance(Effects.BLINDNESS, TICKS_SECOND * 10));
SoundUtils.playSoundForPlayer(player, SoundEvents.TOTEM_USE, 0.04f, 1.0f);
}
itemStack.shrink(1);
return itemStack;
}
use of com.minecolonies.coremod.network.messages.client.VanillaParticleMessage in project minecolonies by ldtteam.
the class ItemScrollGuardHelp method onUseTick.
@Override
public void onUseTick(World worldIn, LivingEntity entity, ItemStack stack, int count) {
if (!worldIn.isClientSide && worldIn.getGameTime() % 5 == 0) {
Network.getNetwork().sendToTrackingEntity(new VanillaParticleMessage(entity.getX(), entity.getY(), entity.getZ(), ParticleTypes.ENCHANT), entity);
Network.getNetwork().sendToPlayer(new VanillaParticleMessage(entity.getX(), entity.getY(), entity.getZ(), ParticleTypes.ENCHANT), (ServerPlayerEntity) entity);
}
}
use of com.minecolonies.coremod.network.messages.client.VanillaParticleMessage in project minecolonies by Minecolonies.
the class WindowTownHallColonyManage method onCreate.
/**
* On create button
*/
public void onCreate() {
final PlayerEntity player = Minecraft.getInstance().player;
final ITextComponent colonyName = new TranslationTextComponent(DEFAULT_COLONY_NAME, player.getName());
new VanillaParticleMessage(pos.getX(), pos.getY(), pos.getZ(), ParticleTypes.DRAGON_BREATH).onExecute(null, false);
player.level.playSound(player, new BlockPos(Minecraft.getInstance().player.position()), SoundEvents.CAMPFIRE_CRACKLE, SoundCategory.AMBIENT, 2.5f, 0.8f);
Network.getNetwork().sendToServer(new CreateColonyMessage(pos, colonyName.getString()));
close();
}
use of com.minecolonies.coremod.network.messages.client.VanillaParticleMessage in project minecolonies by Minecolonies.
the class CitizenSkillHandler method levelUp.
@Override
public void levelUp(final ICitizenData data) {
// Show level-up particles
if (data.getEntity().isPresent()) {
final AbstractEntityCitizen citizen = data.getEntity().get();
citizen.playSound(SoundEvents.PLAYER_LEVELUP, 1.0f, (float) SoundUtils.getRandomPitch(citizen.getRandom()));
Network.getNetwork().sendToTrackingEntity(new VanillaParticleMessage(citizen.getX(), citizen.getY(), citizen.getZ(), ParticleTypes.HAPPY_VILLAGER), data.getEntity().get());
}
if (data.getJob() != null) {
data.getJob().onLevelUp();
}
}
use of com.minecolonies.coremod.network.messages.client.VanillaParticleMessage in project minecolonies by Minecolonies.
the class ItemScrollBuff method onItemUseSuccess.
@Override
protected ItemStack onItemUseSuccess(final ItemStack itemStack, final World world, final ServerPlayerEntity player) {
if (world.random.nextInt(8) > 0) {
for (final LivingEntity entity : world.getLoadedEntitiesOfClass(EntityCitizen.class, player.getBoundingBox().inflate(15, 2, 15))) {
addRegenerationWithParticles(entity);
}
addRegenerationWithParticles(player);
// Send to player additionally, as players do not track themselves
Network.getNetwork().sendToPlayer(new VanillaParticleMessage(player.getX(), player.getY(), player.getZ(), ParticleTypes.HEART), player);
SoundUtils.playSoundForPlayer(player, SoundEvents.PLAYER_LEVELUP, 0.2f, 1.0f);
} else {
player.displayClientMessage(new TranslationTextComponent("minecolonies.scroll.failed" + (world.random.nextInt(FAIL_RESPONSES_TOTAL) + 1)).setStyle(Style.EMPTY.withColor(TextFormatting.GOLD)), true);
player.addEffect(new EffectInstance(Effects.BLINDNESS, TICKS_SECOND * 10));
SoundUtils.playSoundForPlayer(player, SoundEvents.TOTEM_USE, 0.04f, 1.0f);
}
itemStack.shrink(1);
return itemStack;
}
Aggregations