HomeJavaModsHappy Ghast Protection
This plugin is really simple. I saw how cute happy ghasts were, so I made a basic plugin that just cancels the entity damage event for happy ghasts.

In this spoiler is the source code for the happy ghast plugin. I tried looking on spigot for a plugin for my smp that would just protect happy ghasts and couldn't find anything, which is why I am uploading this resource.
Spoiler: Code
Code (Java):
public class HappyGhastPlugin extends JavaPlugin implements Listener {
    @Override
    public void onEnable ( ) {
        getLogger ( ). info ( "Enabled happy ghast plugin. Happy ghasts will no longer take damage." ) ;
        getServer ( ). getPluginManager ( ). registerEvents ( this, this ) ;
    }

    @Override
    public void onDisable ( ) {

    }

    @EventHandler
    public void onGhastDamage (EntityDamageEvent event ) {
        Entity entity = event. getEntity ( ) ;
        if (entity instanceof HappyGhast ) {
            ( (HappyGhast ) entity ). setHealth ( 20 ) ;
            event. setCancelled ( true ) ;
        }

    }

    @EventHandler
    public void onGhastDeath (EntityDeathEvent event ) {
        Entity entity = event. getEntity ( ) ;
        if (entity instanceof HappyGhast ) {
            event. setDroppedExp ( 0 ) ;
            entity. setFireTicks ( 0 ) ;
            event. getEntity ( ). setHealth ( 20 ) ;
        }
    }
}
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Happy Ghast Protection is a free Minecraft Java mod. Compatible with Minecraft 1.21. Downloaded 16 times (via Spigot). Download it and open it directly in the game.

Explore more