Jump to content

James Zhang

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by James Zhang

  1. Hi! I'm trying to create a Mushroom Explorer Map, similar to Woodland/Ocean Explorer Maps ingame. I've got the biome searcher and mapData generator figured out, but I found that the red x disappears upon reentering a world (the rest of the mapData, like scale, xCenter, zCenter, etc, remain unchanged when reentering). I've tried saving the Decorations to the NBT tag of the map, but apparantly this does not work. Can anybody please help me save the decoration so that it remains on the map upon reentering a world? Here's my code for the map data creator, which is called when the player crafts the map and after the target biome has been found: (And here's my github page, if you need to reference by biome finder or MushroomExplorerMapItem class) public static void BiomeMapCreator(BlockPos targetPos, ItemStack stack, World world){ ServerWorld serverWorld = (ServerWorld) world; MapIdTracker mapIdTracker = serverWorld.getServer().overworld().getDataStorage().computeIfAbsent(MapIdTracker::new, "idcounts"); int nextMapId = mapIdTracker.getFreeAuxValueForMap(); stack.getOrCreateTag().putInt("map", nextMapId); MapData mapData = FilledMapItem.getOrCreateSavedData(stack, world); mapData.setProperties(targetPos.getX(), targetPos.getZ(), 4, true, true, World.OVERWORLD); byte x = (byte) ((targetPos.getX() - mapData.x)/4); byte z = (byte) ((targetPos.getZ() - mapData.z)/4); MapDecoration marker = new MapDecoration(MapDecoration.Type.RED_X, x, z, (byte) 0, null); String markerKey = "biome_red_x"; mapData.decorations.put(markerKey, marker); mapData.setDirty(); CompoundNBT mapNBT = new CompoundNBT(); CompoundNBT decorationNBT = new CompoundNBT(); ListNBT decorationList = new ListNBT(); Map.Entry<String, MapDecoration> entry = mapData.decorations.entrySet().iterator().next(); decorationNBT.putString("id", entry.getKey()); decorationNBT.putInt("type", 26); decorationNBT.putInt("x", 0); decorationNBT.putInt("z", 0); decorationNBT.putInt("rot", entry.getValue().getRot()); decorationList.add(decorationNBT); stack.getOrCreateTag().put("Decorations", decorationList); }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.