Class FakePlayerFactory

java.lang.Object
net.neoforged.neoforge.common.util.FakePlayerFactory

public class FakePlayerFactory extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static final record 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private static final com.mojang.authlib.GameProfile
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static FakePlayer
    get(net.minecraft.server.level.ServerLevel level, com.mojang.authlib.GameProfile username)
    Get a fake player with a given username, Mods should either hold weak references to the return value, or listen for a WorldEvent.Unload and kill all references to prevent worlds staying in memory, or call this function every time and let Forge take care of the cleanup.
    static FakePlayer
    getMinecraft(net.minecraft.server.level.ServerLevel level)
     
    static void
    unloadLevel(net.minecraft.server.level.ServerLevel level)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • FakePlayerFactory

      public FakePlayerFactory()
  • Method Details

    • getMinecraft

      public static FakePlayer getMinecraft(net.minecraft.server.level.ServerLevel level)
    • get

      public static FakePlayer get(net.minecraft.server.level.ServerLevel level, com.mojang.authlib.GameProfile username)
      Get a fake player with a given username, Mods should either hold weak references to the return value, or listen for a WorldEvent.Unload and kill all references to prevent worlds staying in memory, or call this function every time and let Forge take care of the cleanup.
    • unloadLevel

      public static void unloadLevel(net.minecraft.server.level.ServerLevel level)