Updated JEI support for rolling machine.
This commit is contained in:
parent
2574a898d8
commit
5e960ec3f2
4 changed files with 21 additions and 84 deletions
|
@ -27,6 +27,7 @@ package techreborn.compat.jei;
|
|||
import mezz.jei.api.*;
|
||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferRegistry;
|
||||
import mezz.jei.collect.ListMultiMap;
|
||||
|
@ -39,11 +40,16 @@ import net.minecraft.client.gui.GuiScreen;
|
|||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.util.StringUtils;
|
||||
|
@ -94,8 +100,8 @@ import techreborn.compat.jei.industrialGrinder.IndustrialGrinderRecipeWrapper;
|
|||
import techreborn.compat.jei.industrialSawmill.IndustrialSawmillRecipeCategory;
|
||||
import techreborn.compat.jei.industrialSawmill.IndustrialSawmillRecipeWrapper;
|
||||
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeCategory;
|
||||
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeHandler;
|
||||
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeMaker;
|
||||
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeWrapper;
|
||||
import techreborn.compat.jei.scrapbox.ScrapboxRecipeCategory;
|
||||
import techreborn.compat.jei.scrapbox.ScrapboxRecipeWrapper;
|
||||
import techreborn.compat.jei.vacuumFreezer.VacuumFreezerRecipeCategory;
|
||||
|
@ -114,7 +120,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@mezz.jei.api.JEIPlugin
|
||||
public class TechRebornJeiPlugin implements IModPlugin {
|
||||
|
||||
|
@ -136,13 +141,15 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
dirtBlock, time, 120);
|
||||
debugRecipes.add(assemblingMachineRecipe);
|
||||
}
|
||||
registry.addRecipes(debugRecipes, RecipeCategoryUids.ASSEMBLING_MACHINE);
|
||||
debugRecipes.clear();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
final int time = (int) Math.round(200 + Math.random() * 100);
|
||||
final ImplosionCompressorRecipe recipe = new ImplosionCompressorRecipe(diamondBlock, diamondBlock, dirtBlock,
|
||||
dirtBlock, time, 120);
|
||||
debugRecipes.add(recipe);
|
||||
}
|
||||
registry.addRecipes(debugRecipes);
|
||||
registry.addRecipes(debugRecipes, RecipeCategoryUids.IMPLOSION_COMPRESSOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -179,6 +186,7 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void register(@Nonnull final IModRegistry registry) {
|
||||
final IJeiHelpers jeiHelpers = registry.getJeiHelpers();
|
||||
|
@ -262,7 +270,10 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
registry.handleRecipes(VacuumFreezerRecipe.class, recipe -> new VacuumFreezerRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.VACUUM_FREEZER);
|
||||
registry.handleRecipes(DistillationTowerRecipe.class, recipe -> new DistillationTowerRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.DISTILLATION_TOWER);
|
||||
registry.handleRecipes(FluidReplicatorRecipe.class, recipe -> new FluidReplicatorRecipeWrapper(jeiHelpers,recipe), RecipeCategoryUids.FLUID_REPLICATOR);
|
||||
registry.addRecipeHandlers(new RollingMachineRecipeHandler());
|
||||
registry.handleRecipes(ShapelessRecipes.class, recipe -> new RollingMachineRecipeWrapper((IRecipeWrapper) recipe), RecipeCategoryUids.ROLLING_MACHINE);
|
||||
registry.handleRecipes(ShapedRecipes.class, recipe -> new RollingMachineRecipeWrapper((IRecipeWrapper) recipe), RecipeCategoryUids.ROLLING_MACHINE);
|
||||
registry.handleRecipes(ShapedOreRecipe.class, recipe -> new RollingMachineRecipeWrapper((IRecipeWrapper) recipe), RecipeCategoryUids.ROLLING_MACHINE);
|
||||
registry.handleRecipes(ShapelessOreRecipe.class, recipe -> new RollingMachineRecipeWrapper((IRecipeWrapper) recipe), RecipeCategoryUids.ROLLING_MACHINE);
|
||||
|
||||
for (final EFluidGenerator type : EFluidGenerator.values()) {
|
||||
registry.handleRecipes(FluidGeneratorRecipe.class, recipe -> new FluidGeneratorRecipeWrapper(jeiHelpers, recipe), type.getRecipeID());
|
||||
|
|
|
@ -82,20 +82,13 @@ public class RollingMachineRecipeCategory implements IRecipeCategory<RollingMach
|
|||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(
|
||||
@Nonnull
|
||||
Minecraft minecraft) {
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
progress.draw(minecraft, 62, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(
|
||||
@Nonnull
|
||||
IRecipeLayout recipeLayout,
|
||||
@Nonnull
|
||||
RollingMachineRecipeWrapper recipeWrapper,
|
||||
@Nonnull
|
||||
IIngredients ingredients) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RollingMachineRecipeWrapper recipeWrapper,
|
||||
@Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
for (int l = 0; l < 3; l++) {
|
||||
for (int k1 = 0; k1 < 3; k1++) {
|
||||
|
@ -103,10 +96,9 @@ public class RollingMachineRecipeCategory implements IRecipeCategory<RollingMach
|
|||
guiItemStacks.init(INPUT_SLOTS[i], true, k1 * 18, l * 18);
|
||||
}
|
||||
}
|
||||
|
||||
guiItemStacks.init(OUTPUT_SLOTS[0], false, 94, 18);
|
||||
|
||||
craftingGridHelper.setInputStacks(guiItemStacks, ingredients.getInputs(ItemStack.class));
|
||||
craftingGridHelper.setOutput(guiItemStacks, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class));
|
||||
guiItemStacks.set(OUTPUT_SLOTS[0], ingredients.getOutputs(ItemStack.class).get(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* 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 techreborn.compat.jei.rollingMachine;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@SuppressWarnings({"deprecation" })
|
||||
public class RollingMachineRecipeHandler implements IRecipeHandler<RollingMachineRecipeWrapper> {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<RollingMachineRecipeWrapper> getRecipeClass() {
|
||||
return RollingMachineRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(
|
||||
@Nonnull
|
||||
RollingMachineRecipeWrapper recipe) {
|
||||
return RecipeCategoryUids.ROLLING_MACHINE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(
|
||||
@Nonnull
|
||||
RollingMachineRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(
|
||||
@Nonnull
|
||||
RollingMachineRecipeWrapper recipe) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -67,10 +67,7 @@ public class RollingMachineRecipeWrapper implements IRecipeWrapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(
|
||||
@Nonnull
|
||||
IIngredients ingredients) {
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
baseRecipe.getIngredients(ingredients);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue