mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Lotsa API restructuring
This commit is contained in:
parent
1df694c8e9
commit
e0cf180358
34 changed files with 305 additions and 195 deletions
|
@ -12,8 +12,9 @@ package de.ellpeck.actuallyadditions.api;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
|
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.*;
|
import de.ellpeck.actuallyadditions.api.recipe.*;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
@ -29,17 +30,25 @@ public class ActuallyAdditionsAPI{
|
||||||
public static final String API_ID = MOD_ID+"api";
|
public static final String API_ID = MOD_ID+"api";
|
||||||
public static final String API_VERSION = "11";
|
public static final String API_VERSION = "11";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this to handle things that aren't based in the API itself
|
||||||
|
* DO NOT CHANGE/OVERRIDE THIS!!
|
||||||
|
* This is getting initialized in Actually Additions' PreInit phase
|
||||||
|
*/
|
||||||
|
public static IMethodHandler methodHandler;
|
||||||
|
|
||||||
public static List<CrusherRecipe> crusherRecipes = new ArrayList<CrusherRecipe>();
|
public static List<CrusherRecipe> crusherRecipes = new ArrayList<CrusherRecipe>();
|
||||||
public static List<BallOfFurReturn> ballOfFurReturnItems = new ArrayList<BallOfFurReturn>();
|
public static List<BallOfFurReturn> ballOfFurReturnItems = new ArrayList<BallOfFurReturn>();
|
||||||
public static List<TreasureChestLoot> treasureChestLoot = new ArrayList<TreasureChestLoot>();
|
public static List<TreasureChestLoot> treasureChestLoot = new ArrayList<TreasureChestLoot>();
|
||||||
public static List<LensNoneRecipe> reconstructorLensNoneRecipes = new ArrayList<LensNoneRecipe>();
|
public static List<LensConversionRecipe> reconstructorLensConversionRecipes = new ArrayList<LensConversionRecipe>();
|
||||||
public static Map<Item, IColorLensChanger> reconstructorLensColorChangers = new HashMap<Item, IColorLensChanger>();
|
public static Map<Item, IColorLensChanger> reconstructorLensColorChangers = new HashMap<Item, IColorLensChanger>();
|
||||||
public static List<CoffeeIngredient> coffeeMachineIngredients = new ArrayList<CoffeeIngredient>();
|
public static List<CoffeeIngredient> coffeeMachineIngredients = new ArrayList<CoffeeIngredient>();
|
||||||
|
|
||||||
public static List<IBookletEntry> bookletEntries = new ArrayList<IBookletEntry>();
|
public static List<IBookletEntry> bookletEntries = new ArrayList<IBookletEntry>();
|
||||||
public static List<BookletPage> bookletPagesWithItemStackData = new ArrayList<BookletPage>();
|
public static List<BookletPage> bookletPagesWithItemStackData = new ArrayList<BookletPage>();
|
||||||
|
|
||||||
//These are getting initlized in Actually Additions' PreInit phase
|
//These are getting initialized in Actually Additions' PreInit phase
|
||||||
|
//DO NOT CHANGE/OVERRIDE THESE!!
|
||||||
public static IBookletEntry entryGettingStarted;
|
public static IBookletEntry entryGettingStarted;
|
||||||
public static IBookletEntry entryFunctionalNonRF;
|
public static IBookletEntry entryFunctionalNonRF;
|
||||||
public static IBookletEntry entryFunctionalRF;
|
public static IBookletEntry entryFunctionalRF;
|
||||||
|
@ -139,26 +148,26 @@ public class ActuallyAdditionsAPI{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a recipe to the Atomic Reconstructor conversion without lens
|
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
||||||
* StackSizes can only be 1 and greater ones will be ignored
|
* StackSizes can only be 1 and greater ones will be ignored
|
||||||
*
|
*
|
||||||
* @param input The input as an ItemStack
|
* @param input The input as an ItemStack
|
||||||
* @param output The output as an ItemStack
|
* @param output The output as an ItemStack
|
||||||
* @param energyUse The amount of RF used per conversion
|
* @param energyUse The amount of RF used per conversion
|
||||||
*/
|
*/
|
||||||
public static void addReconstructorLensNoneRecipe(ItemStack input, ItemStack output, int energyUse){
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
|
||||||
reconstructorLensNoneRecipes.add(new LensNoneRecipe(input, output, energyUse));
|
reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a recipe to the Atomic Reconstructor conversion without lens
|
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
||||||
*
|
*
|
||||||
* @param input The input's OreDictionary name
|
* @param input The input's OreDictionary name
|
||||||
* @param output The output's OreDictionary name
|
* @param output The output's OreDictionary name
|
||||||
* @param energyUse The amount of RF used per conversion
|
* @param energyUse The amount of RF used per conversion
|
||||||
*/
|
*/
|
||||||
public static void addReconstructorLensNoneRecipe(String input, String output, int energyUse){
|
public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){
|
||||||
reconstructorLensNoneRecipes.add(new LensNoneRecipe(input, output, energyUse));
|
reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,5 +43,5 @@ public interface IBookletGui{
|
||||||
|
|
||||||
void drawRect(int startX, int startY, int u, int v, int xSize, int ySize);
|
void drawRect(int startX, int startY, int u, int v, int xSize, int ySize);
|
||||||
|
|
||||||
EntrySet getCurrentEntrySet();
|
IEntrySet getCurrentEntrySet();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package de.ellpeck.actuallyadditions.api.internal;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public interface IEntrySet{
|
||||||
|
|
||||||
|
void setEntry(BookletPage page, IBookletChapter chapter, IBookletEntry entry, int pageInIndex);
|
||||||
|
|
||||||
|
void removeEntry();
|
||||||
|
|
||||||
|
NBTTagCompound writeToNBT();
|
||||||
|
|
||||||
|
BookletPage getCurrentPage();
|
||||||
|
|
||||||
|
IBookletEntry getCurrentEntry();
|
||||||
|
|
||||||
|
IBookletChapter getCurrentChapter();
|
||||||
|
|
||||||
|
int getPageInIndex();
|
||||||
|
|
||||||
|
void setPage(BookletPage page);
|
||||||
|
|
||||||
|
void setEntry(IBookletEntry entry);
|
||||||
|
|
||||||
|
void setChapter(IBookletChapter chapter);
|
||||||
|
|
||||||
|
void setPageInIndex(int page);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package de.ellpeck.actuallyadditions.api.internal;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the internal method handler.
|
||||||
|
* Use ActuallyAdditionsAPI.methodHandler for calling
|
||||||
|
* This is not supposed to be implemented.
|
||||||
|
*/
|
||||||
|
public interface IMethodHandler{
|
||||||
|
|
||||||
|
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
|
||||||
|
|
||||||
|
PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect);
|
||||||
|
|
||||||
|
void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp);
|
||||||
|
|
||||||
|
void addEffectToStack(ItemStack stack, PotionEffect effect);
|
||||||
|
|
||||||
|
PotionEffect[] getEffectsFromStack(ItemStack stack);
|
||||||
|
}
|
|
@ -8,8 +8,9 @@
|
||||||
* © 2016 Ellpeck
|
* © 2016 Ellpeck
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe.coffee;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ public class CoffeeIngredient{
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean effect(ItemStack stack){
|
public boolean effect(ItemStack stack){
|
||||||
return CoffeeBrewing.addEffectToStack(stack, this);
|
return ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtraText(){
|
public String getExtraText(){
|
|
@ -17,7 +17,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LensNoneRecipe{
|
public class LensConversionRecipe{
|
||||||
|
|
||||||
public int energyUse;
|
public int energyUse;
|
||||||
private String input;
|
private String input;
|
||||||
|
@ -25,13 +25,13 @@ public class LensNoneRecipe{
|
||||||
private ItemStack inputStack;
|
private ItemStack inputStack;
|
||||||
private ItemStack outputStack;
|
private ItemStack outputStack;
|
||||||
|
|
||||||
public LensNoneRecipe(ItemStack input, ItemStack output, int energyUse){
|
public LensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
|
||||||
this.inputStack = input;
|
this.inputStack = input;
|
||||||
this.outputStack = output;
|
this.outputStack = output;
|
||||||
this.energyUse = energyUse;
|
this.energyUse = energyUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LensNoneRecipe(String input, String output, int energyUse){
|
public LensConversionRecipe(String input, String output, int energyUse){
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.energyUse = energyUse;
|
this.energyUse = energyUse;
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
|
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
||||||
|
@ -68,6 +69,9 @@ public class ActuallyAdditions{
|
||||||
public void preInit(FMLPreInitializationEvent event){
|
public void preInit(FMLPreInitializationEvent event){
|
||||||
ModUtil.LOGGER.info("Starting PreInitialization Phase...");
|
ModUtil.LOGGER.info("Starting PreInitialization Phase...");
|
||||||
|
|
||||||
|
InitBooklet.preInit();
|
||||||
|
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
||||||
|
|
||||||
new ConfigurationHandler(event.getSuggestedConfigurationFile());
|
new ConfigurationHandler(event.getSuggestedConfigurationFile());
|
||||||
PacketHandler.init();
|
PacketHandler.init();
|
||||||
InitToolMaterials.init();
|
InitToolMaterials.init();
|
||||||
|
@ -79,7 +83,6 @@ public class ActuallyAdditions{
|
||||||
BannerHelper.init();
|
BannerHelper.init();
|
||||||
SoundHandler.init();
|
SoundHandler.init();
|
||||||
UpdateChecker.init();
|
UpdateChecker.init();
|
||||||
InitBooklet.preInit();
|
|
||||||
proxy.preInit(event);
|
proxy.preInit(event);
|
||||||
|
|
||||||
ModUtil.LOGGER.info("PreInitialization Finished.");
|
ModUtil.LOGGER.info("PreInitialization Finished.");
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class BookletUtils{
|
||||||
booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize/2-142/2, booklet.guiTop+booklet.ySize, 0, 243, 142, 13);
|
booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize/2-142/2, booklet.guiTop+booklet.ySize, 0, 243, 142, 13);
|
||||||
|
|
||||||
//Draw No Entry title
|
//Draw No Entry title
|
||||||
if(booklet.currentEntrySet.entry == null){
|
if(booklet.currentEntrySet.getCurrentEntry() == null){
|
||||||
String strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.manualName.1");
|
String strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.manualName.1");
|
||||||
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12, 0);
|
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12, 0);
|
||||||
strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.manualName.2");
|
strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.manualName.2");
|
||||||
|
@ -109,7 +109,7 @@ public class BookletUtils{
|
||||||
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0);
|
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
String strg = booklet.currentEntrySet.chapter == null ? (booklet.currentEntrySet.entry == null ? StringUtil.localize("itemGroup."+ModUtil.MOD_ID) : booklet.currentEntrySet.entry.getLocalizedName()) : booklet.currentEntrySet.chapter.getLocalizedName();
|
String strg = booklet.currentEntrySet.getCurrentChapter() == null ? (booklet.currentEntrySet.getCurrentEntry() == null ? StringUtil.localize("itemGroup."+ModUtil.MOD_ID) : booklet.currentEntrySet.getCurrentEntry().getLocalizedName()) : booklet.currentEntrySet.getCurrentChapter().getLocalizedName();
|
||||||
booklet.drawCenteredString(booklet.getFontRenderer(), strg, booklet.guiLeft+booklet.xSize/2, booklet.guiTop-9, StringUtil.DECIMAL_COLOR_WHITE);
|
booklet.drawCenteredString(booklet.getFontRenderer(), strg, booklet.guiLeft+booklet.xSize/2, booklet.guiTop-9, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,12 +119,12 @@ public class BookletUtils{
|
||||||
* @param pre If the hover info texts or the icon should be drawn
|
* @param pre If the hover info texts or the icon should be drawn
|
||||||
*/
|
*/
|
||||||
public static void drawAchievementInfo(GuiBooklet booklet, boolean pre, int mouseX, int mouseY){
|
public static void drawAchievementInfo(GuiBooklet booklet, boolean pre, int mouseX, int mouseY){
|
||||||
if(booklet.currentEntrySet.chapter == null){
|
if(booklet.currentEntrySet.getCurrentChapter() == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> infoList = null;
|
ArrayList<String> infoList = null;
|
||||||
for(BookletPage page : booklet.currentEntrySet.chapter.getPages()){
|
for(BookletPage page : booklet.currentEntrySet.getCurrentChapter().getPages()){
|
||||||
if(page != null && page.getItemStacksForPage() != null){
|
if(page != null && page.getItemStacksForPage() != null){
|
||||||
for(ItemStack stack : page.getItemStacksForPage()){
|
for(ItemStack stack : page.getItemStacksForPage()){
|
||||||
if(stack != null){
|
if(stack != null){
|
||||||
|
@ -164,15 +164,15 @@ public class BookletUtils{
|
||||||
* -the amount of words and chars in the index (Just for teh lulz)
|
* -the amount of words and chars in the index (Just for teh lulz)
|
||||||
*/
|
*/
|
||||||
public static void renderPre(GuiBooklet booklet, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public static void renderPre(GuiBooklet booklet, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
if(booklet.currentEntrySet.entry != null){
|
if(booklet.currentEntrySet.getCurrentEntry() != null){
|
||||||
//Renders Booklet Page Number and Content
|
//Renders Booklet Page Number and Content
|
||||||
if(booklet.currentEntrySet.chapter != null && booklet.currentEntrySet.page != null){
|
if(booklet.currentEntrySet.getCurrentChapter() != null && booklet.currentEntrySet.getCurrentPage() != null){
|
||||||
booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.page.getID()+"/"+booklet.currentEntrySet.chapter.getPages().length, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+171, StringUtil.DECIMAL_COLOR_WHITE);
|
booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.getCurrentPage().getID()+"/"+booklet.currentEntrySet.getCurrentChapter().getPages().length, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+171, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
booklet.currentEntrySet.page.renderPre(booklet, mouseX, mouseY, ticksElapsed, mousePressed);
|
booklet.currentEntrySet.getCurrentPage().renderPre(booklet, mouseX, mouseY, ticksElapsed, mousePressed);
|
||||||
}
|
}
|
||||||
//Renders Chapter Page Number
|
//Renders Chapter Page Number
|
||||||
else{
|
else{
|
||||||
booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.pageInIndex+"/"+booklet.indexPageAmount, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+171, StringUtil.DECIMAL_COLOR_WHITE);
|
booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.getPageInIndex()+"/"+booklet.indexPageAmount, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+171, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Renders the amount of words and chars the book has
|
//Renders the amount of words and chars the book has
|
||||||
|
@ -211,8 +211,8 @@ public class BookletUtils{
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void updateSearchBar(GuiBooklet booklet){
|
public static void updateSearchBar(GuiBooklet booklet){
|
||||||
if(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch){
|
if(booklet.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch){
|
||||||
BookletEntryAllSearch currentEntry = (BookletEntryAllSearch)booklet.currentEntrySet.entry;
|
BookletEntryAllSearch currentEntry = (BookletEntryAllSearch)booklet.currentEntrySet.getCurrentEntry();
|
||||||
if(booklet.searchField.getText() != null && !booklet.searchField.getText().isEmpty()){
|
if(booklet.searchField.getText() != null && !booklet.searchField.getText().isEmpty()){
|
||||||
currentEntry.chapters.clear();
|
currentEntry.chapters.clear();
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ public class BookletUtils{
|
||||||
else{
|
else{
|
||||||
currentEntry.setChapters((ArrayList<IBookletChapter>)currentEntry.allChapters.clone());
|
currentEntry.setChapters((ArrayList<IBookletChapter>)currentEntry.allChapters.clone());
|
||||||
}
|
}
|
||||||
openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex, false);
|
openIndexEntry(booklet, booklet.currentEntrySet.getCurrentEntry(), booklet.currentEntrySet.getPageInIndex(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,16 +255,16 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
booklet.currentEntrySet.page = null;
|
booklet.currentEntrySet.setPage(null);
|
||||||
booklet.currentEntrySet.chapter = null;
|
booklet.currentEntrySet.setChapter(null);
|
||||||
|
|
||||||
booklet.currentEntrySet.entry = entry;
|
booklet.currentEntrySet.setEntry(entry);
|
||||||
booklet.indexPageAmount = entry == null ? 1 : entry.getChapters().size()/booklet.chapterButtons.length+1;
|
booklet.indexPageAmount = entry == null ? 1 : entry.getChapters().size()/booklet.chapterButtons.length+1;
|
||||||
booklet.currentEntrySet.pageInIndex = entry == null ? 1 : (booklet.indexPageAmount <= page || page <= 0 ? booklet.indexPageAmount : page);
|
booklet.currentEntrySet.setPageInIndex(entry == null ? 1 : (booklet.indexPageAmount <= page || page <= 0 ? booklet.indexPageAmount : page));
|
||||||
|
|
||||||
booklet.buttonPreviousScreen.visible = entry != null;
|
booklet.buttonPreviousScreen.visible = entry != null;
|
||||||
booklet.buttonForward.visible = booklet.currentEntrySet.pageInIndex < booklet.indexPageAmount;
|
booklet.buttonForward.visible = booklet.currentEntrySet.getPageInIndex() < booklet.indexPageAmount;
|
||||||
booklet.buttonBackward.visible = booklet.currentEntrySet.pageInIndex > 1;
|
booklet.buttonBackward.visible = booklet.currentEntrySet.getPageInIndex() > 1;
|
||||||
|
|
||||||
for(int i = 0; i < booklet.chapterButtons.length; i++){
|
for(int i = 0; i < booklet.chapterButtons.length; i++){
|
||||||
IndexButton button = (IndexButton)booklet.chapterButtons[i];
|
IndexButton button = (IndexButton)booklet.chapterButtons[i];
|
||||||
|
@ -282,10 +282,10 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
boolean entryExists = entry.getChapters().size() > i+(booklet.chapterButtons.length*booklet.currentEntrySet.pageInIndex-booklet.chapterButtons.length);
|
boolean entryExists = entry.getChapters().size() > i+(booklet.chapterButtons.length*booklet.currentEntrySet.getPageInIndex()-booklet.chapterButtons.length);
|
||||||
button.visible = entryExists;
|
button.visible = entryExists;
|
||||||
if(entryExists){
|
if(entryExists){
|
||||||
IBookletChapter chap = entry.getChapters().get(i+(booklet.chapterButtons.length*booklet.currentEntrySet.pageInIndex-booklet.chapterButtons.length));
|
IBookletChapter chap = entry.getChapters().get(i+(booklet.chapterButtons.length*booklet.currentEntrySet.getPageInIndex()-booklet.chapterButtons.length));
|
||||||
button.displayString = chap.getLocalizedNameWithFormatting();
|
button.displayString = chap.getLocalizedNameWithFormatting();
|
||||||
button.chap = chap;
|
button.chap = chap;
|
||||||
}
|
}
|
||||||
|
@ -299,10 +299,10 @@ public class BookletUtils{
|
||||||
public static void handleChapterButtonClick(GuiBooklet booklet, GuiButton button){
|
public static void handleChapterButtonClick(GuiBooklet booklet, GuiButton button){
|
||||||
int place = Util.arrayContains(booklet.chapterButtons, button);
|
int place = Util.arrayContains(booklet.chapterButtons, button);
|
||||||
if(place >= 0){
|
if(place >= 0){
|
||||||
if(booklet.currentEntrySet.entry != null){
|
if(booklet.currentEntrySet.getCurrentEntry() != null){
|
||||||
if(booklet.currentEntrySet.chapter == null){
|
if(booklet.currentEntrySet.getCurrentChapter() == null){
|
||||||
if(place < booklet.currentEntrySet.entry.getChapters().size()){
|
if(place < booklet.currentEntrySet.getCurrentEntry().getChapters().size()){
|
||||||
IBookletChapter chap = booklet.currentEntrySet.entry.getChapters().get(place+(booklet.chapterButtons.length*booklet.currentEntrySet.pageInIndex-booklet.chapterButtons.length));
|
IBookletChapter chap = booklet.currentEntrySet.getCurrentEntry().getChapters().get(place+(booklet.chapterButtons.length*booklet.currentEntrySet.getPageInIndex()-booklet.chapterButtons.length));
|
||||||
openChapter(booklet, chap, chap.getPages()[0]);
|
openChapter(booklet, chap, chap.getPages()[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ public class BookletUtils{
|
||||||
* Can only be done when the chapter is not null and an index entry is opened in the booklet
|
* Can only be done when the chapter is not null and an index entry is opened in the booklet
|
||||||
*/
|
*/
|
||||||
public static void openChapter(GuiBooklet booklet, IBookletChapter chapter, BookletPage page){
|
public static void openChapter(GuiBooklet booklet, IBookletChapter chapter, BookletPage page){
|
||||||
if(chapter == null || booklet.currentEntrySet.entry == null){
|
if(chapter == null || booklet.currentEntrySet.getCurrentEntry() == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,11 +328,11 @@ public class BookletUtils{
|
||||||
booklet.searchField.setFocused(false);
|
booklet.searchField.setFocused(false);
|
||||||
booklet.searchField.setText("");
|
booklet.searchField.setText("");
|
||||||
|
|
||||||
booklet.currentEntrySet.chapter = chapter;
|
booklet.currentEntrySet.setChapter(chapter);
|
||||||
booklet.currentEntrySet.page = page != null && doesChapterHavePage(chapter, page) ? page : chapter.getPages()[0];
|
booklet.currentEntrySet.setPage(page != null && doesChapterHavePage(chapter, page) ? page : chapter.getPages()[0]);
|
||||||
|
|
||||||
booklet.buttonForward.visible = getNextPage(chapter, booklet.currentEntrySet.page) != null;
|
booklet.buttonForward.visible = getNextPage(chapter, booklet.currentEntrySet.getCurrentPage()) != null;
|
||||||
booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentEntrySet.page) != null;
|
booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentEntrySet.getCurrentPage()) != null;
|
||||||
booklet.buttonPreviousScreen.visible = true;
|
booklet.buttonPreviousScreen.visible = true;
|
||||||
|
|
||||||
for(GuiButton chapterButton : booklet.chapterButtons){
|
for(GuiButton chapterButton : booklet.chapterButtons){
|
||||||
|
@ -384,19 +384,19 @@ public class BookletUtils{
|
||||||
* Called when the "next page"-button is pressed
|
* Called when the "next page"-button is pressed
|
||||||
*/
|
*/
|
||||||
public static void handleNextPage(GuiBooklet booklet){
|
public static void handleNextPage(GuiBooklet booklet){
|
||||||
if(booklet.currentEntrySet.entry != null){
|
if(booklet.currentEntrySet.getCurrentEntry() != null){
|
||||||
if(booklet.currentEntrySet.page != null){
|
if(booklet.currentEntrySet.getCurrentPage() != null){
|
||||||
BookletPage page = getNextPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page);
|
BookletPage page = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage());
|
||||||
if(page != null){
|
if(page != null){
|
||||||
booklet.currentEntrySet.page = page;
|
booklet.currentEntrySet.setPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
|
booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
|
||||||
booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
|
booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(booklet.currentEntrySet.pageInIndex+1 <= booklet.indexPageAmount){
|
if(booklet.currentEntrySet.getPageInIndex()+1 <= booklet.indexPageAmount){
|
||||||
openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex+1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
|
openIndexEntry(booklet, booklet.currentEntrySet.getCurrentEntry(), booklet.currentEntrySet.getPageInIndex()+1, !(booklet.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,19 +406,19 @@ public class BookletUtils{
|
||||||
* Called when the "previous page"-button is pressed
|
* Called when the "previous page"-button is pressed
|
||||||
*/
|
*/
|
||||||
public static void handlePreviousPage(GuiBooklet booklet){
|
public static void handlePreviousPage(GuiBooklet booklet){
|
||||||
if(booklet.currentEntrySet.entry != null){
|
if(booklet.currentEntrySet.getCurrentEntry() != null){
|
||||||
if(booklet.currentEntrySet.page != null){
|
if(booklet.currentEntrySet.getCurrentPage() != null){
|
||||||
BookletPage page = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page);
|
BookletPage page = getPrevPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage());
|
||||||
if(page != null){
|
if(page != null){
|
||||||
booklet.currentEntrySet.page = page;
|
booklet.currentEntrySet.setPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
|
booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
|
||||||
booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
|
booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(booklet.currentEntrySet.pageInIndex-1 > 0){
|
if(booklet.currentEntrySet.getPageInIndex()-1 > 0){
|
||||||
openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex-1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
|
openIndexEntry(booklet, booklet.currentEntrySet.getCurrentEntry(), booklet.currentEntrySet.getPageInIndex()-1, !(booklet.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,13 @@ package de.ellpeck.actuallyadditions.mod.booklet;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
|
import de.ellpeck.actuallyadditions.api.internal.IEntrySet;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.button.IndexButton;
|
import de.ellpeck.actuallyadditions.mod.booklet.button.IndexButton;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
|
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllSearch;
|
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllSearch;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration;
|
import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemBooklet;
|
import de.ellpeck.actuallyadditions.mod.items.ItemBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
||||||
|
@ -64,7 +65,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
public int ySize;
|
public int ySize;
|
||||||
public int guiLeft;
|
public int guiLeft;
|
||||||
public int guiTop;
|
public int guiTop;
|
||||||
public EntrySet currentEntrySet = new EntrySet(null);
|
public IEntrySet currentEntrySet = new EntrySet(null);
|
||||||
public int indexPageAmount;
|
public int indexPageAmount;
|
||||||
public GuiButton buttonForward;
|
public GuiButton buttonForward;
|
||||||
public GuiButton buttonBackward;
|
public GuiButton buttonBackward;
|
||||||
|
@ -124,7 +125,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
//Draws the search bar
|
//Draws the search bar
|
||||||
if(this.currentEntrySet.entry instanceof BookletEntryAllSearch && this.currentEntrySet.chapter == null){
|
if(this.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch && this.currentEntrySet.getCurrentChapter() == null){
|
||||||
this.mc.getTextureManager().bindTexture(resLoc);
|
this.mc.getTextureManager().bindTexture(resLoc);
|
||||||
this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14);
|
this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14);
|
||||||
}
|
}
|
||||||
|
@ -145,8 +146,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
this.searchField.drawTextBox();
|
this.searchField.drawTextBox();
|
||||||
|
|
||||||
//Renders the current page's content
|
//Renders the current page's content
|
||||||
if(this.currentEntrySet.entry != null && this.currentEntrySet.chapter != null && this.currentEntrySet.page != null){
|
if(this.currentEntrySet.getCurrentEntry() != null && this.currentEntrySet.getCurrentChapter() != null && this.currentEntrySet.getCurrentPage() != null){
|
||||||
this.currentEntrySet.page.render(this, x, y, this.ticksElapsed, this.mousePressed);
|
this.currentEntrySet.getCurrentPage().render(this, x, y, this.ticksElapsed, this.mousePressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draws hovering texts for buttons
|
//Draws hovering texts for buttons
|
||||||
|
@ -204,13 +205,13 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
protected void mouseClicked(int par1, int par2, int par3) throws IOException{
|
protected void mouseClicked(int par1, int par2, int par3) throws IOException{
|
||||||
this.searchField.mouseClicked(par1, par2, par3);
|
this.searchField.mouseClicked(par1, par2, par3);
|
||||||
//Left mouse button
|
//Left mouse button
|
||||||
if(par3 == 0 && this.currentEntrySet.chapter != null){
|
if(par3 == 0 && this.currentEntrySet.getCurrentChapter() != null){
|
||||||
this.mousePressed = true;
|
this.mousePressed = true;
|
||||||
}
|
}
|
||||||
//Right mouse button
|
//Right mouse button
|
||||||
else if(par3 == 1){
|
else if(par3 == 1){
|
||||||
if(this.currentEntrySet.chapter != null){
|
if(this.currentEntrySet.getCurrentChapter() != null){
|
||||||
BookletUtils.openIndexEntry(this, this.currentEntrySet.entry, this.currentEntrySet.pageInIndex, true);
|
BookletUtils.openIndexEntry(this, this.currentEntrySet.getCurrentEntry(), this.currentEntrySet.getPageInIndex(), true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
BookletUtils.openIndexEntry(this, null, 1, true);
|
BookletUtils.openIndexEntry(this, null, 1, true);
|
||||||
|
@ -259,8 +260,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
}
|
}
|
||||||
//Handles gonig from page to chapter or from chapter to index
|
//Handles gonig from page to chapter or from chapter to index
|
||||||
else if(button == this.buttonPreviousScreen){
|
else if(button == this.buttonPreviousScreen){
|
||||||
if(this.currentEntrySet.chapter != null){
|
if(this.currentEntrySet.getCurrentChapter() != null){
|
||||||
BookletUtils.openIndexEntry(this, this.currentEntrySet.entry, this.currentEntrySet.pageInIndex, true);
|
BookletUtils.openIndexEntry(this, this.currentEntrySet.getCurrentEntry(), this.currentEntrySet.getPageInIndex(), true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
BookletUtils.openIndexEntry(this, null, 1, true);
|
BookletUtils.openIndexEntry(this, null, 1, true);
|
||||||
|
@ -389,8 +390,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
super.updateScreen();
|
super.updateScreen();
|
||||||
this.searchField.updateCursorCounter();
|
this.searchField.updateCursorCounter();
|
||||||
|
|
||||||
if(this.currentEntrySet.entry != null && this.currentEntrySet.chapter != null && this.currentEntrySet.page != null){
|
if(this.currentEntrySet.getCurrentEntry() != null && this.currentEntrySet.getCurrentChapter() != null && this.currentEntrySet.getCurrentPage() != null){
|
||||||
this.currentEntrySet.page.updateScreen(this.ticksElapsed);
|
this.currentEntrySet.getCurrentPage().updateScreen(this.ticksElapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean buttonThere = UpdateChecker.needsUpdateNotify;
|
boolean buttonThere = UpdateChecker.needsUpdateNotify;
|
||||||
|
@ -477,7 +478,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntrySet getCurrentEntrySet(){
|
public IEntrySet getCurrentEntrySet(){
|
||||||
return this.currentEntrySet;
|
return this.currentEntrySet;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
|
import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
@ -46,8 +46,8 @@ public class BookmarkButton extends GuiButton{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(this.booklet.currentEntrySet.entry != null){
|
if(this.booklet.currentEntrySet.getCurrentEntry() != null){
|
||||||
this.assignedEntry.setEntry(this.booklet.currentEntrySet.page, this.booklet.currentEntrySet.chapter, this.booklet.currentEntrySet.entry, this.booklet.currentEntrySet.pageInIndex);
|
this.assignedEntry.setEntry(this.booklet.currentEntrySet.getCurrentPage(), this.booklet.currentEntrySet.getCurrentChapter(), this.booklet.currentEntrySet.getCurrentEntry(), this.booklet.currentEntrySet.getPageInIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPageAA;
|
import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPageAA;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeRecipe;
|
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||||
|
|
|
@ -8,15 +8,16 @@
|
||||||
* © 2016 Ellpeck
|
* © 2016 Ellpeck
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.internal;
|
package de.ellpeck.actuallyadditions.mod.booklet.entry;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
|
import de.ellpeck.actuallyadditions.api.internal.IEntrySet;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class EntrySet{
|
public class EntrySet implements IEntrySet{
|
||||||
|
|
||||||
public BookletPage page;
|
public BookletPage page;
|
||||||
public IBookletChapter chapter;
|
public IBookletChapter chapter;
|
||||||
|
@ -49,6 +50,7 @@ public class EntrySet{
|
||||||
return new EntrySet(null);
|
return new EntrySet(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setEntry(BookletPage page, IBookletChapter chapter, IBookletEntry entry, int pageInIndex){
|
public void setEntry(BookletPage page, IBookletChapter chapter, IBookletEntry entry, int pageInIndex){
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.chapter = chapter;
|
this.chapter = chapter;
|
||||||
|
@ -56,10 +58,12 @@ public class EntrySet{
|
||||||
this.pageInIndex = pageInIndex;
|
this.pageInIndex = pageInIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeEntry(){
|
public void removeEntry(){
|
||||||
this.setEntry(null, null, null, 1);
|
this.setEntry(null, null, null, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public NBTTagCompound writeToNBT(){
|
public NBTTagCompound writeToNBT(){
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setInteger("Entry", this.entry == null ? -1 : ActuallyAdditionsAPI.bookletEntries.indexOf(this.entry));
|
compound.setInteger("Entry", this.entry == null ? -1 : ActuallyAdditionsAPI.bookletEntries.indexOf(this.entry));
|
||||||
|
@ -68,4 +72,44 @@ public class EntrySet{
|
||||||
compound.setInteger("PageInIndex", this.pageInIndex);
|
compound.setInteger("PageInIndex", this.pageInIndex);
|
||||||
return compound;
|
return compound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BookletPage getCurrentPage(){
|
||||||
|
return this.page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBookletEntry getCurrentEntry(){
|
||||||
|
return this.entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBookletChapter getCurrentChapter(){
|
||||||
|
return this.chapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPageInIndex(){
|
||||||
|
return this.pageInIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPage(BookletPage page){
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEntry(IBookletEntry entry){
|
||||||
|
this.entry = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setChapter(IBookletChapter chapter){
|
||||||
|
this.chapter = chapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPageInIndex(int page){
|
||||||
|
this.pageInIndex = page;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
|
@ -48,7 +48,7 @@ public class PageCoffeeRecipe extends BookletPageAA{
|
||||||
String strg = "Coffee Machine Recipe";
|
String strg = "Coffee Machine Recipe";
|
||||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||||
|
|
||||||
String text = gui.getCurrentEntrySet().page.getText();
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class PageCoffeeRecipe extends BookletPageAA{
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
stack = new ItemStack(InitItems.itemCoffee);
|
stack = new ItemStack(InitItems.itemCoffee);
|
||||||
CoffeeBrewing.addEffectToStack(stack, this.ingredient);
|
ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this.ingredient);
|
||||||
coordsOffsetX = 39;
|
coordsOffsetX = 39;
|
||||||
coordsOffsetY = 39;
|
coordsOffsetY = 39;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class PageCrafting extends BookletPageAA{
|
||||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = gui.getCurrentEntrySet().page.getText();
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+90, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+90, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class PageCrusherRecipe extends BookletPageAA{
|
||||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = gui.getCurrentEntrySet().page.getText();
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class PageFurnace extends BookletPageAA{
|
||||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = gui.getCurrentEntrySet().page.getText();
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class PagePicture extends PageTextOnly{
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(this.resLoc);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(this.resLoc);
|
||||||
gui.drawRect(gui.getGuiLeft(), gui.getGuiTop(), 0, 0, gui.getXSize(), gui.getYSize());
|
gui.drawRect(gui.getGuiLeft(), gui.getGuiTop(), 0, 0, gui.getXSize(), gui.getYSize());
|
||||||
|
|
||||||
String text = gui.getCurrentEntrySet().page.getText();
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+this.textStartY, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+this.textStartY, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||||
|
@ -30,14 +30,14 @@ import java.util.List;
|
||||||
|
|
||||||
public class PageReconstructor extends BookletPageAA{
|
public class PageReconstructor extends BookletPageAA{
|
||||||
|
|
||||||
private LensNoneRecipe[] recipes;
|
private LensConversionRecipe[] recipes;
|
||||||
private int recipePos;
|
private int recipePos;
|
||||||
|
|
||||||
public PageReconstructor(int id, ArrayList<LensNoneRecipe> recipes){
|
public PageReconstructor(int id, ArrayList<LensConversionRecipe> recipes){
|
||||||
this(id, recipes.toArray(new LensNoneRecipe[recipes.size()]));
|
this(id, recipes.toArray(new LensConversionRecipe[recipes.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageReconstructor(int id, LensNoneRecipe... recipes){
|
public PageReconstructor(int id, LensConversionRecipe... recipes){
|
||||||
super(id);
|
super(id);
|
||||||
this.recipes = recipes;
|
this.recipes = recipes;
|
||||||
this.addToPagesWithItemStackData();
|
this.addToPagesWithItemStackData();
|
||||||
|
@ -56,7 +56,7 @@ public class PageReconstructor extends BookletPageAA{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
LensNoneRecipe recipe = this.recipes[this.recipePos];
|
LensConversionRecipe recipe = this.recipes[this.recipePos];
|
||||||
if(recipe == null){
|
if(recipe == null){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class PageReconstructor extends BookletPageAA{
|
||||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = gui.getCurrentEntrySet().page.getText();
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class PageReconstructor extends BookletPageAA{
|
||||||
public ItemStack[] getItemStacksForPage(){
|
public ItemStack[] getItemStacksForPage(){
|
||||||
if(this.recipes != null){
|
if(this.recipes != null){
|
||||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||||
for(LensNoneRecipe recipe : this.recipes){
|
for(LensConversionRecipe recipe : this.recipes){
|
||||||
if(recipe != null){
|
if(recipe != null){
|
||||||
stacks.addAll(recipe.getOutputs());
|
stacks.addAll(recipe.getOutputs());
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class PageTextOnly extends BookletPageAA{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
String text = gui.getCurrentEntrySet().page.getText();
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
|
import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
@ -74,7 +73,7 @@ public class ItemCoffee extends ItemFoodBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void applyPotionEffectsFromStack(ItemStack stack, EntityLivingBase player){
|
public static void applyPotionEffectsFromStack(ItemStack stack, EntityLivingBase player){
|
||||||
PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack);
|
PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||||
if(effects != null && effects.length > 0){
|
if(effects != null && effects.length > 0){
|
||||||
for(PotionEffect effect : effects){
|
for(PotionEffect effect : effects){
|
||||||
player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration()*20, effect.getAmplifier()));
|
player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration()*20, effect.getAmplifier()));
|
||||||
|
@ -114,7 +113,7 @@ public class ItemCoffee extends ItemFoodBase{
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
||||||
PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack);
|
PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||||
if(effects != null){
|
if(effects != null){
|
||||||
for(PotionEffect effect : effects){
|
for(PotionEffect effect : effects){
|
||||||
list.add(StringUtil.localize(effect.getEffectName())+" "+(effect.getAmplifier()+1)+", "+StringUtils.ticksToElapsedTime(effect.getDuration()*20));
|
list.add(StringUtil.localize(effect.getEffectName())+" "+(effect.getAmplifier()+1)+", "+StringUtils.ticksToElapsedTime(effect.getDuration()*20));
|
||||||
|
@ -138,7 +137,7 @@ public class ItemCoffee extends ItemFoodBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean effect(ItemStack stack){
|
public boolean effect(ItemStack stack){
|
||||||
PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack);
|
PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||||
ArrayList<PotionEffect> effectsNew = new ArrayList<PotionEffect>();
|
ArrayList<PotionEffect> effectsNew = new ArrayList<PotionEffect>();
|
||||||
if(effects != null && effects.length > 0){
|
if(effects != null && effects.length > 0){
|
||||||
for(PotionEffect effect : effects){
|
for(PotionEffect effect : effects){
|
||||||
|
@ -149,7 +148,7 @@ public class ItemCoffee extends ItemFoodBase{
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
if(effectsNew.size() > 0){
|
if(effectsNew.size() > 0){
|
||||||
this.effects = effectsNew.toArray(new PotionEffect[effectsNew.size()]);
|
this.effects = effectsNew.toArray(new PotionEffect[effectsNew.size()]);
|
||||||
CoffeeBrewing.addEffectToStack(stack, this);
|
ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.effects = null;
|
this.effects = null;
|
||||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -27,7 +27,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LensNone extends Lens{
|
public class LensConversion extends Lens{
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,8 +40,8 @@ public class LensNone extends Lens{
|
||||||
for(int reachZ = -range; reachZ < range+1; reachZ++){
|
for(int reachZ = -range; reachZ < range+1; reachZ++){
|
||||||
for(int reachY = -range; reachY < range+1; reachY++){
|
for(int reachY = -range; reachY < range+1; reachY++){
|
||||||
BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
||||||
List<LensNoneRecipe> recipes = LensRecipeHandler.getRecipesFor(new ItemStack(PosUtil.getBlock(pos, tile.getWorldObject()), 1, PosUtil.getMetadata(pos, tile.getWorldObject())));
|
List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(new ItemStack(PosUtil.getBlock(pos, tile.getWorldObject()), 1, PosUtil.getMetadata(pos, tile.getWorldObject())));
|
||||||
for(LensNoneRecipe recipe : recipes){
|
for(LensConversionRecipe recipe : recipes){
|
||||||
if(recipe != null && tile.getEnergy() >= recipe.energyUse){
|
if(recipe != null && tile.getEnergy() >= recipe.energyUse){
|
||||||
List<ItemStack> outputs = recipe.getOutputs();
|
List<ItemStack> outputs = recipe.getOutputs();
|
||||||
if(outputs != null && !outputs.isEmpty()){
|
if(outputs != null && !outputs.isEmpty()){
|
||||||
|
@ -70,8 +70,8 @@ public class LensNone extends Lens{
|
||||||
for(EntityItem item : items){
|
for(EntityItem item : items){
|
||||||
ItemStack stack = item.getEntityItem();
|
ItemStack stack = item.getEntityItem();
|
||||||
if(!item.isDead && stack != null){
|
if(!item.isDead && stack != null){
|
||||||
List<LensNoneRecipe> recipes = LensRecipeHandler.getRecipesFor(stack);
|
List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(stack);
|
||||||
for(LensNoneRecipe recipe : recipes){
|
for(LensConversionRecipe recipe : recipes){
|
||||||
if(recipe != null && tile.getEnergy() >= recipe.energyUse){
|
if(recipe != null && tile.getEnergy() >= recipe.energyUse){
|
||||||
List<ItemStack> outputs = recipe.getOutputs();
|
List<ItemStack> outputs = recipe.getOutputs();
|
||||||
if(outputs != null && !outputs.isEmpty()){
|
if(outputs != null && !outputs.isEmpty()){
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.ColorLensChangerByDyeMeta;
|
import de.ellpeck.actuallyadditions.api.recipe.ColorLensChangerByDyeMeta;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
@ -30,74 +30,74 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class LensRecipeHandler{
|
public class LensRecipeHandler{
|
||||||
|
|
||||||
public static ArrayList<LensNoneRecipe> mainPageRecipes = new ArrayList<LensNoneRecipe>();
|
public static ArrayList<LensConversionRecipe> mainPageRecipes = new ArrayList<LensConversionRecipe>();
|
||||||
public static LensNoneRecipe recipeColorLens;
|
public static LensConversionRecipe recipeColorLens;
|
||||||
public static LensNoneRecipe recipeSoulSand;
|
public static LensConversionRecipe recipeSoulSand;
|
||||||
public static LensNoneRecipe recipeGreenWall;
|
public static LensConversionRecipe recipeGreenWall;
|
||||||
public static LensNoneRecipe recipeWhiteWall;
|
public static LensConversionRecipe recipeWhiteWall;
|
||||||
public static LensNoneRecipe recipeExplosionLens;
|
public static LensConversionRecipe recipeExplosionLens;
|
||||||
public static LensNoneRecipe recipeDamageLens;
|
public static LensConversionRecipe recipeDamageLens;
|
||||||
public static LensNoneRecipe recipeLeather;
|
public static LensConversionRecipe recipeLeather;
|
||||||
public static LensNoneRecipe recipeNetherWart;
|
public static LensConversionRecipe recipeNetherWart;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
//Crystal Blocks
|
//Crystal Blocks
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.REDSTONE_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), 400);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.REDSTONE_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), 400);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.LAPIS_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), 400);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.LAPIS_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), 400);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.DIAMOND_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), 600);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.DIAMOND_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), 600);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.EMERALD_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), 1000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.EMERALD_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), 1000);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.COAL_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 600);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.COAL_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 600);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.IRON_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 800);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.IRON_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 800);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
|
|
||||||
//Crystal Items
|
//Crystal Items
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.REDSTONE), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 40);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.REDSTONE), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 40);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.DYE, 1, 4), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), 40);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DYE, 1, 4), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), 40);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.DIAMOND), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 60);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DIAMOND), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 60);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.EMERALD), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), 100);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.EMERALD), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), 100);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.COAL), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), 60);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.COAL), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), 60);
|
||||||
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
mainPageRecipes.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.IRON_INGOT), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 80);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.IRON_INGOT), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 80);
|
||||||
|
|
||||||
//Lenses
|
//Lenses
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new ItemStack(InitItems.itemColorLens), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new ItemStack(InitItems.itemColorLens), 5000);
|
||||||
recipeColorLens = RecipeUtil.lastReconstructorRecipe();
|
recipeColorLens = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
if(ConfigCrafting.RECONSTRUCTOR_EXPLOSION_LENS.isEnabled()){
|
if(ConfigCrafting.RECONSTRUCTOR_EXPLOSION_LENS.isEnabled()){
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), 5000);
|
||||||
recipeExplosionLens = RecipeUtil.lastReconstructorRecipe();
|
recipeExplosionLens = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
||||||
}
|
}
|
||||||
recipeDamageLens = RecipeUtil.lastReconstructorRecipe();
|
recipeDamageLens = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), 5000);
|
||||||
|
|
||||||
//Misc
|
//Misc
|
||||||
if(ConfigCrafting.RECONSTRUCTOR_MISC.isEnabled()){
|
if(ConfigCrafting.RECONSTRUCTOR_MISC.isEnabled()){
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), 20000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), 20000);
|
||||||
recipeSoulSand = RecipeUtil.lastReconstructorRecipe();
|
recipeSoulSand = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), 8000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), 8000);
|
||||||
recipeLeather = RecipeUtil.lastReconstructorRecipe();
|
recipeLeather = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), 150000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), 150000);
|
||||||
recipeNetherWart = RecipeUtil.lastReconstructorRecipe();
|
recipeNetherWart = RecipeUtil.lastReconstructorRecipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
||||||
recipeWhiteWall = RecipeUtil.lastReconstructorRecipe();
|
recipeWhiteWall = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10);
|
||||||
recipeGreenWall = RecipeUtil.lastReconstructorRecipe();
|
recipeGreenWall = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
IColorLensChanger changer = new ColorLensChangerByDyeMeta();
|
IColorLensChanger changer = new ColorLensChangerByDyeMeta();
|
||||||
|
@ -112,9 +112,9 @@ public class LensRecipeHandler{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<LensNoneRecipe> getRecipesFor(ItemStack input){
|
public static ArrayList<LensConversionRecipe> getRecipesFor(ItemStack input){
|
||||||
ArrayList<LensNoneRecipe> possibleRecipes = new ArrayList<LensNoneRecipe>();
|
ArrayList<LensConversionRecipe> possibleRecipes = new ArrayList<LensConversionRecipe>();
|
||||||
for(LensNoneRecipe recipe : ActuallyAdditionsAPI.reconstructorLensNoneRecipes){
|
for(LensConversionRecipe recipe : ActuallyAdditionsAPI.reconstructorLensConversionRecipes){
|
||||||
if(ItemUtil.contains(recipe.getInputs(), input, true)){
|
if(ItemUtil.contains(recipe.getInputs(), input, true)){
|
||||||
possibleRecipes.add(recipe);
|
possibleRecipes.add(recipe);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
|
|
||||||
public class Lenses{
|
public class Lenses{
|
||||||
|
|
||||||
public static final Lens LENS_NONE = new LensNone();
|
public static final Lens LENS_NONE = new LensConversion();
|
||||||
public static final Lens LENS_DETONATION = new LensDetonation();
|
public static final Lens LENS_DETONATION = new LensDetonation();
|
||||||
public static final Lens LENS_DEATH = new LensDeath();
|
public static final Lens LENS_DEATH = new LensDeath();
|
||||||
public static final Lens LENS_COLOR = new LensColor();
|
public static final Lens LENS_COLOR = new LensColor();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
|
||||||
registry.addRecipes(ActuallyAdditionsAPI.bookletPagesWithItemStackData);
|
registry.addRecipes(ActuallyAdditionsAPI.bookletPagesWithItemStackData);
|
||||||
registry.addRecipes(ActuallyAdditionsAPI.coffeeMachineIngredients);
|
registry.addRecipes(ActuallyAdditionsAPI.coffeeMachineIngredients);
|
||||||
registry.addRecipes(ActuallyAdditionsAPI.crusherRecipes);
|
registry.addRecipes(ActuallyAdditionsAPI.crusherRecipes);
|
||||||
registry.addRecipes(ActuallyAdditionsAPI.reconstructorLensNoneRecipes);
|
registry.addRecipes(ActuallyAdditionsAPI.reconstructorLensConversionRecipes);
|
||||||
|
|
||||||
registry.addRecipeClickArea(GuiCoffeeMachine.class, 53, 42, 22, 16, NEICoffeeMachineRecipe.NAME);
|
registry.addRecipeClickArea(GuiCoffeeMachine.class, 53, 42, 22, 16, NEICoffeeMachineRecipe.NAME);
|
||||||
registry.addRecipeClickArea(GuiGrinder.class, 80, 40, 24, 22, CrusherRecipeCategory.NAME);
|
registry.addRecipeClickArea(GuiGrinder.class, 80, 40, 24, 22, CrusherRecipeCategory.NAME);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.mod.nei.NEICoffeeMachineRecipe;
|
import de.ellpeck.actuallyadditions.mod.nei.NEICoffeeMachineRecipe;
|
||||||
import mezz.jei.api.recipe.IRecipeHandler;
|
import mezz.jei.api.recipe.IRecipeHandler;
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
@ -42,7 +42,7 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
|
||||||
this.theIngredient = ingredient;
|
this.theIngredient = ingredient;
|
||||||
|
|
||||||
this.theOutput = new ItemStack(InitItems.itemCoffee);
|
this.theOutput = new ItemStack(InitItems.itemCoffee);
|
||||||
CoffeeBrewing.addEffectToStack(this.theOutput, this.theIngredient);
|
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.theOutput, this.theIngredient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,19 +10,19 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe;
|
import de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe;
|
||||||
import mezz.jei.api.recipe.IRecipeHandler;
|
import mezz.jei.api.recipe.IRecipeHandler;
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ReconstructorRecipeHandler implements IRecipeHandler<LensNoneRecipe>{
|
public class ReconstructorRecipeHandler implements IRecipeHandler<LensConversionRecipe>{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Class getRecipeClass(){
|
public Class getRecipeClass(){
|
||||||
return LensNoneRecipe.class;
|
return LensConversionRecipe.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -33,12 +33,12 @@ public class ReconstructorRecipeHandler implements IRecipeHandler<LensNoneRecipe
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper(@Nonnull LensNoneRecipe recipe){
|
public IRecipeWrapper getRecipeWrapper(@Nonnull LensConversionRecipe recipe){
|
||||||
return new ReconstructorRecipeWrapper(recipe);
|
return new ReconstructorRecipeWrapper(recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecipeValid(@Nonnull LensNoneRecipe recipe){
|
public boolean isRecipeValid(@Nonnull LensConversionRecipe recipe){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||||
|
@ -27,9 +27,9 @@ import java.util.List;
|
||||||
|
|
||||||
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
||||||
|
|
||||||
public LensNoneRecipe theRecipe;
|
public LensConversionRecipe theRecipe;
|
||||||
|
|
||||||
public ReconstructorRecipeWrapper(LensNoneRecipe recipe){
|
public ReconstructorRecipeWrapper(LensConversionRecipe recipe){
|
||||||
this.theRecipe = recipe;
|
this.theRecipe = recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
/*
|
package de.ellpeck.actuallyadditions.mod.misc;
|
||||||
* This file ("CoffeeBrewing.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
|
|
||||||
*
|
|
||||||
* © 2016 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe.coffee;
|
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
|
import de.ellpeck.actuallyadditions.api.internal.IEntrySet;
|
||||||
|
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
||||||
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
|
@ -17,27 +15,24 @@ import net.minecraft.potion.PotionEffect;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
public class MethodHandler implements IMethodHandler{
|
||||||
* This is a util class for adding Ingredients to ItemStacks
|
|
||||||
* Use when making a custom Coffee Ingredient
|
|
||||||
*/
|
|
||||||
public class CoffeeBrewing{
|
|
||||||
|
|
||||||
public static boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient){
|
@Override
|
||||||
|
public boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient){
|
||||||
boolean worked = false;
|
boolean worked = false;
|
||||||
if(ingredient != null){
|
if(ingredient != null){
|
||||||
PotionEffect[] effects = ingredient.getEffects();
|
PotionEffect[] effects = ingredient.getEffects();
|
||||||
if(effects != null && effects.length > 0){
|
if(effects != null && effects.length > 0){
|
||||||
for(PotionEffect effect : effects){
|
for(PotionEffect effect : effects){
|
||||||
PotionEffect effectHas = getSameEffectFromStack(stack, effect);
|
PotionEffect effectHas = this.getSameEffectFromStack(stack, effect);
|
||||||
if(effectHas != null){
|
if(effectHas != null){
|
||||||
if(effectHas.getAmplifier() < ingredient.maxAmplifier-1){
|
if(effectHas.getAmplifier() < ingredient.maxAmplifier-1){
|
||||||
addEffectProperties(stack, effect, false, true);
|
this.addEffectProperties(stack, effect, false, true);
|
||||||
worked = true;
|
worked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
addEffectToStack(stack, effect);
|
this.addEffectToStack(stack, effect);
|
||||||
worked = true;
|
worked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +41,9 @@ public class CoffeeBrewing{
|
||||||
return worked;
|
return worked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect){
|
@Override
|
||||||
PotionEffect[] effectsStack = getEffectsFromStack(stack);
|
public PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect){
|
||||||
|
PotionEffect[] effectsStack = this.getEffectsFromStack(stack);
|
||||||
if(effectsStack != null && effectsStack.length > 0){
|
if(effectsStack != null && effectsStack.length > 0){
|
||||||
for(PotionEffect effectStack : effectsStack){
|
for(PotionEffect effectStack : effectsStack){
|
||||||
if(effect.getPotion() == effectStack.getPotion()){
|
if(effect.getPotion() == effectStack.getPotion()){
|
||||||
|
@ -58,18 +54,20 @@ public class CoffeeBrewing{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp){
|
@Override
|
||||||
PotionEffect[] effects = getEffectsFromStack(stack);
|
public void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp){
|
||||||
|
PotionEffect[] effects = this.getEffectsFromStack(stack);
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
for(int i = 0; i < effects.length; i++){
|
for(int i = 0; i < effects.length; i++){
|
||||||
if(effects[i].getPotion() == effect.getPotion()){
|
if(effects[i].getPotion() == effect.getPotion()){
|
||||||
effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0));
|
effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0));
|
||||||
}
|
}
|
||||||
addEffectToStack(stack, effects[i]);
|
this.addEffectToStack(stack, effects[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEffectToStack(ItemStack stack, PotionEffect effect){
|
@Override
|
||||||
|
public void addEffectToStack(ItemStack stack, PotionEffect effect){
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
if(tag == null){
|
if(tag == null){
|
||||||
tag = new NBTTagCompound();
|
tag = new NBTTagCompound();
|
||||||
|
@ -88,7 +86,8 @@ public class CoffeeBrewing{
|
||||||
stack.setTagCompound(tag);
|
stack.setTagCompound(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PotionEffect[] getEffectsFromStack(ItemStack stack){
|
@Override
|
||||||
|
public PotionEffect[] getEffectsFromStack(ItemStack stack){
|
||||||
ArrayList<PotionEffect> effects = new ArrayList<PotionEffect>();
|
ArrayList<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
if(tag != null){
|
if(tag != null){
|
||||||
|
@ -102,5 +101,4 @@ public class CoffeeBrewing{
|
||||||
}
|
}
|
||||||
return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null;
|
return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -37,7 +37,7 @@ public class NEIReconstructorRecipe/* extends TemplateRecipeHandler implements I
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(String outputId, Object... results){
|
public void loadCraftingRecipes(String outputId, Object... results){
|
||||||
if(outputId.equals(NAME) && getClass() == NEIReconstructorRecipe.class){
|
if(outputId.equals(NAME) && getClass() == NEIReconstructorRecipe.class){
|
||||||
List<LensNoneRecipe> recipes = ActuallyAdditionsAPI.reconstructorLensNoneRecipes;
|
List<LensNoneRecipe> recipes = ActuallyAdditionsAPI.reconstructorLensConversionRecipes;
|
||||||
//Default Recipes
|
//Default Recipes
|
||||||
for(LensNoneRecipe recipe : recipes){
|
for(LensNoneRecipe recipe : recipes){
|
||||||
arecipes.add(new CachedReconstructorRecipe(recipe, false));
|
arecipes.add(new CachedReconstructorRecipe(recipe, false));
|
||||||
|
@ -66,7 +66,7 @@ public class NEIReconstructorRecipe/* extends TemplateRecipeHandler implements I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(ItemStack result){
|
public void loadCraftingRecipes(ItemStack result){
|
||||||
List<LensNoneRecipe> recipes = ActuallyAdditionsAPI.reconstructorLensNoneRecipes;
|
List<LensNoneRecipe> recipes = ActuallyAdditionsAPI.reconstructorLensConversionRecipes;
|
||||||
//Default Recipes
|
//Default Recipes
|
||||||
for(LensNoneRecipe recipe : recipes){
|
for(LensNoneRecipe recipe : recipes){
|
||||||
if(ItemUtil.contains(recipe.getOutputs(), result, true)){
|
if(ItemUtil.contains(recipe.getOutputs(), result, true)){
|
||||||
|
@ -84,7 +84,7 @@ public class NEIReconstructorRecipe/* extends TemplateRecipeHandler implements I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadUsageRecipes(ItemStack ingredient){
|
public void loadUsageRecipes(ItemStack ingredient){
|
||||||
List<LensNoneRecipe> recipes = ActuallyAdditionsAPI.reconstructorLensNoneRecipes;
|
List<LensNoneRecipe> recipes = ActuallyAdditionsAPI.reconstructorLensConversionRecipes;
|
||||||
//Default Recipes
|
//Default Recipes
|
||||||
for(LensNoneRecipe recipe : recipes){
|
for(LensNoneRecipe recipe : recipes){
|
||||||
if(ItemUtil.contains(recipe.getInputs(), ingredient, true)){
|
if(ItemUtil.contains(recipe.getInputs(), ingredient, true)){
|
||||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ import java.util.List;
|
||||||
|
|
||||||
public class RecipeUtil{
|
public class RecipeUtil{
|
||||||
|
|
||||||
public static LensNoneRecipe lastReconstructorRecipe(){
|
public static LensConversionRecipe lastReconstructorRecipe(){
|
||||||
List<LensNoneRecipe> list = ActuallyAdditionsAPI.reconstructorLensNoneRecipes;
|
List<LensConversionRecipe> list = ActuallyAdditionsAPI.reconstructorLensConversionRecipes;
|
||||||
return list.get(list.size()-1);
|
return list.get(list.size()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.util.playerdata;
|
package de.ellpeck.actuallyadditions.mod.util.playerdata;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
|
import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
||||||
|
|
Loading…
Reference in a new issue