Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.90 KB | None | 0 0
  1. package ru.rarescrap.simpleweightsystem;
  2.  
  3. import cpw.mods.fml.common.eventhandler.SubscribeEvent;
  4. import net.minecraft.potion.PotionEffect;
  5. import net.minecraftforge.common.MinecraftForge;
  6. import ru.rarescrap.weightapi.event.WeightProviderChangedEvent;
  7.  
  8. /**
  9.  * {@link PotionEffect} с бесконечным сроком работы
  10.  */
  11. public class EndlessPotionEffect extends PotionEffect {
  12.     private final UUID id = UUID.nextRandom();
  13.  
  14.     public EndlessPotionEffect(int potionID) {
  15.         this(potionID, 0);
  16.     }
  17.  
  18.     public EndlessPotionEffect(int potionID, int amplifier) {
  19.         this(potionID, amplifier, false);
  20.     }
  21.  
  22.     public EndlessPotionEffect(int potionID, int amplifier, boolean isAmbient) {
  23.         super(potionID, 1, amplifier, isAmbient);
  24.         getCurativeItems().clear(); // Убираем возможность снять эффект молоком (или другим лекарством)
  25. //        MinecraftForge.EVENT_BUS.register(this);
  26.     }
  27.  
  28.     public EndlessPotionEffect(PotionEffect potionEffect) {
  29.         this(potionEffect.getPotionID(), potionEffect.getAmplifier(), potionEffect.getIsAmbient());
  30.     }
  31.  
  32.     @Override
  33.     public int deincrementDuration() {
  34.         return this.duration;
  35.     }
  36.  
  37.     // Контракт симетрии никтогда не выполнится
  38.     @Override
  39.     public final boolean equals(Object p_equals_1_) {
  40.         if (p_equals_1_ instanceof EndlessPotionEffect) {
  41.             EndlessPotionEffect o = (EndlessPotionEffect) p_equals_1_;
  42.             return new EqualsBuilder()
  43. //                    .appendSuper(super.equals(o))
  44.                     .append(this.id, o.id)
  45.                     .build();
  46. //            return this.id.equals(((EndlessPotionEffect) p_equals_1_).id);
  47.         }
  48.         return false;
  49.     }
  50.  
  51.     @Override
  52.     public final int hashCode() {
  53.         return Objects.hashCode(id);
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement