User Tools

Site Tools


tutorial:dimensions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:dimension [2020/02/21 15:59] – The Dimension class earthcomputertutorial:dimensions [2022/01/01 14:46] – fix typo xtexchooser
Line 1: Line 1:
-====== Creating a Dimension [WIP] ======+ 
 +====== Minecraft 1.16 and later ====== 
 + 
 +The information below applies to Minecraft 1.15 and earlier, while in Minecraft 1.16, dimensions can be defined in data packs. More information about custom dimensions in 1.16 can be found in the [[https://minecraft.fandom.com/wiki/Custom_dimension|official wiki]]. 
 + 
 +However, you must still create a portal using fabric, [[tutorial:custom_portals|more information about custom portals here.]] 
 + 
 +An example that also shows some of the fabric-api specific code can be found in the [[https://github.com/FabricMC/fabric/tree/1.16/fabric-dimensions-v1/src/testmod|fabric-dimensions-v1 testmod]]. 
 + 
 +====== Creating a Dimension [WIP] (1.15 and earlier) ======
 Creating your own dimension is an advanced topic. This tutorial assumes you have already read through the previous tutorials on world generation, and have other basic knowledge such as how to create your own blocks. Creating your own dimension is an advanced topic. This tutorial assumes you have already read through the previous tutorials on world generation, and have other basic knowledge such as how to create your own blocks.
  
Line 26: Line 35:
 } }
 </code> </code>
-The ''defaultPlacer'' determines the default placement when an entity is teleported into this dimension. Here we have made it so the entity spawns on the top block at 0, 0 when entering the dimension. If you want custom portal logic, this is the place to do it. See the [[https://github.com/FabricMC/fabric/blob/1.15/fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/v1/EntityPlacer.java|EntityPlacer documentation]] for details.+The ''defaultPlacer'' determines the default placement when an entity is teleported into this dimension. Here we have made itso the entity spawns on the top block at 0, 0 when entering the dimension. If you want custom portal logic, this is the place to do it. See the [[https://github.com/FabricMC/fabric/blob/1.15/fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/v1/EntityPlacer.java|EntityPlacer documentation]] for details.
  
 === The Dimension class === === The Dimension class ===
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
-public class BeeDimension {+public class BeeDimension extends Dimension {
     private static final Vec3d FOG_COLOR = new Vec3d(0.54, 0.44, 0.16);     private static final Vec3d FOG_COLOR = new Vec3d(0.54, 0.44, 0.16);
          
-    public HoneyDimension(World world, DimensionType type) {+    public BeeDimension(World world, DimensionType type) {
         // The third argument indicates how visually bright light level 0 is, with 0 being no extra brightness and 1 being like night vision.         // The third argument indicates how visually bright light level 0 is, with 0 being no extra brightness and 1 being like night vision.
         // The overworld and the end set this to 0, and the Nether sets this to 0.1. We want our dimension to be a bit brighter.         // The overworld and the end set this to 0, and the Nether sets this to 0.1. We want our dimension to be a bit brighter.
Line 63: Line 72:
          
     @Override     @Override
-    public float getSkyAngle(long timeOfDay, float tickDelta) {+    public float getSkyAngle(long worldTime, float tickDelta) { 
 +        // Returns a sky angle ranging between 0 and 1. 
 +        // This is a very simple implementation that approximates the overworld sky angle, but is easier to understand. 
 +        // In the overworld, the sky does not quite move at a constant rate, see the OverworldDimension code for details.
         final int dayLength = 24000;         final int dayLength = 24000;
-        return ((timeOfDay % dayLength) + tickDelta) / dayLength;+        double daysPassed = ((doubleworldTime + tickDelta) / dayLength
 +        return MathHelper.fractionalPart(daysPassed - 0.25);
     }     }
          
Line 97: Line 110:
 } }
 </code> </code>
- 
-=== Travelling between dimensions [TODO] === 
  
 === Creating a ChunkGenerator [TODO] === === Creating a ChunkGenerator [TODO] ===
tutorial/dimensions.txt · Last modified: 2023/09/24 18:56 by mattidragon