<commit_before>package com.mcjty.rftools.dimension;

import com.google.common.collect.ImmutableList;
import com.mcjty.rftools.RFTools;
import com.mcjty.rftools.dimension.world.types.FeatureType;
import com.mcjty.rftools.dimension.world.types.StructureType;
import com.mcjty.rftools.dimension.world.types.TerrainType;
import com.mcjty.rftools.items.dimlets.DimletType;
import com.mcjty.rftools.items.dimlets.KnownDimletConfiguration;
import com.mcjty.varia.Coordinate;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.fluids.FluidStack;

import java.util.*;

public class DimensionInformation {
    private final DimensionDescriptor descriptor;
    private final String name;

    private Coordinate spawnPoint = null;

    private TerrainType terrainType = TerrainType.TERRAIN_VOID;
    private Block baseBlockForTerrain = null;
    private Block fluidForTerrain = null;

    private Set<FeatureType> featureTypes = new HashSet<FeatureType>();
    private Block[] extraOregen = new Block[] {};
    private Block[] fluidsForLakes = new Block[] {};

    private Set<StructureType> structureTypes = new HashSet<StructureType>();
    private List<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
    private String digitString = "";

    private SkyDescriptor skyDescriptor;

    public DimensionInformation(String name, DimensionDescriptor descriptor) {
        this.name = name;
        this.descriptor = descriptor;

        Map<DimletType,List<Integer>> dimlets = descriptor.getDimlets();
        Random random = getRandom(dimlets);

        List<DimensionDescriptor.DimletDescriptor> modifiersForTerrain = descriptor.getModifierDimlets(DimletType.DIMLET_TERRAIN);
        calculateTerrainType(dimlets, modifiersForTerrain, random);

        List<DimensionDescriptor.DimletDescriptor> modifiersForFeature = descriptor.getModifierDimlets(DimletType.DIMLET_FEATURE);
        calculateFeatureType(dimlets, modifiersForFeature, random);

        calculateStructureType(dimlets, random);
        calculateBiomes(dimlets, random);
        calculateDigitString(dimlets);

        calculateSky(dimlets, random);
    }

    private void logDebug(EntityPlayer player, String message) {
        RFTools.message(player, EnumChatFormatting.YELLOW + message);
    }

    public void dump(EntityPlayer player) {
        String digits = getDigitString();
        if (!digits.isEmpty()) {
            logDebug(player, "    Digits: " + digits);
        }
        TerrainType terrainType = getTerrainType();
        logDebug(player, "    Terrain: " + terrainType.toString());
        logDebug(player, "        Base block: " + new ItemStack(baseBlockForTerrain).getDisplayName());
        logDebug(player, "        Base fluid: " + new ItemStack(fluidForTerrain).getDisplayName());
        for (BiomeGenBase biome : getBiomes()) {
            logDebug(player, "    Biome: " + biome.biomeName);
        }
        for (FeatureType featureType : getFeatureTypes()) {
            logDebug(player, "    Feature: " + featureType.toString());
        }
        for (Block block : extraOregen) {
            logDebug(player, "        Extra ore: " + new ItemStack(block).getDisplayName());
        }
        for (Block block : fluidsForLakes) {
            logDebug(player, "        Lake fluid: " + new ItemStack(block).getDisplayName());
        }
        for (StructureType structureType : getStructureTypes()) {
            logDebug(player, "    Structure: " + structureType.toString());
        }
        logDebug(player, "    Sun brightness: " + skyDescriptor.getSunBrightnessFactor());
        logDebug(player, "    Star brightness: " + skyDescriptor.getStarBrightnessFactor());
    }

    public void toBytes(ByteBuf buf) {
        if (terrainType == null) {
            buf.writeInt(TerrainType.TERRAIN_VOID.ordinal());
        } else {
            buf.writeInt(terrainType.ordinal());
        }
        buf.writeInt(featureTypes.size());
        for (FeatureType type : featureTypes) {
            buf.writeInt(type.ordinal());
        }
        buf.writeInt(structureTypes.size());
        for (StructureType type : structureTypes) {
            buf.writeInt(type.ordinal());
        }
        buf.writeInt(biomes.size());
        for (BiomeGenBase entry : biomes) {
            buf.writeInt(entry.biomeID);
        }
        buf.writeInt(digitString.length());
        buf.writeBytes(digitString.getBytes());

        //@todo @@@@@@@@@@@@@@@@@@@@@@@@@@@@#################################
    }

    public void fromBytes(ByteBuf buf) {<commit_msg>Stuff<commit_after>package com.mcjty.rftools.dimension;

import com.mcjty.rftools.RFTools;
import com.mcjty.rftools.dimension.world.types.FeatureType;
import com.mcjty.rftools.dimension.world.types.StructureType;
import com.mcjty.rftools.dimension.world.types.TerrainType;
import com.mcjty.rftools.items.dimlets.DimletType;
import com.mcjty.rftools.items.dimlets.KnownDimletConfiguration;
import com.mcjty.varia.Coordinate;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.biome.BiomeGenBase;

import java.util.*;

public class DimensionInformation {
    private final DimensionDescriptor descriptor;
    private final String name;

    private Coordinate spawnPoint = null;

    private TerrainType terrainType = TerrainType.TERRAIN_VOID;
    private Block baseBlockForTerrain = null;
    private Block fluidForTerrain = null;

    private Set<FeatureType> featureTypes = new HashSet<FeatureType>();
    private Block[] extraOregen = new Block[] {};
    private Block[] fluidsForLakes = new Block[] {};

    private Set<StructureType> structureTypes = new HashSet<StructureType>();
    private List<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
    private String digitString = "";

    private SkyDescriptor skyDescriptor;

    public DimensionInformation(String name, DimensionDescriptor descriptor) {
        this.name = name;
        this.descriptor = descriptor;

        Map<DimletType,List<Integer>> dimlets = descriptor.getDimlets();
        Random random = getRandom(dimlets);

        List<DimensionDescriptor.DimletDescriptor> modifiersForTerrain = descriptor.getModifierDimlets(DimletType.DIMLET_TERRAIN);
        calculateTerrainType(dimlets, modifiersForTerrain, random);

        List<DimensionDescriptor.DimletDescriptor> modifiersForFeature = descriptor.getModifierDimlets(DimletType.DIMLET_FEATURE);
        calculateFeatureType(dimlets, modifiersForFeature, random);

        calculateStructureType(dimlets, random);
        calculateBiomes(dimlets, random);
        calculateDigitString(dimlets);

        calculateSky(dimlets, random);
    }

    private void logDebug(EntityPlayer player, String message) {
        RFTools.message(player, EnumChatFormatting.YELLOW + message);
    }

    public void dump(EntityPlayer player) {
        String digits = getDigitString();
        if (!digits.isEmpty()) {
            logDebug(player, "    Digits: " + digits);
        }
        TerrainType terrainType = getTerrainType();
        logDebug(player, "    Terrain: " + terrainType.toString());
        logDebug(player, "        Base block: " + new ItemStack(baseBlockForTerrain).getDisplayName());
        logDebug(player, "        Base fluid: " + new ItemStack(fluidForTerrain).getDisplayName());
        for (BiomeGenBase biome : getBiomes()) {
            logDebug(player, "    Biome: " + biome.biomeName);
        }
        for (FeatureType featureType : getFeatureTypes()) {
            logDebug(player, "    Feature: " + featureType.toString());
        }
        for (Block block : extraOregen) {
            logDebug(player, "        Extra ore: " + new ItemStack(block).getDisplayName());
        }
        for (Block block : fluidsForLakes) {
            logDebug(player, "        Lake fluid: " + new ItemStack(block).getDisplayName());
        }
        for (StructureType structureType : getStructureTypes()) {
            logDebug(player, "    Structure: " + structureType.toString());
        }
        logDebug(player, "    Sun brightness: " + skyDescriptor.getSunBrightnessFactor());
        logDebug(player, "    Star brightness: " + skyDescriptor.getStarBrightnessFactor());
    }

    public void toBytes(ByteBuf buf) {
        if (terrainType == null) {
            buf.writeInt(TerrainType.TERRAIN_VOID.ordinal());
        } else {
            buf.writeInt(terrainType.ordinal());
        }
        buf.writeInt(featureTypes.size());
        for (FeatureType type : featureTypes) {
            buf.writeInt(type.ordinal());
        }
        buf.writeInt(structureTypes.size());
        for (StructureType type : structureTypes) {
            buf.writeInt(type.ordinal());
        }
        buf.writeInt(biomes.size());
        for (BiomeGenBase entry : biomes) {
            buf.writeInt(entry.biomeID);
        }
        buf.writeInt(digitString.length());
        buf.writeBytes(digitString.getBytes());




        //@todo @@@@@@@@@@@@@@@@@@@@@@@@@@@@#################################
/*
    private Block[] extraOregen = new Block[] {};
    private Block[] fluidsForLakes = new Block[] {};
    private Block baseBlockForTerrain = null;
    private Block fluidForTerrain = null;
    private SkyDescriptor skyDescriptor;


 */
    }

    public void fromBytes(ByteBuf buf) {
{'fraction_non_alphanumeric': 0.11793611793611794, 'fraction_numerical': 0.0, 'mean_word_length': 3.2547909407665507, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7392223', 'n_tokens_mistral': 2810, 'n_tokens_neox': 2755, 'n_words': 513}