mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Close 856 and update jei usage (#857)
* use non-dep fluid methods * start of jei update * Update to non-dep JEI methods * Closes #856
This commit is contained in:
parent
f317b987f1
commit
81d106898b
15 changed files with 72 additions and 364 deletions
|
@ -46,10 +46,9 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.UniversalBucket;
|
||||
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import java.util.*;
|
||||
|
||||
public final class InitBooklet{
|
||||
|
@ -285,9 +284,9 @@ public final class InitBooklet{
|
|||
chaptersIntroduction[10] = new BookletChapter("trialsIntro", ActuallyAdditionsAPI.entryTrials, new ItemStack(Items.GOLD_INGOT), new PageTextOnly(1), new PageTextOnly(2)).setSpecial();
|
||||
new BookletChapterTrials("crystalProduction", new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), false);
|
||||
new BookletChapterTrials("leatherProduction", new ItemStack(Items.LEATHER), false);
|
||||
new BookletChapterTrials("crystalOil", UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, InitFluids.fluidCrystalOil), false);
|
||||
new BookletChapterTrials("crystalOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, Fluid.BUCKET_VOLUME)), false);
|
||||
new BookletChapterTrials("autoDisenchanter", new ItemStack(InitItems.itemDisenchantingLens), false);
|
||||
new BookletChapterTrials("empoweredOil", UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, InitFluids.fluidEmpoweredOil), false);
|
||||
new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, Fluid.BUCKET_VOLUME)), false);
|
||||
new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false);
|
||||
new BookletChapterTrials("empowererAutomation", new ItemStack(InitBlocks.blockEmpowerer), false);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,9 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.fluids.UniversalBucket;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -193,11 +194,10 @@ public class CreativeTab extends CreativeTabs{
|
|||
this.add(InitItems.itemMagnetRing);
|
||||
this.add(InitItems.itemWaterRemovalRing);
|
||||
|
||||
UniversalBucket bucket = ForgeModContainer.getInstance().universalBucket;
|
||||
this.list.add(UniversalBucket.getFilledBucket(bucket, InitFluids.fluidCanolaOil));
|
||||
this.list.add(UniversalBucket.getFilledBucket(bucket, InitFluids.fluidRefinedCanolaOil));
|
||||
this.list.add(UniversalBucket.getFilledBucket(bucket, InitFluids.fluidCrystalOil));
|
||||
this.list.add(UniversalBucket.getFilledBucket(bucket, InitFluids.fluidEmpoweredOil));
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCanolaOil, Fluid.BUCKET_VOLUME)));
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidRefinedCanolaOil, Fluid.BUCKET_VOLUME)));
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, Fluid.BUCKET_VOLUME)));
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, Fluid.BUCKET_VOLUME)));
|
||||
|
||||
this.add(InitItems.itemPhantomConnector);
|
||||
this.add(InitItems.itemFilter);
|
||||
|
|
|
@ -11,119 +11,15 @@
|
|||
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import invtweaks.api.container.InventoryContainer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.inventory.ContainerWorkbench;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerCrafter extends Container{
|
||||
|
||||
public final World world;
|
||||
public final InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
|
||||
public final IInventory craftResult = new InventoryCraftResult();
|
||||
public class ContainerCrafter extends ContainerWorkbench{
|
||||
|
||||
public ContainerCrafter(EntityPlayer player){
|
||||
InventoryPlayer inventory = player.inventory;
|
||||
|
||||
this.world = player.world;
|
||||
|
||||
this.addSlotToContainer(new SlotCrafting(inventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
|
||||
for(int i = 0; i < 3; i++){
|
||||
for(int j = 0; j < 3; j++){
|
||||
this.addSlotToContainer(new Slot(this.craftMatrix, j+i*3, 30+j*18, 17+i*18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++){
|
||||
for(int j = 0; j < 9; j++){
|
||||
this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 84+i*18));
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < 9; i++){
|
||||
this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 142));
|
||||
}
|
||||
|
||||
this.onCraftMatrixChanged(this.craftMatrix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index){
|
||||
ItemStack itemstack = StackUtil.getNull();
|
||||
Slot slot = this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()){
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(index == 0){
|
||||
if(!this.mergeItemStack(itemstack1, 10, 46, true)){
|
||||
return StackUtil.getNull();
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if(index >= 10 && index < 37){
|
||||
if(!this.mergeItemStack(itemstack1, 37, 46, false)){
|
||||
return StackUtil.getNull();
|
||||
}
|
||||
}
|
||||
else if(index >= 37 && index < 46){
|
||||
if(!this.mergeItemStack(itemstack1, 10, 37, false)){
|
||||
return StackUtil.getNull();
|
||||
}
|
||||
}
|
||||
else if(!this.mergeItemStack(itemstack1, 10, 46, false)){
|
||||
return StackUtil.getNull();
|
||||
}
|
||||
|
||||
if(!StackUtil.isValid(itemstack1)){
|
||||
slot.putStack(StackUtil.getNull());
|
||||
}
|
||||
else{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(StackUtil.getStackSize(itemstack1) == StackUtil.getStackSize(itemstack)){
|
||||
return StackUtil.getNull();
|
||||
}
|
||||
|
||||
slot.onTake(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMergeSlot(ItemStack stack, Slot slotIn){
|
||||
return slotIn.inventory != this.craftResult && super.canMergeSlot(stack, slotIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player){
|
||||
super.onContainerClosed(player);
|
||||
|
||||
for(int i = 0; i < 9; ++i){
|
||||
ItemStack stack = this.craftMatrix.removeStackFromSlot(i);
|
||||
if(StackUtil.isValid(stack)){
|
||||
if(!player.addItemStackToInventory(stack))
|
||||
if(!this.world.isRemote) Block.spawnAsEntity(world, player.getPosition(), stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftMatrixChanged(IInventory inv){
|
||||
IRecipe output = CraftingManager.findMatchingRecipe(this.craftMatrix, this.world);
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
if(output != null) stack = output.getRecipeOutput();
|
||||
this.craftResult.setInventorySlotContents(0, stack.copy());
|
||||
super(player.inventory, player.world, player.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
package de.ellpeck.actuallyadditions.mod.jei;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCrafter;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
|
||||
|
@ -19,18 +24,20 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiGrinder;
|
|||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeCategory;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeWrapper;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeCategory;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeWrapper;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeCategory;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeWrapper;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeCategory;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeWrapper;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeCategory;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeWrapper;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import mezz.jei.api.*;
|
||||
import mezz.jei.api.ingredients.IIngredientBlacklist;
|
||||
import mezz.jei.api.ingredients.IModIngredientRegistration;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferRegistry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -49,56 +56,57 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry){
|
||||
IJeiHelpers helpers = registry.getJeiHelpers();
|
||||
|
||||
registry.addRecipeCategories(
|
||||
new CoffeeMachineRecipeCategory(helpers.getGuiHelper()),
|
||||
public void registerCategories(IRecipeCategoryRegistration registry) {
|
||||
IJeiHelpers helpers = registry.getJeiHelpers();
|
||||
registry.addRecipeCategories(
|
||||
new CoffeeMachineRecipeCategory(helpers.getGuiHelper()),
|
||||
new CrusherRecipeCategory(helpers.getGuiHelper()),
|
||||
new ReconstructorRecipeCategory(helpers.getGuiHelper()),
|
||||
new EmpowererRecipeCategory(helpers.getGuiHelper()),
|
||||
new BookletRecipeCategory(helpers.getGuiHelper())
|
||||
);
|
||||
new BookletRecipeCategory(helpers.getGuiHelper()));
|
||||
}
|
||||
|
||||
registry.addRecipeHandlers(
|
||||
new CoffeeMachineRecipeHandler(),
|
||||
new CrusherRecipeHandler(),
|
||||
new ReconstructorRecipeHandler(),
|
||||
new EmpowererRecipeHandler(),
|
||||
new BookletRecipeHandler()
|
||||
);
|
||||
@Override
|
||||
public void register(IModRegistry registry){
|
||||
IJeiHelpers helpers = registry.getJeiHelpers();
|
||||
|
||||
registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.EMPOWERER_RECIPES);
|
||||
registry.handleRecipes(IBookletPage.class, BookletRecipeWrapper::new, BookletRecipeCategory.NAME);
|
||||
registry.handleRecipes(CoffeeIngredient.class, CoffeeMachineRecipeWrapper::new, CoffeeMachineRecipeCategory.NAME);
|
||||
registry.handleRecipes(CrusherRecipe.class, CrusherRecipeWrapper::new, CrusherRecipeCategory.NAME);
|
||||
registry.handleRecipes(LensConversionRecipe.class, ReconstructorRecipeWrapper::new, ReconstructorRecipeCategory.NAME);
|
||||
registry.handleRecipes(EmpowererRecipe.class, EmpowererRecipeWrapper::new, EmpowererRecipeCategory.NAME);
|
||||
|
||||
registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS, CoffeeMachineRecipeCategory.NAME);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES, CrusherRecipeCategory.NAME);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES, ReconstructorRecipeCategory.NAME);
|
||||
registry.addRecipes(ActuallyAdditionsAPI.EMPOWERER_RECIPES, EmpowererRecipeCategory.NAME);
|
||||
|
||||
registry.addRecipeClickArea(GuiCoffeeMachine.class, 53, 42, 22, 16, CoffeeMachineRecipeCategory.NAME);
|
||||
registry.addRecipeClickArea(GuiGrinder.class, 80, 40, 24, 22, CrusherRecipeCategory.NAME);
|
||||
registry.addRecipeClickArea(GuiGrinder.GuiGrinderDouble.class, 51, 40, 74, 22, CrusherRecipeCategory.NAME);
|
||||
registry.addRecipeClickArea(GuiFurnaceDouble.class, 51, 40, 74, 22, VanillaRecipeCategoryUid.SMELTING);
|
||||
|
||||
IItemBlacklist blacklist = helpers.getItemBlacklist();
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockRice));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockCanola));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockFlax));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockCoffee));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockColoredLampOn, 1, Util.WILDCARD));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()));
|
||||
IIngredientBlacklist blacklist = helpers.getIngredientBlacklist();
|
||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockRice));
|
||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockCanola));
|
||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockFlax));
|
||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockCoffee));
|
||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD));
|
||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockColoredLampOn, 1, Util.WILDCARD));
|
||||
blacklist.addIngredientToBlacklist(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()));
|
||||
|
||||
IRecipeTransferRegistry transfer = registry.getRecipeTransferRegistry();
|
||||
transfer.addRecipeTransferHandler(ContainerCrafter.class, VanillaRecipeCategoryUid.CRAFTING, 1, 9, 10, 36);
|
||||
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitItems.itemCrafterOnAStick), VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockFurnaceDouble), VanillaRecipeCategoryUid.SMELTING);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockGrinder), CrusherRecipeCategory.NAME);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockGrinderDouble), CrusherRecipeCategory.NAME);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockCoffeeMachine), CoffeeMachineRecipeCategory.NAME);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockAtomicReconstructor), ReconstructorRecipeCategory.NAME);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockEmpowerer), EmpowererRecipeCategory.NAME);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(InitItems.itemBooklet), BookletRecipeCategory.NAME);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitItems.itemCrafterOnAStick), VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockFurnaceDouble), VanillaRecipeCategoryUid.SMELTING);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockGrinder), CrusherRecipeCategory.NAME);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockGrinderDouble), CrusherRecipeCategory.NAME);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockCoffeeMachine), CoffeeMachineRecipeCategory.NAME);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockAtomicReconstructor), ReconstructorRecipeCategory.NAME);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockEmpowerer), EmpowererRecipeCategory.NAME);
|
||||
registry.addRecipeCatalyst(new ItemStack(InitItems.itemBooklet), BookletRecipeCategory.NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,14 +16,14 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
|||
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class RecipeWrapperWithButton extends BlankRecipeWrapper{
|
||||
public abstract class RecipeWrapperWithButton implements IRecipeWrapper{
|
||||
|
||||
protected final TexturedButton theButton;
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* This file ("BookletRecipeHandler.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.jei.booklet;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class BookletRecipeHandler implements IRecipeHandler<IBookletPage>{
|
||||
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass(){
|
||||
return IBookletPage.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid(IBookletPage recipe){
|
||||
return BookletRecipeCategory.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(IBookletPage recipe){
|
||||
return new BookletRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(IBookletPage recipe){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton{
|
|||
|
||||
@Override
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
||||
List header = minecraft.fontRenderer.listFormattedStringToWidth(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".booklet.header").replaceAll("<item>", TextFormatting.BLUE+"").replaceAll("<r>", TextFormatting.BLACK+""), 150);
|
||||
List<String> header = minecraft.fontRenderer.listFormattedStringToWidth(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".booklet.header").replaceAll("<item>", TextFormatting.BLUE+"").replaceAll("<r>", TextFormatting.BLACK+""), 150);
|
||||
for(int i = 0; i < header.size(); i++){
|
||||
minecraft.fontRenderer.drawString((String)header.get(i), 0, 17+i*(minecraft.fontRenderer.FONT_HEIGHT+1), 0, false);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton{
|
|||
int maxLines = 4;
|
||||
IBookletChapter chapter = this.thePage.getChapter();
|
||||
String aText = chapter.getAllPages()[0].getInfoText();
|
||||
List text = minecraft.fontRenderer.listFormattedStringToWidth(aText != null ? aText : TextFormatting.DARK_RED+StringUtil.localize("container.nei."+ModUtil.MOD_ID+".booklet.noText"), 150);
|
||||
List<String> text = minecraft.fontRenderer.listFormattedStringToWidth(aText != null ? aText : TextFormatting.DARK_RED+StringUtil.localize("container.nei."+ModUtil.MOD_ID+".booklet.noText"), 150);
|
||||
for(int i = 0; i < Math.min(maxLines, text.size()); i++){
|
||||
minecraft.fontRenderer.drawString(text.get(i)+(i == maxLines-1 && text.size() > maxLines ? TextFormatting.RESET+""+TextFormatting.BLACK+"..." : ""), 0, 16+25+i*(minecraft.fontRenderer.FONT_HEIGHT+1), 0, false);
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* This file ("CoffeeMachineRecipeHandler.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class CoffeeMachineRecipeHandler implements IRecipeHandler<CoffeeIngredient>{
|
||||
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass(){
|
||||
return CoffeeIngredient.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid(CoffeeIngredient recipe){
|
||||
return CoffeeMachineRecipeCategory.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(CoffeeIngredient recipe){
|
||||
return new CoffeeMachineRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(CoffeeIngredient recipe){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{
|
|||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients){
|
||||
List list = new ArrayList();
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
list.add(this.theIngredient.ingredient);
|
||||
list.add(this.cup);
|
||||
list.add(this.coffeeBeans);
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* This file ("CrusherRecipeHandler.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.jei.crusher;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class CrusherRecipeHandler implements IRecipeHandler<CrusherRecipe>{
|
||||
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass(){
|
||||
return CrusherRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid(CrusherRecipe recipe){
|
||||
return CrusherRecipeCategory.NAME;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(CrusherRecipe recipe){
|
||||
return new CrusherRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(CrusherRecipe recipe){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton{
|
|||
public void getIngredients(IIngredients ingredients){
|
||||
ingredients.setInput(ItemStack.class, this.theRecipe.inputStack);
|
||||
|
||||
List list = new ArrayList();
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
list.add(this.theRecipe.outputOneStack);
|
||||
if(StackUtil.isValid(this.theRecipe.outputTwoStack)){
|
||||
list.add(this.theRecipe.outputTwoStack);
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* This file ("EmpowererRecipeHandler.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class EmpowererRecipeHandler implements IRecipeHandler<EmpowererRecipe>{
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass(){
|
||||
return EmpowererRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid(EmpowererRecipe recipe){
|
||||
return EmpowererRecipeCategory.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(EmpowererRecipe recipe){
|
||||
return new EmpowererRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(EmpowererRecipe recipe){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* This file ("ReconstructorRecipeHandler.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ReconstructorRecipeHandler implements IRecipeHandler<LensConversionRecipe>{
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass(){
|
||||
return LensConversionRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid(LensConversionRecipe recipe){
|
||||
return ReconstructorRecipeCategory.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(LensConversionRecipe recipe){
|
||||
return new ReconstructorRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(LensConversionRecipe recipe){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ public final class AwfulUtil{
|
|||
|
||||
someInt = someInt-stacks.size();
|
||||
|
||||
while(someInt > 0 && ((List)list).size() > 0){
|
||||
while(someInt > 0 && list.size() > 0){
|
||||
ItemStack itemstack2 = list.remove(MathHelper.getInt(rand, 0, list.size()-1));
|
||||
int i = MathHelper.getInt(rand, 1, itemstack2.getCount()/2);
|
||||
ItemStack itemstack1 = itemstack2.splitStack(i);
|
||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.util.crafting;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public final class RecipeHandler{
|
||||
|
||||
public static IRecipe lastRecipe;
|
||||
|
|
Loading…
Reference in a new issue