Jump to content

Help updating some code to Minecraft 1.19.2


suprB

Recommended Posts

I am updating a mod from 1.18.2. However, there are some parts I cannot figure out, mainly because I cannot find new alternatives as some classes have been removed. These are the parts:

ProgressOption, CycleOption & Option:

Spoiler
private static final Option[] OPTIONS = new Option[] { MobOptions.INVINCIBLE , MobOptions.RARITY };

// MobOptions class...
public static final ProgressOption RARITY = new ProgressOption("cs.mobs.rarity", 0.1, 1, 0.001F,
    gameSettings -> Config.CLIENT.mobs.spawn.rarity.get(),
    (gamesettings, value) -> {
        Config.CLIENT.mobs.spawn.rarity.set(value);
        Config.save();
    },
    (gameSettings, option) -> Component.translatable("cs.mobs.rarity.format")
);

public static final CycleOption<Boolean> INVINCIBLE = CycleOption.createOnOff("cs.mobs.invincible", 
    (settings) ->  Config.CLIENT.mobs.invincible.get(), 
    (settings, function, value) -> {
         Config.CLIENT.mobs.invincible.set(value);
        Config.save();
    }
);

 

Hide Crosshair:

Spoiler
public void onRenderOverlay(RenderGameOverlayEvent.PreLayer event) {
    Crosshair crosshair = CrosshairHandler.get().getCurrentCrosshair();
    if (event.getOverlay() == ForgeIngameGui.CROSSHAIR_ELEMENT && (crosshair == null || crosshair.isDefault())) {
        event.setCanceled(true);
    }
}

 

The problem is that I don't know what's the alternative to Option, ProgressOption and CycleOption (there is CycleButton but I cannot find the others) and there is no RenderGameOverlayEvent or ForgeIngameGui. How can I update this?

Edited by suprB
Add a comment
Link to comment
Share on other sites

I have no idea about the first one.

I suggest you look at where those classes are used by Mojang in 1.18.2, then compare it with the corresponding code in 1.19.2

 

This will probably help with the second one?

https://forums.minecraftforge.net/topic/115993-how-to-remove-the-sight-cross-in-the-center-of-the-screen/?do=findComment&comment=512655

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.