mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Properly propagate the DimensionType information from server to client
at client connection time. This means the client now knows about the dimensiontype properly and can access the ModDimension information on the client. Signed-off-by: cpw <[email protected]>
This commit is contained in:
16 files changed
+220
-409
No files matched your search
@@ -86,6 +86,21 @@ public class DimensionManager
|
||||
private static final Map<ResourceLocation, SavedEntry> savedEntries = new HashMap<>();
|
||||
private static volatile Set<World> playerWorlds = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Register or get the existing dimension type for the given dimtype name.
|
||||
*
|
||||
* Dimensions already known to the save are loaded into the DimensionType map before the {@link RegisterDimensionsEvent} is fired.
|
||||
* You can use this helper to get your existing dimension, or create it if it is not found.
|
||||
*
|
||||
* @param name Registry name
|
||||
* @param type ModDimension type data
|
||||
* @param data Extra data for the ModDimension
|
||||
* @param hasSkyLight does this dimension have a skylight?
|
||||
* @return the DimensionType for the dimension.
|
||||
*/
|
||||
public static DimensionType registerOrGetDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight) {
|
||||
return REGISTRY.getValue(name).orElseGet(()->registerDimension(name, type, data, hasSkyLight));
|
||||
}
|
||||
/**
|
||||
* Registers a real unique dimension, Should be called on server init, or when the dimension is created.
|
||||
* On the client, the list will be reset/reloaded every time a InternalServer is refreshed.
|
||||
@@ -95,6 +110,8 @@ public class DimensionManager
|
||||
* @param name Registry name for this new dimension.
|
||||
* @param type Dimension Type.
|
||||
* @param data Configuration data for this dimension, passed into
|
||||
* @param hasSkyLight skylight for this dimension
|
||||
* @return the DimensionType for the dimension.
|
||||
*/
|
||||
public static DimensionType registerDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user