Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void performEffect(LivingEntity entity, int amplifier) {
- Effect bindingEffect = LifeBindingPotion.LIFE_BINDING_EFFECT.get();
- if (entity.isPotionActive(bindingEffect)) {
- for (LivingEntity livingEntity : entity.world.getEntitiesWithinAABB(LivingEntity.class, entity.getBoundingBox().grow(2.0D))) {
- if (livingEntity.isAlive() && livingEntity != entity) {
- if (!(livingEntity instanceof PlayerEntity && ((PlayerEntity) livingEntity).isCreative())) {
- if (livingEntity instanceof PlayerEntity && entity instanceof PlayerEntity) {
- PlayerEntity player1 = (PlayerEntity)livingEntity;
- PlayerEntity player2 = (PlayerEntity)entity;
- if (player1.isPotionActive(bindingEffect) && player2.isPotionActive(bindingEffect)) {
- PlayerEntity.getUUID(player1.getGameProfile());
- PlayerEntity.getUUID(player2.getGameProfile());
- player1.removePotionEffect(LifeBindingPotion.LIFE_BINDING_EFFECT.get());
- player2.removePotionEffect(LifeBindingPotion.LIFE_BINDING_EFFECT.get());
- player1.getEntityWorld().playSound(null, (player1).getPosition(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.HOSTILE, 0.5F, 1.0F);
- ((ServerWorld)player1.world).spawnParticle(ParticleTypes.EXPLOSION, player1.getPosX(), player1.getPosYHeight(1.0D), player1.getPosZ(), 8, 2.0D, 2.0D, 2.0D, 1.0D);
- ((ServerWorld)player2.world).spawnParticle(ParticleTypes.EXPLOSION, player2.getPosX(), player2.getPosYHeight(1.0D), player2.getPosZ(), 8, 2.0D, 2.0D, 2.0D, 1.0D);
- CapabilityHelper.setPlayerBound((ServerPlayerEntity) player1, true);
- CapabilityHelper.setPlayerBound((ServerPlayerEntity) player2, true);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement