Jump to content

Crash when meddling with capabilities


cowlegs

Recommended Posts

Back again talking about capabilities :S

I created a value attached to the player called 'Nentype' which is equal to 0 initially, the plan is to make it so that when the player loads into the game an event in run which changes 'Nentype' to a random number between 1 and 5 if it's currently set to 0, which will then save upon death/leaving the game, meaning it can't be changed and is set in place.

For some reason, whenever I run the client it loads up fine, but then upon initialization of my world it crashes at the last second and closes down!

 

My EventHandler;

Spoiler

package net.minecraft.util.text;

public class TextComponentString extends TextComponentBase
{
    private final String text;

    public TextComponentString(String msg)
    {
        this.text = msg;
    }

    /**
     * Gets the text value of this component. This is used to access the {@link #text} property, and only should be used
     * when dealing specifically with instances of {@link TextComponentString} - for other purposes, use {@link
     * #getUnformattedComponentText()}.
     */
    public String getText()
    {
        return this.text;
    }

    /**
     * Gets the raw content of this component (but not its sibling components), without any formatting codes. For
     * example, this is the raw text in a {@link TextComponentString}, but it's the translated text for a {@link
     * TextComponentTranslation} and it's the score value for a {@link TextComponentScore}.
     */
    public String getUnformattedComponentText()
    {
        return this.text;
    }

    /**
     * Creates a copy of this component.  Almost a deep copy, except the style is shallow-copied.
     */
    public TextComponentString createCopy()
    {
        TextComponentString textcomponentstring = new TextComponentString(this.text);
        textcomponentstring.setStyle(this.getStyle().createShallowCopy());

        for (ITextComponent itextcomponent : this.getSiblings())
        {
            textcomponentstring.appendSibling(itextcomponent.createCopy());
        }

        return textcomponentstring;
    }

    public boolean equals(Object p_equals_1_)
    {
        if (this == p_equals_1_)
        {
            return true;
        }
        else if (!(p_equals_1_ instanceof TextComponentString))
        {
            return false;
        }
        else
        {
            TextComponentString textcomponentstring = (TextComponentString)p_equals_1_;
            return this.text.equals(textcomponentstring.getText()) && super.equals(p_equals_1_);
        }
    }

    public String toString()
    {
        return "TextComponent{text='" + this.text + '\'' + ", siblings=" + this.siblings + ", style=" + this.getStyle() + '}';
    }
}

 

I've rooted the cause down to being this section, though I'm not sure why it's causing issues... I thought that maybe it's because it's some kind of looping issue causing the crash, but who knows.

Spoiler

 INentype nentype = player.getCapability(NentypeProvider.NEN_TYPE, null);

 if (nentype.getNentype() == 0.0F) {
     String messagetype = String.format("You have no nen type?!?!?!."); player.sendMessage(new TextComponentString(messagetype));
     player.sendMessage(new TextComponentString(messagetype));

     return;
 }

 

 

Crash Log:

Spoiler

---- Minecraft Crash Report ----
// Oh - I know what I did wrong!

Time: 3/25/18 8:40 PM
Description: Ticking memory connection

java.lang.NullPointerException: Ticking memory connection
    at com.Cowlegs.HXHMod.util.handlers.hxhEventHandler.onPlayerLogsIn(hxhEventHandler.java:39)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_14_hxhEventHandler_onPlayerLogsIn_PlayerLoggedInEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
    at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerLoggedIn(FMLCommonHandler.java:574)
    at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(PlayerList.java:228)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:259)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.access$100(NetworkDispatcher.java:72)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:208)
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307)
    at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:863)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
    at java.lang.Thread.run(Thread.java:748)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
    at com.Cowlegs.HXHMod.util.handlers.hxhEventHandler.onPlayerLogsIn(hxhEventHandler.java:39)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_14_hxhEventHandler_onPlayerLogsIn_PlayerLoggedInEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
    at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerLoggedIn(FMLCommonHandler.java:574)
    at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(PlayerList.java:228)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:259)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.access$100(NetworkDispatcher.java:72)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:208)
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307)

-- Ticking connection --
Details:
    Connection: net.minecraft.network.NetworkManager@5f2bdea0
Stacktrace:
    at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:863)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
    at java.lang.Thread.run(Thread.java:748)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_161, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 540431800 bytes (515 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
    FML: MCP 9.42 Powered by Forge 14.23.2.2624 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State     | ID        | Version      | Source                           | Signature |
    |:--------- |:--------- |:------------ |:-------------------------------- |:--------- |
    | UCHIJAAAA | minecraft | 1.12.2       | minecraft.jar                    | None      |
    | UCHIJAAAA | mcp       | 9.42         | minecraft.jar                    | None      |
    | UCHIJAAAA | FML       | 8.0.99.99    | forgeSrc-1.12.2-14.23.2.2624.jar | None      |
    | UCHIJAAAA | forge     | 14.23.2.2624 | forgeSrc-1.12.2-14.23.2.2624.jar | None      |
    | UCHIJAAAA | hxh       | 1.0          | bin                              | None      |

    Loaded coremods (and transformers): 
    GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
    Profiler Position: N/A (disabled)
    Player Count: 1 / 8; [EntityPlayerMP['Player899'/262, l='New World', x=-173.94, y=69.00, z=-58.50]]
    Type: Integrated Server (map_client.txt)
    Is Modded: Definitely; Client brand changed to 'fml,forge'

 

Edited by cowlegs
Added crash report
Link to comment
Share on other sites

Please provide the crash-log. It has all the answers.

Your eventhandler also looks awefully a lot like a TextComponentString class, not an actual class that deals with events...


For now I'm going to guess that you're using the PlayerLoggedInEvent?
You need to wait a tick before doing anything with the given player from that event; it isn't fully initialized, leading to several null-pointers.

  • Like 1

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

2 minutes ago, Matryoshika said:

Please provide the crash-log. It has all the answers.

Your eventhandler also looks awefully a lot like a TextComponentString class, not an actual class that deals with events...


For now I'm going to guess that you're using the PlayerLoggedInEvent?
You need to wait a tick before doing anything with the given player from that event; it isn't fully initialized, leading to several null-pointers.

You'd be right, I AM using the PlayerLoggedInEvent  (Sorry if I didn't provide enough info, since I'm pretty new to this I sometimes get confused on what I should and shouldn't list out..). I also realized I should probably add the crash log, and edited it in. Though you wouldn't have noticed if you hadn't refreshed the page, so my bad :S 

Either way, what would you suggest I do to fix this?

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When i try to launch Minecraft Java 1.20.1 forge with mods (82 mods),on start it loaded all mods,but at end Java just crashed.  p.s i allocated 8GB ram for minecraft and i didn't runned another instance.Log file pp.s I use ATlauncher   Environment: Organising filesystem [24/04/2024 23:40:08 PM] ATLauncher Version: 3.4.36.3 [11ae0b2334c236e93ee8128de980952b2a1b8900] [24/04/2024 23:40:08 PM] App Arguments: ["--install-method=aur","--no-launcher-update"] [24/04/2024 23:40:08 PM] JVM Arguments: ["-Dawt.useSystemAAFontSettings=on","-Dswing.aatext=true"] [24/04/2024 23:40:08 PM] Java Version: Java 22 (22) [24/04/2024 23:40:08 PM] Java Path: /usr/lib/jvm/java-22-openjdk [24/04/2024 23:40:08 PM] 64 Bit Java: true [24/04/2024 23:40:08 PM] RAM Available: 14931MB [24/04/2024 23:40:08 PM] Launcher Directory: **USERSDIR** [24/04/2024 23:40:08 PM] GPU: IvyBridge GT2 [HD Graphics 4000] (Intel Corporation (0x8086)) unknown 256MB VRAM [24/04/2024 23:40:08 PM] CPU: Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz 4 cores/8 threads [24/04/2024 23:40:08 PM] Operating System: EndeavourOS (unknown (unknown) build 6.8.7-arch1-1) [24/04/2024 23:40:08 PM] Bitness: 64 [24/04/2024 23:40:08 PM] Uptime: 15889 [24/04/2024 23:40:08 PM] Manufacturer: GNU/Linux
    • If you have nvidia graphics, don't touch your amd drivers, otherwise it might fix it but keep running on integrated graphics, which will result in terrible performance. For nvidia graphics, you need to tell windows and nvidia control panel that anything Minecraft related (the launcher, java, etc...) should prefer high performance graphics so that it actually uses your nvidia gpu
    • In the ever-evolving landscape of technology, the rise of cryptocurrencies and digital assets has introduced both unparalleled opportunities and unprecedented challenges. As these digital currencies become increasingly prevalent, so too does the risk of theft and loss. Yet, amidst the complexity and uncertainty, there exists a beacon of hope: ADRIAN LAMO HACKER. Technology has indeed become more sophisticated and enhanced, presenting new challenges in the realm of asset recovery. However, just as any other currency can be stolen or lost, crypto and digital assets are not beyond redemption. With the right expertise and guidance, recovery is possible and achievable. Contact ADRIAN LAMO HACKER via the website: https://adrianlamohackpro.online/ , a trusted, honest, and certified agency specializing in the retrieval of stolen or lost digital assets. In my own experience, I found myself in dire straits after falling victim to cybercriminals who absconded with a significant portion of my crypto holdings. It was a daunting situation, but I refused to succumb to despair. Upon engaging ADRIAN LAMO HACKER, their professionalism, and integrity immediately struck me, as an unwavering commitment to their clients. They deeply understand blockchain technology and utilize advanced methodologies to trace and recover lost or stolen funds. Their approach is meticulous, their expertise unparalleled, and their results speak for themselves. In a matter of days, ADRIAN LAMO HACKER successfully traced and recovered over 90% of my stolen funds, a feat I once believed to be unattainable. Their fees were fair and transparent, and communication throughout the process was nothing short of excellent. They kept me informed every step of the way, providing reassurance and guidance when I needed it most. For anyone who has fallen victim to crypto theft or loss, I wholeheartedly recommend ADRIAN LAMO HACKER. They are not just experts in their field; they are guardians of justice in the digital realm. With their assistance, you can reclaim what's rightfully yours and emerge stronger than ever before. So, if you find yourself grappling with the devastation of lost or stolen digital assets, don't despair. Reach out to ADRIAN LAMO HACKER via website: https://adrianlamohackpro.online/  / Telegram: @ADRIANLAMOHACKERTECH and let them guide you toward a brighter tomorrow.
  • Topics

×
×
  • Create New...

Important Information

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