diff --git a/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java b/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java index f8d506c..ec0ef81 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java +++ b/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java @@ -1,6 +1,6 @@ package com.oitsjustjose.criss_cross; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.CreativeTab; import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.lib.LibBlocks; @@ -33,10 +33,10 @@ public class CrissCross public static CommonProxy proxy; @EventHandler - public static void preInit(FMLPreInitializationEvent event) + public void preInit(FMLPreInitializationEvent event) { - ConfigHandler.init(event.getSuggestedConfigurationFile()); - MinecraftForge.EVENT_BUS.register(new ConfigHandler()); + Config.init(event.getSuggestedConfigurationFile()); + MinecraftForge.EVENT_BUS.register(new Config()); proxy.preInit(); LibBlocks.init(); @@ -45,7 +45,7 @@ public class CrissCross } @EventHandler - public static void postInit(FMLPostInitializationEvent event) + public void postInit(FMLPostInitializationEvent event) { MachineRecipes.init(); diff --git a/src/main/java/com/oitsjustjose/criss_cross/container/ContainerAtmosManipulator.java b/src/main/java/com/oitsjustjose/criss_cross/container/ContainerAtmosManipulator.java new file mode 100644 index 0000000..afaa8a5 --- /dev/null +++ b/src/main/java/com/oitsjustjose/criss_cross/container/ContainerAtmosManipulator.java @@ -0,0 +1,36 @@ +package com.oitsjustjose.criss_cross.container; + +import com.oitsjustjose.criss_cross.tileentity.TileAtmosManipulator; +import com.oitsjustjose.criss_cross.tileentity.TileCobblegen; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerAtmosManipulator extends Container +{ + TileAtmosManipulator tileAM; + EntityPlayer player; + + public ContainerAtmosManipulator(EntityPlayer player, TileAtmosManipulator tile) + { + super(); + this.tileAM = tile; + this.player = player; + } + + + public void onCraftGuiOpened(ICrafting crafting) + { + super.onCraftGuiOpened(crafting); + } + + @Override + public boolean canInteractWith(EntityPlayer player) + { + return this.tileAM.isUseableByPlayer(this.player); + } +} diff --git a/src/main/java/com/oitsjustjose/criss_cross/gui/ConfigGUI.java b/src/main/java/com/oitsjustjose/criss_cross/gui/ConfigGUI.java new file mode 100644 index 0000000..5d5d193 --- /dev/null +++ b/src/main/java/com/oitsjustjose/criss_cross/gui/ConfigGUI.java @@ -0,0 +1,63 @@ +package com.oitsjustjose.criss_cross.gui; + +import java.util.List; +import java.util.Set; + +import com.google.common.collect.Lists; +import com.oitsjustjose.criss_cross.lib.Config; +import com.oitsjustjose.criss_cross.lib.Lib; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.fml.client.IModGuiFactory; +import net.minecraftforge.fml.client.config.GuiConfig; +import net.minecraftforge.fml.client.config.IConfigElement; + +public class ConfigGUI extends GuiConfig +{ + public ConfigGUI(GuiScreen guiScreen) + { + super(guiScreen, getConfigElements(), Lib.modid, false, true, GuiConfig.getAbridgedConfigPath(Config.config.toString())); + } + + private static List getConfigElements() + { + List list = Lists.newArrayList(); + + + list.add(new ConfigElement(Config.Cropomator)); + list.add(new ConfigElement(Config.Electroextractor)); + list.add(new ConfigElement(Config.Woodchipper)); + list.add(new ConfigElement(Config.OtherMachines)); + + return list; + } + + public static class GUIFactory implements IModGuiFactory + { + @Override + public void initialize(Minecraft minecraftInstance) + { + + } + + @Override + public Class mainConfigGuiClass() + { + return ConfigGUI.class; + } + + @Override + public Set runtimeGuiCategories() + { + return null; + } + + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) + { + return null; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/gui/GUIAtmosManipulator.java b/src/main/java/com/oitsjustjose/criss_cross/gui/GUIAtmosManipulator.java index 39cfb76..3465b0f 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/gui/GUIAtmosManipulator.java +++ b/src/main/java/com/oitsjustjose/criss_cross/gui/GUIAtmosManipulator.java @@ -1,676 +1,122 @@ package com.oitsjustjose.criss_cross.gui; import java.io.IOException; -import java.util.List; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; -import com.google.common.collect.Lists; -import com.google.gson.JsonParseException; +import com.ibm.icu.impl.ICUService.Key; +import com.oitsjustjose.criss_cross.tileentity.TileAtmosManipulator; -import io.netty.buffer.Unpooled; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiUtilRenderComponents; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.event.ClickEvent; -import net.minecraft.init.Items; -import net.minecraft.item.ItemEditableBook; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.network.PacketBuffer; -import net.minecraft.network.play.client.C17PacketCustomPayload; -import net.minecraft.util.ChatAllowedCharacters; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GUIAtmosManipulator extends GuiScreen { - private static final Logger logger = LogManager.getLogger(); - private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png"); - /** The player editing the book */ - private final EntityPlayer editingPlayer; - private final ItemStack bookObj; - /** Whether the book is signed or can still be edited */ - private final boolean bookIsUnsigned; - /** Whether the book's title or contents has been modified since being opened */ - private boolean bookIsModified; - /** Determines if the signing screen is open */ - private boolean bookGettingSigned; - /** Update ticks since the gui was opened */ - private int updateCount; - private int bookImageWidth = 192; - private int bookImageHeight = 192; - private int bookTotalPages = 1; - private int currPage; - private NBTTagList bookPages; - private String bookTitle = ""; - private List field_175386_A; - private int field_175387_B = -1; - private GUIAtmosManipulator.NextPageButton buttonNextPage; - private GUIAtmosManipulator.NextPageButton buttonPreviousPage; - private GuiButton buttonDone; - /** The GuiButton to sign this book. */ - private GuiButton buttonSign; - private GuiButton buttonFinalize; - private GuiButton buttonCancel; - - public GUIAtmosManipulator(EntityPlayer player, ItemStack book, boolean isUnsigned) - { - this.editingPlayer = player; - this.bookObj = book; - this.bookIsUnsigned = isUnsigned; - - if (book.hasTagCompound()) - { - NBTTagCompound nbttagcompound = book.getTagCompound(); - this.bookPages = nbttagcompound.getTagList("pages", 8); - - if (this.bookPages != null) - { - this.bookPages = (NBTTagList)this.bookPages.copy(); - this.bookTotalPages = this.bookPages.tagCount(); - - if (this.bookTotalPages < 1) - { - this.bookTotalPages = 1; - } - } - } - - if (this.bookPages == null && isUnsigned) - { - this.bookPages = new NBTTagList(); - this.bookPages.appendTag(new NBTTagString("")); - this.bookTotalPages = 1; - } - } - - /** - * Called from the main game loop to update the screen. - */ - public void updateScreen() - { - super.updateScreen(); - ++this.updateCount; - } - - /** - * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the - * window resizes, the buttonList is cleared beforehand. - */ - public void initGui() - { - this.buttonList.clear(); - Keyboard.enableRepeatEvents(true); - - if (this.bookIsUnsigned) - { - this.buttonList.add(this.buttonSign = new GuiButton(3, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.signButton", new Object[0]))); - this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.done", new Object[0]))); - this.buttonList.add(this.buttonFinalize = new GuiButton(5, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.finalizeButton", new Object[0]))); - this.buttonList.add(this.buttonCancel = new GuiButton(4, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.cancel", new Object[0]))); - } - else - { - this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, 4 + this.bookImageHeight, 200, 20, I18n.format("gui.done", new Object[0]))); - } - - int i = (this.width - this.bookImageWidth) / 2; - int j = 2; - this.buttonList.add(this.buttonNextPage = new GUIAtmosManipulator.NextPageButton(1, i + 120, j + 154, true)); - this.buttonList.add(this.buttonPreviousPage = new GUIAtmosManipulator.NextPageButton(2, i + 38, j + 154, false)); - this.updateButtons(); - } - - /** - * Called when the screen is unloaded. Used to disable keyboard repeat events - */ - public void onGuiClosed() - { - Keyboard.enableRepeatEvents(false); - } - - private void updateButtons() - { - this.buttonNextPage.visible = !this.bookGettingSigned && (this.currPage < this.bookTotalPages - 1 || this.bookIsUnsigned); - this.buttonPreviousPage.visible = !this.bookGettingSigned && this.currPage > 0; - this.buttonDone.visible = !this.bookIsUnsigned || !this.bookGettingSigned; - - if (this.bookIsUnsigned) - { - this.buttonSign.visible = !this.bookGettingSigned; - this.buttonCancel.visible = this.bookGettingSigned; - this.buttonFinalize.visible = this.bookGettingSigned; - this.buttonFinalize.enabled = this.bookTitle.trim().length() > 0; - } - } - - private void sendBookToServer(boolean publish) throws IOException - { - if (this.bookIsUnsigned && this.bookIsModified) - { - if (this.bookPages != null) - { - while (this.bookPages.tagCount() > 1) - { - String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1); - - if (s.length() != 0) - { - break; - } - - this.bookPages.removeTag(this.bookPages.tagCount() - 1); - } - - if (this.bookObj.hasTagCompound()) - { - NBTTagCompound nbttagcompound = this.bookObj.getTagCompound(); - nbttagcompound.setTag("pages", this.bookPages); - } - else - { - this.bookObj.setTagInfo("pages", this.bookPages); - } - - String s2 = "MC|BEdit"; - - if (publish) - { - s2 = "MC|BSign"; - this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getName())); - this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim())); - - for (int i = 0; i < this.bookPages.tagCount(); ++i) - { - String s1 = this.bookPages.getStringTagAt(i); - IChatComponent ichatcomponent = new ChatComponentText(s1); - s1 = IChatComponent.Serializer.componentToJson(ichatcomponent); - this.bookPages.set(i, new NBTTagString(s1)); - } - - this.bookObj.setItem(Items.written_book); - } - - PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer()); - packetbuffer.writeItemStackToBuffer(this.bookObj); - this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(s2, packetbuffer)); - } - } - } - - /** - * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) - */ - protected void actionPerformed(GuiButton button) throws IOException - { - if (button.enabled) - { - if (button.id == 0) - { - this.mc.displayGuiScreen((GuiScreen)null); - this.sendBookToServer(false); - } - else if (button.id == 3 && this.bookIsUnsigned) - { - this.bookGettingSigned = true; - } - else if (button.id == 1) - { - if (this.currPage < this.bookTotalPages - 1) - { - ++this.currPage; - } - else if (this.bookIsUnsigned) - { - this.addNewPage(); - - if (this.currPage < this.bookTotalPages - 1) - { - ++this.currPage; - } - } - } - else if (button.id == 2) - { - if (this.currPage > 0) - { - --this.currPage; - } - } - else if (button.id == 5 && this.bookGettingSigned) - { - this.sendBookToServer(true); - this.mc.displayGuiScreen((GuiScreen)null); - } - else if (button.id == 4 && this.bookGettingSigned) - { - this.bookGettingSigned = false; - } - - this.updateButtons(); - } - } - - private void addNewPage() - { - if (this.bookPages != null && this.bookPages.tagCount() < 50) - { - this.bookPages.appendTag(new NBTTagString("")); - ++this.bookTotalPages; - this.bookIsModified = true; - } - } - - /** - * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of - * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) - */ - protected void keyTyped(char typedChar, int keyCode) throws IOException - { - super.keyTyped(typedChar, keyCode); - - if (this.bookIsUnsigned) - { - if (this.bookGettingSigned) - { - this.keyTypedInTitle(typedChar, keyCode); - } - else - { - this.keyTypedInBook(typedChar, keyCode); - } - } - } - - /** - * Processes keystrokes when editing the text of a book - */ - private void keyTypedInBook(char typedChar, int keyCode) - { - if (GuiScreen.isKeyComboCtrlV(keyCode)) - { - this.pageInsertIntoCurrent(GuiScreen.getClipboardString()); - } - else - { - switch (keyCode) - { - case 14: - String s = this.pageGetCurrent(); - - if (s.length() > 0) - { - this.pageSetCurrent(s.substring(0, s.length() - 1)); - } - - return; - case 28: - case 156: - this.pageInsertIntoCurrent("\n"); - return; - default: - - if (ChatAllowedCharacters.isAllowedCharacter(typedChar)) - { - this.pageInsertIntoCurrent(Character.toString(typedChar)); - } - } - } - } - - /** - * Processes keystrokes when editing the title of a book - */ - private void keyTypedInTitle(char p_146460_1_, int p_146460_2_) throws IOException - { - switch (p_146460_2_) - { - case 14: - - if (!this.bookTitle.isEmpty()) - { - this.bookTitle = this.bookTitle.substring(0, this.bookTitle.length() - 1); - this.updateButtons(); - } - - return; - case 28: - case 156: - - if (!this.bookTitle.isEmpty()) - { - this.sendBookToServer(true); - this.mc.displayGuiScreen((GuiScreen)null); - } - - return; - default: - - if (this.bookTitle.length() < 16 && ChatAllowedCharacters.isAllowedCharacter(p_146460_1_)) - { - this.bookTitle = this.bookTitle + Character.toString(p_146460_1_); - this.updateButtons(); - this.bookIsModified = true; - } - } - } - - /** - * Returns the entire text of the current page as determined by currPage - */ - private String pageGetCurrent() - { - return this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount() ? this.bookPages.getStringTagAt(this.currPage) : ""; - } - - /** - * Sets the text of the current page as determined by currPage - */ - private void pageSetCurrent(String p_146457_1_) - { - if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) - { - this.bookPages.set(this.currPage, new NBTTagString(p_146457_1_)); - this.bookIsModified = true; - } - } - - /** - * Processes any text getting inserted into the current page, enforcing the page size limit - */ - private void pageInsertIntoCurrent(String p_146459_1_) - { - String s = this.pageGetCurrent(); - String s1 = s + p_146459_1_; - int i = this.fontRendererObj.splitStringWidth(s1 + "" + EnumChatFormatting.BLACK + "_", 118); - - if (i <= 128 && s1.length() < 256) - { - this.pageSetCurrent(s1); - } - } - - /** - * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks - */ - public void drawScreen(int mouseX, int mouseY, float partialTicks) - { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(bookGuiTextures); - int i = (this.width - this.bookImageWidth) / 2; - int j = 2; - this.drawTexturedModalRect(i, j, 0, 0, this.bookImageWidth, this.bookImageHeight); - - if (this.bookGettingSigned) - { - String s = this.bookTitle; - - if (this.bookIsUnsigned) - { - if (this.updateCount / 6 % 2 == 0) - { - s = s + "" + EnumChatFormatting.BLACK + "_"; - } - else - { - s = s + "" + EnumChatFormatting.GRAY + "_"; - } - } - - String s1 = I18n.format("book.editTitle", new Object[0]); - int k = this.fontRendererObj.getStringWidth(s1); - this.fontRendererObj.drawString(s1, i + 36 + (116 - k) / 2, j + 16 + 16, 0); - int l = this.fontRendererObj.getStringWidth(s); - this.fontRendererObj.drawString(s, i + 36 + (116 - l) / 2, j + 48, 0); - String s2 = I18n.format("book.byAuthor", new Object[] {this.editingPlayer.getName()}); - int i1 = this.fontRendererObj.getStringWidth(s2); - this.fontRendererObj.drawString(EnumChatFormatting.DARK_GRAY + s2, i + 36 + (116 - i1) / 2, j + 48 + 10, 0); - String s3 = I18n.format("book.finalizeWarning", new Object[0]); - this.fontRendererObj.drawSplitString(s3, i + 36, j + 80, 116, 0); - } - else - { - String s4 = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages)}); - String s5 = ""; - - if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) - { - s5 = this.bookPages.getStringTagAt(this.currPage); - } - - if (this.bookIsUnsigned) - { - if (this.fontRendererObj.getBidiFlag()) - { - s5 = s5 + "_"; - } - else if (this.updateCount / 6 % 2 == 0) - { - s5 = s5 + "" + EnumChatFormatting.BLACK + "_"; - } - else - { - s5 = s5 + "" + EnumChatFormatting.GRAY + "_"; - } - } - else if (this.field_175387_B != this.currPage) - { - if (ItemEditableBook.validBookTagContents(this.bookObj.getTagCompound())) - { - try - { - IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s5); - this.field_175386_A = ichatcomponent != null ? GuiUtilRenderComponents.func_178908_a(ichatcomponent, 116, this.fontRendererObj, true, true) : null; - } - catch (JsonParseException var13) - { - this.field_175386_A = null; - } - } - else - { - ChatComponentText chatcomponenttext = new ChatComponentText(EnumChatFormatting.DARK_RED.toString() + "* Invalid book tag *"); - this.field_175386_A = Lists.newArrayList(chatcomponenttext); - } - - this.field_175387_B = this.currPage; - } - - int j1 = this.fontRendererObj.getStringWidth(s4); - this.fontRendererObj.drawString(s4, i - j1 + this.bookImageWidth - 44, j + 16, 0); - - if (this.field_175386_A == null) - { - this.fontRendererObj.drawSplitString(s5, i + 36, j + 16 + 16, 116, 0); - } - else - { - int k1 = Math.min(128 / this.fontRendererObj.FONT_HEIGHT, this.field_175386_A.size()); - - for (int l1 = 0; l1 < k1; ++l1) - { - IChatComponent ichatcomponent2 = (IChatComponent)this.field_175386_A.get(l1); - this.fontRendererObj.drawString(ichatcomponent2.getUnformattedText(), i + 36, j + 16 + 16 + l1 * this.fontRendererObj.FONT_HEIGHT, 0); - } - - IChatComponent ichatcomponent1 = this.func_175385_b(mouseX, mouseY); - - if (ichatcomponent1 != null) - { - this.handleComponentHover(ichatcomponent1, mouseX, mouseY); - } - } - } - - super.drawScreen(mouseX, mouseY, partialTicks); - } - - /** - * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton - */ - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException - { - if (mouseButton == 0) - { - IChatComponent ichatcomponent = this.func_175385_b(mouseX, mouseY); - - if (this.handleComponentClick(ichatcomponent)) - { - return; - } - } - - super.mouseClicked(mouseX, mouseY, mouseButton); - } - - /** - * Executes the click event specified by the given chat component - */ - protected boolean handleComponentClick(IChatComponent p_175276_1_) - { - ClickEvent clickevent = p_175276_1_ == null ? null : p_175276_1_.getChatStyle().getChatClickEvent(); - - if (clickevent == null) - { - return false; - } - else if (clickevent.getAction() == ClickEvent.Action.CHANGE_PAGE) - { - String s = clickevent.getValue(); - - try - { - int i = Integer.parseInt(s) - 1; - - if (i >= 0 && i < this.bookTotalPages && i != this.currPage) - { - this.currPage = i; - this.updateButtons(); - return true; - } - } - catch (Throwable var5) - { - ; - } - - return false; - } - else - { - boolean flag = super.handleComponentClick(p_175276_1_); - - if (flag && clickevent.getAction() == ClickEvent.Action.RUN_COMMAND) - { - this.mc.displayGuiScreen((GuiScreen)null); - } - - return flag; - } - } - - public IChatComponent func_175385_b(int p_175385_1_, int p_175385_2_) - { - if (this.field_175386_A == null) - { - return null; - } - else - { - int i = p_175385_1_ - (this.width - this.bookImageWidth) / 2 - 36; - int j = p_175385_2_ - 2 - 16 - 16; - - if (i >= 0 && j >= 0) - { - int k = Math.min(128 / this.fontRendererObj.FONT_HEIGHT, this.field_175386_A.size()); - - if (i <= 116 && j < this.mc.fontRendererObj.FONT_HEIGHT * k + k) - { - int l = j / this.mc.fontRendererObj.FONT_HEIGHT; - - if (l >= 0 && l < this.field_175386_A.size()) - { - IChatComponent ichatcomponent = (IChatComponent)this.field_175386_A.get(l); - int i1 = 0; - - for (IChatComponent ichatcomponent1 : ichatcomponent) - { - if (ichatcomponent1 instanceof ChatComponentText) - { - i1 += this.mc.fontRendererObj.getStringWidth(((ChatComponentText)ichatcomponent1).getChatComponentText_TextValue()); - - if (i1 > i) - { - return ichatcomponent1; - } - } - } - } - - return null; - } - else - { - return null; - } - } - else - { - return null; - } - } - } - - @SideOnly(Side.CLIENT) - static class NextPageButton extends GuiButton - { - private final boolean field_146151_o; - - public NextPageButton(int p_i46316_1_, int p_i46316_2_, int p_i46316_3_, boolean p_i46316_4_) - { - super(p_i46316_1_, p_i46316_2_, p_i46316_3_, 23, 13, ""); - this.field_146151_o = p_i46316_4_; - } - - /** - * Draws this button to the screen. - */ - public void drawButton(Minecraft mc, int mouseX, int mouseY) - { - if (this.visible) - { - boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.getTextureManager().bindTexture(GUIAtmosManipulator.bookGuiTextures); - int i = 0; - int j = 192; - - if (flag) - { - i += 23; - } - - if (!this.field_146151_o) - { - j += 13; - } - - this.drawTexturedModalRect(this.xPosition, this.yPosition, i, j, 23, 13); - } - } - } + static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/atmosmanipulator.png"); + final EntityPlayer player; + final int RAINID = 0; + final int SUNID = 1; + int updateCount; + int GUIHeight = 166; + int GUIWidth = 176; + TileAtmosManipulator tileAM; + + GuiButton buttonRain; + GuiButton buttonSun; + + public GUIAtmosManipulator(EntityPlayer player, TileAtmosManipulator tile) + { + this.player = player; + this.tileAM = tile; + } + + @Override + public boolean doesGuiPauseGame() + { + return false; + } + + @Override + public void updateScreen() + { + super.updateScreen(); + ++this.updateCount; + } + + @Override + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (keyCode == mc.gameSettings.keyBindInventory.getKeyCode()) + { + this.mc.displayGuiScreen(null); + } + if (keyCode == 1) + { + this.mc.displayGuiScreen((GuiScreen) null); + + if (this.mc.currentScreen == null) + { + this.mc.setIngameFocus(); + } + } + } + + @Override + public void initGui() + { + this.buttonList.clear(); + + int x = (this.width - this.GUIHeight) / 2; + int y = (this.height - this.GUIWidth) / 2; + this.buttonList.add(this.buttonRain = new GuiButton(RAINID, x + 35, y + 20, 98, 20, StatCollector.translateToLocal("button.rain"))); + this.buttonList.add(this.buttonSun = new GuiButton(SUNID, x + 35, y + 75, 98, 20, StatCollector.translateToLocal("button.sun"))); + + this.updateButtons(); + } + + @Override + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + public void updateButtons() + { + this.buttonRain.visible = true; + this.buttonSun.visible = true; + } + + @Override + public void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == this.RAINID) + tileAM.setRain(); + else if (button.id == this.SUNID) + tileAM.setSun(); + this.updateButtons(); + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(texture); + int x = (this.width - this.GUIHeight) / 2; + int y = (this.height - this.GUIWidth) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.GUIHeight, this.GUIWidth); + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.atmosmanipulator"), x + 40, y + 8, 4210752); + + super.drawScreen(mouseX, mouseY, partialTicks); + } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/gui/GUIFactory.java b/src/main/java/com/oitsjustjose/criss_cross/gui/GUIFactory.java deleted file mode 100644 index 4fcd508..0000000 --- a/src/main/java/com/oitsjustjose/criss_cross/gui/GUIFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.oitsjustjose.criss_cross.gui; - -import java.util.Set; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.fml.client.IModGuiFactory; -import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionCategoryElement; -import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionGuiHandler; - -public class GUIFactory implements IModGuiFactory -{ - @Override - public void initialize(Minecraft minecraftInstance) - { - - } - - @Override - public Class mainConfigGuiClass() - { - return ModGUIConfig.class; - } - - @Override - public Set runtimeGuiCategories() - { - return null; - } - - @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) - { - return null; - } -} \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/gui/GUIHandler.java b/src/main/java/com/oitsjustjose/criss_cross/gui/GUIHandler.java index 09f2cea..fdebd99 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/gui/GUIHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/gui/GUIHandler.java @@ -1,5 +1,6 @@ package com.oitsjustjose.criss_cross.gui; +import com.oitsjustjose.criss_cross.container.ContainerAtmosManipulator; import com.oitsjustjose.criss_cross.container.ContainerCobblegen; import com.oitsjustjose.criss_cross.container.ContainerCropomator; import com.oitsjustjose.criss_cross.container.ContainerElectroextractor; @@ -8,6 +9,7 @@ import com.oitsjustjose.criss_cross.container.ContainerScribe; import com.oitsjustjose.criss_cross.container.ContainerStonegen; import com.oitsjustjose.criss_cross.container.ContainerWoodchipper; import com.oitsjustjose.criss_cross.items.ItemPouch; +import com.oitsjustjose.criss_cross.tileentity.TileAtmosManipulator; import com.oitsjustjose.criss_cross.tileentity.TileCobblegen; import com.oitsjustjose.criss_cross.tileentity.TileCropomator; import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor; @@ -15,9 +17,7 @@ import com.oitsjustjose.criss_cross.tileentity.TileScribe; import com.oitsjustjose.criss_cross.tileentity.TileStonegen; import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper; -import net.minecraft.block.state.BlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; @@ -54,6 +54,8 @@ public class GUIHandler implements IGuiHandler return new ContainerStonegen(player, ((TileStonegen) tile)); case 6: // Scribe return new ContainerScribe(player, ((TileScribe) tile)); + case 7: // AtmosManipulator + return new ContainerAtmosManipulator(player, ((TileAtmosManipulator) tile)); } } @@ -85,7 +87,7 @@ public class GUIHandler implements IGuiHandler case 6: // Scribe return new GUIScribe(player, ((TileScribe) tile)); case 7: // AtmosManipulator - return new GUIAtmosManipulator(player, new ItemStack(world.getBlockState(new BlockPos(x, y, z)).getBlock()), false); + return new GUIAtmosManipulator(player, ((TileAtmosManipulator) tile)); } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/gui/ModGUIConfig.java b/src/main/java/com/oitsjustjose/criss_cross/gui/ModGUIConfig.java deleted file mode 100644 index 7c5a6ba..0000000 --- a/src/main/java/com/oitsjustjose/criss_cross/gui/ModGUIConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.oitsjustjose.criss_cross.gui; - -import com.oitsjustjose.criss_cross.lib.ConfigHandler; -import com.oitsjustjose.criss_cross.lib.Lib; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.common.config.ConfigElement; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.fml.client.config.GuiConfig; - -public class ModGUIConfig extends GuiConfig -{ - public ModGUIConfig(GuiScreen guiScreen) - { - super(guiScreen, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Lib.modid, false, true, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString())); - } -} \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/lib/Config.java b/src/main/java/com/oitsjustjose/criss_cross/lib/Config.java new file mode 100644 index 0000000..f3393c8 --- /dev/null +++ b/src/main/java/com/oitsjustjose/criss_cross/lib/Config.java @@ -0,0 +1,191 @@ +package com.oitsjustjose.criss_cross.lib; + +import java.io.File; +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; +import net.minecraftforge.fml.client.event.ConfigChangedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; + +public class Config +{ + public static Configuration config; + public static ConfigCategory Cropomator; + public static ConfigCategory Electroextractor; + public static ConfigCategory Woodchipper; + public static ConfigCategory OtherMachines; + // Cropomator Configs + public static int cropomatorProcessTime; + public static int cropomatorOutput; + public static String cropomatorRecipeItem; + public static String[] cropomatorInputs; + public static String[] cropomatorCatalysts; + public static String[] defaultCropomatorInputs = new String[] { "minecraft:apple", "minecraft:reeds", "minecraft:nether_wart", "minecraft:carrot", "minecraft:cactus", "minecraft:potato", "minecraft:sapling:0", "minecraft:sapling:1", "minecraft:sapling:2", "minecraft:sapling:3", "minecraft:sapling:4", "minecraft:sapling:5", "minecraft:melon", "minecraft:brown_mushroom", "minecraft:red_mushroom", "minecraft:dye:3", "minecraft:pumpkin", "minecraft:wheat", "minecraft:wheat_seeds" }; + public static String[] defaultCropomatorCatalysts = new String[] { "minecraft:dye:15" }; + // Electroextractor Configs + public static int electroextractorProcessTime; + public static int eeOutput; + public static String eeRecipeItem; + public static String[] eeFuels; + public static String[] eeOreDictInputs; + public static String[] defaultEEOreDictInputs = new String[] { "Iron:12428902", "Gold:16772608", "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113", "Nickel:16580553" }; + public static String[] defaultEEFuels = new String[] { "minecraft:redstone_block" }; + // Woodchipper Configs + public static int woodchipperProcessTime; + public static int woodchipperOutput; + public static String woodchipperRecipeItem; + public static String[] woodchipperFuels; + public static String[] defaultWoodchipperFuels = new String[] { "minecraft:water_bucket", "minecraft:potion:0", "crisscross:special_bucket:0" }; + // Scribe Configs + public static String[] scribeRecipes; + public static String[] defaultScribeRecipes = new String[] { "minecraft:fish:3*16=6", "minecraft:spider_eye:0*8=18", "minecraft:obsidian:0*8=3", "minecraft:prismarine_shard:0*16=8", "minecraft:feather:0*32=2", "minecraft:blaze_rod:0*8=20", "minecraft:blaze_powder:0*16=50", "minecraft:piston:0*4=19", "minecraft:prismarine_crystals:0*16=61", "minecraft:fish:0*16=62", "minecraft:potion:8269*1=5", "minecraft:slime:0*8=33", "minecraft:rotten_flesh:0*48=17", "minecraft:double_plant:4*64=7", "ingotIron*24=34", "ingotGold*12=49", "gemQuartz*16=48", "gemDiamond*8=51", "gemEmerald*3=21", "logWood*16=4", "blockIron*4=0", "blockQuartz*16=16", "blockLapis*12=35", "blockRedstone*8=32" }; + // Block Generator Configs (stone and cobble) + public static int blockGeneratorProcessTimes; + + public static void init(File configFile) + { + // Create the configuration object from the given configuration file + if (config == null) + { + config = new Configuration(configFile); + loadConfiguration(); + } + } + + private static void loadConfiguration() + { + Property property; + + // Cropomator + String category = "cropomator"; + List propertyOrder = Lists.newArrayList(); + Cropomator = config.getCategory(category); + config.setCategoryRequiresMcRestart(category, true); + + property = config.get(category, "Cropomator Process Time", 150, "Amount of time for the Cropomator to complete a process", 20, Short.MAX_VALUE); + cropomatorProcessTime = property.getInt(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Cropomator Recipe Items", defaultCropomatorInputs, "Items to be processed by the Cropomator. Formatted as: :: or :."); + cropomatorInputs = property.getStringList(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Cropomator Catalyst Items", defaultCropomatorCatalysts, "Items considered as catalysts by the Cropomator. Formatted as: :: or :."); + cropomatorCatalysts = property.getStringList(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Cropomator Output Quantity", 3); + property.comment = "Quantity output by the Cropomator"; + cropomatorOutput = property.getInt(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Cropomator Crafting Item", "minecraft:diamond_block"); + property.comment = "Key crafting ingredient in Cropomator's Recipe. Formatted as: :: or :."; + cropomatorRecipeItem = property.getString(); + propertyOrder.add(property.getName()); + + Cropomator.setPropertyOrder(propertyOrder); + + // ElectroExtractor + category = "electroextractor"; + propertyOrder = Lists.newArrayList(); + Electroextractor = config.getCategory(category); + config.setCategoryRequiresMcRestart(category, true); + + property = config.get(category, "Electroextractor Process Time", 250, "Amount of time for the Electroextractor to complete a process", 20, Short.MAX_VALUE); + electroextractorProcessTime = property.getInt(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Electroextractor OreDictionary Entries", defaultEEOreDictInputs, "Formatted as :." + "\n" + " Remove the 'ore' part of the oredict name (i.e. 'oreIron' should be entered as 'Iron')" + "\n" + "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal."); + eeOreDictInputs = property.getStringList(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Electroextractor's Fuel Items", defaultEEFuels, "Items considered as fuel for the Electroextractor. Formatted as: :: or :."); + eeFuels = property.getStringList(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Electroextractor Output Quantity", 2); + property.comment = "Quantity output by the Electroextractor"; + eeOutput = property.getInt(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Electroextractor Crafting Item", "minecraft:diamond_block"); + property.comment = "Key crafting ingredient in Electroextractor's Recipe. Formatted as: :: or :."; + eeRecipeItem = property.getString(); + propertyOrder.add(property.getName()); + + Electroextractor.setPropertyOrder(propertyOrder); + + category = "woodchipper"; + propertyOrder = Lists.newArrayList(); + Woodchipper = config.getCategory(category); + config.setCategoryRequiresMcRestart(category, true); + + property = config.get(category, "Woodchipper Process Time", 400, "Amount of time for the Woodchipper to complete a process", 20, Short.MAX_VALUE); + woodchipperProcessTime = property.getInt(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Woodchipper Fuel Items", defaultWoodchipperFuels, "Items considered as fuel for the Woodchipper. Formatted as: :: or :."); + woodchipperFuels = property.getStringList(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Woodchipper Output Quantity", 6, "Amount of planks yielded from a log", 0, 64); + woodchipperOutput = property.getInt(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Woodchipper Crafting Item", "minecraft:diamond_block"); + property.comment = "Key crafting ingredient in Woodchipper's Recipe. Formatted as: :: or :."; + woodchipperRecipeItem = property.getString(); + propertyOrder.add(property.getName()); + + Woodchipper.setPropertyOrder(propertyOrder); + + //Everything Else + category = "other machines"; + propertyOrder = Lists.newArrayList(); + OtherMachines = config.getCategory(category); + config.setCategoryRequiresMcRestart(category, true); + + property = config.get(category, "Scribe Recipes", defaultScribeRecipes, "Formatted as ::*=" + "\n" + "Also can be *qty="); + scribeRecipes = property.getStringList(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Block Generators' Process Times", 20, "Amount of time for Stone and Cobble Generators to produce a block", 20, Short.MAX_VALUE); + blockGeneratorProcessTimes = property.getInt(); + propertyOrder.add(property.getName()); + + OtherMachines.setPropertyOrder(propertyOrder); + + + + if (config.hasChanged()) + config.save(); + + } + + @SubscribeEvent + public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) + { + if (event.modID.equalsIgnoreCase(Lib.modid)) + loadConfiguration(); + } + + // put this here because most references to finditemstack are due to this confighandler + public static ItemStack findItemStack(String modid, String name) + { + if (GameRegistry.findItem(modid, name) != null) + return new ItemStack(GameRegistry.findItem(modid, name), 1); + else if (GameRegistry.findBlock(modid, name) != null) + if (Item.getItemFromBlock(GameRegistry.findBlock(modid, name)) != null) + return new ItemStack(Item.getItemFromBlock(GameRegistry.findBlock(modid, name)), 1); + + return null; + } +} diff --git a/src/main/java/com/oitsjustjose/criss_cross/lib/ConfigHandler.java b/src/main/java/com/oitsjustjose/criss_cross/lib/ConfigHandler.java deleted file mode 100644 index ceba2e2..0000000 --- a/src/main/java/com/oitsjustjose/criss_cross/lib/ConfigHandler.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.oitsjustjose.criss_cross.lib; - -import java.io.File; - -import com.oitsjustjose.criss_cross.util.LogHelper; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.GameRegistry; - -public class ConfigHandler -{ - public static Configuration config; - public static int cropomatorProcessTime; - public static int cropomatorOutput; - public static String cropomatorRecipeItem; - public static String[] cropomatorInputs; - public static String[] cropomatorCatalysts; - public static String[] defaultCropomatorInputs = new String[] { "minecraft:apple", "minecraft:reeds", "minecraft:nether_wart", "minecraft:carrot", "minecraft:cactus", "minecraft:potato", "minecraft:sapling:0", "minecraft:sapling:1", "minecraft:sapling:2", "minecraft:sapling:3", "minecraft:sapling:4", "minecraft:sapling:5", "minecraft:melon", "minecraft:brown_mushroom", "minecraft:red_mushroom", "minecraft:dye:3", "minecraft:pumpkin", "minecraft:wheat", "minecraft:wheat_seeds" }; - public static String[] defaultCropomatorCatalystItems = new String[] { "minecraft:dye:15" }; - - public static int electroextractorProcessTime; - public static int electroextractorOutput; - public static String electroextractorRecipeItem; - public static String[] electroextractorEnergySources; - public static String[] electroextractorOreDictInputs; - public static String[] defaultElectroextractorOreDictInputs = new String[] { "Iron:12428902", "Gold:16772608", "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113", "Nickel:16580553" }; - public static String[] defaultElectroextractorEnergySources = new String[] { "minecraft:redstone_block" }; - - public static int woodchipperProcessTime; - public static int woodchipperOutput; - public static String woodchipperRecipeItem; - public static String[] woodchipperFuels; - public static String[] defaultWoodchipperFuels = new String[] { "minecraft:water_bucket", "minecraft:potion:0", "crisscross:special_bucket:0" }; - - public static String[] scribeRecipes; - public static String[] defaultScribeRecipes = new String[] { "minecraft:fish:3*16=6", "minecraft:spider_eye:0*8=18", "minecraft:obsidian:0*8=3", "minecraft:prismarine_shard:0*16=8", "minecraft:feather:0*32=2", "minecraft:blaze_rod:0*8=20", "minecraft:blaze_powder:0*16=50", "minecraft:piston:0*4=19", "minecraft:prismarine_crystals:0*16=61", "minecraft:fish:0*16=62", "minecraft:potion:8269*1=5", "minecraft:slime:0*8=33", "minecraft:rotten_flesh:0*48=17", "minecraft:double_plant:4*64=7", "ingotIron*24=34", "ingotGold*12=49", "gemQuartz*16=48", "gemDiamond*8=51", "gemEmerald*3=21", "logWood*16=4", "blockIron*4=0", "blockQuartz*16=16", "blockLapis*12=35", "blockRedstone*8=32" }; - - public static int blockGeneratorProcessTimes; - - public static void init(File configFile) - { - // Create the configuration object from the given configuration file - if (config == null) - { - config = new Configuration(configFile); - loadConfiguration(); - } - } - - private static void loadConfiguration() - { - // Cropomator Configs - cropomatorInputs = config.get(config.CATEGORY_GENERAL, "Cropomator's Recipe Items.", defaultCropomatorInputs, "A list of items to be added to the Cropomator's recipe list. Formatted as: :: or :.").getStringList(); - - cropomatorCatalysts = config.get(config.CATEGORY_GENERAL, "Cropomator's Catalyst Items.", defaultCropomatorCatalystItems, "A list of items to be added to the Cropomator's catalyst list. Formatted as: :: or :.").getStringList(); - - cropomatorProcessTime = config.getInt("Cropomator Processing Time", config.CATEGORY_GENERAL, 150, 1, Short.MAX_VALUE, "Control how many ticks it takes the Cropomator to process an item. Default is 150; furnaces are 200."); - - cropomatorOutput = config.getInt("Cropomator Output Quantity", config.CATEGORY_GENERAL, 3, 0, 64, "Control how many of the input item you get as the output item. Default is 3."); - - cropomatorRecipeItem = config.getString("Cropomator Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block", "This is the item located in the center of the crafting recipe for the Cropomator. Formatted as: :: or :."); - - // Electroextractor's Configs - electroextractorEnergySources = config.get(config.CATEGORY_GENERAL, "Electroextractor's Fuel Items.", defaultElectroextractorEnergySources, "A list of items to be added as the Electroextractor's energy sources. Formatted as: :: or :.").getStringList(); - - electroextractorProcessTime = config.getInt("Electroextractor Processing Time", config.CATEGORY_GENERAL, 250, 0, Short.MAX_VALUE, "Control how many ticks it takes the Electroextractor to process an item. Default is 250; furnaces are 200."); - - electroextractorOutput = config.getInt("Electroextractor Output Quantity", config.CATEGORY_GENERAL, 2, 0, 64, "Control how many dusts you get as the output. Default is 2."); - - electroextractorRecipeItem = config.getString("Electroextractor Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block", "This is the item located in the center of the crafting recipe for the Electroextractor. Formatted as: :: or :."); - - electroextractorOreDictInputs = config.get(config.CATEGORY_GENERAL, "Electroextractor OreDictionary Entries.", defaultElectroextractorOreDictInputs, "Formatted as :." + "\n" + " Remove the 'ore' part of the oredict name (i.e. 'oreIron' should be entered as 'Iron')" + "\n" + "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal.").getStringList(); - - // Woodchipper's Configs - woodchipperFuels = config.get(config.CATEGORY_GENERAL, "Woodchipper Fuel Items", defaultWoodchipperFuels, "A list of items to be added as the Woodchipper's 'fuels'. Formatted as: :: or :.").getStringList(); - - woodchipperProcessTime = config.getInt("Woodchipper Process Time", config.CATEGORY_GENERAL, 400, 0, Short.MAX_VALUE, "Control how many ticks it takes the Woodchipper to process an item. Default is 400; furnaces are 200."); - - woodchipperOutput = config.getInt("Woodchipper Output Quantity", config.CATEGORY_GENERAL, 6, 0, 64, "Control how many planks are yielded from processing a log. Default is 6."); - - woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL, "minecraft:diamond_block", "This is the item located in the center of the crafting recipe for the Woodchipper. Formatted as: :: or :."); - - scribeRecipes = config.get(config.CATEGORY_GENERAL, "Custom Scribe Recipes", defaultScribeRecipes, "Formatted as ::*=" + "\n" + "Also can be *qty=" + "\n" + "A list of custom additional recipes for the Scribe. Default ones cannot be disabled").getStringList(); - - // Autosmith's Configs - blockGeneratorProcessTimes = config.getInt("Stone Generators' Process Times", config.CATEGORY_GENERAL, 20, 0, Short.MAX_VALUE, "Control how many ticks it takes a stone generator to process an item. Default is 20; furnaces are 200."); - - if (config.hasChanged()) - config.save(); - } - - @SubscribeEvent - public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) - { - if (event.modID.equalsIgnoreCase(Lib.modid)) - loadConfiguration(); - } - - // put this here because most references to finditemstack are due to this confighandler - public static ItemStack findItemStack(String modid, String name) - { - if (GameRegistry.findItem(modid, name) != null) - return new ItemStack(GameRegistry.findItem(modid, name), 1); - else if (GameRegistry.findBlock(modid, name) != null) - if (Item.getItemFromBlock(GameRegistry.findBlock(modid, name)) != null) - return new ItemStack(Item.getItemFromBlock(GameRegistry.findBlock(modid, name)), 1); - - return null; - } -} diff --git a/src/main/java/com/oitsjustjose/criss_cross/lib/Lib.java b/src/main/java/com/oitsjustjose/criss_cross/lib/Lib.java index 2cc92f7..ddb84fb 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/lib/Lib.java +++ b/src/main/java/com/oitsjustjose/criss_cross/lib/Lib.java @@ -10,7 +10,7 @@ public class Lib public static final String modid = "CrissCross"; public static final String name = "CrissCross"; public static final String version = "@VERSION@"; - public static final String guifactory = "com.oitsjustjose.criss_cross.gui.GUIFactory"; + public static final String guifactory = "com.oitsjustjose.criss_cross.gui.ConfigGUI$GUIFactory"; public static final String clientProxy = "com.oitsjustjose.criss_cross.util.ClientProxy"; public static final String commonProxy = "com.oitsjustjose.criss_cross.util.CommonProxy"; diff --git a/src/main/java/com/oitsjustjose/criss_cross/recipes/CraftingRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/recipes/CraftingRecipes.java index 582bcca..8c81d68 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/recipes/CraftingRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/recipes/CraftingRecipes.java @@ -1,6 +1,6 @@ package com.oitsjustjose.criss_cross.recipes; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.LibBlocks; import com.oitsjustjose.criss_cross.lib.LibItems; import com.oitsjustjose.criss_cross.util.LogHelper; @@ -43,12 +43,12 @@ public class CraftingRecipes static void initUserRecipes() { //Woodchipper Recipe - String[] unlocItem = ConfigHandler.woodchipperRecipeItem.split(":"); + String[] unlocItem = Config.woodchipperRecipeItem.split(":"); ItemStack centerItem = new ItemStack(Blocks.diamond_block); - if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null) + if (Config.findItemStack(unlocItem[0], unlocItem[1]) != null) { - ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]); + ItemStack newStack = Config.findItemStack(unlocItem[0], unlocItem[1]); if (unlocItem.length == 2) centerItem = newStack; if (unlocItem.length == 3) @@ -56,7 +56,7 @@ public class CraftingRecipes } else { - LogHelper.warn(ConfigHandler.woodchipperRecipeItem + " could not be implemented into the Woodchipper's Crafting Recipe."); + LogHelper.warn(Config.woodchipperRecipeItem + " could not be implemented into the Woodchipper's Crafting Recipe."); LogHelper.warn("The fallback, " + centerItem.getDisplayName() + ", has been used instead"); LogHelper.warn("Please confirm you have the name and formatting correct."); System.out.println(); @@ -65,12 +65,12 @@ public class CraftingRecipes GameRegistry.addRecipe(new ItemStack(LibBlocks.woodchipper), new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem }); //Electroextractor Recipe - unlocItem = ConfigHandler.electroextractorRecipeItem.split(":"); + unlocItem = Config.eeRecipeItem.split(":"); centerItem = new ItemStack(Blocks.diamond_block); - if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null) + if (Config.findItemStack(unlocItem[0], unlocItem[1]) != null) { - ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]); + ItemStack newStack = Config.findItemStack(unlocItem[0], unlocItem[1]); if (unlocItem.length == 2) centerItem = newStack; if (unlocItem.length == 3) @@ -78,7 +78,7 @@ public class CraftingRecipes } else { - LogHelper.warn(ConfigHandler.electroextractorRecipeItem + " could not be implemented into the Electroextractor's Crafting Recipe."); + LogHelper.warn(Config.eeRecipeItem + " could not be implemented into the Electroextractor's Crafting Recipe."); LogHelper.warn("The fallback, " + centerItem.getDisplayName() + ", has been used instead"); LogHelper.warn("Please confirm you have the name and formatting correct."); System.out.println(); @@ -87,12 +87,12 @@ public class CraftingRecipes GameRegistry.addRecipe(new ItemStack(LibBlocks.electroextractor), new Object[] { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem }); //Cropomator Recipe - unlocItem = ConfigHandler.cropomatorRecipeItem.split(":"); + unlocItem = Config.cropomatorRecipeItem.split(":"); centerItem = new ItemStack(Blocks.diamond_block); - if (ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]) != null) + if (Config.findItemStack(unlocItem[0], unlocItem[1]) != null) { - ItemStack newStack = ConfigHandler.findItemStack(unlocItem[0], unlocItem[1]); + ItemStack newStack = Config.findItemStack(unlocItem[0], unlocItem[1]); if (unlocItem.length == 2) centerItem = newStack; if (unlocItem.length == 3) @@ -100,7 +100,7 @@ public class CraftingRecipes } else { - LogHelper.warn(ConfigHandler.cropomatorRecipeItem + " could not be implemented into the Cropomator's Crafting Recipe."); + LogHelper.warn(Config.cropomatorRecipeItem + " could not be implemented into the Cropomator's Crafting Recipe."); LogHelper.warn("The fallback, " + centerItem.getDisplayName() + ", has been used instead"); LogHelper.warn("Please confirm you have the name and formatting correct."); System.out.println(); diff --git a/src/main/java/com/oitsjustjose/criss_cross/recipes/MachineRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/recipes/MachineRecipes.java index 5845057..beb7ad8 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/recipes/MachineRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/recipes/MachineRecipes.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import com.oitsjustjose.criss_cross.items.ItemDust; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.LibItems; import com.oitsjustjose.criss_cross.recipes.machine.CropomatorRecipes; import com.oitsjustjose.criss_cross.recipes.machine.ElectroextractorRecipes; @@ -47,9 +47,9 @@ public class MachineRecipes TileCobblegen.addFuel(new ItemStack(Items.water_bucket)); TileCobblegen.addFuel(new ItemStack(LibItems.buckets)); - ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore), new ItemStack(Items.diamond, ConfigHandler.electroextractorOutput)); - ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore), new ItemStack(Items.emerald, ConfigHandler.electroextractorOutput)); - ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal, ConfigHandler.electroextractorOutput)); + ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore), new ItemStack(Items.diamond, Config.eeOutput)); + ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore), new ItemStack(Items.emerald, Config.eeOutput)); + ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal, Config.eeOutput)); ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint)); ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.cobblestone, 16), new ItemStack(Blocks.sand, 16)); ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.sandstone, 1, Short.MAX_VALUE), new ItemStack(Blocks.sand, 4)); @@ -68,11 +68,11 @@ public class MachineRecipes public static void initScribeRecipes() { - for (int i = 0; i < ConfigHandler.scribeRecipes.length; i++) + for (int i = 0; i < Config.scribeRecipes.length; i++) { try { - String[] parts = ConfigHandler.scribeRecipes[i].split("[\\W]"); + String[] parts = Config.scribeRecipes[i].split("[\\W]"); if (parts.length == 5) { String modid = parts[0]; @@ -81,11 +81,11 @@ public class MachineRecipes int qty = Integer.parseInt(parts[3]); int enchID = Integer.parseInt(parts[4]); - if (ConfigHandler.findItemStack(modid, object) != null) + if (Config.findItemStack(modid, object) != null) { if (Enchantment.getEnchantmentById(enchID) != null) { - ItemStack newStack = ConfigHandler.findItemStack(modid, object); + ItemStack newStack = Config.findItemStack(modid, object); ScribeRecipes.getInstance().addRecipe(new ItemStack(newStack.getItem(), qty, metadata), getEnchantedBook(enchID)); } else @@ -124,36 +124,36 @@ public class MachineRecipes public static void initCropomatorRecipes() { - for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++) + for (int i = 0; i < Config.cropomatorInputs.length; i++) { try { - String[] parts = ConfigHandler.cropomatorInputs[i].split(":"); + String[] parts = Config.cropomatorInputs[i].split(":"); if (parts.length == 2) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) + if (Config.findItemStack(parts[0], parts[1]) != null) { - ItemStack newStack = ConfigHandler.findItemStack(parts[0], parts[1]); - CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), ConfigHandler.cropomatorOutput, newStack.getItemDamage())); + ItemStack newStack = Config.findItemStack(parts[0], parts[1]); + CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), Config.cropomatorOutput, newStack.getItemDamage())); } else { - LogHelper.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); + LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } if (parts.length == 3) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) + if (Config.findItemStack(parts[0], parts[1]) != null) { - ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); - newStack.stackSize = ConfigHandler.cropomatorOutput; - CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), ConfigHandler.cropomatorOutput, newStack.getItemDamage())); + ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); + newStack.stackSize = Config.cropomatorOutput; + CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), Config.cropomatorOutput, newStack.getItemDamage())); } else { - LogHelper.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); + LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } @@ -168,32 +168,32 @@ public class MachineRecipes public static void initCropomatorFuels() { - for (int i = 0; i < ConfigHandler.cropomatorCatalysts.length; i++) + for (int i = 0; i < Config.cropomatorCatalysts.length; i++) { try { - String[] parts = ConfigHandler.cropomatorCatalysts[i].split(":"); + String[] parts = Config.cropomatorCatalysts[i].split(":"); if (parts.length == 2) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) - TileCropomator.addFuel(ConfigHandler.findItemStack(parts[0], parts[1])); + if (Config.findItemStack(parts[0], parts[1]) != null) + TileCropomator.addFuel(Config.findItemStack(parts[0], parts[1])); else { - LogHelper.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); + LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } if (parts.length == 3) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) + if (Config.findItemStack(parts[0], parts[1]) != null) { - ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); + ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); TileCropomator.addFuel(newStack); } else { - LogHelper.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); + LogHelper.warn("Item " + Config.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } @@ -240,7 +240,7 @@ public class MachineRecipes { ItemStack localItemStack5 = localItemStack4.copy(); ItemStack tmp129_127 = localItemStack5; - tmp129_127.stackSize = ConfigHandler.woodchipperOutput; + tmp129_127.stackSize = Config.woodchipperOutput; WoodchipperRecipes.getInstance().addRecipe(localItemStack3, localItemStack5); } } @@ -254,7 +254,7 @@ public class MachineRecipes { localItemStack4 = localItemStack3.copy(); ItemStack temp = localItemStack4; - temp.stackSize = ConfigHandler.woodchipperOutput; + temp.stackSize = Config.woodchipperOutput; WoodchipperRecipes.getInstance().addRecipe(localItemStack2, localItemStack4); } } @@ -263,32 +263,32 @@ public class MachineRecipes public static void initWoodchipperFuels() { - for (int i = 0; i < ConfigHandler.woodchipperFuels.length; i++) + for (int i = 0; i < Config.woodchipperFuels.length; i++) { try { - String[] parts = ConfigHandler.woodchipperFuels[i].split(":"); + String[] parts = Config.woodchipperFuels[i].split(":"); if (parts.length == 2) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) - TileWoodchipper.addFuel(ConfigHandler.findItemStack(parts[0], parts[1])); + if (Config.findItemStack(parts[0], parts[1]) != null) + TileWoodchipper.addFuel(Config.findItemStack(parts[0], parts[1])); else { - LogHelper.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); + LogHelper.warn("Item " + Config.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } if (parts.length == 3) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) + if (Config.findItemStack(parts[0], parts[1]) != null) { - ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); + ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); TileWoodchipper.addFuel(newStack); } else { - LogHelper.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); + LogHelper.warn("Item " + Config.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } @@ -302,32 +302,32 @@ public class MachineRecipes static void initElectroextractorFuels() { - for (int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++) + for (int i = 0; i < Config.eeFuels.length; i++) { try { - String[] parts = ConfigHandler.electroextractorEnergySources[i].split(":"); + String[] parts = Config.eeFuels[i].split(":"); if (parts.length == 2) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) - TileElectroextractor.addFuel(ConfigHandler.findItemStack(parts[0], parts[1])); + if (Config.findItemStack(parts[0], parts[1]) != null) + TileElectroextractor.addFuel(Config.findItemStack(parts[0], parts[1])); else { - LogHelper.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + " could not be added to the Electroextractor's fuel list."); + LogHelper.warn("Item " + Config.eeFuels[i] + " could not be added to the Electroextractor's fuel list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } if (parts.length == 3) { - if (ConfigHandler.findItemStack(parts[0], parts[1]) != null) + if (Config.findItemStack(parts[0], parts[1]) != null) { - ItemStack newStack = new ItemStack(ConfigHandler.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); + ItemStack newStack = new ItemStack(Config.findItemStack(parts[0], parts[1]).getItem(), 1, Integer.parseInt(parts[2])); TileElectroextractor.addFuel(newStack); } else { - LogHelper.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + " could not be added to the Electroextractor's fuel list."); + LogHelper.warn("Item " + Config.eeFuels[i] + " could not be added to the Electroextractor's fuel list."); LogHelper.warn("Please confirm you have the name and formatting correct."); } } @@ -342,19 +342,19 @@ public class MachineRecipes static void initElectroextractorOreDictionary() { ArrayList dustNames = ItemDust.getDusts(); - for (int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++) + for (int i = 0; i < Config.eeOreDictInputs.length; i++) { - String[] entry = ConfigHandler.electroextractorOreDictInputs[i].split(":"); + String[] entry = Config.eeOreDictInputs[i].split(":"); if (doesOreNameExist("ore" + entry[0]) && doesOreNameExist("ingot" + entry[0])) { List ores = OreDictionary.getOres("ore" + entry[0]); ItemDust.addDustType(entry[0], Integer.parseInt(entry[1])); for (int j = 0; j < ores.size(); j++) - ElectroextractorRecipes.getInstance().addRecipe(ores.get(j), new ItemStack(LibItems.dusts, ConfigHandler.electroextractorOutput, dustNames.size() - 1)); + ElectroextractorRecipes.getInstance().addRecipe(ores.get(j), new ItemStack(LibItems.dusts, Config.eeOutput, dustNames.size() - 1)); } else { - LogHelper.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i] + " could not be registered."); + LogHelper.warn("Your oreDictionary Entry " + Config.eeOreDictInputs[i] + " could not be registered."); if (!doesOreNameExist("ore" + entry[0])) LogHelper.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0] + "."); else if (!doesOreNameExist("ingot" + entry[0])) diff --git a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileAtmosManipulator.java b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileAtmosManipulator.java index 091c4e6..c176871 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileAtmosManipulator.java +++ b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileAtmosManipulator.java @@ -1,8 +1,48 @@ package com.oitsjustjose.criss_cross.tileentity; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; public class TileAtmosManipulator extends TileEntity { - + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; + } + + public void setRain() + { + EntityPlayer player = worldObj.getClosestPlayer(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 3); + worldObj.getWorldInfo().setRaining(true); + + if (worldObj.isRemote) + { + worldObj.setRainStrength(1.0F); + worldObj.setThunderStrength(1.0f); + } + + worldObj.getWorldInfo().setThunderTime(0); + worldObj.getWorldInfo().setThundering(true); + } + + public void setSun() + { + EntityPlayer player = worldObj.getClosestPlayer(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 3); + if (player.inventory.hasItem(Items.lava_bucket)) + { + worldObj.getWorldInfo().setRaining(false); + + if (worldObj.isRemote) + { + worldObj.setRainStrength(0.0F); + worldObj.setThunderStrength(0.0f); + } + + worldObj.getWorldInfo().setThunderTime(0); + worldObj.getWorldInfo().setThundering(false); + } + } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCobblegen.java b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCobblegen.java index 9088ecb..7a7aab7 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCobblegen.java +++ b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCobblegen.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import com.oitsjustjose.criss_cross.blocks.BlockStonegen; import com.oitsjustjose.criss_cross.container.ContainerCobblegen; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Lib; import net.minecraft.entity.player.EntityPlayer; @@ -24,7 +24,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileCobblegen extends TileEntityLockable implements ITickable, ISidedInventory { - private static int proTicks = ConfigHandler.blockGeneratorProcessTimes; + private static int proTicks = Config.blockGeneratorProcessTimes; private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsBottom = new int[] { 2, 1 }; private static final int[] slotsSides = new int[] { 1 }; diff --git a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCropomator.java b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCropomator.java index 4b1241c..fa30be4 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCropomator.java +++ b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileCropomator.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import com.oitsjustjose.criss_cross.blocks.BlockCropomator; import com.oitsjustjose.criss_cross.container.ContainerCropomator; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.recipes.machine.CropomatorRecipes; @@ -23,8 +23,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileCropomator extends TileEntityLockable implements ITickable, ISidedInventory { - private static int proTicks = ConfigHandler.cropomatorProcessTime; - private static int qty = ConfigHandler.cropomatorOutput; + private static int proTicks = Config.cropomatorProcessTime; + private static int qty = Config.cropomatorOutput; private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsBottom = new int[] { 2, 1 }; private static final int[] slotsSides = new int[] { 1 }; diff --git a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileElectroextractor.java b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileElectroextractor.java index 8ef6bbf..6be84e3 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileElectroextractor.java +++ b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileElectroextractor.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor; import com.oitsjustjose.criss_cross.container.ContainerElectroextractor; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.recipes.machine.ElectroextractorRecipes; @@ -23,8 +23,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileElectroextractor extends TileEntityLockable implements ITickable, ISidedInventory { - private static int proTicks = ConfigHandler.electroextractorProcessTime; - private static int qty = ConfigHandler.electroextractorOutput; + private static int proTicks = Config.electroextractorProcessTime; + private static int qty = Config.eeOutput; private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsBottom = new int[] { 2, 1 }; private static final int[] slotsSides = new int[] { 1 }; diff --git a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileScribe.java b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileScribe.java index 9f0d492..1353686 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileScribe.java +++ b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileScribe.java @@ -24,12 +24,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileScribe extends TileEntityLockable implements ITickable, ISidedInventory { private static int proTicks = 700; - private static final int[] slotsTop = new int[] { 0 }; - private static final int[] slotsBottom = new int[] { 2, 1 }; - private static final int[] slotsSides = new int[] { 1 }; private static String customName; private ItemStack[] ItemStacks = new ItemStack[3]; - public int fuelTime; public int writingTime; public int fuelUsetime; @@ -402,18 +398,18 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI @Override public int[] getSlotsForFace(EnumFacing side) { - return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides); + return new int[]{}; } @Override public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction) { - return this.isItemValidForSlot(slot, itemstack); + return false; } @Override public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction) { - return direction != EnumFacing.DOWN || slot != 1; + return false; } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileStonegen.java b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileStonegen.java index 0b29080..fbc669e 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileStonegen.java +++ b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileStonegen.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import com.oitsjustjose.criss_cross.blocks.BlockStonegen; import com.oitsjustjose.criss_cross.container.ContainerStonegen; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Lib; import net.minecraft.entity.player.EntityPlayer; @@ -24,7 +24,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileStonegen extends TileEntityLockable implements ITickable, ISidedInventory { - private static int proTicks = ConfigHandler.blockGeneratorProcessTimes; + private static int proTicks = Config.blockGeneratorProcessTimes; private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsBottom = new int[] { 2, 1 }; private static final int[] slotsSides = new int[] { 1 }; diff --git a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileWoodchipper.java b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileWoodchipper.java index dfcac6f..61d5d4d 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileWoodchipper.java +++ b/src/main/java/com/oitsjustjose/criss_cross/tileentity/TileWoodchipper.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import com.oitsjustjose.criss_cross.blocks.BlockWoodchipper; import com.oitsjustjose.criss_cross.container.ContainerWoodchipper; -import com.oitsjustjose.criss_cross.lib.ConfigHandler; +import com.oitsjustjose.criss_cross.lib.Config; import com.oitsjustjose.criss_cross.lib.Lib; import com.oitsjustjose.criss_cross.recipes.machine.WoodchipperRecipes; @@ -23,8 +23,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileWoodchipper extends TileEntityLockable implements ITickable, ISidedInventory { - private static int proTicks = ConfigHandler.woodchipperProcessTime; - private static int qty = ConfigHandler.woodchipperOutput; + private static int proTicks = Config.woodchipperProcessTime; + private static int qty = Config.woodchipperOutput; private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsBottom = new int[] { 2, 1 }; private static final int[] slotsSides = new int[] { 1 }; diff --git a/src/main/resources/assets/crisscross/lang/en_US.lang b/src/main/resources/assets/crisscross/lang/en_US.lang index fc2f515..2d72708 100644 --- a/src/main/resources/assets/crisscross/lang/en_US.lang +++ b/src/main/resources/assets/crisscross/lang/en_US.lang @@ -5,6 +5,8 @@ tile.CrissCross.WoodChipper.name=Wood Chipper tile.CrissCross.CobblestoneGenerator.name=Cobblestone Generator tile.CrissCross.StoneGenerator.name=Smooth Stone Generator tile.CrissCross.Scribe.name=Scribe +tile.CrissCross.AtmosManipulator.name=Atmos Manipulator + #Items item.CrissCross.trash.name=This is a bad item, please trash it. @@ -27,6 +29,9 @@ container.woodchipper=Wood Chipper container.stonegen=Smooth Stone Generator container.cobblegen=Cobblestone Generator container.scribe=Scribe +container.atmosmanipulator=Atmos Manipulator +button.sun=§eSun Creator§r +button.rain=§1Rain Creator§r #NEI Integration recipe.cropomatorfuel=Cropomator Fuels diff --git a/src/main/resources/assets/crisscross/textures/gui/atmosmanipulator.png b/src/main/resources/assets/crisscross/textures/gui/atmosmanipulator.png new file mode 100644 index 0000000..37fc4d1 Binary files /dev/null and b/src/main/resources/assets/crisscross/textures/gui/atmosmanipulator.png differ