Some JEI changes

This commit is contained in:
Ellpeck 2016-10-31 20:19:55 +01:00
parent a515839c5c
commit 9a0698a907
9 changed files with 39 additions and 90 deletions

View file

@ -17,32 +17,29 @@ import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.recipe.IRecipeWrapper;
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;
public RecipeWrapperWithButton(){
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);
}
}
};
this.theButton = new TexturedButton(23782, this.getButtonX(), this.getButtonY(), 146, 154, 20, 20);
}
public abstract int getButtonX();
public abstract int getButtonY();
public boolean handleClick(Minecraft mc, int mouseX, int mouseY){
if(this.theButton.mousePressed(mc, mouseX, mouseY)){
this.theButton.playPressSound(mc.getSoundHandler());
@Override
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
if(this.theButton.mousePressed(minecraft, mouseX, mouseY)){
this.theButton.playPressSound(minecraft.getSoundHandler());
BookletPage page = this.getPage();
if(page != null){
@ -58,7 +55,19 @@ public abstract class RecipeWrapperWithButton{
public abstract BookletPage getPage();
public void updateButton(Minecraft mc, int mouseX, int mouseY){
this.theButton.drawButton(mc, mouseX, mouseY);
@Override
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();
}
}
}

View file

@ -28,7 +28,7 @@ public class BookletRecipeCategory implements IRecipeCategory{
private final IDrawable background;
public BookletRecipeCategory(IGuiHelper helper){
this.background = helper.createBlankDrawable(160, 100);
this.background = helper.createBlankDrawable(160, 105);
}

View file

@ -25,7 +25,7 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.Arrays;
import java.util.List;
public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
public class BookletRecipeWrapper extends RecipeWrapperWithButton{
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+"Page "+this.thePage.getID(), 25, 95, 0, false);
this.updateButton(minecraft, mouseX, mouseY);
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
}
@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
public int getButtonX(){
return 0;

View file

@ -27,7 +27,7 @@ public class CoffeeMachineRecipeCategory implements IRecipeCategory{
private final IDrawable background;
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);
}

View file

@ -30,7 +30,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{
public final CoffeeIngredient theIngredient;
public final ItemStack theOutput;
@ -75,8 +75,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
this.updateButton(minecraft, mouseX, mouseY);
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(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){
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
@ -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
public int getButtonX(){
return 0;
@ -109,7 +99,7 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
@Override
public int getButtonY(){
return 70;
return 68;
}
@Override

View file

@ -26,7 +26,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
public class CrusherRecipeWrapper extends RecipeWrapperWithButton{
public final CrusherRecipe theRecipe;
@ -66,11 +66,11 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
this.updateButton(minecraft, mouseX, mouseY);
if(this.theRecipe.outputTwoStack != null){
minecraft.fontRendererObj.drawString(this.theRecipe.outputTwoChance+"%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
}
@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
public int getButtonX(){
return -5;

View file

@ -26,7 +26,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{
public final EmpowererRecipe theRecipe;
@ -59,26 +59,11 @@ public class EmpowererRecipeWrapper extends RecipeWrapperWithButton implements I
return new ArrayList<FluidStack>();
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
this.updateButton(minecraft, mouseX, mouseY);
}
@Override
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
public int getButtonX(){
return 2;

View file

@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton{
public final LensConversionRecipe theRecipe;
@ -58,26 +58,11 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implemen
return new ArrayList<FluidStack>();
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
this.updateButton(minecraft, mouseX, mouseY);
}
@Override
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
public int getButtonX(){
return 3;

View file

@ -94,7 +94,7 @@ container.nei.actuallyadditions.reconstructor.name=Atomic Reconstructor
container.nei.actuallyadditions.empowerer.name=Empowerer
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!
#Damage Sources