| 1 | package net.minecraft.data.worldgen;
|
| 2 |
|
| 3 | import java.util.Optional;
|
| 4 | import net.minecraft.core.HolderGetter;
|
| 5 | import net.minecraft.core.particles.ParticleTypes;
|
| 6 | import net.minecraft.core.registries.Registries;
|
| 7 | import net.minecraft.data.worldgen.biome.OverworldBiomes;
|
| 8 | import net.minecraft.sounds.Musics;
|
| 9 | import net.minecraft.tags.BlockTags;
|
| 10 | import net.minecraft.tags.TimelineTags;
|
| 11 | import net.minecraft.util.ARGB;
|
| 12 | import net.minecraft.util.valueproviders.ConstantInt;
|
| 13 | import net.minecraft.util.valueproviders.UniformInt;
|
| 14 | import net.minecraft.world.attribute.AmbientSounds;
|
| 15 | import net.minecraft.world.attribute.BackgroundMusic;
|
| 16 | import net.minecraft.world.attribute.BedRule;
|
| 17 | import net.minecraft.world.attribute.EnvironmentAttributeMap;
|
| 18 | import net.minecraft.world.attribute.EnvironmentAttributes;
|
| 19 | import net.minecraft.world.clock.WorldClock;
|
| 20 | import net.minecraft.world.clock.WorldClocks;
|
| 21 | import net.minecraft.world.level.CardinalLighting;
|
| 22 | import net.minecraft.world.level.block.Block;
|
| 23 | import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
|
| 24 | import net.minecraft.world.level.dimension.DimensionType;
|
| 25 | import net.minecraft.world.timeline.Timeline;
|
| 26 | import net.minecraft.world.timeline.Timelines;
|
| 27 |
|
| 28 | public class DimensionTypes {
|
| 29 | public static void bootstrap(final BootstrapContext<DimensionType> context) {
|
| 30 | HolderGetter<Block> blocks = context.lookup(Registries.BLOCK);
|
| 31 | HolderGetter<Timeline> timelines = context.lookup(Registries.TIMELINE);
|
| 32 | HolderGetter<WorldClock> clocks = context.lookup(Registries.WORLD_CLOCK);
|
| 33 | EnvironmentAttributeMap overworldAttributes = EnvironmentAttributeMap.builder()
|
| 34 | .set(EnvironmentAttributes.FOG_COLOR, ARGB.vector3fFromRGB24(-4138753))
|
| 35 | .set(EnvironmentAttributes.SKY_COLOR, ARGB.vector3fFromRGB24(OverworldBiomes.calculateSkyColor(0.8F)))
|
| 36 | .set(EnvironmentAttributes.AMBIENT_LIGHT_COLOR, ARGB.vector3fFromRGB24(-16119286))
|
| 37 | .set(EnvironmentAttributes.CLOUD_COLOR, ARGB.vector4fFromARGB32(ARGB.white(0.8F)))
|
| 38 | .set(EnvironmentAttributes.CLOUD_HEIGHT, 192.33F)
|
| 39 | .set(EnvironmentAttributes.BACKGROUND_MUSIC, BackgroundMusic.OVERWORLD)
|
| 40 | .set(EnvironmentAttributes.BED_RULE, BedRule.CAN_SLEEP_WHEN_DARK)
|
| 41 | .set(EnvironmentAttributes.STRAW_BED_RULE, BedRule.DESTROY_ON_LEAVE)
|
| 42 | .set(EnvironmentAttributes.RESPAWN_ANCHOR_WORKS, false)
|
| 43 | .set(EnvironmentAttributes.NETHER_PORTAL_SPAWNS_PIGLINS, true)
|
| 44 | .set(EnvironmentAttributes.AMBIENT_SOUNDS, AmbientSounds.LEGACY_CAVE_SETTINGS)
|
| 45 | .build();
|
| 46 | context.register(
|
| 47 | BuiltinDimensionTypes.OVERWORLD,
|
| 48 | new DimensionType(
|
| 49 | false,
|
| 50 | true,
|
| 51 | false,
|
| 52 | false,
|
| 53 | 1.0,
|
| 54 | -64,
|
| 55 | 384,
|
| 56 | 384,
|
| 57 | blocks.getOrThrow(BlockTags.INFINIBURN_OVERWORLD),
|
| 58 | 0.0F,
|
| 59 | new DimensionType.MonsterSettings(UniformInt.of(0, 7), 0),
|
| 60 | DimensionType.Skybox.OVERWORLD,
|
| 61 | CardinalLighting.Type.DEFAULT,
|
| 62 | overworldAttributes,
|
| 63 | timelines.getOrThrow(TimelineTags.IN_OVERWORLD),
|
| 64 | Optional.of(clocks.getOrThrow(WorldClocks.OVERWORLD))
|
| 65 | )
|
| 66 | );
|
| 67 | context.register(
|
| 68 | BuiltinDimensionTypes.NETHER,
|
| 69 | new DimensionType(
|
| 70 | true,
|
| 71 | false,
|
| 72 | true,
|
| 73 | false,
|
| 74 | 8.0,
|
| 75 | 0,
|
| 76 | 256,
|
| 77 | 128,
|
| 78 | blocks.getOrThrow(BlockTags.INFINIBURN_NETHER),
|
| 79 | 0.1F,
|
| 80 | new DimensionType.MonsterSettings(ConstantInt.of(7), 15),
|
| 81 | DimensionType.Skybox.NONE,
|
| 82 | CardinalLighting.Type.NETHER,
|
| 83 | EnvironmentAttributeMap.builder()
|
| 84 | .set(EnvironmentAttributes.FOG_START_DISTANCE, 10.0F)
|
| 85 | .set(EnvironmentAttributes.FOG_END_DISTANCE, 96.0F)
|
| 86 | .set(EnvironmentAttributes.SKY_LIGHT_COLOR, ARGB.vector3fFromRGB24(Timelines.NIGHT_SKY_LIGHT_COLOR))
|
| 87 | .set(EnvironmentAttributes.SKY_LIGHT_LEVEL, 4.0F)
|
| 88 | .set(EnvironmentAttributes.SKY_LIGHT_FACTOR, 0.0F)
|
| 89 | .set(EnvironmentAttributes.AMBIENT_LIGHT_COLOR, ARGB.vector3fFromRGB24(-13621215))
|
| 90 | .set(EnvironmentAttributes.DEFAULT_DRIPSTONE_PARTICLE, ParticleTypes.DRIPPING_DRIPSTONE_LAVA)
|
| 91 | .set(EnvironmentAttributes.BED_RULE, BedRule.DESTROY_ON_USE)
|
| 92 | .set(EnvironmentAttributes.STRAW_BED_RULE, BedRule.DESTROY_ON_USE)
|
| 93 | .set(EnvironmentAttributes.RESPAWN_ANCHOR_WORKS, true)
|
| 94 | .set(EnvironmentAttributes.WATER_EVAPORATES, true)
|
| 95 | .set(EnvironmentAttributes.FAST_LAVA, true)
|
| 96 | .set(EnvironmentAttributes.PIGLINS_ZOMBIFY, false)
|
| 97 | .set(EnvironmentAttributes.CAN_START_RAID, false)
|
| 98 | .set(EnvironmentAttributes.SNOW_GOLEM_MELTS, true)
|
| 99 | .build(),
|
| 100 | timelines.getOrThrow(TimelineTags.IN_NETHER),
|
| 101 | Optional.empty()
|
| 102 | )
|
| 103 | );
|
| 104 | context.register(
|
| 105 | BuiltinDimensionTypes.END,
|
| 106 | new DimensionType(
|
| 107 | true,
|
| 108 | true,
|
| 109 | false,
|
| 110 | true,
|
| 111 | 1.0,
|
| 112 | 0,
|
| 113 | 256,
|
| 114 | 256,
|
| 115 | blocks.getOrThrow(BlockTags.INFINIBURN_END),
|
| 116 | 0.25F,
|
| 117 | new DimensionType.MonsterSettings(ConstantInt.of(15), 0),
|
| 118 | DimensionType.Skybox.END,
|
| 119 | CardinalLighting.Type.DEFAULT,
|
| 120 | EnvironmentAttributeMap.builder()
|
| 121 | .set(EnvironmentAttributes.FOG_COLOR, ARGB.vector3fFromRGB24(-15199464))
|
| 122 | .set(EnvironmentAttributes.SKY_LIGHT_COLOR, ARGB.vector3fFromRGB24(-5480243))
|
| 123 | .set(EnvironmentAttributes.SKY_COLOR, ARGB.vector3fFromRGB24(-16777216))
|
| 124 | .set(EnvironmentAttributes.SKY_LIGHT_FACTOR, 0.0F)
|
| 125 | .set(EnvironmentAttributes.AMBIENT_LIGHT_COLOR, ARGB.vector3fFromRGB24(-12630209))
|
| 126 | .set(EnvironmentAttributes.BACKGROUND_MUSIC, new BackgroundMusic(Musics.END))
|
| 127 | .set(EnvironmentAttributes.AMBIENT_SOUNDS, AmbientSounds.LEGACY_CAVE_SETTINGS)
|
| 128 | .set(EnvironmentAttributes.BED_RULE, BedRule.DESTROY_ON_USE)
|
| 129 | .set(EnvironmentAttributes.STRAW_BED_RULE, BedRule.DESTROY_ON_USE)
|
| 130 | .set(EnvironmentAttributes.RESPAWN_ANCHOR_WORKS, false)
|
| 131 | .build(),
|
| 132 | timelines.getOrThrow(TimelineTags.IN_END),
|
| 133 | Optional.of(clocks.getOrThrow(WorldClocks.THE_END))
|
| 134 | )
|
| 135 | );
|
| 136 | context.register(
|
| 137 | BuiltinDimensionTypes.OVERWORLD_CAVES,
|
| 138 | new DimensionType(
|
| 139 | false,
|
| 140 | true,
|
| 141 | true,
|
| 142 | false,
|
| 143 | 1.0,
|
| 144 | -64,
|
| 145 | 384,
|
| 146 | 384,
|
| 147 | blocks.getOrThrow(BlockTags.INFINIBURN_OVERWORLD),
|
| 148 | 0.0F,
|
| 149 | new DimensionType.MonsterSettings(UniformInt.of(0, 7), 0),
|
| 150 | DimensionType.Skybox.OVERWORLD,
|
| 151 | CardinalLighting.Type.DEFAULT,
|
| 152 | overworldAttributes,
|
| 153 | timelines.getOrThrow(TimelineTags.IN_OVERWORLD),
|
| 154 | Optional.of(clocks.getOrThrow(WorldClocks.OVERWORLD))
|
| 155 | )
|
| 156 | );
|
| 157 | }
|
| 158 | }
|
| 159 |
|