▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/Lib99j
Lib99j

Lib99j

Another useful library mod for server-side development.

Оцените первым
422
4

About

This is a mod used as a base for all my mods. Feel free to use it if you wish.

Library Features

  • VFX including locking camera, overlays, and more
  • Server-side gui textures
  • Server-side particles
  • Hide bossbars
  • Custom effects
  • Pondering
  • Easy config creation
  • And more...

Usage

On mod initialization, please run Lib99j.ensureLoaded(). This forces the library to load before yours, which allows all the features to work correctly

build.gradle (Version number from modrinth)

repositories {
	maven { url = 'https://dj.ucc.asn.au/maven/' }
}

dependencies {
  implementation include("com.daniel99j:djutil:1.1")
  implementation include("com.daniel99j:lib99j:VERSION")
}

Ponder (Server-side)

This is a re-creation of Create Mod's ponder system, now server-side. See /mod/ponderplus for an example.

Features:

  • No client mods
  • Skip, rewind, and pause
  • If installed alongside Polydex or Booklet, click once to open a ponder
  • Fast
  • Does not change the player - neither the server or client know you are pondering, everything happens at the network level
  • Fully self-contained
  • No real-world changes
  • Works with Polymer and server-side mods (and client ones too!)

Controls (in-game hud shows these):

  • F: Identify - fly around and it will show what you are looking at
  • SPACE: Pause/play
  • Q: Exit
  • L: Open menu
  • S: Restart scene
  • D: Next scene (if possible)
  • A: Previous scene (if possible)
  • SCROLL: Select step to skip to
  • W: Skip to selected step

Commands:

/ponder all <id>
/ponder item <item>
/ponder item <item> scene <id>
/ponder item hand
/ponder item hand <id>
/ponder scene pause
/ponder scene unpause
/ponder scene exit

Dev commands:

/ponder dev ui_creator -> Opens the UI creator.
/ponder dev ui_creator_from <ponder command> -> Opens the UI creator after running the specified ponder command
/ponder dev toggle_free_movement -> Toggle free movement in a ponder scene
/ponder dev get_edits -> Lists all interactions made with the world in free move mode

UI creator:

  • Stained glass shows safe area
  • Open menu [L] to start editing
  • If on the client hold shift in the menu to see what ponder ui coordinate the cursor is over, CTRL-C to copy

Demo video:

Game properties

  • enableHideableBossbar() makes yellow bossbars white, and using BossBarVisibility you can make any bossbar invisible
  • enableCustomEffectBadLuck() makes the unluck effect show as "Custom Effect (/polymer effects)" and have a custom sprite
  • enablePonder() enables ponder (see above)
  • enableAddingAssetTranslationsToServer() makes all lang files in the assets folder be treated as a server translation in Nucleoid Server Translations API

Configs

  • Lib99j also provides an easy to use config api
  • Per-world, common, client only, and server only configuration options
  • Optional client syncing
  • Uses cloth config for screen
  • In-game server side dialog re-creation of cloth config (/lib99j config {modid})
  • Mod menu support
  • JSON serialization through GSON
  • Supports primitives, identifiers, vec2, vec3, colours automatically in all config screens and config files
  • Use ConfigManager.addConfig(modid, modconfig) to add configs. Each ModConfig contains a nullable ConfigHolder for each context. Just supply a config class and you're done
  • Use ServerConfigCopy.getConfigOption(modid, serializedName, optionClass, fallback) to get a synced option from the server (option must be annotated with sync = true)

Example config class:

public class ExampleConfig {
    @ConfigEntry
    public boolean testBool = true;

    @ConfigEntry(sync = true)
    @SerializedName("wavy_ui")
    public boolean wavyUi = false;

    //Object primitives work too!
    @ConfigEntry(min = 0, max = 10000)
    public Integer explosionDamage = 10;

    @ConfigEntry(displayType = ConfigDisplayType.SLIDER, max = 50, min = 0)
    public int explosionSize = 10;

    @ConfigEntry(displayType = ConfigDisplayType.COLOUR_PICKER)
    public int worldTint = 0xff00ff;

    @ConfigEntry(displayType = ConfigDisplayType.COLOUR_PICKER_ALPHA)
    public int overlayColour = 0xff0000ff;

    @ConfigEntry
    public Identifier packId = Identifier.withDefaultNamespace("test");

    @ConfigEntry
    public Vec2 spawnRotation = Vec2.ZERO;

    @ConfigEntry
    public Vec3 spawnPos = Vec3.ZERO;

    //ChatFormatting is an Enum
    @ConfigEntry
    public ChatFormatting formatType = ChatFormatting.RED;
}

Mod install status

  • Use ModInstallManager.syncInstalledStatus(modid) to mark your mod to have its install status synced, then use ModInstallManager.isInstalled(modid, player) to check if the mod is installed on the client

Gui Utils

  • By default, Lib99j generates a font space range of -256 to 256 (Note, when using eg, space=270, it uses a combo of 256 and 14!). Use GuiUtils.getSpace() and related functions
  • GuiUtils.nextPage(), GuiUtils.previousPage(), and GuiUtils.head() create player heads for use in guis
  • GuiUtils.doesPlayerHaveMods() allows you to see what mods are installed, read the documentation for more info
  • GuiUtils.toast() displays an advancement popup with a custom item and text
  • Now for the meat of it!
  • GuiUtils.generateTexture() and GuiUtils.generateColourableTexture() creates a GuiElementBuilder that has an auto generated item model and definition. Texture format: "examplemod", "ui/test/image". Note that other base paths are accepted, but it is recommended to use /ui/ as other functions use this solely
  • GuiUtils.generateBarTexture() creates a vertical bottom to top filling bar with a base, fill, and overlay.
  • BackgroundTextures are a basic inventory-based font background generator, eg: new BackgroundTexture(Identifier.fromNamespaceAndPath(MagmaNetworkMod.MOD_ID, "test/test_ui"), 176). Uses /ui/ for texture references.

VFX

  • VfxUtils.shake() causes a camerashake effect similar to bedrock edition
  • VfxUtils.addGenericScreenEffect() adds many other client-side effect such as:
  • RED_TINT - Red worldborder tint
  • SNOW - Powder snow overlay
  • FIRE - Self-explanatory
  • NAUSEA - You get it.
  • BLACK_HEARTS - Withered hearts
  • GREEN_HEARTS - Poisoned hearts
  • GREEN_HUNGER - Green hunger haunches
  • BLINDNESS - The blindness effect
  • NIGHT_VISION - The night vision effect
  • CONDUIT_POWER - The conduit power effect
  • DARKNESS - Warden darkness effect
  • LOCK_CAMERA_AND_POS - More complicated, explained next.
  • Camera Locking
  • To lock the player's camera and movement, add the LOCK_CAMERA_AND_POS effect
  • setCameraInterpolation, setCameraPos, setCameraPitch, and setCameraYaw control varius aspects of the locked camera
  • Due to technical reasons, the player is unable to see the hotbar, and the game looks like it is in spectator mode
  • registerCameraLockHandler registers a camera lock handler for a source id, which supplies camera rotation and player
  • MISC
  • VfxUtils.clientSideExplode() causes a client-side explosion destroying blocks (ONLY ON THE CLIENT). Use only for cinematics, as ghost blocks are buggy
  • VfxUtils.fireworkExplode() creates a firework explosion as if a firework actually spawned
  • VfxUtils.sendFakeEntity() sends a client side entity. Note it will never be removed normally, so it is only recommended to use this with lightning bolts or other entities that will be auto-removed

Particles

WORK IN PROGRESS FEATURE, may experience heavy server lag. Rework will happen soon when I have time.

Misc

  • PlayPacketUtils contains a list of all PLAY packets
  • ConfigUtils has some basic configuration functions
  • GameProperties has some toggles and information about the game

This project has no affiliation with Create Mod, Ponder, or any similar mods.

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

26.1.x1.21.x

Платформы

Поддерживаемые окружения

Сервер

Зависимости

Ссылки

Создатели

Детали

Лицензия:
Опубликован:1 год назад
Обновлён:2 месяца назад
Главная