use of com.integral.enigmaticlegacy.packets.clients.PacketRecallParticles in project Enigmatic-Legacy by Aizistral-Studios.
the class RecallPotion method onItemUseFinish.
@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) {
PlayerEntity player = entityLiving instanceof PlayerEntity ? (PlayerEntity) entityLiving : null;
if (player instanceof ServerPlayerEntity) {
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayerEntity) player, stack);
}
if (!worldIn.isRemote) {
Vec3d vec = SuperpositionHandler.getValidSpawn(worldIn, player);
worldIn.playSound(null, player.getPosition(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, (float) (0.8F + (Math.random() * 0.2)));
EnigmaticLegacy.packetInstance.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(player.posX, player.posY, player.posZ, 128, player.dimension)), new PacketPortalParticles(player.posX, player.posY + (player.getHeight() / 2), player.posZ, 100, 1.25F, false));
player.setPositionAndUpdate(vec.x, vec.y, vec.z);
worldIn.playSound(null, player.getPosition(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, (float) (0.8F + (Math.random() * 0.2)));
EnigmaticLegacy.packetInstance.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(player.posX, player.posY, player.posZ, 128, player.dimension)), new PacketRecallParticles(player.posX, player.posY + (player.getHeight() / 2), player.posZ, 48, false));
}
if (player == null || !player.abilities.isCreativeMode) {
stack.shrink(1);
if (stack.isEmpty()) {
return new ItemStack(Items.GLASS_BOTTLE);
}
if (player != null) {
player.inventory.addItemStackToInventory(new ItemStack(Items.GLASS_BOTTLE));
}
}
return stack;
}
Aggregations