Skip to content

Virtual resource packs

Frontrider edited this page Oct 17, 2019 · 1 revision

Example code

   HashMap<String, InputStreamProvider> map = new HashMap<>();
       map.put("assets/minecraft/blockstates/cobblestone.json", InputStreamProvider.of(() -> "{\n" +
               "    \"variants\": {\n" +
              "        \"\": { \"model\": \"block/sandstone\" }\n" +
               "    }\n" +
               "}\n"));
       VirtualResourcePackManager.INSTANCE.addPack(
               new VirtualResourcePack(new Identifier("cotton", "test"), map),
               Collections.singleton(ResourceType.CLIENT_RESOURCES)
      );