diff --git a/build.gradle b/build.gradle index 2a5bae82..b4178055 100644 --- a/build.gradle +++ b/build.gradle @@ -1,41 +1,30 @@ buildscript { repositories { - - // [HTTPS FIX] Replace mavenCentral() with the code block below - maven { - url = "https://maven.minecraftforge.net/" - } - + mavenCentral() maven { name = "forge" - url = "https://files.minecraftforge.net/maven" - } - maven { - name = "forge2" url = "https://maven.minecraftforge.net/" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } - - flatDir { - dirs 'libs' - } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } +apply plugin: 'java' +apply plugin: 'idea' apply plugin: 'forge' -version = " 1.1.4 - MC 1.7.10" -group= "electroblob.wizardry"// http://maven.apache.org/guides/mini/guide-naming-conventions.html +version = " 1.1.5 - MC 1.7.10" +group = "electroblob.wizardry"// http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Electroblob's Wizardry " minecraft { - version = "1.7.10-10.13.4.1558-1.7.10" + version = "1.7.10-10.13.4.1614-1.7.10" runDir = "eclipse" } @@ -54,24 +43,18 @@ artifacts { archives jar } -dependencies { - // you may put jars on which you depend on in ./libs - // or you may define them like so.. - //compile "some.group:artifact:version:classifier" - //compile "some.group:artifact:version" - - // real examples - //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // for more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html - +repositories { + maven { + name 'ChickenBones maven' + url 'https://chickenbones.net/maven/' + } } -processResources -{ +dependencies { + compileOnly 'codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev' +} + +processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version @@ -79,11 +62,11 @@ processResources // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - + // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } - + // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b7612167..99340b4a 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 678d9d8d..2c2bbe5f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Jul 02 15:54:47 CDT 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/gradlew b/gradlew index 91a7e269..cccdd3d5 100644 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,47 +6,6 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" @@ -61,9 +20,49 @@ while [ -h "$PRG" ] ; do fi done SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- +cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" -cd "$SAVED" >&- +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282a..f9553162 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java b/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java index 3c2ba523..05cebbe4 100644 --- a/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java +++ b/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java @@ -1,21 +1,15 @@ package electroblob.wizardry.client; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; - -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - +import codechicken.nei.VisiblityData; +import codechicken.nei.api.INEIGuiHandler; +import codechicken.nei.api.TaggedInventoryArea; +import cpw.mods.fml.common.Optional.Interface; +import cpw.mods.fml.common.Optional.Method; import cpw.mods.fml.common.network.simpleimpl.IMessage; import electroblob.wizardry.ExtendedPlayer; import electroblob.wizardry.SpellGlyphData; import electroblob.wizardry.WandHelper; import electroblob.wizardry.Wizardry; -import electroblob.wizardry.WizardryGuiHandler; import electroblob.wizardry.item.ItemWand; import electroblob.wizardry.packet.PacketControlInput; import electroblob.wizardry.packet.WizardryPacketHandler; @@ -23,32 +17,39 @@ import electroblob.wizardry.spell.Spell; import electroblob.wizardry.tileentity.ContainerArcaneWorkbench; import electroblob.wizardry.tileentity.SlotWizardry; import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench; +import java.awt.Rectangle; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; -public class GuiArcaneWorkbench extends GuiContainer { +@Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems") +public class GuiArcaneWorkbench extends GuiContainer implements INEIGuiHandler { private GuiButton applyBtn; private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/gui/arcane_workbench.png"); private IInventory playerInventory; private IInventory arcaneWorkbenchInventory; - - private final int tooltipWidth = 164; + + private static final int tooltipWidth = 164; + private static final int tooltipHeight = 155; public GuiArcaneWorkbench(InventoryPlayer invPlayer, TileEntityArcaneWorkbench entity) { super(new ContainerArcaneWorkbench(invPlayer, entity)); @@ -61,16 +62,7 @@ public class GuiArcaneWorkbench extends GuiContainer { @Override public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_){ - // Tests if there is a wand in the workbench and edits the positioning accordingly - if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){ - guiLeft = (this.width - this.xSize - tooltipWidth)/2; - this.applyBtn.xPosition = (this.width - tooltipWidth)/2 + 48; - }else{ - guiLeft = (this.width - this.xSize)/2; - this.applyBtn.xPosition = this.width/2 + 48; - } - - if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack()){ + if(this.hasWand()){ this.applyBtn.enabled = true; }else{ this.applyBtn.enabled = false; @@ -87,7 +79,7 @@ public class GuiArcaneWorkbench extends GuiContainer { this.fontRendererObj.drawString(this.arcaneWorkbenchInventory.hasCustomInventoryName() ? this.arcaneWorkbenchInventory.getInventoryName() : I18n.format(this.arcaneWorkbenchInventory.getInventoryName()), 8, 6, 4210752); this.fontRendererObj.drawString(this.playerInventory.hasCustomInventoryName() ? this.playerInventory.getInventoryName() : I18n.format(this.playerInventory.getInventoryName()), 8, this.ySize - 96 + 2, 4210752); - if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){ + if(this.hasWand()){ ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack(); @@ -156,7 +148,7 @@ public class GuiArcaneWorkbench extends GuiContainer { } // Tooltip only drawn if there is a wand - if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){ + if(this.hasWand()){ // Tooltip box drawTexturedModalRect(guiLeft + xSize, guiTop, xSize, 0, 256 - xSize - 4, ySize); @@ -191,8 +183,8 @@ public class GuiArcaneWorkbench extends GuiContainer { if(level > 0){ ItemStack stack = new ItemStack(item, level); - this.itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, guiLeft + xSize + 6 + x, y); - this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, guiLeft + xSize + 6 + x, y); + itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, guiLeft + xSize + 6 + x, y); + itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, guiLeft + xSize + 6 + x, y); x += 18; } } @@ -222,7 +214,8 @@ public class GuiArcaneWorkbench extends GuiContainer { } } - public void initGui() + @SuppressWarnings("unchecked") + public void initGui() { this.mc.thePlayer.openContainer = this.inventorySlots; this.guiLeft = (this.width - this.xSize) / 2; @@ -263,7 +256,8 @@ public class GuiArcaneWorkbench extends GuiContainer { return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && par6 < par2 + par4 + 1; } - protected void drawItemStackTooltip(ItemStack par1ItemStack, int par2, int par3) + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected void drawItemStackTooltip(ItemStack par1ItemStack, int par2, int par3) { List list = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); @@ -283,7 +277,8 @@ public class GuiArcaneWorkbench extends GuiContainer { drawHoveringText(list, par2, par3, (font == null ? fontRendererObj : font)); } - protected void drawHoveringText(List par1List, int par2, int par3, FontRenderer font) + @SuppressWarnings("rawtypes") + protected void drawHoveringText(List par1List, int par2, int par3, FontRenderer font) { if (!par1List.isEmpty()) { @@ -360,5 +355,71 @@ public class GuiArcaneWorkbench extends GuiContainer { } } + /** + * @return A list of TaggedInventoryAreas that will be used with the savestates. + */ + @Method(modid = "NotEnoughItems") + @Override + public List getInventoryAreas(GuiContainer gui) { + return Collections.emptyList(); + } + + /** + * NEI will give the specified item to the InventoryRange returned if the player's inventory is full. + * Should not return null, just an empty list + */ + @Method(modid = "NotEnoughItems") + @Override + public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item) { + return Collections.emptyList(); + } + + /** + * Handles clicks while an itemstack has been dragged from the item panel. Use this to set configurable slots and the like. + * Changes made to the stackSize of the dragged stack will be kept + * @param gui The current gui instance + * @param mousex The x position of the mouse + * @param mousey The y position of the mouse + * @param draggedStack The stack being dragged from the item panel + * @param button The button presed + * @return True if the drag n drop was handled. False to resume processing through other routes. The held stack will be deleted if draggedStack.stackSize == 0 + */ + @Method(modid = "NotEnoughItems") + @Override + public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) { + return false; + } + + /** + * Used to prevent the item panel from drawing on top of other gui elements. + * This function will also be called with a 1x1 size rectangle on the mouse position for determining if the given coordinate should override item panel functions such as scrolling + * @param x The x coordinate of the rectangle bounding the slot + * @param y The y coordinate of the rectangle bounding the slot + * @param w The w coordinate of the rectangle bounding the slot + * @param h The h coordinate of the rectangle bounding the slot + * @return true if the item panel slot within the specified rectangle should not be rendered. + */ + @Method(modid = "NotEnoughItems") + @Override + public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { + if(this.hasWand()) { + Rectangle itemPanel = new Rectangle(x, y, w, h); + Rectangle tooltip = new Rectangle(this.guiLeft + this.xSize, this.guiTop, tooltipWidth, tooltipHeight); + return itemPanel.intersects(tooltip); + } + return false; + } + + @Method(modid = "NotEnoughItems") + @Override + public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) { + return currentVisibility; + } + + private boolean hasWand() { + return this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() + && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand; + } + } diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index b11683b0..621b6c83 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,8 +2,8 @@ { "modid" : "wizardry", "name" : "Electroblob's Wizardry", - "version" : "1.1.5", - "url" : "https://minecraft.curseforge.com/projects/electroblobs-wizardry", + "version" : "${version}", + "url" : "https://www.curseforge.com/minecraft/mc-mods/electroblobs-wizardry/", "credits" : "Made by Electroblob", "authors" : [ "Electroblob"