Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

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.

  • Author
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?

  • Author

I actually managed to find the solution after doing some digging and experimentation with this - thanks to your help, so thanks!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.