mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Deleted old booklet stuff
This commit is contained in:
parent
3f09889e7f
commit
1a2952d078
5 changed files with 0 additions and 420 deletions
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IBookletPage.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.inventory.gui.booklet;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public interface IBookletPage{
|
|
||||||
|
|
||||||
int getID();
|
|
||||||
|
|
||||||
void setChapter(BookletChapter chapter);
|
|
||||||
|
|
||||||
BookletChapter getChapter();
|
|
||||||
|
|
||||||
String getText();
|
|
||||||
|
|
||||||
void renderPre(GuiBooklet gui, int mouseX, int mouseY);
|
|
||||||
|
|
||||||
void render(GuiBooklet gui, int mouseX, int mouseY);
|
|
||||||
|
|
||||||
ItemStack getItemStackForPage();
|
|
||||||
}
|
|
|
@ -1,130 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("PageCrafting.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.inventory.gui.booklet;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.Util;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.entity.RenderItem;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.minecraft.item.crafting.ShapedRecipes;
|
|
||||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class PageCrafting extends PageText{
|
|
||||||
|
|
||||||
private final IRecipe recipe;
|
|
||||||
|
|
||||||
public PageCrafting(int id, IRecipe recipe){
|
|
||||||
super(id);
|
|
||||||
this.recipe = recipe;
|
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemStackForPage(){
|
|
||||||
return this.recipe == null ? null : this.recipe.getRecipeOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
if(this.recipe != null){
|
|
||||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
|
||||||
gui.drawTexturedModalRect(gui.guiLeft+27, gui.guiTop+20, 146, 20, 99, 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
if(this.recipe == null){
|
|
||||||
gui.unicodeRenderer.drawSplitString(StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
gui.unicodeRenderer.drawSplitString(gui.currentPage.getText(), gui.guiLeft+14, gui.guiTop+112, 115, 0);
|
|
||||||
|
|
||||||
if(this.recipe != null){
|
|
||||||
|
|
||||||
ItemStack[] stacks = new ItemStack[9];
|
|
||||||
int width = 3;
|
|
||||||
int height = 3;
|
|
||||||
|
|
||||||
if(recipe instanceof ShapedRecipes){
|
|
||||||
ShapedRecipes shaped = (ShapedRecipes)recipe;
|
|
||||||
width = shaped.recipeWidth;
|
|
||||||
height = shaped.recipeHeight;
|
|
||||||
stacks = shaped.recipeItems;
|
|
||||||
}
|
|
||||||
else if(recipe instanceof ShapelessRecipes){
|
|
||||||
ShapelessRecipes shapeless = (ShapelessRecipes)recipe;
|
|
||||||
for(int i = 0; i < shapeless.recipeItems.size(); i++){
|
|
||||||
stacks[i] = (ItemStack)shapeless.recipeItems.get(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(recipe instanceof ShapedOreRecipe){
|
|
||||||
ShapedOreRecipe shaped = (ShapedOreRecipe)recipe;
|
|
||||||
width = ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
|
|
||||||
height = ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
|
|
||||||
for(int i = 0; i < shaped.getInput().length; i++){
|
|
||||||
Object input = shaped.getInput()[i];
|
|
||||||
if(input != null){
|
|
||||||
stacks[i] = input instanceof ItemStack ? (ItemStack)input : ((ArrayList<ItemStack>)input).get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(recipe instanceof ShapelessOreRecipe){
|
|
||||||
ShapelessOreRecipe shapeless = (ShapelessOreRecipe)recipe;
|
|
||||||
for(int i = 0; i < shapeless.getInput().size(); i++){
|
|
||||||
Object input = shapeless.getInput().get(i);
|
|
||||||
stacks[i] = input instanceof ItemStack ? (ItemStack)input : ((ArrayList<ItemStack>)input).get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int xShowOutput = gui.guiLeft+28+82;
|
|
||||||
int yShowOutput = gui.guiTop+23+20;
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
|
||||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), recipe.getRecipeOutput(), xShowOutput, yShowOutput);
|
|
||||||
RenderHelper.enableStandardItemLighting();
|
|
||||||
for(int i = 0; i < 2; i++){
|
|
||||||
boolean tooltip = i == 1;
|
|
||||||
for(int x = 0; x < width; x++){
|
|
||||||
for(int y = 0; y < height; y++){
|
|
||||||
ItemStack stack = stacks[y*width+x];
|
|
||||||
if(stack != null){
|
|
||||||
int xShow = gui.guiLeft+28+x*21;
|
|
||||||
int yShow = gui.guiTop+23+y*21;
|
|
||||||
if(!tooltip){
|
|
||||||
if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0);
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
|
||||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, xShow, yShow);
|
|
||||||
RenderHelper.enableStandardItemLighting();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
|
|
||||||
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mouseX >= xShowOutput && mouseX <= xShowOutput+16 && mouseY >= yShowOutput && mouseY <= yShowOutput+16){
|
|
||||||
gui.renderToolTip(recipe.getRecipeOutput(), mouseX, mouseY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("PageCrusher.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.inventory.gui.booklet;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.recipe.CrusherRecipeManualRegistry;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.entity.RenderItem;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class PageCrusherRecipe extends PageText{
|
|
||||||
|
|
||||||
public ItemStack input;
|
|
||||||
|
|
||||||
public PageCrusherRecipe(int id, ItemStack input){
|
|
||||||
super(id);
|
|
||||||
this.input = input;
|
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
if(CrusherRecipeManualRegistry.getOutput(this.input, false) != null){
|
|
||||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
|
||||||
gui.drawTexturedModalRect(gui.guiLeft+37, gui.guiTop+20, 60, 180, 60, 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemStackForPage(){
|
|
||||||
return CrusherRecipeManualRegistry.getOutput(this.input, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
ItemStack output = CrusherRecipeManualRegistry.getOutput(this.input, false);
|
|
||||||
if(output == null){
|
|
||||||
gui.unicodeRenderer.drawSplitString(StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
gui.unicodeRenderer.drawSplitString(gui.currentPage.getText(), gui.guiLeft+14, gui.guiTop+112, 115, 0);
|
|
||||||
|
|
||||||
int secondChance = CrusherRecipeManualRegistry.getSecondChance(this.input);
|
|
||||||
if(secondChance > 0){
|
|
||||||
gui.unicodeRenderer.drawString(secondChance+"%", gui.guiLeft+37+62, gui.guiTop+20+35, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(output != null){
|
|
||||||
for(int i = 0; i < 2; i++){
|
|
||||||
for(int j = 0; j < 3; j++){
|
|
||||||
ItemStack stack = (j == 0 ? this.input : (j == 1 ? output : (j == 2 ? CrusherRecipeManualRegistry.getOutput(this.input, true) : null)));
|
|
||||||
|
|
||||||
if(stack != null){
|
|
||||||
boolean tooltip = i == 1;
|
|
||||||
|
|
||||||
int xShow = gui.guiLeft+37+(j == 0 ? 0 : (j == 1 ? 42 : (j == 2 ? 43 : 0)));
|
|
||||||
int yShow = gui.guiTop+20+(j == 0 ? 18 : (j == 1 ? 12 : (j == 2 ? 30 : 0)));
|
|
||||||
if(!tooltip){
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
|
||||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, xShow, yShow);
|
|
||||||
RenderHelper.enableStandardItemLighting();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
|
|
||||||
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,85 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("PageFurnace.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.inventory.gui.booklet;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.entity.RenderItem;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class PageFurnace extends PageText{
|
|
||||||
|
|
||||||
private final ItemStack result;
|
|
||||||
|
|
||||||
public PageFurnace(int id, ItemStack result){
|
|
||||||
super(id);
|
|
||||||
this.result = result;
|
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemStackForPage(){
|
|
||||||
return this.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
if(this.getInputForOutput(this.result) != null){
|
|
||||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
|
||||||
gui.drawTexturedModalRect(gui.guiLeft+37, gui.guiTop+20, 0, 180, 60, 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
ItemStack input = this.getInputForOutput(this.result);
|
|
||||||
if(input == null){
|
|
||||||
gui.unicodeRenderer.drawSplitString(StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
gui.unicodeRenderer.drawSplitString(gui.currentPage.getText(), gui.guiLeft+14, gui.guiTop+112, 115, 0);
|
|
||||||
|
|
||||||
if(input != null){
|
|
||||||
for(int i = 0; i < 2; i++){
|
|
||||||
for(int x = 0; x < 2; x++){
|
|
||||||
ItemStack stack = x == 0 ? input : this.result;
|
|
||||||
boolean tooltip = i == 1;
|
|
||||||
|
|
||||||
int xShow = gui.guiLeft+37+1+x*40;
|
|
||||||
int yShow = gui.guiTop+20+20;
|
|
||||||
if(!tooltip){
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
|
||||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, xShow, yShow);
|
|
||||||
RenderHelper.enableStandardItemLighting();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
|
|
||||||
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, x == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack getInputForOutput(ItemStack output){
|
|
||||||
for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){
|
|
||||||
ItemStack stack = (ItemStack)((Map.Entry)o).getValue();
|
|
||||||
if(stack.isItemEqual(output)) return (ItemStack)((Map.Entry)o).getKey();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,92 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("PageText.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.inventory.gui.booklet;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import org.lwjgl.input.Mouse;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PageText implements IBookletPage{
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private BookletChapter chapter;
|
|
||||||
|
|
||||||
public PageText(int id){
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getID(){
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setChapter(BookletChapter chapter){
|
|
||||||
this.chapter = chapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BookletChapter getChapter(){
|
|
||||||
return this.chapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(){
|
|
||||||
return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY){
|
|
||||||
gui.unicodeRenderer.drawSplitString(gui.currentPage.getText(), gui.guiLeft+14, gui.guiTop+11, 115, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemStackForPage(){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected void renderTooltipAndTransfer(GuiBooklet gui, ItemStack stack, int x, int y, boolean checkAndTransfer){
|
|
||||||
List list = stack.getTooltip(gui.mc.thePlayer, gui.mc.gameSettings.advancedItemTooltips);
|
|
||||||
|
|
||||||
for(int k = 0; k < list.size(); ++k){
|
|
||||||
if(k == 0){
|
|
||||||
list.set(k, stack.getRarity().rarityColor+(String)list.get(k));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
list.set(k, StringUtil.GRAY+list.get(k));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(checkAndTransfer){
|
|
||||||
for(IBookletPage page : InitBooklet.pagesWithItemStackData){
|
|
||||||
if(page.getItemStackForPage() != null && page.getItemStackForPage().isItemEqual(stack)){
|
|
||||||
list.add(StringUtil.ORANGE+"Click to see Recipe!");
|
|
||||||
|
|
||||||
if(Mouse.isButtonDown(0)){
|
|
||||||
gui.openChapter(page.getChapter(), page);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gui.drawHoveringText(list, x, y);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue