mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Some JEI changes
This commit is contained in:
parent
a515839c5c
commit
9a0698a907
9 changed files with 39 additions and 90 deletions
|
@ -17,32 +17,29 @@ import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
|
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public abstract class RecipeWrapperWithButton{
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class RecipeWrapperWithButton implements IRecipeWrapper{
|
||||||
|
|
||||||
protected final TexturedButton theButton;
|
protected final TexturedButton theButton;
|
||||||
|
|
||||||
public RecipeWrapperWithButton(){
|
public RecipeWrapperWithButton(){
|
||||||
this.theButton = new TexturedButton(23782, this.getButtonX(), this.getButtonY(), 146, 154, 20, 20){
|
this.theButton = new TexturedButton(23782, this.getButtonX(), this.getButtonY(), 146, 154, 20, 20);
|
||||||
@Override
|
|
||||||
public void drawButton(Minecraft minecraft, int x, int y){
|
|
||||||
super.drawButton(minecraft, x, y);
|
|
||||||
if(this.visible && this.hovered){
|
|
||||||
String text = StringUtil.localize("booklet."+ModUtil.MOD_ID+".clickToSeeRecipe");
|
|
||||||
Minecraft.getMinecraft().fontRendererObj.drawString(text, this.xPosition-Minecraft.getMinecraft().fontRendererObj.getStringWidth(text)-1, this.yPosition+this.height/2-Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT/2, StringUtil.DECIMAL_COLOR_WHITE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract int getButtonX();
|
public abstract int getButtonX();
|
||||||
|
|
||||||
public abstract int getButtonY();
|
public abstract int getButtonY();
|
||||||
|
|
||||||
public boolean handleClick(Minecraft mc, int mouseX, int mouseY){
|
@Override
|
||||||
if(this.theButton.mousePressed(mc, mouseX, mouseY)){
|
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
|
||||||
this.theButton.playPressSound(mc.getSoundHandler());
|
if(this.theButton.mousePressed(minecraft, mouseX, mouseY)){
|
||||||
|
this.theButton.playPressSound(minecraft.getSoundHandler());
|
||||||
|
|
||||||
BookletPage page = this.getPage();
|
BookletPage page = this.getPage();
|
||||||
if(page != null){
|
if(page != null){
|
||||||
|
@ -58,7 +55,19 @@ public abstract class RecipeWrapperWithButton{
|
||||||
|
|
||||||
public abstract BookletPage getPage();
|
public abstract BookletPage getPage();
|
||||||
|
|
||||||
public void updateButton(Minecraft mc, int mouseX, int mouseY){
|
@Override
|
||||||
this.theButton.drawButton(mc, mouseX, mouseY);
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
||||||
|
this.theButton.drawButton(minecraft, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<String> getTooltipStrings(int mouseX, int mouseY){
|
||||||
|
if(this.theButton.isMouseOver()){
|
||||||
|
return Collections.singletonList(StringUtil.localize("booklet."+ModUtil.MOD_ID+".clickToSeeRecipe"));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class BookletRecipeCategory implements IRecipeCategory{
|
||||||
private final IDrawable background;
|
private final IDrawable background;
|
||||||
|
|
||||||
public BookletRecipeCategory(IGuiHelper helper){
|
public BookletRecipeCategory(IGuiHelper helper){
|
||||||
this.background = helper.createBlankDrawable(160, 100);
|
this.background = helper.createBlankDrawable(160, 105);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
public class BookletRecipeWrapper extends RecipeWrapperWithButton{
|
||||||
|
|
||||||
public final BookletPage thePage;
|
public final BookletPage thePage;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe
|
||||||
minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+chapter.getLocalizedName(), 25, 85, 0, false);
|
minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+chapter.getLocalizedName(), 25, 85, 0, false);
|
||||||
minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+"Page "+this.thePage.getID(), 25, 95, 0, false);
|
minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+"Page "+this.thePage.getID(), 25, 95, 0, false);
|
||||||
|
|
||||||
this.updateButton(minecraft, mouseX, mouseY);
|
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,16 +83,6 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getTooltipStrings(int mouseX, int mouseY){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
|
|
||||||
return this.handleClick(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX(){
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CoffeeMachineRecipeCategory implements IRecipeCategory{
|
||||||
private final IDrawable background;
|
private final IDrawable background;
|
||||||
|
|
||||||
public CoffeeMachineRecipeCategory(IGuiHelper helper){
|
public CoffeeMachineRecipeCategory(IGuiHelper helper){
|
||||||
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEICoffeeMachine"), 0, 0, 126, 88);
|
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEICoffeeMachine"), 0, 0, 126, 92);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{
|
||||||
|
|
||||||
public final CoffeeIngredient theIngredient;
|
public final CoffeeIngredient theIngredient;
|
||||||
public final ItemStack theOutput;
|
public final ItemStack theOutput;
|
||||||
|
@ -75,8 +75,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
||||||
this.updateButton(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
if(this.theIngredient.getExtraText() != null){
|
if(this.theIngredient.getExtraText() != null){
|
||||||
minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||||
minecraft.fontRendererObj.drawString(this.theIngredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
minecraft.fontRendererObj.drawString(this.theIngredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||||
|
@ -85,6 +83,8 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
|
||||||
if(this.theIngredient.maxAmplifier > 0){
|
if(this.theIngredient.maxAmplifier > 0){
|
||||||
minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".coffee.maxAmount")+": "+this.theIngredient.maxAmplifier, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".coffee.maxAmount")+": "+this.theIngredient.maxAmplifier, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,16 +92,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getTooltipStrings(int mouseX, int mouseY){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
|
|
||||||
return this.handleClick(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX(){
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -109,7 +99,7 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonY(){
|
public int getButtonY(){
|
||||||
return 70;
|
return 68;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
public class CrusherRecipeWrapper extends RecipeWrapperWithButton{
|
||||||
|
|
||||||
public final CrusherRecipe theRecipe;
|
public final CrusherRecipe theRecipe;
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
||||||
this.updateButton(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
if(this.theRecipe.outputTwoStack != null){
|
if(this.theRecipe.outputTwoStack != null){
|
||||||
minecraft.fontRendererObj.drawString(this.theRecipe.outputTwoChance+"%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
minecraft.fontRendererObj.drawString(this.theRecipe.outputTwoChance+"%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,16 +78,6 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getTooltipStrings(int mouseX, int mouseY){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
|
|
||||||
return this.handleClick(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX(){
|
||||||
return -5;
|
return -5;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{
|
||||||
|
|
||||||
public final EmpowererRecipe theRecipe;
|
public final EmpowererRecipe theRecipe;
|
||||||
|
|
||||||
|
@ -59,26 +59,11 @@ public class EmpowererRecipeWrapper extends RecipeWrapperWithButton implements I
|
||||||
return new ArrayList<FluidStack>();
|
return new ArrayList<FluidStack>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
|
||||||
this.updateButton(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight){
|
public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getTooltipStrings(int mouseX, int mouseY){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
|
|
||||||
return this.handleClick(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX(){
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton{
|
||||||
|
|
||||||
public final LensConversionRecipe theRecipe;
|
public final LensConversionRecipe theRecipe;
|
||||||
|
|
||||||
|
@ -58,26 +58,11 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implemen
|
||||||
return new ArrayList<FluidStack>();
|
return new ArrayList<FluidStack>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
|
||||||
this.updateButton(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight){
|
public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getTooltipStrings(int mouseX, int mouseY){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
|
|
||||||
return this.handleClick(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX(){
|
||||||
return 3;
|
return 3;
|
||||||
|
|
|
@ -94,7 +94,7 @@ container.nei.actuallyadditions.reconstructor.name=Atomic Reconstructor
|
||||||
container.nei.actuallyadditions.empowerer.name=Empowerer
|
container.nei.actuallyadditions.empowerer.name=Empowerer
|
||||||
|
|
||||||
container.nei.actuallyadditions.booklet.name=ActAdd Manual
|
container.nei.actuallyadditions.booklet.name=ActAdd Manual
|
||||||
container.nei.actuallyadditions.booklet.header=The <item>Actually Additions Manual<r> reads:
|
container.nei.actuallyadditions.booklet.header=The <item>Actually Additions Manual<r> says:
|
||||||
container.nei.actuallyadditions.booklet.noText=Nothing, apparently! But that doesn't matter. Just click the button on the bottom to see the item inside the booklet and look through its pages to find some fancy stuff!
|
container.nei.actuallyadditions.booklet.noText=Nothing, apparently! But that doesn't matter. Just click the button on the bottom to see the item inside the booklet and look through its pages to find some fancy stuff!
|
||||||
|
|
||||||
#Damage Sources
|
#Damage Sources
|
||||||
|
|
Loading…
Reference in a new issue