跳到主要内容

44维度

代码

添加gradle依赖:

maven {url = "https://maven.kyrptonaught.dev"}

modImplementation 'net.kyrptonaught:customportalapi:0.0.1-beta64-1.20.2'
include 'net.kyrptonaught:customportalapi:0.0.1-beta64-1.20.2'

维度json:resources/data/tutorialmod/dimension/kaupendim.json

{
"type": "tutorialmod:kaupendim_type",
"generator": {
"type": "minecraft:noise",
"settings": "minecraft:overworld",
"biome_source": {
"type": "minecraft:multi_noise",
"biomes": [
{
"biome": "minecraft:ocean",
"parameters": {
"temperature": -0.15,
"humidity": 0.2,
"continentalness": 0,
"erosion": 0,
"weirdness": 0.1,
"depth": 0,
"offset": 0
}
},
{
"biome": "minecraft:birch_forest",
"parameters": {
"temperature": 0.2,
"humidity": 0.1,
"continentalness": 0.15,
"erosion": 0,
"weirdness": 0,
"depth": 0,
"offset": 0
}
},
{
"biome": "minecraft:plains",
"parameters": {
"temperature": 0.15,
"humidity": 0,
"continentalness": 0,
"erosion": 0,
"weirdness": 0,
"depth": 0,
"offset": 0
}
},
{
"biome": "tutorialmod:test_biome",
"parameters": {
"temperature": 0,
"humidity": 0,
"continentalness": 0,
"erosion": 0,
"weirdness": 0,
"depth": 0,
"offset": 0
}
}
]
}
}
}

在world中新建一个dimension包:

public class ModDimensions {
public static final RegistryKey<DimensionOptions> KAUPENDIM_KEY = RegistryKey.of(RegistryKeys.DIMENSION,
new Identifier(TutorialMod.MOD_ID, "kaupendim"));
public static final RegistryKey<World> KAUPENDIM_LEVEL_KEY = RegistryKey.of(RegistryKeys.WORLD,
new Identifier(TutorialMod.MOD_ID, "kaupendim"));
public static final RegistryKey<DimensionType> KAUPEN_DIM_TYPE = RegistryKey.of(RegistryKeys.DIMENSION_TYPE,
new Identifier(TutorialMod.MOD_ID, "kaupendim_type"));

public static void bootstrapType(Registerable<DimensionType> context) {
context.register(KAUPEN_DIM_TYPE, new DimensionType(
OptionalLong.of(12000), // fixedTime
false, // hasSkylight
false, // hasCeiling
false, // ultraWarm
true, // natural
1.0, // coordinateScale
true, // bedWorks
false, // respawnAnchorWorks
0, // minY
256, // height
256, // logicalHeight
BlockTags.INFINIBURN_OVERWORLD, // infiniburn
DimensionTypes.OVERWORLD_ID, // effectsLocation
1.0f, // ambientLight
new DimensionType.MonsterSettings(false, false, UniformIntProvider.create(0, 0), 0)));
}
}

TutorialMod中:

CustomPortalBuilder.beginPortal()
.frameBlock(ModBlocks.RUBY_BLOCK)
.lightWithItem(ModItems.CORN)
.destDimID(new Identifier(TutorialMod.MOD_ID, "kaupendim"))
.tintColor(0xc76efa)
.registerPortal();

TutorialModDataGenerator:

registryBuilder.addRegistry(RegistryKeys.DIMENSION_TYPE, ModDimensions::bootstrapType);

ModWorldGenerator:

entries.addAll(registries.getWrapperOrThrow(RegistryKeys.DIMENSION_TYPE));

效果

使用玉米来激活:

image-20240825220005071