diff options
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | build.gradle.kts | 20 | ||||
-rw-r--r-- | src/test/java/TestMain.java | 16 |
3 files changed, 47 insertions, 3 deletions
@@ -1,11 +1,19 @@ # NEU repo parsing -A standalone library for parsing the [NEU repo](https://github.com/NotEnoughUpdates/NotEnoughUpdates-REPO/). Intended to be used for NEU, but can also be used for other purposes. +A standalone library for parsing the [NEU repo](https://github.com/NotEnoughUpdates/NotEnoughUpdates-REPO/). Intended to +be used for NEU, but can also be used for other purposes. -## Licensing +## Versioning + +Due to this library not having parity with the actual parser in the normal NEU mod, there will be rapid changes in +development. As such every commit could be a breaking change. Please plan accordingly for now. -This repository incorporates (in addition to libraries loaded by gradle) a file taken from [the google gson extra repository](https://github.com/google/gson/blob/master/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java) with our own changes (highlighted in the code). That file is licensed under the Apache License version 2.0. The rest of the source code is licensed under the BSD-3-Clause No Military License. +## Licensing +This repository incorporates (in addition to libraries loaded by gradle) a file taken +from [the google gson extra repository](https://github.com/google/gson/blob/master/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java) +with our own changes (highlighted in the code). That file is licensed under the Apache License version 2.0. The rest of +the source code is licensed under the BSD-3-Clause No Military License. ``` Copyright (c) 2022 The NEU authors. All Rights Reserved. diff --git a/build.gradle.kts b/build.gradle.kts index 22c343e..8291632 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -84,6 +84,26 @@ publishing { artifact(sourcesJar) { classifier = "sources" } + pom { + name.set("NEU Repo Parsing") + description.set("A library for standardized parsing of the NotEnoughUpdates item repository") + url.set("https://github.com/NotEnoughUpdates/RepoParser") + + licenses { + license { + name.set("BSD 3-Clause No Military License") + url.set("https://github.com/NotEnoughUpdates/RepoParser/blob/master/LICENSE") + } + } + developers { + developer { + name.set("Linnea Gräf") + } + } + scm { + url.set("https://github.com/NotEnoughUpdates/RepoParser") + } + } } } } diff --git a/src/test/java/TestMain.java b/src/test/java/TestMain.java index e3c05ec..b52fcb6 100644 --- a/src/test/java/TestMain.java +++ b/src/test/java/TestMain.java @@ -3,8 +3,11 @@ import io.github.moulberry.repo.NEURepository; import io.github.moulberry.repo.NEURepositoryException; import io.github.moulberry.repo.NEURepositoryVersion; import io.github.moulberry.repo.data.NEUForgeRecipe; +import io.github.moulberry.repo.data.NEUMobDropRecipe; import java.nio.file.Paths; +import java.util.stream.Collectors; +import java.util.stream.Stream; public class TestMain { public static void main(String[] args) throws NEURepositoryException { @@ -26,5 +29,18 @@ public class TestMain { System.out.println("is vanilla ASPECT_OF_THE_END: " + repository.getItems().getItemBySkyblockId("ASPECT_OF_THE_END").isVanilla()); System.out.println("is vanilla DIAMOND: " + repository.getItems().getItemBySkyblockId("DIAMOND").isVanilla()); System.out.println("crafting recipe of DIVAN DRILL: " + ((NEUForgeRecipe) recipes.getRecipes().get("DIVAN_DRILL").stream().findAny().get()).getInputs()); + + System.out.println("Non standard drop chances: " + repository.getItems().getItems().values().stream() + .flatMap(it -> it.getRecipes().stream()) + .flatMap(it -> { + if (it instanceof NEUMobDropRecipe) { + return ((NEUMobDropRecipe) it).getDrops().stream(); + } + return Stream.empty(); + }) + .map(it -> it.getChance()) + .filter(it -> it != null && !it.matches("\\d+(.\\d+)?+%")) + .collect(Collectors.toList())); + } } |