| 
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 |  |  | --- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
 | 
					
						
							|  |  |  | +++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
 | 
					
						
							| 
									
										
										
										
											2022-12-08 03:00:00 +11:00
										 |  |  | @@ -31,6 +31,12 @@
 | 
					
						
							| 
									
										
										
										
											2022-03-01 02:00:00 +11:00
										 |  |  |  import net.minecraft.world.level.material.EnumPistonReaction; | 
					
						
							|  |  |  |  import org.slf4j.Logger; | 
					
						
							| 
									
										
										
										
											2021-03-09 08:47:33 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  | +// CraftBukkit start
 | 
					
						
							| 
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 |  |  | +import net.minecraft.resources.MinecraftKey;
 | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  | +import org.bukkit.craftbukkit.entity.CraftLivingEntity;
 | 
					
						
							|  |  |  | +import org.bukkit.entity.LivingEntity;
 | 
					
						
							|  |  |  | +// CraftBukkit end
 | 
					
						
							| 
									
										
										
										
											2021-03-09 08:47:33 +11:00
										 |  |  | +
 | 
					
						
							| 
									
										
										
										
											2023-03-15 03:30:00 +11:00
										 |  |  |  public class EntityAreaEffectCloud extends Entity implements TraceableEntity { | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2022-03-01 02:00:00 +11:00
										 |  |  |      private static final Logger LOGGER = LogUtils.getLogger(); | 
					
						
							| 
									
										
										
										
											2022-12-08 03:00:00 +11:00
										 |  |  | @@ -129,6 +135,22 @@
 | 
					
						
							| 
									
										
										
										
											2016-03-02 20:43:58 -05:00
										 |  |  |   | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  | +    // CraftBukkit start accessor methods
 | 
					
						
							|  |  |  | +    public void refreshEffects() {
 | 
					
						
							| 
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 |  |  | +        if (!this.fixedColor) {
 | 
					
						
							| 
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 |  |  | +            this.getEntityData().set(EntityAreaEffectCloud.DATA_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, this.effects)));
 | 
					
						
							| 
									
										
										
										
											2016-03-02 20:43:58 -05:00
										 |  |  | +        }
 | 
					
						
							|  |  |  | +    }
 | 
					
						
							|  |  |  | +
 | 
					
						
							| 
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 |  |  | +    public String getPotionType() {
 | 
					
						
							| 
									
										
										
										
											2022-12-08 03:00:00 +11:00
										 |  |  | +        return ((MinecraftKey) BuiltInRegistries.POTION.getKey(this.potion)).toString();
 | 
					
						
							| 
									
										
										
										
											2016-03-02 20:43:58 -05:00
										 |  |  | +    }
 | 
					
						
							|  |  |  | +
 | 
					
						
							| 
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 |  |  | +    public void setPotionType(String string) {
 | 
					
						
							| 
									
										
										
										
											2022-12-08 03:00:00 +11:00
										 |  |  | +        setPotion(BuiltInRegistries.POTION.get(new MinecraftKey(string)));
 | 
					
						
							| 
									
										
										
										
											2016-03-02 20:43:58 -05:00
										 |  |  | +    }
 | 
					
						
							|  |  |  | +    // CraftBukkit end
 | 
					
						
							|  |  |  | +
 | 
					
						
							|  |  |  |      public int getColor() { | 
					
						
							| 
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 |  |  |          return (Integer) this.getEntityData().get(EntityAreaEffectCloud.DATA_COLOR); | 
					
						
							| 
									
										
										
										
											2016-03-02 20:43:58 -05:00
										 |  |  |      } | 
					
						
							| 
									
										
										
										
											2023-03-15 03:30:00 +11:00
										 |  |  | @@ -263,6 +285,7 @@
 | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  |                      if (!list1.isEmpty()) { | 
					
						
							| 
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 |  |  |                          Iterator iterator1 = list1.iterator(); | 
					
						
							| 
									
										
										
										
											2016-03-12 12:12:25 -05:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  | +                        List<LivingEntity> entities = new java.util.ArrayList<LivingEntity>(); // CraftBukkit
 | 
					
						
							| 
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 |  |  |                          while (iterator1.hasNext()) { | 
					
						
							|  |  |  |                              EntityLiving entityliving = (EntityLiving) iterator1.next(); | 
					
						
							| 
									
										
										
										
											2016-03-12 12:12:25 -05:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2023-03-15 03:30:00 +11:00
										 |  |  | @@ -272,6 +295,17 @@
 | 
					
						
							| 
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 |  |  |                                  double d8 = d6 * d6 + d7 * d7; | 
					
						
							| 
									
										
										
										
											2016-03-12 12:12:25 -05:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 |  |  |                                  if (d8 <= (double) (f * f)) { | 
					
						
							| 
									
										
										
										
											2016-03-12 12:12:25 -05:00
										 |  |  | +                                    // CraftBukkit start
 | 
					
						
							|  |  |  | +                                    entities.add((LivingEntity) entityliving.getBukkitEntity());
 | 
					
						
							|  |  |  | +                                }
 | 
					
						
							|  |  |  | +                            }
 | 
					
						
							|  |  |  | +                        }
 | 
					
						
							|  |  |  | +                        org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
 | 
					
						
							| 
									
										
										
										
											2019-02-07 00:40:41 -05:00
										 |  |  | +                        if (!event.isCancelled()) {
 | 
					
						
							| 
									
										
										
										
											2016-03-12 12:12:25 -05:00
										 |  |  | +                            for (LivingEntity entity : event.getAffectedEntities()) {
 | 
					
						
							|  |  |  | +                                if (entity instanceof CraftLivingEntity) {
 | 
					
						
							|  |  |  | +                                    EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
 | 
					
						
							|  |  |  | +                                    // CraftBukkit end
 | 
					
						
							| 
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 |  |  |                                      this.victims.put(entityliving, this.tickCount + this.reapplicationDelay); | 
					
						
							|  |  |  |                                      Iterator iterator2 = list.iterator(); | 
					
						
							| 
									
										
										
										
											2016-03-12 12:12:25 -05:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2023-03-15 03:30:00 +11:00
										 |  |  | @@ -281,7 +315,7 @@
 | 
					
						
							| 
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 |  |  |                                          if (mobeffect1.getEffect().isInstantenous()) { | 
					
						
							|  |  |  |                                              mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D); | 
					
						
							| 
									
										
										
										
											2018-07-20 16:04:37 +10:00
										 |  |  |                                          } else { | 
					
						
							| 
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 |  |  | -                                            entityliving.addEffect(new MobEffect(mobeffect1), this);
 | 
					
						
							|  |  |  | +                                            entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
 | 
					
						
							| 
									
										
										
										
											2018-07-20 16:04:37 +10:00
										 |  |  |                                          } | 
					
						
							|  |  |  |                                      } | 
					
						
							|  |  |  |   |