类 RegistryCodecTest

java.lang.Object
net.neoforged.neoforge.oldtest.misc.RegistryCodecTest

public class RegistryCodecTest extends Object
This test mod show a few example usages of Registry.byNameCodec() to serialize and deserialize registry entries to JSON or NBT. There are 4 tested cases : 1. json -> Pair 2. Pair -> nbt 3. Pair -> compressed json 4. compressed json -> Pair For each test the result will be logged.
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    private static final com.mojang.serialization.Codec<com.mojang.datafixers.util.Pair<Block,Item>>
    This Codec can serialize and deserialize a Pair<Item, Block>.
    private static final org.apache.logging.log4j.Logger
     
  • 构造器概要

    构造器
    构造器
    说明
    RegistryCodecTest(net.neoforged.bus.api.IEventBus modEventBus)
     
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    commonSetup(net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent event)
     

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • CODEC

      private static final com.mojang.serialization.Codec<com.mojang.datafixers.util.Pair<Block,Item>> CODEC
      This Codec can serialize and deserialize a Pair<Item, Block>. The resulting JSON (or NBT equivalent) will have this structure:
      
       {
           "block": "block_registry_name",
           "item": "item_registry_name"
       }
       
  • 构造器详细资料

    • RegistryCodecTest

      public RegistryCodecTest(net.neoforged.bus.api.IEventBus modEventBus)
  • 方法详细资料

    • commonSetup

      public void commonSetup(net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent event)