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:
cpw committed 2019-10-02 21:54:02 -04:00
1 parent c985225d0c
commit 48735c3946
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)
{