Fixed some minor things

This commit is contained in:
Ellpeck 2015-10-04 13:21:07 +02:00
parent cbaa8095e8
commit f42bf35372
15 changed files with 42 additions and 102 deletions

View file

@ -27,20 +27,17 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.Random;
public class BlockLeafGenerator extends BlockContainerBase implements IActAddItemOrBlock{ public class BlockLeafGenerator extends BlockContainerBase implements IActAddItemOrBlock{
private IIcon topIcon; private IIcon topIcon;
private IIcon bottomIcon; private IIcon bottomIcon;
public BlockLeafGenerator(){ public BlockLeafGenerator(){
super(Material.rock); super(Material.iron);
this.setHarvestLevel("axe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.75F); this.setHardness(5.0F);
this.setResistance(3.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeWood); this.setStepSound(soundTypeMetal);
this.setTickRandomly(true);
} }
@Override @Override
@ -53,18 +50,6 @@ public class BlockLeafGenerator extends BlockContainerBase implements IActAddIte
return side <= 1 ? (side == 0 ? this.bottomIcon : this.topIcon) : this.blockIcon; return side <= 1 ? (side == 0 ? this.bottomIcon : this.topIcon) : this.blockIcon;
} }
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
int meta = world.getBlockMetadata(x, y, z);
if(meta == 1){
for(int i = 0; i < 5; i++){
world.spawnParticle("smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
}
}
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){

View file

@ -59,6 +59,7 @@ public class GuiBooklet extends GuiScreen{
public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT]; public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT];
private GuiTextField searchField; private GuiTextField searchField;
private int ticksElapsed; private int ticksElapsed;
private boolean mousePressed;
private GuiScreen parentScreen; private GuiScreen parentScreen;
@ -103,7 +104,7 @@ public class GuiBooklet extends GuiScreen{
if(this.currentIndexEntry != null){ if(this.currentIndexEntry != null){
if(this.currentChapter != null && this.currentPage != null){ if(this.currentChapter != null && this.currentPage != null){
this.drawCenteredString(this.fontRendererObj, this.currentPage.getID()+"/"+this.currentChapter.pages.length, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE); this.drawCenteredString(this.fontRendererObj, this.currentPage.getID()+"/"+this.currentChapter.pages.length, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
this.currentPage.renderPre(this, x, y, this.ticksElapsed); this.currentPage.renderPre(this, x, y, this.ticksElapsed, this.mousePressed);
} }
else{ else{
this.drawCenteredString(this.fontRendererObj, this.pageOpenInIndex+"/"+this.indexPageAmount, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE); this.drawCenteredString(this.fontRendererObj, this.pageOpenInIndex+"/"+this.indexPageAmount, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
@ -126,7 +127,7 @@ public class GuiBooklet extends GuiScreen{
this.searchField.drawTextBox(); this.searchField.drawTextBox();
if(this.currentIndexEntry != null && this.currentChapter != null && this.currentPage != null){ if(this.currentIndexEntry != null && this.currentChapter != null && this.currentPage != null){
this.currentPage.render(this, x, y, this.ticksElapsed); this.currentPage.render(this, x, y, this.ticksElapsed, this.mousePressed);
} }
this.fontRendererObj.setUnicodeFlag(false); this.fontRendererObj.setUnicodeFlag(false);
@ -163,6 +164,10 @@ public class GuiBooklet extends GuiScreen{
} }
this.fontRendererObj.setUnicodeFlag(unicodeBefore); this.fontRendererObj.setUnicodeFlag(unicodeBefore);
if(this.mousePressed){
this.mousePressed = false;
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -196,6 +201,11 @@ public class GuiBooklet extends GuiScreen{
@Override @Override
protected void mouseClicked(int par1, int par2, int par3){ protected void mouseClicked(int par1, int par2, int par3){
this.searchField.mouseClicked(par1, par2, par3); this.searchField.mouseClicked(par1, par2, par3);
if(par3 == 0){
this.mousePressed = true;
}
super.mouseClicked(par1, par2, par3); super.mouseClicked(par1, par2, par3);
} }

View file

@ -85,7 +85,7 @@ public class InitBooklet{
new BookletChapter("solarPanel", entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue()), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText()); new BookletChapter("solarPanel", entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue()), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
new BookletChapter("heatCollector", entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.HEAT_COLLECTOR_ENERGY_PRODUCED.getValue()).addTextReplacement("<min>", ConfigIntValues.HEAT_COLLECTOR_BLOCKS.getValue()), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText()); new BookletChapter("heatCollector", entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.HEAT_COLLECTOR_ENERGY_PRODUCED.getValue()).addTextReplacement("<min>", ConfigIntValues.HEAT_COLLECTOR_BLOCKS.getValue()), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText());
new BookletChapter("canola", entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addTextReplacement("<pressRF>", ConfigIntValues.PRESS_ENERGY_USED.getValue()).addTextReplacement("<canola>", ConfigIntValues.PRESS_MB_PRODUCED.getValue()).addTextReplacement("<rf>", ConfigIntValues.OIL_GEN_ENERGY_PRODUCED.getValue()), new PageCrafting(2, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(3, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(4, BlockCrafting.recipeOilGen).setNoText()); new BookletChapter("canola", entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addTextReplacement("<pressRF>", ConfigIntValues.PRESS_ENERGY_USED.getValue()).addTextReplacement("<canola>", ConfigIntValues.PRESS_MB_PRODUCED.getValue()).addTextReplacement("<rf>", ConfigIntValues.OIL_GEN_ENERGY_PRODUCED.getValue()), new PageCrafting(2, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(3, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(4, BlockCrafting.recipeOilGen).setNoText());
new BookletChapter("leafGen", entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LEAF_GENERATOR_ENERGY_PRODUCED.getValue()), new PageCrafting(2, BlockCrafting.recipeLeafGen)); new BookletChapter("leafGen", entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LEAF_GENERATOR_ENERGY_PRODUCED.getValue()).addTextReplacement("<range>", ConfigIntValues.LEAF_GENERATOR_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipeLeafGen));
//No RF Using Items //No RF Using Items
new BookletChapter("wings", entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()); new BookletChapter("wings", entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings).setNoText());

View file

@ -13,7 +13,6 @@ package ellpeck.actuallyadditions.booklet.page;
import ellpeck.actuallyadditions.booklet.BookletChapter; import ellpeck.actuallyadditions.booklet.BookletChapter;
import ellpeck.actuallyadditions.booklet.GuiBooklet; import ellpeck.actuallyadditions.booklet.GuiBooklet;
import ellpeck.actuallyadditions.booklet.InitBooklet; import ellpeck.actuallyadditions.booklet.InitBooklet;
import ellpeck.actuallyadditions.event.KeyStates;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.StringUtil;
@ -96,11 +95,11 @@ public class BookletPage{
return this; return this;
} }
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
} }
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
} }
@ -109,7 +108,7 @@ public class BookletPage{
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected void renderTooltipAndTransfer(GuiBooklet gui, ItemStack stack, int x, int y, boolean checkAndTransfer){ protected void renderTooltipAndTransfer(GuiBooklet gui, ItemStack stack, int x, int y, boolean checkAndTransfer, boolean mousePressed){
boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag(); boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag();
gui.mc.fontRenderer.setUnicodeFlag(false); gui.mc.fontRenderer.setUnicodeFlag(false);
@ -129,7 +128,7 @@ public class BookletPage{
if(ItemUtil.contains(page.getItemStacksForPage(), stack, true)){ if(ItemUtil.contains(page.getItemStacksForPage(), stack, true)){
list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe")); list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"));
if(KeyStates.mouseButtonState.checkPressed(true)){ if(mousePressed){
gui.openIndexEntry(page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); gui.openIndexEntry(page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
gui.openChapter(page.getChapter(), page); gui.openChapter(page.getChapter(), page);
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));

View file

@ -27,14 +27,14 @@ public class PageCoffeeRecipe extends BookletPage{
} }
@Override @Override
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc); gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
gui.drawTexturedModalRect(gui.guiLeft+19, gui.guiTop+20, 146, 94, 99, 60); gui.drawTexturedModalRect(gui.guiLeft+19, gui.guiTop+20, 146, 94, 99, 60);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
String strg = "Coffee Machine Recipe"; String strg = "Coffee Machine Recipe";
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0); gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
@ -91,7 +91,7 @@ public class PageCoffeeRecipe extends BookletPage{
} }
else{ else{
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j != 2); this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j != 2, mousePressed);
} }
} }
} }

View file

@ -43,7 +43,7 @@ public class PageCrafting extends BookletPage{
} }
@Override @Override
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){ if(this.recipes[this.recipePos] != null){
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc); gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
gui.drawTexturedModalRect(gui.guiLeft+27, gui.guiTop+20, 146, 20, 99, 60); gui.drawTexturedModalRect(gui.guiLeft+27, gui.guiTop+20, 146, 20, 99, 60);
@ -52,7 +52,7 @@ public class PageCrafting extends BookletPage{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
IRecipe recipe = this.recipes[this.recipePos]; IRecipe recipe = this.recipes[this.recipePos];
if(recipe == null){ if(recipe == null){
@ -124,7 +124,7 @@ public class PageCrafting extends BookletPage{
} }
else{ else{
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, true); this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, true, mousePressed);
} }
} }
} }
@ -132,7 +132,7 @@ public class PageCrafting extends BookletPage{
} }
} }
if(mouseX >= xShowOutput && mouseX <= xShowOutput+16 && mouseY >= yShowOutput && mouseY <= yShowOutput+16){ if(mouseX >= xShowOutput && mouseX <= xShowOutput+16 && mouseY >= yShowOutput && mouseY <= yShowOutput+16){
this.renderTooltipAndTransfer(gui, recipe.getRecipeOutput(), mouseX, mouseY, false); this.renderTooltipAndTransfer(gui, recipe.getRecipeOutput(), mouseX, mouseY, false, mousePressed);
} }
} }
} }

View file

@ -37,7 +37,7 @@ public class PageCrusherRecipe extends BookletPage{
} }
@Override @Override
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(recipe != null){ if(recipe != null){
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc); gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
gui.drawTexturedModalRect(gui.guiLeft+37, gui.guiTop+20, 60, 180, 60, 60); gui.drawTexturedModalRect(gui.guiLeft+37, gui.guiTop+20, 60, 180, 60, 60);
@ -46,7 +46,7 @@ public class PageCrusherRecipe extends BookletPage{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(recipe == null){ if(recipe == null){
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0); gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
} }
@ -96,7 +96,7 @@ public class PageCrusherRecipe extends BookletPage{
} }
else{ else{
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j == 0); this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j == 0, mousePressed);
} }
} }
} }

View file

@ -38,7 +38,7 @@ public class PageFurnace extends BookletPage{
} }
@Override @Override
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){ if(this.input != null || this.getInputForOutput(this.result) != null){
gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc); gui.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
gui.drawTexturedModalRect(gui.guiLeft+37, gui.guiTop+20, 0, 180, 60, 60); gui.drawTexturedModalRect(gui.guiLeft+37, gui.guiTop+20, 0, 180, 60, 60);
@ -47,7 +47,7 @@ public class PageFurnace extends BookletPage{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result); ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result);
if(input == null){ if(input == null){
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0); gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
@ -78,7 +78,7 @@ public class PageFurnace extends BookletPage{
} }
else{ else{
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, x == 0); this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, x == 0, mousePressed);
} }
} }
} }

View file

@ -31,7 +31,7 @@ public class PageTextOnly extends BookletPage{
} }
@Override @Override
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed){ public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
String text = gui.currentPage.getText(); String text = gui.currentPage.getText();
if(text != null && !text.isEmpty()){ if(text != null && !text.isEmpty()){
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+9, 115, 0); gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+9, 115, 0);

View file

@ -164,7 +164,7 @@ public enum ConfigIntValues{
LEAF_GENERATOR_ENERGY_PRODUCED("Leaf Generator: Energy Produce", ConfigCategories.MACHINE_VALUES, 40, 1, 10000, "How much Energy the Leaf Generator produces per Leaf broken"), LEAF_GENERATOR_ENERGY_PRODUCED("Leaf Generator: Energy Produce", ConfigCategories.MACHINE_VALUES, 40, 1, 10000, "How much Energy the Leaf Generator produces per Leaf broken"),
LEAF_GENERATOR_COOLDOWN_TIME("Leaf Generator: Cooldown Time", ConfigCategories.MACHINE_VALUES, 5, 0, 100, "The amount of ticks that it takes util another Leaf gets proken"), LEAF_GENERATOR_COOLDOWN_TIME("Leaf Generator: Cooldown Time", ConfigCategories.MACHINE_VALUES, 5, 0, 100, "The amount of ticks that it takes util another Leaf gets proken"),
LEAF_GENERATOR_RANGE("Leaf Generator: Range", ConfigCategories.MACHINE_VALUES, 5, 1, 100, "The radius of a leaf generator"); LEAF_GENERATOR_RANGE("Leaf Generator: Range", ConfigCategories.MACHINE_VALUES, 7, 1, 100, "The radius of a leaf generator");
public final String name; public final String name;
public final String category; public final String category;

View file

@ -37,7 +37,6 @@ public class InitEvents{
public static void initClient(){ public static void initClient(){
Util.registerEvent(new TooltipEvent()); Util.registerEvent(new TooltipEvent());
Util.registerEvent(new RenderPlayerEventAA()); Util.registerEvent(new RenderPlayerEventAA());
Util.registerEvent(new KeyStates());
if(Loader.isModLoaded("NotEnoughItems")){ if(Loader.isModLoaded("NotEnoughItems")){
Util.registerEvent(new NeiScreenEvents()); Util.registerEvent(new NeiScreenEvents());

View file

@ -1,50 +0,0 @@
/*
* This file ("KeyStates.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.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import ellpeck.actuallyadditions.util.KeyBinds;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public class KeyStates{
public static KeyState mouseButtonState = new KeyState();
public static KeyState infoButtonState = new KeyState();
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event){
if(event.phase != TickEvent.Phase.END){
mouseButtonState.tick(Mouse.isButtonDown(0));
infoButtonState.tick(Keyboard.isKeyDown(KeyBinds.keybindOpenBooklet.getKeyCode()));
}
}
public static class KeyState{
private boolean pressed;
private boolean pressedLastTime;
public void tick(boolean pressed){
this.pressed = pressed && !this.pressedLastTime;
this.pressedLastTime = pressed;
}
public boolean checkPressed(boolean shouldUnpress){
boolean isPressed = this.pressed;
if(shouldUnpress){
this.pressed = false;
}
return isPressed;
}
}
}

View file

@ -37,11 +37,11 @@ public class TooltipEvent{
if(event.itemStack != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiBooklet)){ if(event.itemStack != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiBooklet)){
for(BookletPage page : InitBooklet.pagesWithItemStackData){ for(BookletPage page : InitBooklet.pagesWithItemStackData){
if(ItemUtil.contains(page.getItemStacksForPage(), event.itemStack, true)){ if(ItemUtil.contains(page.getItemStacksForPage(), event.itemStack, true)){
if(ConfigBoolValues.SHOW_BOOKLET_INFO.isEnabled()){
int keyCode = KeyBinds.keybindOpenBooklet.getKeyCode(); int keyCode = KeyBinds.keybindOpenBooklet.getKeyCode();
event.toolTip.add(EnumChatFormatting.GOLD+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".keyToSeeRecipe", keyCode > 0 && keyCode < Keyboard.KEYBOARD_SIZE ? "'"+Keyboard.getKeyName(keyCode)+"'" : "[NONE]")); if(ConfigBoolValues.SHOW_BOOKLET_INFO.isEnabled()){
event.toolTip.add(EnumChatFormatting.GOLD+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".keyToSeeRecipe", keyCode > 0 && keyCode < Keyboard.KEYBOARD_SIZE ? Keyboard.getKeyName(keyCode) : "[NONE]"));
} }
if(KeyStates.infoButtonState.checkPressed(true)){ if(keyCode > 0 && keyCode < Keyboard.KEYBOARD_SIZE && Keyboard.isKeyDown(keyCode) && KeyUtil.isAltPressed()){
GuiBooklet book = new GuiBooklet(Minecraft.getMinecraft().currentScreen); GuiBooklet book = new GuiBooklet(Minecraft.getMinecraft().currentScreen);
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
Minecraft.getMinecraft().displayGuiScreen(book); Minecraft.getMinecraft().displayGuiScreen(book);

View file

@ -23,7 +23,6 @@ import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.event.InitEvents; import ellpeck.actuallyadditions.event.InitEvents;
import ellpeck.actuallyadditions.tile.*; import ellpeck.actuallyadditions.tile.*;
import ellpeck.actuallyadditions.util.AssetUtil; import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.KeyBinds;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.playerdata.PersistentClientData; import ellpeck.actuallyadditions.util.playerdata.PersistentClientData;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -41,8 +40,6 @@ public class ClientProxy implements IProxy{
ModUtil.LOGGER.info("PreInitializing ClientProxy..."); ModUtil.LOGGER.info("PreInitializing ClientProxy...");
PersistentClientData.setTheFile(new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"Data.dat")); PersistentClientData.setTheFile(new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"Data.dat"));
KeyBinds.init();
} }
@Override @Override

View file

@ -404,7 +404,7 @@ booklet.actuallyadditions.indexEntry.itemsRF.name=Items that use RF
#Booklet Info #Booklet Info
booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is disabled in the Config File! If you're on a server, ask the server author to enable it in the config. If you're on a client, press the 'Open Config'-Button on the top right and enable the recipe! booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is disabled in the Config File! If you're on a server, ask the server author to enable it in the config. If you're on a client, press the 'Open Config'-Button on the top right and enable the recipe!
booklet.actuallyadditions.clickToSeeRecipe=Click to see more Information booklet.actuallyadditions.clickToSeeRecipe=Click to see more Information
booklet.actuallyadditions.keyToSeeRecipe=Press %s to see more Information booklet.actuallyadditions.keyToSeeRecipe=Press ALT+%s to see more Information
#Booklet Chapters #Booklet Chapters
booklet.actuallyadditions.chapter.intro.name=An Introduction to ActAdd booklet.actuallyadditions.chapter.intro.name=An Introduction to ActAdd
@ -542,5 +542,5 @@ booklet.actuallyadditions.chapter.batteries.name=Batteries
booklet.actuallyadditions.chapter.batteries.text.1=<item>Batteries<r> are a good way to store RF to move around. They can be <imp>charged in an Energizer<r> and <imp>discharged in an Enervator<r>. booklet.actuallyadditions.chapter.batteries.text.1=<item>Batteries<r> are a good way to store RF to move around. They can be <imp>charged in an Energizer<r> and <imp>discharged in an Enervator<r>.
booklet.actuallyadditions.chapter.leafGen.name=Leaf-Eating Generator booklet.actuallyadditions.chapter.leafGen.name=Leaf-Eating Generator
booklet.actuallyadditions.chapter.leafGen.text.1=The <item>Leaf Generator<r> can generate <imp>RF<r> just by being placed alongside some <item>Leaves<r>. <n>It will destroy the leaves, generating <imp><rf> RF per leaf broken<r> in the process. <n>By right-clicking the generator, you can see how much RF it has stored. booklet.actuallyadditions.chapter.leafGen.text.1=The <item>Leaf Generator<r> can generate <imp>RF<r> just by being placed alongside some <item>Leaves<r>. <n>It will destroy the leaves, generating <imp><rf> RF per leaf broken<r> in the process. <n>By right-clicking the generator, you can see how much RF it has stored. <n>It has a <imp>range of <range><r> blocks.
booklet.actuallyadditions.chapter.leafGen.text.2=<i>Munchy booklet.actuallyadditions.chapter.leafGen.text.2=<i>Munchy