-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/vandendaelen/handles/helpers/DimensionHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.vandendaelen.handles.helpers; | ||
|
||
import net.minecraft.world.dimension.DimensionType; | ||
import net.minecraft.world.server.ServerWorld; | ||
import net.minecraftforge.fml.server.ServerLifecycleHooks; | ||
|
||
import java.text.MessageFormat; | ||
import java.util.ArrayList; | ||
import java.util.stream.Collectors; | ||
|
||
public class DimensionHelper { | ||
public static DimensionType getDimension(int id){ | ||
ArrayList<ServerWorld> worlds = new ArrayList<>(); | ||
ServerLifecycleHooks.getCurrentServer().getWorlds().iterator().forEachRemaining(worlds::add); | ||
return worlds.get(id).getDimension().getType(); | ||
} | ||
|
||
public static ArrayList<String> getPrettyDimensionList(){ | ||
ArrayList<ServerWorld> worlds = new ArrayList<>(); | ||
ServerLifecycleHooks.getCurrentServer().getWorlds().iterator().forEachRemaining(worlds::add); | ||
return (ArrayList<String>) worlds.stream().map(w -> MessageFormat.format("{0} - {1}", worlds.indexOf(w), w.getDimension().getType().getRegistryName().getNamespace())).collect(Collectors.toList()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters