Some quality of life adjustments

This commit is contained in:
Sollace 2019-03-05 12:45:56 +02:00
parent b4663b4881
commit 68cbb4b57b
5 changed files with 36 additions and 15 deletions

View file

@ -54,9 +54,23 @@ repositories {
flatDir { flatDir {
dir 'lib' dir 'lib'
} }
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "http://dvs1.progwml6.com/files/maven"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "modmaven.k-4u.nl"
}
} }
dependencies { dependencies {
deobfCompile('com.minelittlepony:jumpingcastle:1.12.2.1.0.0:universal') deobfCompile('com.minelittlepony:jumpingcastle:1.12.2.1.0.0:universal')
// compile against the JEI API but do not include it at runtime
deobfProvided "mezz.jei:jei_${project.mcVersion}:${project.jeiVersion}:api"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${project.mcVersion}:${project.jeiVersion}"
} }
processResources { processResources {

View file

@ -8,6 +8,7 @@ buildVersion=2
buildRevision=6 buildRevision=6
mcVersion=1.12.2 mcVersion=1.12.2
mcfVersion=14.23.2.2654 mcfVersion=14.23.2.2654
jeiVersion=4.15.0.268
mcMappings=stable_39 mcMappings=stable_39
refCore=mixins.unicopia.refmap.json refCore=mixins.unicopia.refmap.json
forgeGradleVersion=2.3-SNAPSHOT forgeGradleVersion=2.3-SNAPSHOT

View file

@ -57,7 +57,16 @@ public class Unicopia implements IGuiHandler {
private static IChannel channel; private static IChannel channel;
private static CraftingManager craftingManager; private static CraftingManager craftingManager = new CraftingManager(MODID, "enchanting") {
@Override
protected void registerRecipeTypes(Map<String, Function<JsonObject, IRecipe>> types) {
super.registerRecipeTypes(types);
types.put("unicopia:crafting_spell", SpellRecipe::deserialize);
AffineIngredients.instance().load();
}
};
public static CraftingManager getCraftingManager() { public static CraftingManager getCraftingManager() {
return craftingManager; return craftingManager;
@ -106,16 +115,7 @@ public class Unicopia implements IGuiHandler {
@EventHandler @EventHandler
public void posInit(FMLPostInitializationEvent event) { public void posInit(FMLPostInitializationEvent event) {
craftingManager = new CraftingManager(MODID, "enchanting") { craftingManager.load();
@Override
protected void registerRecipeTypes(Map<String, Function<JsonObject, IRecipe>> types) {
super.registerRecipeTypes(types);
types.put("unicopia:crafting_spell", SpellRecipe::deserialize);
AffineIngredients.instance().load();
}
};
Pages.instance().load(); Pages.instance().load();

View file

@ -27,7 +27,7 @@ public class GuiSpellBook extends GuiContainer implements IPageUnlockListener {
private static IPage currentIPage; private static IPage currentIPage;
private static final ResourceLocation spellBookGuiTextures = new ResourceLocation("unicopia", "textures/gui/container/book.png"); public static final ResourceLocation spellBookGuiTextures = new ResourceLocation("unicopia", "textures/gui/container/book.png");
private IPlayer playerExtension; private IPlayer playerExtension;

View file

@ -1,5 +1,6 @@
package com.minelittlepony.unicopia.util.crafting; package com.minelittlepony.unicopia.util.crafting;
import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
@ -40,8 +41,6 @@ public class CraftingManager {
public CraftingManager(@Nonnull ResourceLocation id) { public CraftingManager(@Nonnull ResourceLocation id) {
crafting_id = id; crafting_id = id;
assets = new AssetWalker(id, this::handleJson); assets = new AssetWalker(id, this::handleJson);
load();
} }
protected void handleJson(ResourceLocation id, JsonObject json) throws JsonParseException { protected void handleJson(ResourceLocation id, JsonObject json) throws JsonParseException {
@ -87,7 +86,7 @@ public class CraftingManager {
public IRecipe findMatchingRecipe(InventoryCrafting craftMatrix, World worldIn) { public IRecipe findMatchingRecipe(InventoryCrafting craftMatrix, World worldIn) {
load(); load();
for (IRecipe irecipe : REGISTRY.values()) { for (IRecipe irecipe : getRecipes()) {
if (irecipe.matches(craftMatrix, worldIn)) { if (irecipe.matches(craftMatrix, worldIn)) {
return irecipe; return irecipe;
} }
@ -96,6 +95,13 @@ public class CraftingManager {
return null; return null;
} }
public Collection<IRecipe> getRecipes() {
if (REGISTRY.isEmpty()) {
load();
}
return REGISTRY.values();
}
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting craftMatrix, World worldIn) { public NonNullList<ItemStack> getRemainingItems(InventoryCrafting craftMatrix, World worldIn) {
IRecipe recipe = findMatchingRecipe(craftMatrix, worldIn); IRecipe recipe = findMatchingRecipe(craftMatrix, worldIn);