diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2021-12-27 02:50:29 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2021-12-27 02:50:29 +0000 |
commit | 6e8a40242fcd7fd85a99009e5bc626972c8fa0d8 (patch) | |
tree | 6fb4a45cf17dd22748148417bc7bb0efb850cea3 | |
parent | ef8ac539395ce5067edfcf1b8a98ae746c476fc1 (diff) | |
download | GT5-Unofficial-6e8a40242fcd7fd85a99009e5bc626972c8fa0d8.tar.gz GT5-Unofficial-6e8a40242fcd7fd85a99009e5bc626972c8fa0d8.tar.bz2 GT5-Unofficial-6e8a40242fcd7fd85a99009e5bc626972c8fa0d8.zip |
Updated Build Script.
Fixed Volumetric Flask Configurator not working.
Fixed recipe for Reservoir Hatch.
8 files changed, 354 insertions, 188 deletions
diff --git a/build.gradle b/build.gradle index 18fedd355e..43dfa37748 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428 +//version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb /* DO NOT CHANGE THIS FILE! @@ -42,6 +42,7 @@ plugins { id("org.ajoberstar.grgit") version("3.1.1") id("com.github.johnrengelman.shadow") version("4.0.4") id("com.palantir.git-version") version("0.12.3") + id("maven-publish") } apply plugin: 'forge' @@ -194,7 +195,9 @@ if(file("addon.gradle").exists()) { apply from: 'repositories.gradle' configurations { - implementation.extendsFrom(shadowImplementation) + implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored + implementation.extendsFrom(shadowCompile) + implementation.extendsFrom(shadeCompile) } repositories { @@ -260,16 +263,28 @@ task relocateShadowJar(type: ConfigureShadowRelocation) { } shadowJar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + manifest { attributes(getManifestAttributes()) } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation] + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] dependsOn(relocateShadowJar) } jar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + manifest { attributes(getManifestAttributes()) } @@ -343,31 +358,31 @@ tasks.withType(JavaExec).configureEach { } processResources - { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName - } +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version - if(usesMixins.toBoolean()) { - from refMap - } + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } - } + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} def getManifestAttributes() { def manifestAttributes = [:] @@ -400,6 +415,12 @@ task sourcesJar(type: Jar) { } task shadowDevJar(type: ShadowJar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + from sourceSets.main.output getArchiveClassifier().set("dev") @@ -408,7 +429,7 @@ task shadowDevJar(type: ShadowJar) { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation] + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] } task relocateShadowDevJar(type: ConfigureShadowRelocation) { @@ -423,6 +444,12 @@ task circularResolverJar(type: Jar) { } task devJar(type: Jar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + from sourceSets.main.output getArchiveClassifier().set("dev") @@ -460,6 +487,38 @@ artifacts { } } +// publishing +publishing { + publications { + maven(MavenPublication) { + artifact source: jar + artifact source: sourcesJar, classifier: "src" + artifact source: devJar, classifier: "dev" + if (apiPackage) { + artifact source: apiJar, classifier: "api" + } + + groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group + artifactId = System.getenv("ARTIFACT_ID") ?: project.name + version = System.getenv("ARTIFACT_VERSION") ?: project.version + } + } + + repositories { + maven { + String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown" + String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown" + String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName" + name = "GitHubPackages" + url = githubRepositoryUrl + credentials { + username = System.getenv("GITHUB_ACTOR") ?: "NONE" + password = System.getenv("GITHUB_TOKEN") ?: "NONE" + } + } + } +} + // Updating task updateBuildScript { doLast { diff --git a/src/main/java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java b/src/main/java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java index 36ea2af7cc..90f9c1056a 100644 --- a/src/main/java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java +++ b/src/main/java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java @@ -92,12 +92,7 @@ public class VolumetricFlaskSetter extends BasicTileBlockWithTooltip { @Override public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; + return 0; } @Override diff --git a/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java b/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java index de3106c957..65e84d7272 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java +++ b/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java @@ -4,6 +4,7 @@ import java.util.Iterator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.Inventory_VolumetricFlaskSetter; import gtPlusPlus.core.slots.SlotNoInput; @@ -24,8 +25,8 @@ public class Container_VolumetricFlaskSetter extends Container { public final Inventory_VolumetricFlaskSetter inventoryChest; - public short mCustomValue; - private short oCustomValue; + public int mCustomValue; + private int oCustomValue; private int mTimer; @@ -181,5 +182,9 @@ public class Container_VolumetricFlaskSetter extends Container { break; } } + + public void log(String aString) { + Logger.INFO("[Flask-Container] "+aString); + } }
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java b/src/main/java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java index 0257e51d0c..512f31dd47 100644 --- a/src/main/java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java +++ b/src/main/java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java @@ -5,13 +5,13 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.container.Container_VolumetricFlaskSetter; import gtPlusPlus.core.gui.widget.GuiValueField; import gtPlusPlus.core.handler.PacketHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.network.packet.Packet_VolumetricFlaskGui; import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; -import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; @@ -19,67 +19,203 @@ import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class GUI_VolumetricFlaskSetter extends GuiContainer { - private GuiTextField mText; + private static final ResourceLocation mGuiTextures = new ResourceLocation( + CORE.MODID, "textures/gui/VolumetricFlaskSetter.png" + ); + private Container_VolumetricFlaskSetter mContainer; private boolean mIsOpen = false; + private GuiValueField mText; private TileEntityVolumetricFlaskSetter mTile; - private Container_VolumetricFlaskSetter mContainer; - private static final ResourceLocation mGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/VolumetricFlaskSetter.png"); - public GUI_VolumetricFlaskSetter(Container_VolumetricFlaskSetter aContainer){ + public GUI_VolumetricFlaskSetter(Container_VolumetricFlaskSetter aContainer) { super(aContainer); mContainer = aContainer; mTile = mContainer.mTileEntity; } - public void initGui(){ + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(mGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int i, final int j) { + super.drawGuiContainerForegroundLayer(i, j); + this.mText.drawTextBox(); + this.fontRendererObj.drawString( + I18n.format("container.VolumetricFlaskSetter", new Object[0]), 4, 3, 4210752 + ); + int aYVal = 49; + this.fontRendererObj.drawString( + I18n.format("0 = 16l", new Object[0]), 8, aYVal, 4210752 + ); + this.fontRendererObj.drawString( + I18n.format("4 = 576l", new Object[0]), 64, aYVal, 4210752 + ); + this.fontRendererObj.drawString( + I18n.format("1 = 36l", new Object[0]), 8, aYVal += 8, 4210752 + ); + this.fontRendererObj.drawString( + I18n.format("5 = 720l", new Object[0]), 64, aYVal, 4210752 + ); + this.fontRendererObj.drawString( + I18n.format("2 = 144l", new Object[0]), 8, aYVal += 8, 4210752 + ); + this.fontRendererObj.drawString( + I18n.format("6 = 864l", new Object[0]), 64, aYVal, 4210752 + ); + this.fontRendererObj.drawString( + I18n.format("3 = 432l", new Object[0]), 8, aYVal += 8, 4210752 + ); + this.fontRendererObj.drawString( + I18n.format("-> = Custom", new Object[0]), 59, aYVal, 4210752 + ); + + } + + public void drawScreen(int par1, int par2, float par3) { + this.drawDefaultBackground(); + super.drawScreen(par1, par2, par3); + } + + protected String getText() { + return this.mText.getText(); + } + + public void initGui() { super.initGui(); - Keyboard.enableRepeatEvents(true); + // Keyboard.enableRepeatEvents(true); mIsOpen = true; - this.mText = new GuiValueField(this.fontRendererObj, 26, 31, this.width / 2 - 62, this.height/2-52, 106, 14); + this.mText = new GuiValueField( + this.fontRendererObj, 26, 31, this.width / 2 + - 62, this.height / 2 - 52, 106, 14, this + ); mText.setMaxStringLength(5); mText.setEnableBackgroundDrawing(true); mText.setText("0"); mText.setFocused(true); } - protected void keyTyped(char par1, int par2){ + public boolean isNumber(char c) { + boolean isNum = ((c >= 48 && c <= 57) || c == 45); + if (isNum) { + log("Found Digit: "+c+" | char value"); + } + else { + switch (c) { + case '0' : + case '1' : + case '2' : + case '3' : + case '4' : + case '5' : + case '6' : + case '7' : + case '8' : + case '9' : + log("Found Digit: "+c+" | char switch"); + return true; + } + } + return isNum; + } + + public boolean isNumber(int c) { + switch (c) { + case Keyboard.KEY_0 : + case Keyboard.KEY_1 : + case Keyboard.KEY_2 : + case Keyboard.KEY_3 : + case Keyboard.KEY_4 : + case Keyboard.KEY_5 : + case Keyboard.KEY_6 : + case Keyboard.KEY_7 : + case Keyboard.KEY_8 : + case Keyboard.KEY_9 : + case Keyboard.KEY_NUMPAD0 : + case Keyboard.KEY_NUMPAD1 : + case Keyboard.KEY_NUMPAD2 : + case Keyboard.KEY_NUMPAD3 : + case Keyboard.KEY_NUMPAD4 : + case Keyboard.KEY_NUMPAD5 : + case Keyboard.KEY_NUMPAD6 : + case Keyboard.KEY_NUMPAD7 : + case Keyboard.KEY_NUMPAD8 : + case Keyboard.KEY_NUMPAD9 : + log("Found Digit: "+Keyboard.getKeyName(c)+" | LWJGL Keybinding"); + return true; + } + return false; + } + + protected void keyTyped(char par1, int par2) { if (mIsOpen) { + log("Pressed " + par1 + " | " + par2); if (mText.isFocused()) { + log("Text box has focus."); if (par2 == Keyboard.KEY_RETURN) { - if (mText.isFocused()) { - mText.setFocused(false); - } + log("Pressed Enter, unfocusing."); + mText.setFocused(false); } else if (par2 == Keyboard.KEY_BACK) { + log("Pressed Backspace."); String aCurrentText = getText(); if (aCurrentText.length() > 0) { - this.mText.setText(aCurrentText.substring(0, aCurrentText.length() - 1)); + this.mText.setText( + aCurrentText.substring( + 0, aCurrentText.length() - 1 + ) + ); if (getText().length() <= 0) { - this.mText.setText("0"); + setText(0); } sendUpdateToServer(); } } else { - if (isNumber(par1)) { - if (this.mText.getText().equals("0")) { - this.mText.setText(""+par1); + if (isNumber(par2) || isNumber(par1)) { + log("Pressed number."); + if (this.mText.getText().equals("0")) { + this.mText.textboxKeyTyped(par1, par2); sendUpdateToServer(); } else { - this.mText.textboxKeyTyped(par1, par2); - sendUpdateToServer(); + this.mText.textboxKeyTyped(par1, par2); + sendUpdateToServer(); } } else { - super.keyTyped(par1, par2); + log("Pressed unused key."); + super.keyTyped(par1, par2); } - } + } } else { - super.keyTyped(par1, par2); + log("Text box not focused."); + super.keyTyped(par1, par2); } } + else { + log("Gui is not open?"); + } + } + + protected void mouseClicked(int x, int y, int btn) { + if (mIsOpen) { + log("Clicked."); + this.mText.mouseClicked(x, y, btn); + if (!mText.didClickInTextField(x, y)) { + log("Did not click in text box, passing to super."); + super.mouseClicked(x, y, btn); + } + } + else { + log("Gui is not open?"); + } } @Override @@ -88,10 +224,29 @@ public class GUI_VolumetricFlaskSetter extends GuiContainer { mText.setEnabled(false); mText.setVisible(false); super.onGuiClosed(); - Keyboard.enableRepeatEvents(false); + // Keyboard.enableRepeatEvents(false); + } + + public int parse(String aValue) { + try { + return Integer.parseInt(getText()); + } + catch (NumberFormatException e) { + return 0; + } + } + + public void sendUpdateToServer() { + if (getText().length() > 0) { + PacketHandler.sendToServer(new Packet_VolumetricFlaskGui(mTile, parse(getText()))); + } + } + + public void setText(int aValue) { + this.mText.setText("" + aValue); } - public void updateScreen(){ + public void updateScreen() { super.updateScreen(); // Update Textbox to 0 if Empty if (getText().length() <= 0) { @@ -101,83 +256,19 @@ public class GUI_VolumetricFlaskSetter extends GuiContainer { this.mText.updateCursorCounter(); // Check TextBox Value is correct - short aCustomValue = 0; if (getText().length() > 0) { - try { - aCustomValue = Short.parseShort(getText()); - short aTileValue = ((Container_VolumetricFlaskSetter) mContainer).mCustomValue; - if (mContainer != null) { - if (aTileValue != aCustomValue){ - this.mText.setText(""+aTileValue); - } + int aCustomValue = parse(getText()); + int aTileValue = ((Container_VolumetricFlaskSetter) mContainer).mCustomValue; + if (mContainer != null) { + if (aTileValue != aCustomValue) { + setText(aTileValue); } - } catch (NumberFormatException ex) { - } - } - } - - public void drawScreen(int par1, int par2, float par3){ - this.drawDefaultBackground(); - super.drawScreen(par1, par2, par3); - - - } - - protected void mouseClicked(int x, int y, int btn) { - if (mIsOpen) { - super.mouseClicked(x, y, btn); - this.mText.mouseClicked(x, y, btn); } } - - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - super.drawGuiContainerForegroundLayer(i, j); - this.mText.drawTextBox(); - this.fontRendererObj.drawString(I18n.format("container.VolumetricFlaskSetter", new Object[0]), 4, 3, 4210752); - int aYVal = 49; - this.fontRendererObj.drawString(I18n.format("0 = 16l", new Object[0]), 8, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("4 = 576l", new Object[0]), 64, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("1 = 36l", new Object[0]), 8, aYVal+=8, 4210752); - this.fontRendererObj.drawString(I18n.format("5 = 720l", new Object[0]), 64, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("2 = 144l", new Object[0]), 8, aYVal+=8, 4210752); - this.fontRendererObj.drawString(I18n.format("6 = 864l", new Object[0]), 64, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("3 = 432l", new Object[0]), 8, aYVal+=8, 4210752); - this.fontRendererObj.drawString(I18n.format("-> = Custom", new Object[0]), 59, aYVal, 4210752); - - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(mGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - public boolean isNumber(char c) { - return ((c >= 48 && c <= 57) || c == 45); - } - - protected String getText() { - return this.mText.getText(); - } - - protected void sendUpdateToServer() { - short aCustomValue = 0; - if (getText().length() > 0) { - try { - aCustomValue = Short.parseShort(getText()); - PacketHandler.sendToServer(new Packet_VolumetricFlaskGui(mTile, aCustomValue)); - } catch (NumberFormatException ex) { - - } - } + public void log(String aString) { + Logger.INFO("[Flask-GUI] "+aString); } -}
\ No newline at end of file +} diff --git a/src/main/java/gtPlusPlus/core/gui/widget/GuiValueField.java b/src/main/java/gtPlusPlus/core/gui/widget/GuiValueField.java index ac4c1a8aee..c9c294ea1c 100644 --- a/src/main/java/gtPlusPlus/core/gui/widget/GuiValueField.java +++ b/src/main/java/gtPlusPlus/core/gui/widget/GuiValueField.java @@ -2,7 +2,9 @@ package gtPlusPlus.core.gui.widget; import java.lang.reflect.Field; +import gtPlusPlus.core.gui.machine.GUI_VolumetricFlaskSetter; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.DevHelper; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiTextField; @@ -11,76 +13,86 @@ public class GuiValueField extends GuiTextField { private final FontRenderer mFontRenderer; private final int mScreenLocationX; private final int mScreenLocationY; - - public GuiValueField(FontRenderer aFontRenderer, int aX, int aY, int aScreenLocationX, int aScreenLocationY, int aWidth, int aHeight) { + private final GUI_VolumetricFlaskSetter mGUI; + + public GuiValueField(FontRenderer aFontRenderer, int aX, int aY, int aScreenLocationX, int aScreenLocationY, int aWidth, int aHeight, GUI_VolumetricFlaskSetter aGUI) { super(aFontRenderer, aX, aY, aWidth, aHeight); mFontRenderer = aFontRenderer; mScreenLocationX = aScreenLocationX; mScreenLocationY = aScreenLocationY; + mGUI = aGUI; } - - public boolean canLoseFocus() { - Field canLoseFocus = ReflectionUtils.getField(GuiTextField.class, "canLoseFocus"); + + public boolean canLoseFocus() { + Field canLoseFocus = ReflectionUtils.getField(GuiTextField.class, DevHelper.isObfuscatedEnvironment() ? "field_146212_n" : "canLoseFocus"); if (canLoseFocus != null) { return (boolean) ReflectionUtils.getFieldValue(canLoseFocus, this); } return true; } - + + @Override public boolean isFocused() { - Field isFocused = ReflectionUtils.getField(GuiTextField.class, "isFocused"); - if (isFocused != null) { - return (boolean) ReflectionUtils.getFieldValue(isFocused, this); - } - return false; + return super.isFocused(); } - + public boolean isBackgroundDrawingEnabled() { - Field enableBackgroundDrawing = ReflectionUtils.getField(GuiTextField.class, "enableBackgroundDrawing"); + Field enableBackgroundDrawing = ReflectionUtils.getField(GuiTextField.class, DevHelper.isObfuscatedEnvironment() ? "field_146215_m" : "enableBackgroundDrawing"); if (enableBackgroundDrawing != null) { return (boolean) ReflectionUtils.getFieldValue(enableBackgroundDrawing, this); } return true; } + public int getLineScrollOffset() { - Field lineScrollOffset = ReflectionUtils.getField(GuiTextField.class, "lineScrollOffset"); + Field lineScrollOffset = ReflectionUtils.getField(GuiTextField.class, DevHelper.isObfuscatedEnvironment() ? "field_146225_q" : "lineScrollOffset"); if (lineScrollOffset != null) { return (int) ReflectionUtils.getFieldValue(lineScrollOffset, this); } return 0; } - - /** - * Args: x, y, buttonClicked - */ - public void mouseClicked(int aX, int aY, int aButton){ - - boolean flag = aX >= this.mScreenLocationX && aX < this.mScreenLocationX + this.width && aY >= this.mScreenLocationY && aY < this.mScreenLocationY + this.height; - //Logger.INFO("Clicked X:"+aX); - //Logger.INFO("Clicked Y:"+aY); - //Logger.INFO("ScreenPos X:"+mScreenLocationX); - //Logger.INFO("ScreenPos Y:"+mScreenLocationY); - //Logger.INFO("Render X:"+xPosition); - //Logger.INFO("Render Y:"+yPosition); - - if (canLoseFocus()) - { - this.setFocused(flag); - } - - if (isFocused() && aButton == 0) - { - int l = aX - this.mScreenLocationX; + public boolean didClickInTextField(int aX, int aY) { + mGUI.log("Clicked at X:"+aX+", Y:"+aY); + boolean aDidClick = aX >= this.mScreenLocationX && aX < this.mScreenLocationX + this.width && aY >= this.mScreenLocationY && aY < this.mScreenLocationY + this.height; + mGUI.log("Did click in textbox? "+aDidClick); + mGUI.log("Expected Region: X:"+mScreenLocationX+"-"+(this.mScreenLocationX + this.width)); + mGUI.log("Expected Region: Y:"+mScreenLocationY+"-"+(this.mScreenLocationY + this.height)); + return aDidClick; + } - if (isBackgroundDrawingEnabled()) - { - l -= 4; - } + /** + * Args: x, y, buttonClicked + */ + @Override + public void mouseClicked(int aX, int aY, int aButton){ + boolean aDidClick = didClickInTextField(aX, aY); - String s = this.mFontRenderer.trimStringToWidth(this.getText().substring(getLineScrollOffset()), this.getWidth()); - this.setCursorPosition(this.mFontRenderer.trimStringToWidth(s, l).length() + getLineScrollOffset()); - } - } + mGUI.log("Did click inside text box? "+aDidClick); + mGUI.log("Focus 1: "+this.isFocused()); + this.setFocused(aDidClick); + mGUI.log("Focus 2: "+this.isFocused()); + if (isFocused()) { + int l = aX - this.mScreenLocationX; + if (isBackgroundDrawingEnabled()) { + l -= 4; + } + if (aButton == 0) { + mGUI.log("Left clicked in text box."); + String s = this.mFontRenderer.trimStringToWidth(this.getText().substring(getLineScrollOffset()), this.getWidth()); + this.setCursorPosition(this.mFontRenderer.trimStringToWidth(s, l).length() + getLineScrollOffset()); + } + else if (aButton == 1) { + mGUI.log("Right clicked in text box."); + mGUI.setText(0); + mGUI.sendUpdateToServer(); + String s = this.mFontRenderer.trimStringToWidth(this.getText().substring(getLineScrollOffset()), this.getWidth()); + this.setCursorPosition(this.mFontRenderer.trimStringToWidth(s, l).length() + getLineScrollOffset()); + } + } + else { + mGUI.log("Clicked, but no focus."); + } + } } diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 6e042a71b1..cd8d9311c0 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -1414,7 +1414,7 @@ public class RECIPES_Machines { RecipeUtils.addShapedGregtechRecipe( - CI.getPlate(6, 1), ItemList.Casing_Gearbox_Titanium, CI.getPlate(6, 1), + CI.getPlate(6, 1), ItemList.Casing_Gearbox_Titanium.get(1), CI.getPlate(6, 1), CI.getPlate(6, 1), CI.getFluidRegulator(5, 1), CI.getPlate(6, 1), CI.getTieredCircuit(6), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(6), GregtechItemList.Hatch_Reservoir.get(1)); diff --git a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java b/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java index 5b837397b1..bc096c0d53 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java +++ b/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java @@ -26,22 +26,22 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide public int locationY; public int locationZ; private int aCurrentMode = 0; - private short aCustomValue = 1000; + private int aCustomValue = 1000; public TileEntityVolumetricFlaskSetter() { this.inventoryContents = new Inventory_VolumetricFlaskSetter(); this.setTileLocation(); } - public short getCustomValue() { + public int getCustomValue() { //Logger.INFO("Value: "+this.aCustomValue); return this.aCustomValue; } public void setCustomValue(int aVal) { - Logger.INFO("Old Value: "+this.aCustomValue); + log("Old Value: "+this.aCustomValue); this.aCustomValue = (short) MathUtils.balance(aVal, 0, Short.MAX_VALUE); - Logger.INFO("New Value: "+this.aCustomValue); + log("New Value: "+this.aCustomValue); markDirty(); } @@ -141,7 +141,7 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide // Skip slot 7 (Custom) unless it has a value > 0 if (e == 7 && getCustomValue() <= 0) { - Logger.INFO("Skipping Custom slot as value <= 0"); + log("Skipping Custom slot as value <= 0"); continue; } if (e == Container_VolumetricFlaskSetter.SLOT_OUTPUT) { @@ -168,8 +168,8 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide // Check that the Circuit in the Output slot is not null and the same type as the circuit input. if (aTypeInCheckedSlot > 0 && (aTypeInSlot == aTypeInCheckedSlot) && f != null) { if (g.getItem() == f.getItem() && VolumetricFlaskHelper.getFlaskCapacity(f) == getCapacityForSlot(e) && ((aInputFluidStack == null && aFluidInCheckedSlot == null) || aInputFluidStack.isFluidEqual(aFluidInCheckedSlot))) { - Logger.INFO("Input Slot Flask Contains: "+(aInputFluidStack != null ? aInputFluidStack.getLocalizedName() : "Empty")); - Logger.INFO("Output Slot Flask Contains: "+(aFluidInCheckedSlot != null ? aFluidInCheckedSlot.getLocalizedName() : "Empty")); + log("Input Slot Flask Contains: "+(aInputFluidStack != null ? aInputFluidStack.getLocalizedName() : "Empty")); + log("Output Slot Flask Contains: "+(aFluidInCheckedSlot != null ? aFluidInCheckedSlot.getLocalizedName() : "Empty")); aSize = f.stackSize + g.stackSize; if (aSize > 16) { aInputStack = g.copy(); @@ -253,7 +253,7 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide final NBTTagCompound chestData = new NBTTagCompound(); this.inventoryContents.writeToNBT(chestData); nbt.setTag("ContentsChest", chestData); - nbt.setShort("aCustomValue", aCustomValue); + nbt.setInteger("aCustomValue", aCustomValue); if (this.hasCustomInventoryName()) { nbt.setString("CustomName", this.getCustomName()); } @@ -265,7 +265,7 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide super.readFromNBT(nbt); // Utils.LOG_WARNING("Trying to read NBT data from TE."); this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - this.aCustomValue = nbt.getShort("aCustomValue"); + this.aCustomValue = nbt.getInteger("aCustomValue"); if (nbt.hasKey("CustomName", 8)) { this.setCustomName(nbt.getString("CustomName")); } @@ -399,5 +399,9 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide return false; } } + + public void log(String aString) { + Logger.INFO("[Flask-Tile] "+aString); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java index e76b769ef6..141e75c8b5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java @@ -47,7 +47,7 @@ public class RecipeGen_BlastSmelterGT_Ex implements IOreRecipeRegistrator { if (aMaterial.mBlastFurnaceRequired) { addBlastRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, null, aMaterial.mBlastFurnaceTemp > 1750 ? GT_OreDictUnificator.get(OrePrefixes.ingotHot, aMaterial.mSmeltInto, tDustStack, 1L) : GT_Utility.copyAmount(1L, new Object[]{tDustStack}), null, (int) Math.max(aMaterial.getMass() / 40L, 1L) * aMaterial.mBlastFurnaceTemp, 120, aMaterial); if (aMaterial.mBlastFurnaceTemp <= 1000) { - GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_Utility.copyAmount(1L, new Object[]{tDustStack}), aMaterial.mBlastFurnaceTemp); + //GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_Utility.copyAmount(1L, new Object[]{tDustStack}), aMaterial.mBlastFurnaceTemp); } } } @@ -83,8 +83,8 @@ public class RecipeGen_BlastSmelterGT_Ex implements IOreRecipeRegistrator { if (!aMaterial.contains(SubTag.NO_SMELTING)) { if ((aMaterial.mBlastFurnaceRequired) || (aMaterial.mDirectSmelting.mBlastFurnaceRequired)) { addBlastRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, null, aMaterial.mBlastFurnaceTemp > 1750 ? GT_OreDictUnificator.get(OrePrefixes.ingotHot, aMaterial, GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), 1L) : GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), null, (int) Math.max(aMaterial.getMass() / 4L, 1L) * aMaterial.mBlastFurnaceTemp, 120, aMaterial); - if (aMaterial.mBlastFurnaceTemp <= 1000) - GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), aMaterial.mBlastFurnaceTemp * 2); + //if (aMaterial.mBlastFurnaceTemp <= 1000) + //GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), aMaterial.mBlastFurnaceTemp * 2); } } } |