mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 14:50:56 +00:00
Reformat code
This commit is contained in:
@@ -6,7 +6,7 @@ plugins {
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(file("src/main/resources/terra.accesswidener"))
|
||||
|
||||
|
||||
mixin {
|
||||
defaultRefmapName.set("terra.common.refmap.json")
|
||||
}
|
||||
@@ -14,11 +14,11 @@ loom {
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ import com.dfsek.terra.mod.util.PresetUtil;
|
||||
public abstract class ModPlatform extends AbstractPlatform {
|
||||
private final ItemHandle itemHandle = new MinecraftItemHandle();
|
||||
private final WorldHandle worldHandle = new MinecraftWorldHandle();
|
||||
|
||||
|
||||
public abstract MinecraftServer getServer();
|
||||
|
||||
public void registerWorldTypes(BiConsumer<Identifier, WorldPreset> registerFunction) {
|
||||
@@ -110,8 +110,11 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
protected abstract BaseAddon getPlatformAddon();
|
||||
|
||||
public abstract Registry<DimensionType> dimensionTypeRegistry();
|
||||
|
||||
public abstract Registry<Biome> biomeRegistry();
|
||||
|
||||
public abstract Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry();
|
||||
|
||||
public abstract Registry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterListRegistry();
|
||||
|
||||
@Override
|
||||
|
||||
+3
-1
@@ -26,7 +26,9 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticle
|
||||
}
|
||||
|
||||
try {
|
||||
return new BiomeParticleConfig(ParticleEffectArgumentType.readParameters(new StringReader(particle), Registries.PARTICLE_TYPE.getReadOnlyWrapper()), probability);
|
||||
return new BiomeParticleConfig(
|
||||
ParticleEffectArgumentType.readParameters(new StringReader(particle), Registries.PARTICLE_TYPE.getReadOnlyWrapper()),
|
||||
probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ public final class Codecs {
|
||||
|
||||
public static final Codec<TerraBiomeSource> TERRA_BIOME_SOURCE = RecordCodecBuilder
|
||||
.create(instance -> instance.group(
|
||||
CONFIG_PACK.fieldOf("pack")
|
||||
.stable()
|
||||
.forGetter(TerraBiomeSource::getPack))
|
||||
CONFIG_PACK.fieldOf("pack")
|
||||
.stable()
|
||||
.forGetter(TerraBiomeSource::getPack))
|
||||
.apply(instance, instance.stable(TerraBiomeSource::new)));
|
||||
|
||||
public static final Codec<MinecraftChunkGeneratorWrapper> MINECRAFT_CHUNK_GENERATOR_WRAPPER = RecordCodecBuilder
|
||||
|
||||
+2
-1
@@ -129,7 +129,8 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
||||
|
||||
private void beard(StructureAccessor structureAccessor, Chunk chunk, WorldProperties world, BiomeProvider biomeProvider,
|
||||
PreLoadCompatibilityOptions compatibilityOptions) {
|
||||
StructureWeightSampler structureWeightSampler = StructureWeightSampler.createStructureWeightSampler(structureAccessor, chunk.getPos());
|
||||
StructureWeightSampler structureWeightSampler = StructureWeightSampler.createStructureWeightSampler(structureAccessor,
|
||||
chunk.getPos());
|
||||
double threshold = compatibilityOptions.getBeardThreshold();
|
||||
double airThreshold = compatibilityOptions.getAirThreshold();
|
||||
int xi = chunk.getPos().x << 4;
|
||||
|
||||
+3
-3
@@ -63,9 +63,9 @@ public class TerraBiomeSource extends BiomeSource {
|
||||
@Override
|
||||
public RegistryEntry<Biome> getBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseSampler noiseSampler) {
|
||||
return ((ProtoPlatformBiome) pack
|
||||
.getBiomeProvider()
|
||||
.getBiome(biomeX << 2, biomeY << 2, biomeZ << 2, SeedHack.getSeed(noiseSampler))
|
||||
.getPlatformBiome()).getDelegate();
|
||||
.getBiomeProvider()
|
||||
.getBiome(biomeX << 2, biomeY << 2, biomeZ << 2, SeedHack.getSeed(noiseSampler))
|
||||
.getPlatformBiome()).getDelegate();
|
||||
}
|
||||
|
||||
public BiomeProvider getProvider() {
|
||||
|
||||
+2
-1
@@ -36,7 +36,8 @@ public class MinecraftWorldHandle implements WorldHandle {
|
||||
@Override
|
||||
public @NotNull BlockState createBlockState(@NotNull String data) {
|
||||
try {
|
||||
net.minecraft.block.BlockState state = BlockArgumentParser.block(Registries.BLOCK.getReadOnlyWrapper(), data, true).blockState();
|
||||
net.minecraft.block.BlockState state = BlockArgumentParser.block(Registries.BLOCK.getReadOnlyWrapper(), data, true)
|
||||
.blockState();
|
||||
if(state == null) throw new IllegalArgumentException("Invalid data: " + data);
|
||||
return (BlockState) state;
|
||||
} catch(CommandSyntaxException e) {
|
||||
|
||||
+7
-7
@@ -66,7 +66,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setDelay(int delay) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getMinSpawnDelay() {
|
||||
@@ -74,7 +74,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setMinSpawnDelay(int delay) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getMaxSpawnDelay() {
|
||||
@@ -82,7 +82,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setMaxSpawnDelay(int delay) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getSpawnCount() {
|
||||
@@ -90,7 +90,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setSpawnCount(int spawnCount) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getMaxNearbyEntities() {
|
||||
@@ -98,7 +98,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setMaxNearbyEntities(int maxNearbyEntities) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getRequiredPlayerRange() {
|
||||
@@ -106,7 +106,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setRequiredPlayerRange(int requiredPlayerRange) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getSpawnRange() {
|
||||
@@ -114,7 +114,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setSpawnRange(int spawnRange) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void terra$applyState(String state) {
|
||||
|
||||
+2
-2
@@ -55,9 +55,9 @@ public abstract class WorldChunkMixin {
|
||||
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
||||
BlockPos blockPos = new BlockPos(x, y, z);
|
||||
setBlockState(blockPos, (net.minecraft.block.BlockState) data, false);
|
||||
if (physics) {
|
||||
if(physics) {
|
||||
net.minecraft.block.BlockState state = ((net.minecraft.block.BlockState) data);
|
||||
if (state.isLiquid()) {
|
||||
if(state.isLiquid()) {
|
||||
world.getFluidTickScheduler().scheduleTick(OrderedTick.create(state.getFluidState().getFluid(), blockPos));
|
||||
} else {
|
||||
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(state.getBlock(), blockPos));
|
||||
|
||||
@@ -158,7 +158,8 @@ public final class MinecraftUtil {
|
||||
|
||||
builder.temperature(Objects.requireNonNullElse(vanillaBiomeProperties.getTemperature(), vanilla.getTemperature()));
|
||||
|
||||
builder.downfall(Objects.requireNonNullElse(vanillaBiomeProperties.getDownfall(), ((BiomeAccessor) ((Object) vanilla)).getWeather().downfall()));
|
||||
builder.downfall(Objects.requireNonNullElse(vanillaBiomeProperties.getDownfall(),
|
||||
((BiomeAccessor) ((Object) vanilla)).getWeather().downfall()));
|
||||
|
||||
builder.temperatureModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getTemperatureModifier(),
|
||||
((BiomeAccessor) ((Object) vanilla)).getWeather().temperatureModifier()));
|
||||
|
||||
@@ -51,27 +51,35 @@ public class PresetUtil {
|
||||
PRESETS.add(generatorID);
|
||||
|
||||
RegistryEntry<DimensionType> registryEntry = dimensionTypeRegistry.getEntry(DimensionTypes.THE_NETHER).orElseThrow();
|
||||
RegistryEntry.Reference<MultiNoiseBiomeSourceParameterList> reference = multiNoiseBiomeSourceParameterLists.getEntry(MultiNoiseBiomeSourceParameterLists.NETHER).orElseThrow();
|
||||
RegistryEntry<ChunkGeneratorSettings> registryEntry2 = chunkGeneratorSettingsRegistry.getEntry(ChunkGeneratorSettings.NETHER).orElseThrow();
|
||||
RegistryEntry.Reference<MultiNoiseBiomeSourceParameterList> reference = multiNoiseBiomeSourceParameterLists.getEntry(
|
||||
MultiNoiseBiomeSourceParameterLists.NETHER).orElseThrow();
|
||||
RegistryEntry<ChunkGeneratorSettings> registryEntry2 = chunkGeneratorSettingsRegistry.getEntry(ChunkGeneratorSettings.NETHER)
|
||||
.orElseThrow();
|
||||
|
||||
RegistryEntry<DimensionType> registryEntry3 = dimensionTypeRegistry.getEntry(DimensionTypes.THE_END).orElseThrow();
|
||||
RegistryEntry<ChunkGeneratorSettings> registryEntry4 = chunkGeneratorSettingsRegistry.getEntry(ChunkGeneratorSettings.END).orElseThrow();
|
||||
RegistryEntry<ChunkGeneratorSettings> registryEntry4 = chunkGeneratorSettingsRegistry.getEntry(ChunkGeneratorSettings.END)
|
||||
.orElseThrow();
|
||||
|
||||
TerraBiomeSource biomeSource = new TerraBiomeSource(pack);
|
||||
ChunkGenerator generator = new MinecraftChunkGeneratorWrapper(biomeSource, pack, overworld);
|
||||
|
||||
DimensionOptions dimensionOptions = new DimensionOptions(overworldDimensionType, generator);
|
||||
DimensionOptions netherDimensionOptions = new DimensionOptions(registryEntry, new NoiseChunkGenerator(MultiNoiseBiomeSource.create(reference), registryEntry2));
|
||||
DimensionOptions endDimensionOptions = new DimensionOptions(registryEntry3, new NoiseChunkGenerator(TheEndBiomeSource.createVanilla(platform.biomeRegistry().getReadOnlyWrapper()), registryEntry4));
|
||||
DimensionOptions netherDimensionOptions = new DimensionOptions(registryEntry,
|
||||
new NoiseChunkGenerator(MultiNoiseBiomeSource.create(reference),
|
||||
registryEntry2));
|
||||
DimensionOptions endDimensionOptions = new DimensionOptions(registryEntry3, new NoiseChunkGenerator(
|
||||
TheEndBiomeSource.createVanilla(platform.biomeRegistry().getReadOnlyWrapper()), registryEntry4));
|
||||
|
||||
WorldPreset preset = createPreset(dimensionOptions, netherDimensionOptions, endDimensionOptions);
|
||||
LOGGER.info("Created world type \"{}\"", generatorID);
|
||||
return Pair.of(generatorID, preset);
|
||||
}
|
||||
|
||||
private static WorldPreset createPreset(DimensionOptions dimensionOptions, DimensionOptions netherDimensionOptions, DimensionOptions endDimensionOptions) {
|
||||
private static WorldPreset createPreset(DimensionOptions dimensionOptions, DimensionOptions netherDimensionOptions,
|
||||
DimensionOptions endDimensionOptions) {
|
||||
return new WorldPreset(
|
||||
Map.of(DimensionOptions.OVERWORLD, dimensionOptions, DimensionOptions.NETHER, netherDimensionOptions, DimensionOptions.END, endDimensionOptions)
|
||||
Map.of(DimensionOptions.OVERWORLD, dimensionOptions, DimensionOptions.NETHER, netherDimensionOptions, DimensionOptions.END,
|
||||
endDimensionOptions)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class TagUtil {
|
||||
": " +
|
||||
vanilla.streamTags()
|
||||
.toList());
|
||||
|
||||
|
||||
vanilla.streamTags()
|
||||
.forEach(
|
||||
tag -> collect
|
||||
|
||||
Reference in New Issue
Block a user