Smarth Saini
📎 1 file 6,678 chars
📄
pasted-code-1790774659281.txt
txt 237 lines
▶
Create a lightweight Minecraft Fabric mod for **Minecraft Java Edition 1.21.11**.

## MOD NAME

**Galaxy Destroyer**

## MAIN WEAPON

Add a powerful futuristic gun called **Galaxy Destroyer**.

The Galaxy Destroyer should be an original weapon inspired by the concept of an orbital railgun, but it must have its **own completely different design, animations, sounds, effects, and visual identity**. Do not copy another mod's assets or code.

### Weapon Design

* Futuristic cosmic/galactic weapon.
* Large but clean and simple 3D model.
* Unique silhouette that clearly distinguishes it from an orbital railgun.
* Dark metallic body with glowing cosmic energy elements.
* Add a small energy core/reactor somewhere on the weapon.
* The weapon should visually charge before firing.
* Keep the model optimized and low-poly so it does not unnecessarily reduce FPS.

### Firing System

When the player fires Galaxy Destroyer:

1. The weapon enters a short charging animation.
2. The energy core begins glowing.
3. Small particles gather around the weapon.
4. A powerful energy beam is fired toward the target.
5. Create a short screen/camera effect when firing.
6. Create an impact explosion/effect at the target.
7. Add smoke, sparks, energy particles, and a shockwave.
8. Play custom futuristic charging and firing sounds.
9. Add a cooldown after firing.

The animation should feel powerful but should **not** be overly complicated or resource-heavy.

### Damage

Galaxy Destroyer should be an extremely powerful end-game weapon.

Use damage comparable to an **orbital-railgun-style superweapon**, but implement the damage system independently.

Requirements:

* Very high single-target damage.
* Strong area-of-effect damage around the impact point.
* Configurable damage values.
* Configurable explosion radius.
* Configurable cooldown.
* Do not make the weapon constantly spam explosions or particles.

Make all important values configurable so they can easily be changed later.

### Targeting

The weapon should fire toward the direction the player is looking.

Prefer a reliable raycast-based targeting system:

* Detect blocks and entities in the player's line of sight.
* Fire the beam at the first valid target.
* If an entity is hit, apply the configured damage.
* If a block is hit, create the impact effect at the hit location.
* Prevent unnecessary calculations every game tick.

### Visual Effects

Create lightweight custom effects such as:

* Cosmic energy beam
* Purple/blue/white energy glow
* Small particles
* Impact flash
* Shockwave ring
* Sparks
* Smoke
* Energy trails

**Performance requirement:** optimize all particles and rendering. Do not create thousands of particles per shot.

Avoid expensive shaders, ray-tracing, huge animated textures, or constantly running calculations.

### Animation

Create original animations including:

* Idle animation
* Charging animation
* Firing animation
* Recoil animation
* Cooldown animation

The animation should look smooth while remaining lightweight.

### Sounds

Add original sound events:

* galaxy_destroyer_charge
* galaxy_destroyer_fire
* galaxy_destroyer_impact
* galaxy_destroyer_cooldown

Use placeholder/generated sounds if actual audio assets cannot be created, and structure the mod so the sounds can easily be replaced later.

### Item Features

Galaxy Destroyer should:

* Have a custom item model.
* Have a custom item name.
* Have a custom tooltip.
* Show useful information such as damage/cooldown.
* Have durability or an energy/ammo system.
* Prevent firing while on cooldown.
* Work properly in survival and creative modes.
* Have a configurable crafting recipe or optional creative-only acquisition.

### Performance

This is extremely important.

The mod must be designed for a **low-end PC**.

Priorities:

* Minimal CPU usage.
* Minimal RAM usage.
* Minimal GPU usage.
* Efficient entity raycasting.
* Efficient particle spawning.
* No unnecessary tick loops.
* No permanent background effects.
* No large textures.
* Low-poly model.
* Avoid unnecessary dependencies.
* Do not add an API key requirement.
* Do not require an external server.
* Keep the mod as small and lightweight as reasonably possible.

The mod should be usable alongside common Fabric performance mods such as Sodium.

## VERSION / LOADER

Target exactly:

**Minecraft Java Edition 1.21.11**
**Fabric Loader**

Use versions of Fabric API and Fabric Loom that are actually compatible with Minecraft 1.21.11.

Do not target 1.21, 1.21.1, 1.21.4, 1.21.10, or another Minecraft version.

## PROJECT STRUCTURE

Create a complete Gradle Fabric mod project containing:

* `build.gradle`
* `settings.gradle`
* `gradle.properties`
* `gradlew`
* `gradlew.bat`
* `src/main/java/...`
* `src/main/resources/fabric.mod.json`
* Item registration
* Weapon logic
* Client rendering
* Animations
* Particles
* Sounds
* Textures/model resources
* Recipe resources
* Configuration system

Use clean, maintainable Java code.

Separate client-side rendering/effects from common/server-side weapon logic wherever appropriate.

## IMPORTANT MULTIPLAYER REQUIREMENT

The actual damage and important weapon logic must be handled safely on the server side.

Do not trust client-side damage calculations.

Synchronize only the visual effects and necessary weapon state between client and server.

## CONFIGURATION

Create a simple configuration system with options such as:

* damage
* explosion radius
* cooldown
* beam duration
* maximum range
* particle amount
* screen shake
* friendly fire
* block damage
* energy/ammo requirements

Use sensible default values.

## ERROR HANDLING

The mod should fail gracefully if an optional resource or sound is missing.

Do not crash Minecraft because of a missing cosmetic effect.

## BUILD REQUIREMENT

After creating the complete project:

1. Run the Gradle build.
2. Fix all compilation errors.
3. Fix Fabric/Minecraft version compatibility errors.
4. Verify that the final project builds successfully.
5. Produce the final compiled mod:

**`GalaxyDestroyer-1.21.11.jar`**

Place the compiled `.jar` inside the project's `build/libs/` directory.

Also provide the complete source code so the mod can be modified later.

## FINAL OUTPUT

The final result should contain:

**GalaxyDestroyer-1.21.11.jar**

and the complete source project.

Do not just provide pseudocode or an example. Create a complete, compilable Fabric mod project targeting Minecraft 1.21.11.
Kodari AI
KodariSep 30 at 1:37 pm 4
GalaxyDestroyer
Galaxy Destroyer is a lightweight Fabric mod for Minecraft 1.21.11 that introduces a powerful futuristic cosmic weapon. It features a custom low-poly 3D model with glowing energy core, charging and firing animations, particle effects, and original sounds. The weapon uses efficient raycast targeting to deliver high single-target and area-of-effect damage with configurable values. Includes a full configuration system for damage, explosion radius, cooldown, beam duration, range, particle amount, screen shake, friendly fire, block damage, and energy requirements. Server-side damage handling ensures multiplayer safety, while client-side effects remain optimized for low-end PCs. The mod provides a crafting recipe, custom tooltip, durability system, and works in both survival and creative modes.
  1. Set up the 1.21.11 Fabric Gradle project and server-authoritative weapon/configuration logic.

  2. Add registered item/sounds, lightweight impact/beam effects, and client firing feedback.

  3. Add item model, language, and crafting recipe resources.

Created the Fabric 1.21.11 source project with the server-authoritative weapon, configurable charge/cooldown/damage, raycast targeting, bounded beam and impact effects, item model, recipe, sounds, and client firing flash.

The compiled JAR is not available: this environment has no Gradle build tools, so I could not build or verify it. With Gradle 8.14 or newer installed, run ./gradlew remapJar; the configured output is build/libs/GalaxyDestroyer-1.21.11.jar. The model reuses vanilla textures, and the custom sound events currently map to vanilla sounds as placeholders.

Smarth Saini

the gun doesnt work fix that and make a cool design as that design is so bad and doesnt visible

Kodari AI
KodariSep 30 at 1:52 pm 2
  1. Fix the weapon’s firing path and any server/client interaction causing it not to fire.

  2. Replace the hard-to-see item appearance with a stronger, clearly visible custom design.

Fixed the firing path so the server fires when the charge completes, rather than relying on a specific usage-tick value. Rebuilt the model with opaque block textures and a larger dark-metal body, bright reactor, crystal barrel, side rails, and grip so it’s easier to see in hand and in the inventory.

Test it with /give @s galaxydestroyer:galaxy_destroyer, then hold right-click through the charge. I couldn’t run Minecraft or Gradle here, so the changes are not build- or in-game-verified.

Smarth Saini

how the gun work it doesnt do any destruction and no any animation come from it

Kodari AI
KodariOct 1 at 10:56 am 1
  1. Trace and fix server-side firing/target damage.

  2. Add visible charge, beam, and impact animation feedback.

Fixed the missing feedback and block damage:

  • Charge animation: while holding right-click, the gun now uses Minecraft’s bow-draw pose, with the existing charge particles.

  • Beam: made the firing beam denser so it’s easier to see.

  • Block destruction: block damage is enabled by default and now applies to your existing config the first time it’s upgraded. It breaks the block the beam hits; it does not destroy a radius of terrain. You can turn it off afterward with blockDamage=false in config/galaxy_destroyer.properties.

How to fire: hold right-click for the full charge—20 ticks (about 1 second) by default. It fires automatically when charged; releasing early cancels the shot. The beam damages the first entity or block in your line of sight, with area damage to nearby entities.

I couldn’t run Gradle or test it in-game here, so the changes are not build-verified.

Smarth Saini

so give me another file that doesn't have this issue and gun have animation also

Kodari AI
KodariOct 1 at 11:05 am 2
  1. Trace the existing gun implementation and identify a replacement that actually damages blocks and shows firing animation.

Added AnimatedGalaxyDestroyerItem.java and registered it as the existing gun’s implementation. While charging, it uses the bow-hold pose and emits rotating particles; firing at a block now breaks a small radius around the impact, even if the old blockDamage config was off.

Use /give @s galaxydestroyer:galaxy_destroyer, hold right-click through the full charge (20 ticks by default), and aim at a block to see the destruction. I couldn’t test it in-game here.

Smarth Saini

the damage dealt by the gun is too low make it stronger like it destroyer atleast one chuck from top to down even bedrock means a heavy mod and it also don't have animation when i fire also add that

Kodari AI
KodariOct 1 at 11:16 am 1
  1. Make the charged shot dramatically destructive, including a configurable top-to-bottom column that can destroy bedrock.

  2. Add clear firing animation and visual impact feedback.

The gun now hits much harder and, when a shot hits a block, clears the entire 16×16 chunk column from top to bottom—including bedrock. It removes blocks without drops and processes the column in batches to reduce the chance of freezing the server. Damage is set to 10,000; existing configs are upgraded to that value.

Firing now swings the hand holding the gun and triggers the screen flash; the beam and impact particles remain. Aim at a block and hold right-click through the charge to fire. I couldn’t run a build or test this in-game here.

Smarth Saini

nice but the mod removing layer by layer of the chunk make it instant like i fire a shot it instantly destroy full chunk and increase cooldown of gun to 20 sec and i said make a deadly and i provided some image make the gun animation and everything like this but with different color and change the destruction level to 5 chunks in a single hit

5 images attached
Kodari AI
KodariOct 1 at 11:40 am 3
  1. Make one shot instantly clear a five-chunk-wide column and set a 20-second cooldown.

  2. Add visible aiming, charging, beam, and impact effects inspired by the reference images.

The shot now clears five full chunk columns—the target chunk plus its four cardinal neighbors—from the world’s bottom to top, including bedrock. Blocks are removed immediately when the shot hits; they don’t drop items. The cooldown is 20 seconds, including for existing configs.

Added a pulsing charge reticle, expanding charge particles, and a firing beam-and-impact HUD animation. The world beam and impact particles also last longer and are denser.

Warning: clearing five full chunks at once can cause a significant server hitch and permanently alter the terrain. Back up worlds before testing. I haven’t verified this in-game.

Smarth Saini

nice but where is sounds add sounds when i hold gun and prepare for fire and when fire is done and i said make exact same animations like i provided and u only make aim shower make full exact animation and chunks will clear after the animation is about to end and make a deadly animation sound also and when shot is fired the chunks must be cleared in circle shape not in crosshair shape.

Kodari AI
KodariOct 1 at 12:03 pm 4
  1. Add charge and firing audio plus a fuller charge-to-blast animation.

  2. Delay the blast until its animation finishes, then clear five chunk-columns in a circular pattern.

Added charge sounds at the start and during the hold, plus a louder firing sound and a delayed explosion sound. The shooter now hears them too.

The firing effect now has expanding rings, radial streaks, a beam, and a flash. The blast waits until near the end of the 40-tick animation, then clears a circular, full-height area about five chunks in surface area, including bedrock. It removes blocks without drops.

This is a custom screen-space animation, not an exact animated 3D gun replica. The instant blast changes roughly 480,000 block positions, so it may cause a major server hitch; back up the world before testing. I haven’t verified it in-game.

Smarth Saini

very cool but where is that beam coming from sky when i fired a shot and when that beam end a big black hole like structure appear and after 3 sec it blast and that main hole means destruction made by gun appears and when i fired a shot the environment becomes red like a deadly theme

Kodari AI
KodariOct 1 at 12:27 pm 2
  1. Add a sky-origin beam, growing black-hole effect, and blast exactly three seconds later.

  2. Turn the surrounding environment red during the firing sequence, then restore it.

Added the firing sequence: a beam descends from the sky while a smoky, portal-like void expands at the target. After 3 seconds, it detonates and clears the existing circular, full-height blast area—including bedrock. The firing HUD now pulses red and flashes at detonation.

The blast still changes hundreds of thousands of block positions at once, which can cause a major server hitch. I couldn’t verify the effect in-game.

Smarth Saini

nice but i said make a beam which is not on my screen it is on minecraft and the sky becomes red not my screen overall mod is good but make these changes and beam in minecraft remains for atleast 10 sec and the closing animation of beam also result in cleaning of red sky but slowly and make a full deadly sound for it

Kodari AI
KodariOct 1 at 12:39 pm 2
  1. Replace the screen-space beam with a persistent in-world sky-to-target beam lasting at least 10 seconds.

  2. Tint the world sky red during the sequence and fade it back gradually as the beam closes.

  3. Add a layered, ominous charge/beam/impact sound sequence.

  • Replaced the screen-wide red effect with a red tint on the actual sky, synchronized to players in the same world.

  • The in-world beam holds for 10 seconds, then retracts over 2 seconds as the sky fades back. The blast happens when the beam begins retracting.

  • Added recurring dragon-growl audio during the beam, followed by a wither roar and the existing explosion sound.

I haven’t verified the mixin or effects in-game; the blast can still cause a significant server hitch.

Smarth Saini

perfect but the red beam coming from sky is not showing add that

Kodari AI
KodariOct 1 at 12:46 pm 1

Added a bright red in-world beam from the sky to the impact point. It’s sent as forced particles so players can see it from up to 512 blocks away, and it follows the existing 10-second hold and closing animation.

Smarth Saini

make the beam like the given image but with red color and when beam is end a big black hole in red color appear for 5 sec after that the main destruction appears without any delay

1 image attached
Kodari AI
KodariOct 1 at 1:05 pm 3
  1. Make the sky-to-impact beam thick, bright red, and ringed at the impact point.

  2. Retract it, expand a red-rimmed black hole, hold it fully formed for 5 seconds, then detonate immediately.

Updated the in-world beam with a thicker, brighter red column and a circular impact ring. It holds for 10 seconds, retracts over 2 seconds as the red-rimmed black hole grows, then holds at full size for 5 seconds. Destruction triggers on the same tick that hold ends; the existing sound sequence is preserved.

I haven’t verified the effect in-game.

Smarth Saini

nice but where is that black hole after beams end and before original destruction shows add that and makes a circle around the beam and make particles visible from far away and increase range of the target and make the gun legendary means yellow color of name and remove the description of gun

Kodari AI
KodariOct 2 at 8:16 am 1
  1. Make the red beam and black-hole phase clearly visible in-world, including a visible ring and long-range effects.

  2. Increase the weapon’s target range.

  3. Give the gun a yellow name and remove its description.

  1. Beam/black hole: red rings now circle the beam, and black-hole particles are force-sent so they remain visible at long distances, including the five-second hold.

  2. Next: raise the weapon’s configured targeting range.

  1. Added two bright red circular rings around the beam’s impact point. Black-hole particles are now force-sent to players up to 512 blocks away, including throughout its five-second hold.

  2. Increased the target range to 256 blocks, including upgrading existing generated configs.

  3. Made the gun’s name yellow and removed its tooltip description.

I haven’t verified the changes in-game.

Smarth Saini

i said make a circle around beam and before destroying chucks a black hole appears but u dont add that please add that and make a powerful description in gun with different colors

Kodari AI
KodariOct 2 at 10:04 am 2
  1. Fix the in-world beam circle and ensure a visible black hole appears before the destruction sequence.

  2. Add a dramatic multicolored gun description.

Updated the sequence: the beam now has two bright circular rings around its impact point. After the beam closes, a large dark-centered, red-rimmed black hole forms, remains visible for 5 seconds, then destruction begins immediately. The particles are force-sent for long-range visibility.

Added a four-line gun description in dark red, gold, dark purple, and aqua.

Smarth Saini

nice but add more powers in the shot and add extra abilities from your side and in description how we use different powers and make animations more cool and deadly and sounds also but must add different powers with the different keys to change the power option

Kodari AI
KodariOct 2 at 11:01 am 2
  1. Add selectable shot powers with dedicated keybinds and route each firing mode into the weapon’s shot logic.

  2. Upgrade the firing visuals/audio for the powers and document the controls in the gun’s description.

Added four selectable powers. While holding the gun, press 1–4 to choose a mode, then hold right-click to charge and fire. The tooltip now explains each power and its key.

  • 1 — Annihilation: the original sky beam and black hole; clears a full-height column when aimed at a block.

  • 2 — Supernova: triple direct-hit damage and double blast damage.

  • 3 — Singularity: pulls nearby foes toward the black hole.

  • 4 — Rift Lance: 1.5× targeting range and quadruple direct damage, without splash damage.

Each mode now has its own beam and black-hole particle colors and a distinct sound pitch/layering. I haven’t verified the changes in-game.

Smarth Saini

for using different powers use like shift+ left click for first power etc. and in description write all keys for firing certain power and add best animation u could add but it must be deadly and when i fired shot the sky becomes dark red

Kodari AI
KodariOct 2 at 11:11 am 2
  1. Change power selection to Shift + left-click for powers 1–4, and make the tooltip list every selection and firing key.

  2. Improve the shot animation and make the sky turn dark red when a shot is fired.

Added direct power-selection shortcuts; right-click still charges and fires the selected power:

  • Annihilation: Shift + Left-click

  • Supernova: Ctrl + Left-click

  • Singularity: Alt + Left-click

  • Rift Lance: Shift + Ctrl + Left-click

The tooltip lists each selection and firing control. Shots now trigger an immediate beam burst and a 36-tick red targeting flash, while the sky turns deep red at full tint. The existing black-hole and destruction timing is unchanged.

I haven’t verified the visuals in-game.

Smarth Saini

nice but firstly change the buttons for selecting the power and add a power above hotbar that show which power is selected and only first power works and other 3 doesnt work so fix that and make power destructions according to u but dont change first power

Kodari AI
KodariOct 3 at 10:16 am 3
  1. Trace power selection, HUD, and shot handling to find why powers 2–4 fail; preserve power 1 unchanged.

  2. Change the selection controls and add a selected-power HUD indicator.

  3. Implement distinct destructive effects for powers 2–4 and update the controls description.

  1. Replace the fragile modifier-click selector with dedicated power keys and fix server selection delivery.

  2. Show the selected power above the hotbar and list the new controls in the gun tooltip.

  3. Give powers 2–4 distinct destruction effects while leaving power 1’s behavior intact.

Power selection now uses G / H / J / K while holding the gun; right-click still charges and fires. The selected power is displayed above the hotbar, and the tooltip lists every control.

Powers 2–4 now have distinct terrain effects after their charge sequence: Supernova blasts a spherical crater, Singularity carves a funnel, and Rift Lance drills a tunnel along the shot path. Annihilation’s existing behavior is unchanged.

Smarth Saini

make the selecting powers with previous buttons but dont use alt button

Kodari AI
KodariOct 3 at 10:22 am 1

Power selection now uses the previous mouse-button style without Alt: Shift + Left-click selects Annihilation, Ctrl + Left-click selects Supernova, Left-click selects Singularity, and Shift + Ctrl + Left-click selects Rift Lance. While holding the gun, these clicks select powers instead of attacking; hold Right-click to charge and fire. The tooltip lists every control.

Smarth Saini

nice but make different sounds for different power and power singularity and rift lance doesnt do any damage so change their ability like singularity make a tunnel and powers names is shown for only 4 sec after holding not for always and change the description with full details of power but must change sounds for different powers and one more thing change animations as u make same animations for all power with different color please change the animations

Kodari AI
KodariOct 3 at 10:50 am 2
  1. Add a distinct firing sound for each power.

  2. Fix Singularity and Rift Lance so their tunnel abilities also deal damage.

  3. Show the selected power for four seconds after selection, then hide the HUD label.

  4. Expand the tooltip with complete power details and give each power a distinct animation.

Tasks 1–2 done: each power now plays a different firing sound; Singularity drills a widening tunnel and Singularity/Rift Lance deal immediate direct and area damage, with their terrain effects applied on firing. Annihilation’s destruction path remains unchanged. I’ll now make the HUD label time out after four seconds.

  • Sounds: Each power now uses a distinct firing sound.

  • Singularity and Rift Lance: Both deal direct and area damage immediately. Singularity drills a widening tunnel; Rift Lance’s narrow tunnel is now carved immediately when terrain damage is enabled.

  • HUD: The selected power label appears for four seconds after selection, then disappears.

  • Descriptions and animations: The tooltip now details each power’s damage, terrain effect, and controls. Supernova, Singularity, and Rift Lance have distinct flame-burst, collapsing-vortex, and jagged-lightning beam effects. Annihilation’s destruction and animation remain unchanged.

I haven’t verified the visuals in-game.

Smarth Saini

what u do the change is nothing first change the description of gun with full details of mod but all powers have its space of description in different second change sounds of the powers with some deadly sounds third the power singularity and rift lance doesnt do any damage so add any power/destruction u want and add animation in disappearing the power name

Kodari AI
KodariOct 3 at 11:12 am 2
  1. Rewrite the gun’s description with clearly separated details for all four powers.

  2. Make each power’s firing sound distinct and more menacing.

  3. Fix damage for Singularity and Rift Lance, and animate the power-name fade-out.

Tasks 1–3 done: the tooltip now describes the mod and separates all four powers; firing sounds are distinct and more menacing; Singularity and Rift Lance damage targets along the beam and deliver a damage-floor impact blast. I’ll finish by animating the power-name fade-out.

  • Gun description: The tooltip now explains the mod and lists each power’s details and controls on its own line.

  • Sounds: Each power now has a distinct, dramatic sound: Warden sonic boom, explosion, Ender Dragon growl, or Wither spawn.

  • Singularity and Rift Lance: Both damage living targets along the beam and create an impact blast with damage at least equal to the configured direct damage. Their tunnel effects remain; friendly-fire settings are respected.

  • Power-name animation: The selected name appears for four seconds, then fades and slides upward during its final second.

Annihilation’s damage and destruction behavior remain unchanged.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle
Code
21 1,624
src/main/java/com/kodari/galaxydestroyer/GalaxyDestroyerMod.java
package com.kodari.galaxydestroyer;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;

public final class GalaxyDestroyerMod implements ModInitializer {
    public static final String MOD_ID = "galaxydestroyer";
    public static final GalaxyDestroyerItem GALAXY_DESTROYER = registerItem("galaxy_destroyer");
    public static final SoundEvent CHARGE_SOUND = registerSound("galaxy_destroyer_charge");
    public static final SoundEvent FIRE_SOUND = registerSound("galaxy_destroyer_fire");
    public static final SoundEvent IMPACT_SOUND = registerSound("galaxy_destroyer_impact");
    public static final SoundEvent COOLDOWN_SOUND = registerSound("galaxy_destroyer_cooldown");
    public static final SoundEvent BEAM_SOUND = registerSound("galaxy_destroyer_beam");
    public static final SoundEvent CLOSING_SOUND = registerSound("galaxy_destroyer_close");

    @Override
    public void onInitialize() {
        GalaxyDestroyerConfig.load();
        PayloadTypeRegistry.playS2C().register(ShotFxPayload.ID, ShotFxPayload.CODEC);
        PayloadTypeRegistry.playC2S().register(PowerSelectionPayload.ID, PowerSelectionPayload.CODEC);
        ServerPlayNetworking.registerGlobalReceiver(PowerSelectionPayload.ID, (payload, context) -> {
            if (payload.power() >= 0 && payload.power() < 4) {
                var player = context.player();
                if (player.getStackInHand(Hand.MAIN_HAND).isOf(GALAXY_DESTROYER)
                        || player.getStackInHand(Hand.OFF_HAND).isOf(GALAXY_DESTROYER)) {
                    GalaxyDestroyerItem.setSelectedPower(player, payload.power());
                }
            }
        });
        ServerTickEvents.END_SERVER_TICK.register(server -> GalaxyDestroyerItem.tickBeamVisuals());
    }

    private static GalaxyDestroyerItem registerItem(String path) {
        Identifier id = Identifier.of(MOD_ID, path);
        RegistryKey<Item> key = RegistryKey.of(RegistryKeys.ITEM, id);
        return Registry.register(Registries.ITEM, id, new AnimatedGalaxyDestroyerItem(key));
    }

    private static SoundEvent registerSound(String path) {
        Identifier id = Identifier.of(MOD_ID, path);
        return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id));
    }
}