Skip to content

Commit d58b84f

Browse files
committed
Save
1 parent 535f60c commit d58b84f

File tree

9 files changed

+205047
-60
lines changed

9 files changed

+205047
-60
lines changed

src/main/java/com/cyao/FlatCarverContext.java

-47
This file was deleted.
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
package com.cyao;
22

33
import net.fabricmc.api.ModInitializer;
4+
import net.minecraft.registry.Registries;
45
import net.minecraft.registry.Registry;
56
import net.minecraft.util.Identifier;
67
import org.slf4j.Logger;
78
import org.slf4j.LoggerFactory;
89

9-
import static net.minecraft.registry.Registries.CHUNK_GENERATOR;
10-
1110
public class FlatMinecraft implements ModInitializer {
1211
public static final String MOD_ID = "flat-minecraft";
1312
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
1413

1514
@Override
1615
public void onInitialize() {
1716
LOGGER.info("Initializing mod");
18-
Registry.register(CHUNK_GENERATOR,
19-
Identifier.of("flat-minecraft:2D-world"),
17+
Registry.register(Registries.CHUNK_GENERATOR,
18+
Identifier.of("flat-minecraft:paper-world"),
2019
PaperChunkGenerator.CODEC);
2120
}
2221
}

src/main/java/com/cyao/PaperChunkGenerator.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private OptionalInt sampleHeightmap(
205205
generationShapeConfig,
206206
DensityFunctionTypes.Beardifier.INSTANCE,
207207
this.settings.value(),
208-
(AquiferSampler.FluidLevelSampler)this.fluidLevelSampler.get(),
208+
this.fluidLevelSampler.get(),
209209
Blender.getNoBlending()
210210
);
211211
chunkNoiseSampler.sampleStartDensity();
@@ -296,9 +296,6 @@ public void carve(
296296
chunkx -> this.createChunkNoiseSampler(chunkx, structureAccessor, Blender.getBlender(chunkRegion), noiseConfig)
297297
);
298298
AquiferSampler aquiferSampler = chunkNoiseSampler.getAquiferSampler();
299-
CarverContext carverContext = new CarverContext(
300-
this, chunkRegion.getRegistryManager(), chunk.getHeightLimitView(), chunkNoiseSampler, noiseConfig, this.settings.value().surfaceRule()
301-
);
302299
CarvingMask carvingMask = ((ProtoChunk)chunk).getOrCreateCarvingMask(carverStep);
303300

304301
for (int j = -8; j <= 8; j++) {
@@ -318,7 +315,7 @@ public void carve(
318315
ConfiguredCarver<?> configuredCarver = registryEntry.value();
319316
chunkRandom.setCarverSeed(seed + (long)l, chunkPos2.x, chunkPos2.z);
320317
if (configuredCarver.shouldCarve(chunkRandom)) {
321-
configuredCarver.carve(carverContext, chunk, biomeAccess2::getBiome, chunkRandom, aquiferSampler, chunkPos2, carvingMask);
318+
// configuredCarver.carve(carverContext, chunk, biomeAccess2::getBiome, chunkRandom, aquiferSampler, chunkPos2, carvingMask);
322319
}
323320

324321
l++;
@@ -336,7 +333,7 @@ public CompletableFuture<Chunk> populateNoise(Blender blender, NoiseConfig noise
336333
return k <= 0 ? CompletableFuture.completedFuture(chunk) : CompletableFuture.supplyAsync(Util.debugSupplier("wgen_fill_noise", () -> {
337334
int l = chunk.getSectionIndex(k * generationShapeConfig.verticalCellBlockCount() - 1 + i);
338335
int m = chunk.getSectionIndex(i);
339-
Set<ChunkSection> set = Sets.<ChunkSection>newHashSet();
336+
Set<ChunkSection> set = Sets.newHashSet();
340337

341338
for (int n = l; n >= m; n--) {
342339
ChunkSection chunkSection = chunk.getSection(n);

src/main/java/com/cyao/mixin/WorldPresetMixin.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@Mixin(WorldPresets.Registrar.class)
2525
public abstract class WorldPresetMixin {
2626
@Unique
27-
private static final RegistryKey<WorldPreset> PAPER_WORLD = RegistryKey.of(RegistryKeys.WORLD_PRESET, Identifier.of("flat-minecraft:2D-world"));
27+
private static final RegistryKey<WorldPreset> PAPER_WORLD = RegistryKey.of(RegistryKeys.WORLD_PRESET, Identifier.of("flat-minecraft:paper-world"));
2828
@Shadow
2929
protected abstract void register(RegistryKey<WorldPreset> key, DimensionOptions dimensionOptions);
3030
@Shadow
@@ -33,7 +33,7 @@ public abstract class WorldPresetMixin {
3333
@Shadow @Final private RegistryEntryLookup<MultiNoiseBiomeSourceParameterList> multiNoisePresetLookup;
3434
@Shadow @Final private RegistryEntryLookup<ChunkGeneratorSettings> chunkGeneratorSettingsLookup;
3535

36-
@Inject(method = "bootstrap()V", at = @At("RETURN"))
36+
@Inject(method = "bootstrap(Lnet/minecraft/world/biome/source/BiomeSource;)V", at = @At("RETURN"))
3737
private void addPresets(CallbackInfo ci) {
3838
RegistryEntry.Reference<MultiNoiseBiomeSourceParameterList> reference = this.multiNoisePresetLookup
3939
.getOrThrow(MultiNoiseBiomeSourceParameterLists.OVERWORLD);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"generator.flat-minecraft.paper-world": "2D Minecraft",
3+
}

0 commit comments

Comments
 (0)