11package  dev .compactmods .machines ;
22
33import  dev .compactmods .machines .api .core .Constants ;
4+ import  dev .compactmods .machines .api .tunnels .capability .CapabilityTunnel ;
45import  dev .compactmods .machines .command .Commands ;
56import  dev .compactmods .machines .config .CommonConfig ;
67import  dev .compactmods .machines .config .EnableVanillaRecipesConfigCondition ;
78import  dev .compactmods .machines .config .ServerConfig ;
8- import  dev .compactmods .machines .core .Registries ;
9- import  dev .compactmods .machines .core .UIRegistration ;
9+ import  dev .compactmods .machines .core .*;
1010import  dev .compactmods .machines .dimension .Dimension ;
1111import  dev .compactmods .machines .graph .Graph ;
12+ import  dev .compactmods .machines .machine .CompactMachineBlockEntity ;
1213import  dev .compactmods .machines .machine .Machines ;
14+ import  dev .compactmods .machines .room .RoomEventHandler ;
1315import  dev .compactmods .machines .room .data .LootFunctions ;
16+ import  dev .compactmods .machines .room .network .RoomNetworkHandler ;
1417import  dev .compactmods .machines .shrinking .Shrinking ;
18+ import  dev .compactmods .machines .tunnel .TunnelWallEntity ;
1519import  dev .compactmods .machines .tunnel .Tunnels ;
1620import  dev .compactmods .machines .upgrade .MachineRoomUpgrades ;
1721import  dev .compactmods .machines .wall .Walls ;
@@ -62,28 +66,18 @@ public void onInitialize() {
6266        doRegistration ();
6367
6468        // Configuration 
65-         ModLoadingContext  mlCtx  = ModLoadingContext .get ();
66-         mlCtx .registerConfig (ModConfig .Type .COMMON , CommonConfig .CONFIG );
67-         mlCtx .registerConfig (ModConfig .Type .SERVER , ServerConfig .CONFIG );
69+         ModLoadingContext .registerConfig (Constants .MOD_ID , ModConfig .Type .COMMON , CommonConfig .CONFIG );
70+         ModLoadingContext .registerConfig (Constants .MOD_ID , ModConfig .Type .SERVER , ServerConfig .CONFIG );
6871
6972        EnableVanillaRecipesConfigCondition .register ();
7073
71- //        UIRegistration.init(); TODO: PORT 
72- //        Tunnels.init(); 
73- //        CMGraphRegistration.init(); 
74- //        MachineRoomUpgrades.init(); 
75- //        CompactMachinesCommands.init(); 
76- //        CompactMachinesLootFunctions.init(); 
77- // 
78- //        ModLoadingContext.registerConfig(MOD_ID, ModConfig.Type.COMMON, CommonConfig.CONFIG); 
79- //        ModLoadingContext.registerConfig(MOD_ID, ModConfig.Type.SERVER, ServerConfig.CONFIG); 
80- //        ModConfigEvent.LOADING.register(CommonConfig::onLoaded); 
81- //        ServerWorldEvents.LOAD.register(ServerEventHandler::onWorldLoaded); 
82- //        ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register(ServerEventHandler::onPlayerDimChange); 
83- //        ServerPlayConnectionEvents.JOIN.register(ServerEventHandler::onPlayerLogin); 
84- //        CommonEventHandler.init(); 
85- //        RoomEventHandler.init(); 
86- //        ModBusEvents.setup(); 
74+         ModConfigEvent .LOADING .register (CommonConfig ::onLoaded );
75+         ServerWorldEvents .LOAD .register (ServerEventHandler ::onWorldLoaded );
76+         ServerEntityWorldChangeEvents .AFTER_PLAYER_CHANGE_WORLD .register (ServerEventHandler ::onPlayerDimChange );
77+         ServerPlayConnectionEvents .JOIN .register (ServerEventHandler ::onPlayerLogin );
78+         CommonEventHandler .init ();
79+         RoomEventHandler .init ();
80+         ModBusEvents .setup ();
8781
8882        CompactMachinesNet .CHANNEL .initServerListener ();
8983        RoomNetworkHandler .CHANNEL .initServerListener ();
@@ -92,47 +86,43 @@ public void onInitialize() {
9286            RoomNetworkHandler .CHANNEL .initClientListener ();
9387        }
9488
95-         Registration .init ();
96- 
9789        ItemStorage .SIDED .registerForBlockEntities ((blockEntity , context ) -> {
9890            if  (blockEntity  instanceof  CompactMachineBlockEntity  machine )
9991                return  machine .getTunnelContext (CapabilityTunnel .ITEM , context );
10092            if  (blockEntity  instanceof  TunnelWallEntity  tunnel )
10193                return  tunnel .getCapability (CapabilityTunnel .ITEM , context );
10294            return  null ;
103-         }, Registration .MACHINE_TILE_ENTITY .get (), Tunnels .TUNNEL_BLOCK_ENTITY .get ());
95+         }, Machines .MACHINE_TILE_ENTITY .get (), Tunnels .TUNNEL_BLOCK_ENTITY .get ());
10496        FluidStorage .SIDED .registerForBlockEntities ((blockEntity , context ) -> {
10597            if  (blockEntity  instanceof  CompactMachineBlockEntity  machine )
10698                return  machine .getTunnelContext (CapabilityTunnel .FLUID , context );
10799            if  (blockEntity  instanceof  TunnelWallEntity  tunnel )
108100                return  tunnel .getCapability (CapabilityTunnel .FLUID , context );
109101            return  null ;
110-         }, Registration .MACHINE_TILE_ENTITY .get (), Tunnels .TUNNEL_BLOCK_ENTITY .get ());
102+         }, Machines .MACHINE_TILE_ENTITY .get (), Tunnels .TUNNEL_BLOCK_ENTITY .get ());
111103        EnergyStorage .SIDED .registerForBlockEntities ((blockEntity , context ) -> {
112104            if  (blockEntity  instanceof  CompactMachineBlockEntity  machine )
113105                return  machine .getTunnelContext (CapabilityTunnel .ENERGY , context );
114106            if  (blockEntity  instanceof  TunnelWallEntity  tunnel )
115107                return  tunnel .getCapability (CapabilityTunnel .ENERGY , context );
116108            return  null ;
117-         }, Registration .MACHINE_TILE_ENTITY .get (), Tunnels .TUNNEL_BLOCK_ENTITY .get ());
109+         }, Machines .MACHINE_TILE_ENTITY .get (), Tunnels .TUNNEL_BLOCK_ENTITY .get ());
118110    }
119111
120112    /** 
121113     * Sets up the deferred registration for usage in package/module setup. 
122114     */ 
123115    private  static  void  doRegistration () {
124-         var  bus  = FMLJavaModLoadingContext .get ().getModEventBus ();
125- 
126-         Registries .BLOCKS .register (bus );
127-         Registries .ITEMS .register (bus );
128-         Registries .BLOCK_ENTITIES .register (bus );
129-         Registries .TUNNEL_DEFINITIONS .register (bus );
130-         Registries .CONTAINERS .register (bus );
131-         Registries .UPGRADES .register (bus );
132-         Registries .NODE_TYPES .register (bus );
133-         Registries .EDGE_TYPES .register (bus );
134-         Registries .COMMAND_ARGUMENT_TYPES .register (bus );
135-         Registries .LOOT_FUNCS .register (bus );
116+         Registries .BLOCKS .register ();
117+         Registries .ITEMS .register ();
118+         Registries .BLOCK_ENTITIES .register ();
119+         Registries .TUNNEL_DEFINITIONS .register ();
120+         Registries .CONTAINERS .register ();
121+         Registries .UPGRADES .register ();
122+         Registries .NODE_TYPES .register ();
123+         Registries .EDGE_TYPES .register ();
124+         Registries .COMMAND_ARGUMENT_TYPES .register ();
125+         Registries .LOOT_FUNCS .register ();
136126    }
137127
138128    private  static  void  preparePackages () {
0 commit comments