mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 21:09:23 +01:00
Added some fancy recipe auto-scrolling for multiple recipes on the same page
This commit is contained in:
parent
582b988545
commit
2aa2e547c8
9 changed files with 47 additions and 16 deletions
|
@ -87,6 +87,10 @@ public class GuiBooklet extends GuiScreen{
|
|||
super.updateScreen();
|
||||
this.searchField.updateCursorCounter();
|
||||
|
||||
if(this.currentIndexEntry != null && this.currentChapter != null && this.currentPage != null){
|
||||
this.currentPage.updateScreen(this.ticksElapsed);
|
||||
}
|
||||
|
||||
boolean buttonThere = UpdateChecker.doneChecking && UpdateChecker.updateVersion > UpdateChecker.clientVersion;
|
||||
this.getButton(BUTTON_UPDATE_ID).visible = buttonThere;
|
||||
if(buttonThere){
|
||||
|
|
|
@ -74,7 +74,7 @@ public class InitBooklet{
|
|||
new BookletChapter("greenhouseGlass", entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass).setNoText());
|
||||
new BookletChapter("fishingNet", entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText());
|
||||
new BookletChapter("feeder", entryFunctionalNonRF, new ItemStack(InitBlocks.blockFeeder), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText());
|
||||
new BookletChapter("compost", entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemFertilizer)).addTextReplacement("<num>", ConfigIntValues.COMPOST_AMOUNT.getValue()), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageCrafting(3, ItemCrafting.recipeMashedFood));
|
||||
new BookletChapter("compost", entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemFertilizer)).addTextReplacement("<num>", ConfigIntValues.COMPOST_AMOUNT.getValue()), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageCrafting(3, ItemCrafting.recipesMashedFood));
|
||||
new BookletChapter("crate", entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate));
|
||||
|
||||
//RF Using Blocks
|
||||
|
|
|
@ -93,6 +93,10 @@ public class BookletPage{
|
|||
return null;
|
||||
}
|
||||
|
||||
public void updateScreen(int ticksElapsed){
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void renderTooltipAndTransfer(GuiBooklet gui, ItemStack stack, int x, int y, boolean checkAndTransfer, boolean mouseClick){
|
||||
List list = stack.getTooltip(gui.mc.thePlayer, gui.mc.gameSettings.advancedItemTooltips);
|
||||
|
|
|
@ -28,31 +28,56 @@ import java.util.ArrayList;
|
|||
|
||||
public class PageCrafting extends BookletPage{
|
||||
|
||||
private final IRecipe recipe;
|
||||
private final IRecipe[] recipes;
|
||||
private int recipePos;
|
||||
|
||||
public PageCrafting(int id, IRecipe recipe){
|
||||
public PageCrafting(int id, IRecipe... recipes){
|
||||
super(id);
|
||||
this.recipe = recipe;
|
||||
this.recipes = recipes;
|
||||
InitBooklet.pagesWithItemStackData.add(this);
|
||||
}
|
||||
|
||||
public PageCrafting(int id, ArrayList<IRecipe> recipes){
|
||||
this(id, recipes.toArray(new IRecipe[recipes.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getItemStacksForPage(){
|
||||
return this.recipe == null ? null : new ItemStack[]{this.recipe.getRecipeOutput()};
|
||||
ItemStack[] stacks = new ItemStack[this.recipes.length];
|
||||
for(int i = 0; i < stacks.length; i++){
|
||||
if(this.recipes[i] != null){
|
||||
stacks[i] = this.recipes[i].getRecipeOutput();
|
||||
}
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
||||
if(this.recipe != null){
|
||||
if(this.recipes[this.recipePos] != null){
|
||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
||||
gui.drawTexturedModalRect(gui.guiLeft+27, gui.guiTop+20, 146, 20, 99, 60);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen(int ticksElapsed){
|
||||
if(ticksElapsed%30 == 0){
|
||||
if(this.recipePos+1 >= this.recipes.length){
|
||||
this.recipePos = 0;
|
||||
}
|
||||
else{
|
||||
this.recipePos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
||||
if(this.recipe == null){
|
||||
IRecipe recipe = this.recipes[this.recipePos];
|
||||
|
||||
if(recipe == null){
|
||||
gui.unicodeRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
}
|
||||
else{
|
||||
|
@ -65,7 +90,7 @@ public class PageCrafting extends BookletPage{
|
|||
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+90, 115, 0);
|
||||
}
|
||||
|
||||
if(this.recipe != null){
|
||||
if(recipe != null){
|
||||
|
||||
ItemStack[] stacks = new ItemStack[9];
|
||||
int width = 3;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class PageCrusherRecipe extends BookletPage{
|
|||
|
||||
@Override
|
||||
public ItemStack[] getItemStacksForPage(){
|
||||
return new ItemStack[]{this.recipe == null ? null : this.recipe.firstOutput};
|
||||
return this.recipe == null ? new ItemStack[0] : new ItemStack[]{this.recipe.firstOutput};
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -38,7 +38,7 @@ public class PageFurnace extends BookletPage{
|
|||
|
||||
@Override
|
||||
public ItemStack[] getItemStacksForPage(){
|
||||
return new ItemStack[]{this.result};
|
||||
return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,7 +32,7 @@ public class PageTextOnly extends BookletPage{
|
|||
|
||||
@Override
|
||||
public ItemStack[] getItemStacksForPage(){
|
||||
return new ItemStack[]{this.stack};
|
||||
return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ItemCrafting{
|
|||
public static IRecipe recipeBook;
|
||||
public static IRecipe recipeTinyCoal;
|
||||
public static IRecipe recipeTinyChar;
|
||||
public static IRecipe recipeMashedFood;
|
||||
public static ArrayList<IRecipe> recipesMashedFood = new ArrayList<IRecipe>();
|
||||
public static IRecipe recipeDrill;
|
||||
public static IRecipe recipeDrillSpeedI;
|
||||
public static IRecipe recipeDrillSpeedII;
|
||||
|
@ -478,9 +478,7 @@ public class ItemCrafting{
|
|||
if(!isBlacklisted(item)){
|
||||
ItemStack ingredient = new ItemStack((Item)item, 1, Util.WILDCARD);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
|
||||
if(recipeMashedFood == null){
|
||||
recipeMashedFood = Util.lastIRecipe();
|
||||
}
|
||||
recipesMashedFood.add(Util.lastIRecipe());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ booklet.actuallyadditions.chapter.feeder.text.1=The <item>Feeder<r> is a good al
|
|||
|
||||
booklet.actuallyadditions.chapter.compost.name=Compost and Fertilizer
|
||||
booklet.actuallyadditions.chapter.compost.text.1=The <item>Compost<r> is used to make <item>Fertilizier<r> from <item>Mashed Food<r>. <item>Fertilizer<r> acts just like Bone Meal, but can be crafted in a much simpler manner just by crafting <item>Mashed Food<r> and then putting <num> of those inside of a <item>Compost<r> and waiting for a bit. When the mashed food is composted, just take it out by right-clicking again.
|
||||
booklet.actuallyadditions.chapter.compost.text.3=<item>Mashed Food<r> can be crafted from <imp>any time of food or plantable item<r>.
|
||||
booklet.actuallyadditions.chapter.compost.text.3=<item>Mashed Food<r> can be crafted from <imp>any type of food or plantable item<r>.
|
||||
|
||||
booklet.actuallyadditions.chapter.crate.name=Storage Crates
|
||||
booklet.actuallyadditions.chapter.crate.text.1=<item>Storage Crates<r> are big. <imp>Really big<r>. They hold tons of items, more than 4 chests worth of them. <n><n><i>"F-in' gigantic"<rs><n> -Some Magazine
|
||||
|
|
Loading…
Reference in a new issue