Fix dimension tag in example

This commit is contained in:
rtm516 2020-10-10 17:52:13 +01:00 committed by GitHub
parent 976c2d0f89
commit 0d78575081
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -249,10 +249,23 @@ public class MinecraftProtocolTest {
private static CompoundTag getDimensionTag() { private static CompoundTag getDimensionTag() {
CompoundTag tag = new CompoundTag(""); CompoundTag tag = new CompoundTag("");
ListTag dimensionTag = new ListTag("dimension");
CompoundTag overworldTag = getOverworldTag(); CompoundTag dimensionTypes = new CompoundTag("minecraft:dimension_type");
dimensionTypes.put(new StringTag("type", "minecraft:dimension_type"));
ListTag dimensionTag = new ListTag("value");
CompoundTag overworldTag = convertToValue("minecraft:overworld", 0, getOverworldTag().getValue());
dimensionTag.add(overworldTag); dimensionTag.add(overworldTag);
overworldTag.put(tag); dimensionTypes.put(dimensionTag);
tag.put(dimensionTypes);
CompoundTag biomeTypes = new CompoundTag("minecraft:worldgen/biome");
biomeTypes.put(new StringTag("type", "minecraft:worldgen/biome"));
ListTag biomeTag = new ListTag("value");
CompoundTag plainsTag = convertToValue("minecraft:plains", 0, getPlainsTag().getValue());
biomeTag.add(plainsTag);
biomeTypes.put(biomeTag);
tag.put(biomeTypes);
return tag; return tag;
} }
@ -274,4 +287,44 @@ public class MinecraftProtocolTest {
overworldTag.put(new ByteTag("has_ceiling", (byte) 0)); overworldTag.put(new ByteTag("has_ceiling", (byte) 0));
return overworldTag; return overworldTag;
} }
private static CompoundTag getPlainsTag() {
CompoundTag plainsTag = new CompoundTag("");
plainsTag.put(new StringTag("name", "minecraft:plains"));
plainsTag.put(new StringTag("precipitation", "rain"));
plainsTag.put(new FloatTag("depth", 0.125f));
plainsTag.put(new FloatTag("temperature", 0.8f));
plainsTag.put(new FloatTag("scale", 0.05f));
plainsTag.put(new FloatTag("downfall", 0.4f));
plainsTag.put(new StringTag("category", "plains"));
CompoundTag effects = new CompoundTag("effects");
effects.put(new LongTag("sky_color", 7907327));
effects.put(new LongTag("water_fog_color", 329011));
effects.put(new LongTag("fog_color", 12638463));
effects.put(new LongTag("water_color", 4159204));
CompoundTag moodSound = new CompoundTag("mood_sound");
moodSound.put(new IntTag("tick_delay", 6000));
moodSound.put(new FloatTag("offset", 2.0f));
moodSound.put(new StringTag("sound", "minecraft:ambient.cave"));
moodSound.put(new IntTag("block_search_extent", 8));
effects.put(moodSound);
plainsTag.put(effects);
return plainsTag;
}
private static CompoundTag convertToValue(String name, int id, Map<String, Tag> values) {
CompoundTag tag = new CompoundTag(name);
tag.put(new StringTag("name", name));
tag.put(new IntTag("id", id));
CompoundTag element = new CompoundTag("element");
element.setValue(values);
tag.put(element);
return tag;
}
} }