<commit_before>package com.github.lunatrius.laserlevel.json;

import com.github.lunatrius.laserlevel.marker.Marker;
import com.github.lunatrius.laserlevel.reference.Reference;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;

import java.lang.reflect.Type;

public class MarkerSerializer implements JsonSerializer<Marker>, JsonDeserializer<Marker> {
    @Override
    public JsonElement serialize(final Marker src, final Type typeOfSrc, final JsonSerializationContext context) {
        final JsonObject object = new JsonObject();
        object.addProperty("markerlength", src.markerLength);
        object.addProperty("x", src.pos.x);
        object.addProperty("y", src.pos.y);
        object.addProperty("z", src.pos.z);
        object.addProperty("dimension", src.dimension);
        object.addProperty("enabled", src.enabled);
        object.addProperty("spacing", src.spacing);
        object.addProperty("red", src.getRed());
        object.addProperty("green", src.getGreen());
        object.addProperty("blue", src.getBlue());

        final JsonObject sides = new JsonObject();
        for (final EnumFacing side : EnumFacing.VALUES) {
            sides.addProperty(side.getName(), src.isEnabled(side));
        }

        object.add("sides", sides);

        return object;
    }

    @Override
    public Marker deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException {
        if (json.isJsonObject()) {
            try {
                final JsonObject object = json.getAsJsonObject();
                final int markerLength = getAsInt(object, "markerlength", 64);
                final int x = getAsInt(object, "x", 0);
                final int y = getAsInt(object, "y", 0);
                final int z = getAsInt(object, "z", 0);
                final int dimension = getAsInt(object, "dimension", 0);
                final boolean enabled = getAsBoolean(object, "enabled", false);
                final int spacing = getAsInt(object, "spacing", 1);
                final int red = getAsInt(object, "red", 0);
                final int green = getAsInt(object, "green", 0);
                final int blue = getAsInt(object, "blue", 0);
                final JsonObject sides = object.getAsJsonObject("sides");

                final Marker marker = new Marker(new BlockPos(x, y, z), dimension, spacing, 0x000000);
                marker.markerLength = markerLength;
                marker.enabled = enabled;
                marker.setRed(red);<commit_msg>Missed a constant.<commit_after>package com.github.lunatrius.laserlevel.json;

import com.github.lunatrius.laserlevel.marker.Constants;
import com.github.lunatrius.laserlevel.marker.Marker;
import com.github.lunatrius.laserlevel.reference.Reference;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;

import java.lang.reflect.Type;

public class MarkerSerializer implements JsonSerializer<Marker>, JsonDeserializer<Marker> {
    @Override
    public JsonElement serialize(final Marker src, final Type typeOfSrc, final JsonSerializationContext context) {
        final JsonObject object = new JsonObject();
        object.addProperty("markerlength", src.markerLength);
        object.addProperty("x", src.pos.x);
        object.addProperty("y", src.pos.y);
        object.addProperty("z", src.pos.z);
        object.addProperty("dimension", src.dimension);
        object.addProperty("enabled", src.enabled);
        object.addProperty("spacing", src.spacing);
        object.addProperty("red", src.getRed());
        object.addProperty("green", src.getGreen());
        object.addProperty("blue", src.getBlue());

        final JsonObject sides = new JsonObject();
        for (final EnumFacing side : EnumFacing.VALUES) {
            sides.addProperty(side.getName(), src.isEnabled(side));
        }

        object.add("sides", sides);

        return object;
    }

    @Override
    public Marker deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException {
        if (json.isJsonObject()) {
            try {
                final JsonObject object = json.getAsJsonObject();
                final int markerLength = getAsInt(object, "markerlength", Constants.Rendering.DEFAULT_LENGTH);
                final int x = getAsInt(object, "x", 0);
                final int y = getAsInt(object, "y", 0);
                final int z = getAsInt(object, "z", 0);
                final int dimension = getAsInt(object, "dimension", 0);
                final boolean enabled = getAsBoolean(object, "enabled", false);
                final int spacing = getAsInt(object, "spacing", 1);
                final int red = getAsInt(object, "red", 0);
                final int green = getAsInt(object, "green", 0);
                final int blue = getAsInt(object, "blue", 0);
                final JsonObject sides = object.getAsJsonObject("sides");

                final Marker marker = new Marker(new BlockPos(x, y, z), dimension, spacing, 0x000000);
                marker.markerLength = markerLength;
                marker.enabled = enabled;
                marker.setRed(red);
{'fraction_non_alphanumeric': 0.11189412169130285, 'fraction_numerical': 0.005500171880371262, 'mean_word_length': 2.9344151453684924, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5108749', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1580, 'n_words': 375}