Skip to content

Commit

Permalink
Fix world create
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Feb 1, 2024
1 parent 7250fe5 commit 0b8649d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
+ continue;
+ }
+ }
+ World.setGeneratorAndEnv(this.server.getGenerator(name), ForgeInjectBukkit.environment.get(registrykey1));
+ World.setGeneratorAndEnv(this.server.getGenerator(name), ForgeInjectBukkit.environment.getOrDefault(dimensiontype1, org.bukkit.World.Environment.CUSTOM));
+ // Mohist start - split calculate for ServerLeverl Preparing
+ IChunkStatusListener mohist$progressListener = this.field_213220_d.create(11);
+ ServerWorld serverworld1 = new ServerWorld(this, this.field_213217_au, this.field_71310_m, derivedworldinfo, registrykey1, dimensiontype1, mohist$progressListener, chunkgenerator1, flag, j, ImmutableList.of(), false);
Expand Down
2 changes: 1 addition & 1 deletion patches/minecraft/net/minecraft/world/World.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
}
-
+ if (environment == null) {
+ environment = ForgeInjectBukkit.environment.getOrDefault(typeKey, org.bukkit.World.Environment.CUSTOM);
+ environment = ForgeInjectBukkit.environment.getOrDefault(p_i241925_3_, org.bukkit.World.Environment.CUSTOM);
+ }
+ func_175723_af().world = this; // Mohist move form ServerWorld
this.field_217407_c = Thread.currentThread();
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/mohistmc/forge/ForgeInjectBukkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@

public class ForgeInjectBukkit {

public static BiMap<RegistryKey<DimensionType>, World.Environment> environment =
HashBiMap.create(ImmutableMap.<RegistryKey<DimensionType>, World.Environment>builder()
.put(DimensionType.OVERWORLD_LOCATION, World.Environment.NORMAL)
.put(DimensionType.NETHER_LOCATION, World.Environment.NETHER)
.put(DimensionType.END_LOCATION, World.Environment.THE_END)
public static BiMap<DimensionType, World.Environment> environment =
HashBiMap.create(ImmutableMap.<DimensionType, World.Environment>builder()
.put(DimensionType.DEFAULT_OVERWORLD, World.Environment.NORMAL)
.put(DimensionType.DEFAULT_NETHER, World.Environment.NETHER)
.put(DimensionType.DEFAULT_END, World.Environment.THE_END)
.build());

public static BiMap<World.Environment, RegistryKey<Dimension>> environment0 =
Expand Down Expand Up @@ -222,6 +222,7 @@ public static void addEnumEnvironment(Registry<Dimension> registry) {
String name = normalizeName(key.location().toString());
int id = i - 1;
environment1 = MohistEnumHelper.addEnum(World.Environment.class, name, new Class[]{Integer.TYPE}, new Object[]{id});
environment.put(dimensionType, environment1);
environment0.put(environment1, key);
MohistMC.LOGGER.debug("Registered forge DimensionType as environment {}", environment1);
i++;
Expand Down

0 comments on commit 0b8649d

Please sign in to comment.