switched VirtualPockets from Codecs to fromTag/ toTag serialization
This commit is contained in:
parent
cf94db47d8
commit
0fb93068bd
7 changed files with 181 additions and 65 deletions
|
@ -3,21 +3,50 @@ package org.dimdev.dimdoors.pockets;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.google.common.collect.Lists;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
|
||||||
public final class PocketGroup {
|
public final class PocketGroup {
|
||||||
|
/*
|
||||||
public static final Codec<PocketGroup> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
public static final Codec<PocketGroup> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||||
Codec.STRING.fieldOf("group").forGetter(PocketGroup::getGroup),
|
Codec.STRING.fieldOf("group").forGetter(PocketGroup::getGroup),
|
||||||
VirtualPocket.CODEC.listOf().fieldOf("pockets").forGetter(PocketGroup::getEntries)
|
VirtualPocket.CODEC.listOf().fieldOf("pockets").forGetter(PocketGroup::getEntries)
|
||||||
).apply(instance, PocketGroup::new));
|
).apply(instance, PocketGroup::new));
|
||||||
private final String group;
|
*/
|
||||||
private final List<VirtualPocket> entries;
|
|
||||||
|
private String group;
|
||||||
|
private List<VirtualPocket> entries;
|
||||||
|
|
||||||
|
public PocketGroup() {
|
||||||
|
}
|
||||||
|
|
||||||
public PocketGroup(String group, List<VirtualPocket> entries) {
|
public PocketGroup(String group, List<VirtualPocket> entries) {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PocketGroup fromTag(CompoundTag tag) {
|
||||||
|
this.group = tag.getString("group");
|
||||||
|
|
||||||
|
ListTag pockets = tag.getList("pockets", 10);
|
||||||
|
this.entries = Lists.newArrayList();
|
||||||
|
for (int i = 0; i < pockets.size(); i++) {
|
||||||
|
CompoundTag pocket = pockets.getCompound(i);
|
||||||
|
entries.add(VirtualPocket.deserialize(pocket));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
tag.putString("group", this.group);
|
||||||
|
|
||||||
|
ListTag pockets = new ListTag();
|
||||||
|
entries.forEach(pocket -> pockets.add(pocket.toTag(new CompoundTag())));
|
||||||
|
tag.put("pockets", pockets);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGroup() {
|
public String getGroup() {
|
||||||
return this.group;
|
return this.group;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import java.util.*;
|
||||||
import com.google.common.collect.*;
|
import com.google.common.collect.*;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import com.mojang.serialization.JsonOps;
|
import net.minecraft.nbt.*;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -20,9 +20,6 @@ import org.dimdev.dimdoors.util.PocketGenerationParameters;
|
||||||
import org.dimdev.dimdoors.util.WeightedList;
|
import org.dimdev.dimdoors.util.WeightedList;
|
||||||
import org.dimdev.dimdoors.util.schematic.v2.Schematic;
|
import org.dimdev.dimdoors.util.schematic.v2.Schematic;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.nbt.NbtIo;
|
|
||||||
|
|
||||||
public class SchematicV2Handler {
|
public class SchematicV2Handler {
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
private static final Gson GSON = new GsonBuilder().setLenient().setPrettyPrinting().create();
|
private static final Gson GSON = new GsonBuilder().setLenient().setPrettyPrinting().create();
|
||||||
|
@ -43,17 +40,18 @@ public class SchematicV2Handler {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
Set<String> names = ImmutableSet.of("default_private", "default_public");
|
Set<String> names = ImmutableSet.of("default_private", "default_public");
|
||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
try (BufferedReader reader = Files.newBufferedReader(Paths.get(SchematicV2Handler.class.getResource(String.format("/data/dimdoors/pockets/json/v2/%s.json", name)).toURI()))) {
|
try (BufferedReader reader = Files.newBufferedReader(Paths.get(SchematicV2Handler.class.getResource(String.format("/data/dimdoors/pockets/json/v2/%s.json", name)).toURI()))) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
while (true) {
|
while (true) {
|
||||||
String line = reader.readLine();
|
String line = reader.readLine();
|
||||||
if (line == null) {
|
if (line == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result.add(line);
|
result.add(line);
|
||||||
}
|
}
|
||||||
JsonObject json = GSON.fromJson(String.join("", result), JsonObject.class);
|
|
||||||
PocketGroup type = PocketGroup.CODEC.decode(JsonOps.INSTANCE, json).getOrThrow(false, System.err::println).getFirst();
|
CompoundTag groupTag = StringNbtReader.parse(String.join("", result));
|
||||||
|
PocketGroup type = new PocketGroup().fromTag(groupTag);
|
||||||
|
|
||||||
this.pocketGroups.add(type);
|
this.pocketGroups.add(type);
|
||||||
|
|
||||||
|
@ -64,7 +62,7 @@ public class SchematicV2Handler {
|
||||||
virtualPocket.init(type.getGroup());
|
virtualPocket.init(type.getGroup());
|
||||||
weightedPockets.add(virtualPocket);
|
weightedPockets.add(virtualPocket);
|
||||||
}
|
}
|
||||||
} catch (IOException | URISyntaxException e) {
|
} catch (IOException | URISyntaxException | CommandSyntaxException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.dimdev.dimdoors.pockets;
|
package org.dimdev.dimdoors.pockets;
|
||||||
|
|
||||||
import com.mojang.datafixers.util.Pair;
|
|
||||||
import com.mojang.serialization.*;
|
import com.mojang.serialization.*;
|
||||||
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder;
|
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
@ -13,10 +13,13 @@ import org.dimdev.dimdoors.util.PocketGenerationParameters;
|
||||||
import org.dimdev.dimdoors.util.Weighted;
|
import org.dimdev.dimdoors.util.Weighted;
|
||||||
import org.dimdev.dimdoors.world.pocket.Pocket;
|
import org.dimdev.dimdoors.world.pocket.Pocket;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
|
||||||
// TODO: do something about getting correct Pocket sizes
|
// TODO: do something about getting correct Pocket sizes
|
||||||
public abstract class VirtualPocket implements Weighted<PocketGenerationParameters> {
|
public abstract class VirtualPocket implements Weighted<PocketGenerationParameters> {
|
||||||
public static final Registry<VirtualPocketType<? extends VirtualPocket>> REGISTRY = FabricRegistryBuilder.from(new SimpleRegistry<VirtualPocketType<? extends VirtualPocket>>(RegistryKey.ofRegistry(new Identifier("dimdoors", "virtual_pocket_type")), Lifecycle.stable())).buildAndRegister();
|
public static final Registry<VirtualPocketType<? extends VirtualPocket>> REGISTRY = FabricRegistryBuilder.from(new SimpleRegistry<VirtualPocketType<? extends VirtualPocket>>(RegistryKey.ofRegistry(new Identifier("dimdoors", "virtual_pocket_type")), Lifecycle.stable())).buildAndRegister();
|
||||||
|
/*
|
||||||
public static final Codec<VirtualPocket> CODEC = new Codec<VirtualPocket>() {
|
public static final Codec<VirtualPocket> CODEC = new Codec<VirtualPocket>() {
|
||||||
@Override
|
@Override
|
||||||
public <T> DataResult<Pair<VirtualPocket, T>> decode(DynamicOps<T> dynamicOps, T input) {
|
public <T> DataResult<Pair<VirtualPocket, T>> decode(DynamicOps<T> dynamicOps, T input) {
|
||||||
|
@ -29,6 +32,22 @@ public abstract class VirtualPocket implements Weighted<PocketGenerationParamete
|
||||||
return null; // TODO: write encode function
|
return null; // TODO: write encode function
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static VirtualPocket deserialize(CompoundTag tag) {
|
||||||
|
Identifier id = Identifier.tryParse(tag.getString("type")); // TODO: return some NONE VirtualPocket if type cannot be found or deserialization fails.
|
||||||
|
return REGISTRY.get(id).fromTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CompoundTag serialize(VirtualPocket virtualPocket) {
|
||||||
|
return virtualPocket.toTag(new CompoundTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract VirtualPocket fromTag(CompoundTag tag);
|
||||||
|
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
return this.getType().toTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void init(String group);
|
public abstract void init(String group);
|
||||||
|
|
||||||
|
@ -41,20 +60,33 @@ public abstract class VirtualPocket implements Weighted<PocketGenerationParamete
|
||||||
|
|
||||||
public abstract String getKey();
|
public abstract String getKey();
|
||||||
|
|
||||||
|
|
||||||
public interface VirtualPocketType<T extends VirtualPocket> {
|
public interface VirtualPocketType<T extends VirtualPocket> {
|
||||||
VirtualPocketType<SchematicGenerator> SCHEMATIC = register(new Identifier("dimdoors", SchematicGenerator.KEY), SchematicGenerator.CODEC);
|
VirtualPocketType<SchematicGenerator> SCHEMATIC = register(new Identifier("dimdoors", SchematicGenerator.KEY), SchematicGenerator::new);
|
||||||
|
|
||||||
VirtualPocketType<DepthDependentSelector> DEPTH_DEPENDENT = register(new Identifier("dimdoors", DepthDependentSelector.KEY), DepthDependentSelector.CODEC);
|
VirtualPocketType<DepthDependentSelector> DEPTH_DEPENDENT = register(new Identifier("dimdoors", DepthDependentSelector.KEY), DepthDependentSelector::new);
|
||||||
|
|
||||||
|
|
||||||
|
VirtualPocket fromTag(CompoundTag tag);
|
||||||
|
|
||||||
Codec<T> getCodec();
|
CompoundTag toTag(CompoundTag tag);
|
||||||
|
|
||||||
static void register() {
|
static void register() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static <T extends VirtualPocket> VirtualPocketType<T> register(Identifier id, Codec<T> codec) {
|
static <U extends VirtualPocket> VirtualPocketType<U> register(Identifier id, Supplier<U> constructor) {
|
||||||
return Registry.register(REGISTRY, id, () -> codec);
|
return Registry.register(REGISTRY, id, new VirtualPocketType<U>() {
|
||||||
|
@Override
|
||||||
|
public VirtualPocket fromTag(CompoundTag tag) {
|
||||||
|
return constructor.get().fromTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
tag.putString("type", id.toString());
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.dimdev.dimdoors.pockets.generator;
|
package org.dimdev.dimdoors.pockets.generator;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
@ -20,18 +19,22 @@ public class SchematicGenerator extends VirtualPocket {
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
public static final String KEY = "schematic";
|
public static final String KEY = "schematic";
|
||||||
|
|
||||||
|
/*
|
||||||
public static final Codec<SchematicGenerator> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
public static final Codec<SchematicGenerator> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||||
Codec.INT.fieldOf("size").forGetter(SchematicGenerator::getSize),
|
Codec.INT.fieldOf("size").forGetter(SchematicGenerator::getSize),
|
||||||
Codec.STRING.fieldOf("id").forGetter(SchematicGenerator::getName),
|
Codec.STRING.fieldOf("id").forGetter(SchematicGenerator::getName),
|
||||||
Codec.INT.optionalFieldOf("weight", 5).forGetter(schematicGenerator -> schematicGenerator.getWeight(null))
|
Codec.INT.optionalFieldOf("weight", 5).forGetter(schematicGenerator -> schematicGenerator.getWeight(null))
|
||||||
).apply(instance, SchematicGenerator::new));
|
).apply(instance, SchematicGenerator::new));
|
||||||
|
*/
|
||||||
|
|
||||||
private final int size;
|
private int size;
|
||||||
private final String name;
|
private String name;
|
||||||
private final Identifier templateID;
|
private Identifier templateID;
|
||||||
private final int weight;
|
private int weight;
|
||||||
|
|
||||||
SchematicGenerator(int size, String name, int weight) {
|
public SchematicGenerator() {}
|
||||||
|
|
||||||
|
public SchematicGenerator(int size, String name, int weight) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
|
@ -56,6 +59,26 @@ public class SchematicGenerator extends VirtualPocket {
|
||||||
return this.weight;
|
return this.weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VirtualPocket fromTag(CompoundTag tag) {
|
||||||
|
this.name = tag.getString("id");
|
||||||
|
this.size = tag.getInt("size");
|
||||||
|
this.weight = tag.contains("weight") ? tag.getInt("weight") : 5;
|
||||||
|
|
||||||
|
this.templateID = new Identifier("dimdoors", name);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
super.toTag(tag);
|
||||||
|
|
||||||
|
tag.putString("id", this.name);
|
||||||
|
tag.putInt("size", this.size);
|
||||||
|
tag.putInt("weight", this.weight);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(String group) {
|
public void init(String group) {
|
||||||
SchematicV2Handler.getInstance().loadSchematic(templateID, group, size, name);
|
SchematicV2Handler.getInstance().loadSchematic(templateID, group, size, name);
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
package org.dimdev.dimdoors.pockets.selection;
|
package org.dimdev.dimdoors.pockets.selection;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.google.common.collect.Maps;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Pair;
|
import net.minecraft.nbt.ListTag;
|
||||||
import org.dimdev.dimdoors.pockets.VirtualPocket;
|
import org.dimdev.dimdoors.pockets.VirtualPocket;
|
||||||
import org.dimdev.dimdoors.util.PocketGenerationParameters;
|
import org.dimdev.dimdoors.util.PocketGenerationParameters;
|
||||||
import org.dimdev.dimdoors.world.pocket.Pocket;
|
import org.dimdev.dimdoors.world.pocket.Pocket;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class DepthDependentSelector extends VirtualPocket {
|
public class DepthDependentSelector extends VirtualPocket {
|
||||||
public static final String KEY = "depth_dependent";
|
public static final String KEY = "depth_dependent";
|
||||||
|
/*
|
||||||
private static final Codec<Pair<String, VirtualPocket>> PAIR_CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
private static final Codec<Pair<String, VirtualPocket>> PAIR_CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||||
Codec.STRING.fieldOf("regex").forGetter(Pair::getLeft),
|
Codec.STRING.fieldOf("regex").forGetter(Pair::getLeft),
|
||||||
VirtualPocket.CODEC.fieldOf("pocket").forGetter(Pair::getRight)
|
VirtualPocket.CODEC.fieldOf("pocket").forGetter(Pair::getRight)
|
||||||
|
@ -22,13 +23,17 @@ public class DepthDependentSelector extends VirtualPocket {
|
||||||
Codec.STRING.fieldOf("id").forGetter(DepthDependentSelector::getName),
|
Codec.STRING.fieldOf("id").forGetter(DepthDependentSelector::getName),
|
||||||
PAIR_CODEC.listOf().fieldOf("pockets").forGetter(DepthDependentSelector::getPocketList)
|
PAIR_CODEC.listOf().fieldOf("pockets").forGetter(DepthDependentSelector::getPocketList)
|
||||||
).apply(instance, DepthDependentSelector::new));
|
).apply(instance, DepthDependentSelector::new));
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final String name;
|
private String name;
|
||||||
private final List<Pair<String, VirtualPocket>> pocketList;
|
private LinkedHashMap<String, VirtualPocket> pocketList;
|
||||||
|
|
||||||
public DepthDependentSelector(String name, List<Pair<String, VirtualPocket>> pocketList) {
|
public DepthDependentSelector() {
|
||||||
|
|
||||||
|
}
|
||||||
|
public DepthDependentSelector(String name, LinkedHashMap<String, VirtualPocket> pocketList) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.pocketList = pocketList;
|
this.pocketList = pocketList;
|
||||||
}
|
}
|
||||||
|
@ -37,13 +42,42 @@ public class DepthDependentSelector extends VirtualPocket {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<String, VirtualPocket>> getPocketList() {
|
public LinkedHashMap<String, VirtualPocket> getPocketList() {
|
||||||
return pocketList;
|
return pocketList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VirtualPocket fromTag(CompoundTag tag) {
|
||||||
|
this.name = tag.getString("id");
|
||||||
|
ListTag regexPockets = tag.getList("pockets", 10);
|
||||||
|
pocketList = Maps.newLinkedHashMap();
|
||||||
|
for (int i = 0; i < regexPockets.size(); i++) {
|
||||||
|
CompoundTag pocket = regexPockets.getCompound(i);
|
||||||
|
pocketList.put(pocket.getString("regex"), VirtualPocket.deserialize(pocket.getCompound("pocket")));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
super.toTag(tag);
|
||||||
|
|
||||||
|
tag.putString("id", this.name);
|
||||||
|
|
||||||
|
ListTag regexPockets = new ListTag();
|
||||||
|
pocketList.forEach((regex, pocket) -> {
|
||||||
|
CompoundTag compound = new CompoundTag();
|
||||||
|
compound.putString("regex", regex);
|
||||||
|
compound.put("pocket", pocket.toTag(new CompoundTag()));
|
||||||
|
regexPockets.add(compound);
|
||||||
|
});
|
||||||
|
tag.put("pockets", regexPockets);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(String group) {
|
public void init(String group) {
|
||||||
pocketList.forEach(pair -> pair.getRight().init(group));
|
pocketList.forEach((regex, pocket) -> pocket.init(group));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,11 +107,11 @@ public class DepthDependentSelector extends VirtualPocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
private VirtualPocket getNextPocket(PocketGenerationParameters parameters) {
|
private VirtualPocket getNextPocket(PocketGenerationParameters parameters) {
|
||||||
for (Pair<String, VirtualPocket> pair : pocketList) {
|
for (Map.Entry<String, VirtualPocket> entry : pocketList.entrySet()) {
|
||||||
if (Pattern.compile(pair.getLeft()).matcher(String.valueOf(parameters.getSourceVirtualLocation().getDepth())).matches()) {
|
if (Pattern.compile(entry.getKey()).matcher(String.valueOf(parameters.getSourceVirtualLocation().getDepth())).matches()) {
|
||||||
return pair.getRight();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pocketList.get(0).getRight();
|
return pocketList.values().stream().findFirst().get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,49 +2,49 @@
|
||||||
"group": "private",
|
"group": "private",
|
||||||
"pockets": [
|
"pockets": [
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_0",
|
"id": "private_pocket_0",
|
||||||
"size": 0,
|
"size": 0,
|
||||||
"weight": 20
|
"weight": 20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_1",
|
"id": "private_pocket_1",
|
||||||
"size": 1,
|
"size": 1,
|
||||||
"weight": 17
|
"weight": 17
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_2",
|
"id": "private_pocket_2",
|
||||||
"size": 2,
|
"size": 2,
|
||||||
"weight": 14
|
"weight": 14
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_3",
|
"id": "private_pocket_3",
|
||||||
"size": 3,
|
"size": 3,
|
||||||
"weight": 11
|
"weight": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_4",
|
"id": "private_pocket_4",
|
||||||
"size": 4,
|
"size": 4,
|
||||||
"weight": 8
|
"weight": 8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_5",
|
"id": "private_pocket_5",
|
||||||
"size": 5,
|
"size": 5,
|
||||||
"weight": 5
|
"weight": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_6",
|
"id": "private_pocket_6",
|
||||||
"size": 6,
|
"size": 6,
|
||||||
"weight": 3
|
"weight": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "private_pocket_7",
|
"id": "private_pocket_7",
|
||||||
"size": 7,
|
"size": 7,
|
||||||
"weight": 1
|
"weight": 1
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
"group": "public",
|
"group": "public",
|
||||||
"pockets": [
|
"pockets": [
|
||||||
{
|
{
|
||||||
"virtual_type": "depth_dependent",
|
"type": "dimdoors:depth_dependent",
|
||||||
"id": "public_pocket",
|
"id": "public_pocket",
|
||||||
"pockets": [
|
"pockets": [
|
||||||
{
|
{
|
||||||
"regex": "6",
|
"regex": "6",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_0",
|
"id": "public_pocket_0",
|
||||||
"size": 0,
|
"size": 0,
|
||||||
"weight": 20
|
"weight": 20
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
{
|
{
|
||||||
"regex": "7",
|
"regex": "7",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_1",
|
"id": "public_pocket_1",
|
||||||
"size": 1,
|
"size": 1,
|
||||||
"weight": 17
|
"weight": 17
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
{
|
{
|
||||||
"regex": "8",
|
"regex": "8",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_2",
|
"id": "public_pocket_2",
|
||||||
"size": 2,
|
"size": 2,
|
||||||
"weight": 14
|
"weight": 14
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
{
|
{
|
||||||
"regex": "9",
|
"regex": "9",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_3",
|
"id": "public_pocket_3",
|
||||||
"size": 3,
|
"size": 3,
|
||||||
"weight": 11
|
"weight": 11
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
{
|
{
|
||||||
"regex": "10",
|
"regex": "10",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_4",
|
"id": "public_pocket_4",
|
||||||
"size": 4,
|
"size": 4,
|
||||||
"weight": 8
|
"weight": 8
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
{
|
{
|
||||||
"regex": "11",
|
"regex": "11",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_5",
|
"id": "public_pocket_5",
|
||||||
"size": 5,
|
"size": 5,
|
||||||
"weight": 5
|
"weight": 5
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
{
|
{
|
||||||
"regex": "12",
|
"regex": "12",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_6",
|
"id": "public_pocket_6",
|
||||||
"size": 6,
|
"size": 6,
|
||||||
"weight": 3
|
"weight": 3
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
{
|
{
|
||||||
"regex": "[0-9]+",
|
"regex": "[0-9]+",
|
||||||
"pocket": {
|
"pocket": {
|
||||||
"virtual_type": "schematic",
|
"type": "dimdoors:schematic",
|
||||||
"id": "public_pocket_7",
|
"id": "public_pocket_7",
|
||||||
"size": 7,
|
"size": 7,
|
||||||
"weight": 1
|
"weight": 1
|
||||||
|
|
Loading…
Reference in a new issue