1313import me .isaiah .common .IServer ;
1414import me .isaiah .common .Side ;
1515import me .isaiah .common .cmixin .IMixinMinecraftServer ;
16+ import me .isaiah .common .cmixin .IMixinWorld ;
1617import me .isaiah .common .world .IWorld ;
1718import net .minecraft .MinecraftVersion ;
1819import net .minecraft .item .ItemStack ;
1920import net .minecraft .resource .ResourcePackProfile ;
2021import net .minecraft .server .MinecraftServer ;
22+ import net .minecraft .server .world .ServerWorld ;
23+ import net .minecraft .util .Identifier ;
2124import net .minecraft .util .JsonHelper ;
2225import net .minecraft .village .TradeOffer ;
26+ import net .minecraft .world .World ;
2327
2428public class FabricServer implements IServer {
2529
30+ private static FabricServer INSTANCE ;
31+
32+ public static FabricServer getInstance () {
33+ return INSTANCE ;
34+ }
35+
2636 private MinecraftServer mc ;
2737 public HashMap <String , IWorld > worlds ;
38+ public HashMap <String , IWorld > worldsMap ;
2839
2940 public FabricServer (MinecraftServer mc ) {
41+ FabricServer .INSTANCE = this ;
3042 this .mc = mc ;
3143 this .worlds = new HashMap <>();
44+ this .worldsMap = new HashMap <>();
3245 }
3346
34- public void world (IWorld icommon , String name ) {
47+ public void world (IWorld icommon , String name , Identifier worldId ) {
3548 worlds .put (name , icommon );
49+ worldsMap .put (worldId .toString (), icommon );
50+ }
51+
52+ public IWorld getIWorldForMinecraftWorld (World world ) {
53+ return worldsMap .get (world .getRegistryKey ().getValue ().toString ());
3654 }
3755
3856 @ Override
@@ -44,6 +62,11 @@ public String getMinecraftVersion() {
4462 public Collection <IWorld > getWorlds () {
4563 return worlds .values ();
4664 }
65+
66+ @ Override
67+ public IWorld getWorld (Identifier id ) {
68+ return worldsMap .get (id .toString ());
69+ }
4770
4871 @ Override
4972 public IWorld getWorld (String name ) {
0 commit comments