Skip to content

Instantly share code, notes, and snippets.

@John-Paul-R
Created July 31, 2021 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save John-Paul-R/796b4a7da569dbc27dcef6e1aabd2ab3 to your computer and use it in GitHub Desktop.
Save John-Paul-R/796b4a7da569dbc27dcef6e1aabd2ab3 to your computer and use it in GitHub Desktop.
Glowmorgification Potion Assistance
{
"effect.better_glow_squids.glowmorgification": "Glowmorgification Effect!"
}
package com.fibermc.essentialcommands;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffectType;
import net.minecraft.entity.passive.SquidEntity;
import net.minecraft.potion.Potion;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import java.awt.*;
public class GlowmorgificationMod {
public static class GlowmorgificationEffect extends StatusEffect {
protected GlowmorgificationEffect(StatusEffectType type, int color) {
super(type, color);
}
@Override
public boolean isInstant() {
return true;
}
public boolean canApplyUpdateEffect(int duration, int amplifier) {
return duration >= 1;
}
@Override
public void applyInstantEffect(Entity source, Entity attacker, LivingEntity target, int amplifier, double proximity) {
if(target instanceof SquidEntity) {
System.out.println("Hi");
}
super.applyInstantEffect(source, attacker, target, amplifier, proximity);
}
}
public class StatusEffectRegistry {
public static final StatusEffect GLOWMORGIFICATION_EFFECT = new GlowmorgificationEffect(StatusEffectType.BENEFICIAL, new Color(0, 0, 0).getRGB());
public static final Potion GLOWMORGIFICATION_POTION = new Potion(new StatusEffectInstance[]{new StatusEffectInstance(StatusEffectRegistry.GLOWMORGIFICATION_EFFECT, 1)});
public static void registerAll() {
Registry.register(Registry.STATUS_EFFECT, new Identifier("better_glow_squids", "glowmorgification"), GLOWMORGIFICATION_EFFECT);
Registry.register(Registry.POTION, new Identifier("better_glow_squids", "glowmorgification"), GLOWMORGIFICATION_POTION);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment