* 1.20.5 recipes: null over -1

* add 1.21

* 1.21 (#26)

* update classname

* update moved class

* updated to equivelant method since gettranslatekey removed

* added isCursed list as bandaid alternative for now since isCursed() removed

* added isTreasure list as bandaid alternative for now since isTreasure() removed

* found alternative method to canCombine() since removed

* modified getEnchantmentTarget name to handle registryEntryList since getApplicableItems dosnt return tagKey anymore

* bandaid list solution for "tradeable" property since isTradeable removed and no alternative in mappings

* bandaid solution for discoverable property since removed and no alternative to isAvailiableForRandomSelection in 1.21 mappings

* removed .toPath since apparently it dosnt exist

* no longer outputs in tagkey format

* fixed not adding enchantcategories for items properly

* added SuperGamerTron tag solution

* Update build.yml

---------

Co-authored-by: Madlykeanu <96554689+Madlykeanu@users.noreply.github.com>
Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
This commit is contained in:
extremeheat
2024-10-27 11:34:53 +01:00
committed by GitHub
co-authored by Madlykeanu Romain Beaumont
parent 131218ce79
commit 2c423f77f8
25 changed files with 1681 additions and 2 deletions
@@ -85,7 +85,52 @@ public class RecipeDataGenerator implements IDataGenerator {
for (RecipeEntry<?> recipeE : Objects.requireNonNull(DGU.getWorld()).getRecipeManager().values()) {
Recipe<?> recipe = recipeE.value();
if (recipe instanceof ShapedRecipe sr) {
generateShapedRecipe(registryManager, finalObj, sr, 0);
var ingredients = sr.getIngredients();
List<Integer> ingr = new ArrayList<>();
for (int i = 0; i < 9; i++) {
if (i >= ingredients.size()) {
ingr.add(null);
continue;
}
var stacks = ingredients.get(i);
var matching = stacks.getMatchingStacks();
if (matching.length == 0) {
ingr.add(null);
} else {
ingr.add(getRawIdFor(matching[0].getItem()));
}
}
//Lists.reverse(ingr);
JsonArray inShape = new JsonArray();
var iter = ingr.iterator();
for (int y = 0; y < sr.getHeight(); y++) {
var jsonRow = new JsonArray();
for (int z = 0; z < sr.getWidth(); z++) {
jsonRow.add(iter.next());
}
inShape.add(jsonRow);
}
JsonObject finalRecipe = new JsonObject();
finalRecipe.add("inShape", inShape);
var resultObject = new JsonObject();
resultObject.addProperty("id", getRawIdFor(sr.getResult(registryManager).getItem()));
resultObject.addProperty("count", sr.getResult(registryManager).getCount());
finalRecipe.add("result", resultObject);
String id = ((Integer) getRawIdFor(sr.getResult(registryManager).getItem())).toString();
if (!finalObj.has(id)) {
finalObj.add(id, new JsonArray());
}
finalObj.get(id).getAsJsonArray().add(finalRecipe);
// var input = new JsonArray();
// var ingredients = sr.getIngredients().stream().toList();
// for (int y = 0; y < sr.getHeight(); y++) {