leon s.kennedy

--- 📎 Attached 1 file(s):

File: pasted-code-1793341557815.txt

txt
package com.aaditya.supermansuit;

import net.minecraft.world.effect.*;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.entity.projectile.LargeFireball;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class SupermanAbilities {

    @SubscribeEvent
    public static void playerTick(TickEvent.PlayerTickEvent event) {

        Player player = event.player;

        // Full Armor Check
        boolean suit =
                !player.getInventory().armor.get(0).isEmpty() &&
                !player.getInventory().armor.get(1).isEmpty() &&
                !player.getInventory().armor.get(2).isEmpty() &&
                !player.getInventory().armor.get(3).isEmpty();

        if(suit) {

            // Super Speed
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.MOVEMENT_SPEED,
                            10,
                            5,
                            false,
                            false));

            // Super Jump
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.JUMP,
                            10,
                            8,
                            false,
                            false));

            // Strength
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.DAMAGE_BOOST,
                            10,
                            8,
                            false,
                            false));

            // Invulnerability
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.DAMAGE_RESISTANCE,
                            10,
                            4,
                            false,
                            false));

            // Flight
            player.getAbilities().mayfly = true;
            player.getAbilities().setFlyingSpeed(0.4F);
        }
    }

    @SubscribeEvent
    public static void punch(AttackEntityEvent event) {

        Player player = event.getEntity();

        Entity target = event.getTarget();

        boolean suit =
                !player.getInventory().armor.get(0).isEmpty() &&
                !player.getInventory().armor.get(1).isEmpty() &&
                !player.getInventory().armor.get(2).isEmpty() &&
                !player.getInventory().armor.get(3).isEmpty();

        if(suit) {

            target.setDeltaMovement(
                    target.getDeltaMovement()
                            .add(0, 2, 5));

        }
    }

    @SubscribeEvent
    public static void noFallDamage(LivingHurtEvent event) {

        if(event.getEntity() instanceof Player player) {

            boolean suit =
                    !player.getInventory().armor.get(0).isEmpty() &&
                    !player.getInventory().armor.get(1).isEmpty() &&
                    !player.getInventory().armor.get(2).isEmpty() &&
                    !player.getInventory().armor.get(3).isEmpty();

            if(suit) {
                if(event.getSource().toString().contains("fall")) {
                    event.setCanceled(true);
                }
            }
        }
    }

    // Heat Vision Function
    public static void heatVision(Player player) {

        Vec3 look = player.getLookAngle();

        LargeFireball fireball =
                new LargeFireball(
                        player.level(),
                        player,
                        look.x,
                        look.y,
                        look.z,
                        5);

        player.level().addFreshEntity(fireball);
    }
}
📎 1 file 4,161 chars
📄
pasted-code-1793341651281.txt
txt 131 lines
▶
package com.aaditya.supermansuit;

import net.minecraft.world.effect.*;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.entity.projectile.LargeFireball;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class SupermanAbilities {

    @SubscribeEvent
    public static void playerTick(TickEvent.PlayerTickEvent event) {

        Player player = event.player;

        // Full Armor Check
        boolean suit =
                !player.getInventory().armor.get(0).isEmpty() &&
                !player.getInventory().armor.get(1).isEmpty() &&
                !player.getInventory().armor.get(2).isEmpty() &&
                !player.getInventory().armor.get(3).isEmpty();

        if(suit) {

            // Super Speed
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.MOVEMENT_SPEED,
                            10,
                            5,
                            false,
                            false));

            // Super Jump
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.JUMP,
                            10,
                            8,
                            false,
                            false));

            // Strength
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.DAMAGE_BOOST,
                            10,
                            8,
                            false,
                            false));

            // Invulnerability
            player.addEffect(
                    new MobEffectInstance(
                            MobEffects.DAMAGE_RESISTANCE,
                            10,
                            4,
                            false,
                            false));

            // Flight
            player.getAbilities().mayfly = true;
            player.getAbilities().setFlyingSpeed(0.4F);
        }
    }

    @SubscribeEvent
    public static void punch(AttackEntityEvent event) {

        Player player = event.getEntity();

        Entity target = event.getTarget();

        boolean suit =
                !player.getInventory().armor.get(0).isEmpty() &&
                !player.getInventory().armor.get(1).isEmpty() &&
                !player.getInventory().armor.get(2).isEmpty() &&
                !player.getInventory().armor.get(3).isEmpty();

        if(suit) {

            target.setDeltaMovement(
                    target.getDeltaMovement()
                            .add(0, 2, 5));

        }
    }

    @SubscribeEvent
    public static void noFallDamage(LivingHurtEvent event) {

        if(event.getEntity() instanceof Player player) {

            boolean suit =
                    !player.getInventory().armor.get(0).isEmpty() &&
                    !player.getInventory().armor.get(1).isEmpty() &&
                    !player.getInventory().armor.get(2).isEmpty() &&
                    !player.getInventory().armor.get(3).isEmpty();

            if(suit) {
                if(event.getSource().toString().contains("fall")) {
                    event.setCanceled(true);
                }
            }
        }
    }

    // Heat Vision Function
    public static void heatVision(Player player) {

        Vec3 look = player.getLookAngle();

        LargeFireball fireball =
                new LargeFireball(
                        player.level(),
                        player,
                        look.x,
                        look.y,
                        look.z,
                        5);

        player.level().addFreshEntity(fireball);
    }
}
Kodari AI
KodariOct 30 at 6:31 am 2
SupermanSuitMod
Grants players superpowers when wearing a full set of armor. Provides super speed, super jump, strength, invulnerability, and flight abilities. Includes a powerful punch knockback effect and complete fall damage immunity. Also features a heat vision attack that launches large fireballs in the player's facing direction.
  1. Create the Fabric 1.21.4 project scaffold.

  2. Port the suit-triggered effects, flight, punch knockback, fall-damage immunity, and heat-vision helper using verified Yarn/Fabric APIs.

  3. Keep the supplied armor-check behavior; this initializes the code but does not add armor items.

Created the Fabric 1.21.4 mod scaffold and ported the supplied abilities: a full armor set grants the effects and flight, punches launch targets, and fall damage is blocked. The heat-vision helper spawns a fireball but, like the supplied code, isn’t bound to a key or item use.

The original armor check treats any complete armor set as the suit, and flight permission isn’t revoked when armor is removed. No custom Superman armor items or recipes were included.

Kodari can make mistakes. Review important code before using.
Files
src
AADITYA
build.gradle
gradle.properties
settings.gradle
Code
7 161
src/main/java/com/aaditya/supermansuit/SupermanSuit.java
package com.aaditya.supermansuit;

import net.fabricmc.api.ModInitializer;

public class SupermanSuit implements ModInitializer {
    @Override
    public void onInitialize() {
        SupermanAbilities.register();
    }
}