Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.rarescrap.simpleweightsystem;
- import cpw.mods.fml.common.eventhandler.SubscribeEvent;
- import net.minecraft.potion.PotionEffect;
- import net.minecraftforge.common.MinecraftForge;
- import ru.rarescrap.weightapi.event.WeightProviderChangedEvent;
- /**
- * {@link PotionEffect} с бесконечным сроком работы
- */
- public class EndlessPotionEffect extends PotionEffect {
- private final UUID id = UUID.nextRandom();
- public EndlessPotionEffect(int potionID) {
- this(potionID, 0);
- }
- public EndlessPotionEffect(int potionID, int amplifier) {
- this(potionID, amplifier, false);
- }
- public EndlessPotionEffect(int potionID, int amplifier, boolean isAmbient) {
- super(potionID, 1, amplifier, isAmbient);
- getCurativeItems().clear(); // Убираем возможность снять эффект молоком (или другим лекарством)
- // MinecraftForge.EVENT_BUS.register(this);
- }
- public EndlessPotionEffect(PotionEffect potionEffect) {
- this(potionEffect.getPotionID(), potionEffect.getAmplifier(), potionEffect.getIsAmbient());
- }
- @Override
- public int deincrementDuration() {
- return this.duration;
- }
- // Контракт симетрии никтогда не выполнится
- @Override
- public final boolean equals(Object p_equals_1_) {
- if (p_equals_1_ instanceof EndlessPotionEffect) {
- EndlessPotionEffect o = (EndlessPotionEffect) p_equals_1_;
- return new EqualsBuilder()
- // .appendSuper(super.equals(o))
- .append(this.id, o.id)
- .build();
- // return this.id.equals(((EndlessPotionEffect) p_equals_1_).id);
- }
- return false;
- }
- @Override
- public final int hashCode() {
- return Objects.hashCode(id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement