-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
580 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.cyao; | ||
|
||
import net.minecraft.block.BlockState; | ||
import net.minecraft.registry.DynamicRegistryManager; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.HeightLimitView; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.gen.HeightContext; | ||
import net.minecraft.world.gen.chunk.ChunkNoiseSampler; | ||
import net.minecraft.world.gen.noise.NoiseConfig; | ||
import net.minecraft.world.gen.surfacebuilder.MaterialRules; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Function; | ||
|
||
public class FlatCarverContext extends HeightContext { | ||
private final DynamicRegistryManager registryManager; | ||
private final ChunkNoiseSampler chunkNoiseSampler; | ||
private final NoiseConfig noiseConfig; | ||
private final MaterialRules.MaterialRule materialRule; | ||
|
||
public FlatCarverContext(PaperChunkGenerator noiseChunkGenerator, DynamicRegistryManager registryManager, HeightLimitView heightLimitView, ChunkNoiseSampler chunkNoiseSampler, NoiseConfig noiseConfig, MaterialRules.MaterialRule materialRule) { | ||
super(noiseChunkGenerator, heightLimitView); | ||
this.registryManager = registryManager; | ||
this.chunkNoiseSampler = chunkNoiseSampler; | ||
this.noiseConfig = noiseConfig; | ||
this.materialRule = materialRule; | ||
} | ||
|
||
/** @deprecated */ | ||
@Deprecated | ||
public Optional<BlockState> applyMaterialRule(Function<BlockPos, RegistryEntry<Biome>> posToBiome, Chunk chunk, BlockPos pos, boolean hasFluid) { | ||
return this.noiseConfig.getSurfaceBuilder().applyMaterialRule(this.materialRule, this, posToBiome, chunk, this.chunkNoiseSampler, pos, hasFluid); | ||
} | ||
|
||
/** @deprecated */ | ||
@Deprecated | ||
public DynamicRegistryManager getRegistryManager() { | ||
return this.registryManager; | ||
} | ||
|
||
public NoiseConfig getNoiseConfig() { | ||
return this.noiseConfig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
package com.cyao; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import static net.minecraft.registry.Registries.CHUNK_GENERATOR; | ||
|
||
public class FlatMinecraft implements ModInitializer { | ||
public static final String MOD_ID = "flat-minecraft"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); | ||
|
||
@Override | ||
public void onInitialize() { | ||
LOGGER.info("Initializing mod"); | ||
Registry.register(CHUNK_GENERATOR, | ||
Identifier.of("flat-minecraft:2D-world"), | ||
PaperChunkGenerator.CODEC); | ||
} | ||
} |
Oops, something went wrong.