Fix UU matter recipes.

Adds a PaddedShapedRecipe to RebornCore
This commit is contained in:
modmuss50 2021-06-02 21:25:15 +01:00
parent 315891885d
commit dc216b974d
39 changed files with 233 additions and 261 deletions

View file

@ -1 +1,5 @@
group = 'RebornCore' group = 'RebornCore'
minecraft {
accessWidener = file("src/main/resources/reborncore.accesswidener")
}

View file

@ -45,6 +45,7 @@ import reborncore.common.misc.RebornCoreTags;
import reborncore.common.multiblock.MultiblockRegistry; import reborncore.common.multiblock.MultiblockRegistry;
import reborncore.common.network.ServerBoundPackets; import reborncore.common.network.ServerBoundPackets;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.recipes.PaddedShapedRecipe;
import reborncore.common.util.CalenderUtils; import reborncore.common.util.CalenderUtils;
import reborncore.common.util.GenericWrenchHelper; import reborncore.common.util.GenericWrenchHelper;
@ -107,6 +108,7 @@ public class RebornCore implements ModInitializer {
RebornCoreCommands.setup(); RebornCoreCommands.setup();
RebornCoreTags.WATER_EXPLOSION_ITEM.toString(); RebornCoreTags.WATER_EXPLOSION_ITEM.toString();
PaddedShapedRecipe.PADDED.toString();
/* register UnloadHandler */ /* register UnloadHandler */
ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.register((blockEntity, world) -> { ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.register((blockEntity, world) -> {

View file

@ -0,0 +1,62 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.common.recipes;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.registry.Registry;
import java.util.Map;
public class PaddedShapedRecipe extends ShapedRecipe {
public static final Identifier ID = new Identifier("reborncore", "padded");
public static final RecipeSerializer<ShapedRecipe> PADDED = Registry.register(Registry.RECIPE_SERIALIZER, ID, new Serializer());
public PaddedShapedRecipe(Identifier id, String group, int width, int height, DefaultedList<Ingredient> input, ItemStack output) {
super(id, group, width, height, input, output);
}
private static class Serializer extends ShapedRecipe.Serializer {
@Override
public PaddedShapedRecipe read(Identifier identifier, JsonObject jsonObject) {
String group = JsonHelper.getString(jsonObject, "group", "");
Map<String, Ingredient> map = readSymbols(JsonHelper.getObject(jsonObject, "key"));
String[] strings = getPattern(JsonHelper.getArray(jsonObject, "pattern"));
int width = strings[0].length();
int height = strings.length;
DefaultedList<Ingredient> ingredients = createPatternMatrix(strings, map, width, height);
ItemStack output = outputFromJson(JsonHelper.getObject(jsonObject, "result"));
return new PaddedShapedRecipe(identifier, group, width, height, ingredients, output);
}
}
}

View file

@ -46,5 +46,6 @@
], ],
"custom": { "custom": {
"modmenu:api": true "modmenu:api": true
} },
"accessWidener": "reborncore.accesswidener"
} }

View file

@ -0,0 +1,5 @@
accessWidener v1 named
accessible method net/minecraft/recipe/ShapedRecipe readSymbols (Lcom/google/gson/JsonObject;)Ljava/util/Map;
accessible method net/minecraft/recipe/ShapedRecipe getPattern (Lcom/google/gson/JsonArray;)[Ljava/lang/String;
accessible method net/minecraft/recipe/ShapedRecipe createPatternMatrix ([Ljava/lang/String;Ljava/util/Map;II)Lnet/minecraft/util/collection/DefaultedList;

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"UXX", "U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:aluminum_dust" "item": "techreborn:aluminum_dust"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"UXX", "U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:bone" "item": "minecraft:bone"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"XXU", " U",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:cactus" "item": "minecraft:cactus"

View file

@ -1,16 +1,13 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"UUX", "UU ",
"XUX" " U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
},
"X": {
"item": "minecraft:air"
} }
}, },
"result": { "result": {

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXU", " U",
"XXX", " ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:clay" "item": "minecraft:clay"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"XUX", " U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:coal_ore" "item": "minecraft:coal_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"XXX", " ",
"UXX" "U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:cocoa_beans" "item": "minecraft:cocoa_beans"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"XXX", " ",
"XUX" " U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:copper_dust" "item": "techreborn:copper_dust"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XUX", " U ",
"UUU", "UUU",
"UUX" "UU "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:diamond_ore" "item": "minecraft:diamond_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"UXU", "U U",
"UXX" "U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:emerald_ore" "item": "minecraft:emerald_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"XXX", " ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:ender_pearl" "item": "minecraft:ender_pearl"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"UXX", "U ",
"UXX" "U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:feather" "item": "minecraft:feather"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"XXX", " ",
"XXU" " U"
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:glass" "item": "minecraft:glass"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUX", "UU ",
"XXX", " ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:glowstone" "item": "minecraft:glowstone"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"UUU", "UUU",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:gold_ore" "item": "minecraft:gold_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"XXX", " ",
"UXX" "U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:grass_block" "item": "minecraft:grass_block"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"XUX", " U ",
"XXU" " U"
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:gunpowder" "item": "minecraft:gunpowder"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUX", "UU ",
"UXX", "U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:ink_sac" "item": "minecraft:ink_sac"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"UUX", "UU ",
"UXX" "U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:iridium_ore" "item": "techreborn:iridium_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXU", "U U",
"XXX", " ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:iron_ore" "item": "minecraft:iron_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UXX", "U ",
"UXX", "U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:lapis_ore" "item": "minecraft:lapis_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"UXX", "U ",
"UXX" "U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:lead_dust" "item": "techreborn:lead_dust"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XUX", " U ",
"XXU", " U",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:lily_pad" "item": "minecraft:lily_pad"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XUX", " U ",
"XXX", " ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:oak_wood" "item": "minecraft:oak_wood"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"XUX", " U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:obsidian" "item": "minecraft:obsidian"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"UUX", "UU ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:platinum_dust" "item": "techreborn:platinum_dust"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"XXX", " ",
"UXU" "U U"
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:redstone_ore" "item": "minecraft:redstone_ore"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"XXX", " ",
"XUX" " U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:snow_block" "item": "minecraft:snow_block"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"XUX", " U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:stone" "item": "minecraft:stone"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XUX", " U ",
"XXX", " ",
"UXX" "U "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:sugar_cane" "item": "minecraft:sugar_cane"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XXX", " ",
"XUX", " U ",
"XXU" " U"
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:tin_dust" "item": "techreborn:tin_dust"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"UXU", "U U",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:titanium_dust" "item": "techreborn:titanium_dust"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"UUU", "UUU",
"UUU", "UUU",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "techreborn:tungsten_dust" "item": "techreborn:tungsten_dust"

View file

@ -1,17 +1,14 @@
{ {
"type": "minecraft:crafting_shaped", "type": "reborncore:padded",
"pattern": [ "pattern": [
"XUX", " U ",
"XUX", " U ",
"XXX" " "
], ],
"key": { "key": {
"U": { "U": {
"item": "techreborn:uu_matter" "item": "techreborn:uu_matter"
}, }
"X": {
"item": "minecraft:air"
}
}, },
"result": { "result": {
"item": "minecraft:vine" "item": "minecraft:vine"