diff --git a/build.gradle b/build.gradle index f8251051..b3d4f596 100755 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'eclipse' id 'idea' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[6.0,6.2)' + id 'net.neoforged.gradle' version '[6.0.18,6.2)' } version = "${mc_version}-${mod_version}" @@ -119,7 +119,7 @@ sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { - flatDir { dir 'libs' } + // flatDir { dir 'libs' } maven { // location of the maven that hosts JEI files name = "Progwml6 maven" @@ -147,7 +147,8 @@ dependencies { // The "userdev" classifier will be requested and setup by ForgeGradle. // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + // minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}" + minecraft "net.neoforged:forge:${mc_version}-${forge_version}" // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime @@ -159,15 +160,21 @@ dependencies { runtimeOnly fg.deobf("dev.emi:emi-forge:${emi_version}+${mc_version}") - // implementation fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") - runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") - compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api") + runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${mc_version}") + compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${mc_version}:api") compileOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}-FORGE:api") runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}-FORGE") - + +//optional deps + + compileOnly fg.deobf("vazkii.botania:Botania:${mc_version}-443-FORGE:api") + runtimeOnly fg.deobf("vazkii.botania:Botania:${mc_version}-443-FORGE") + + implementation fg.deobf("curse.maven:cyclic-239286:5940363") + // Example mod dependency using a mod jar from ./libs with a flat dir repository // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar // The group id is ignored when searching -- in this case, it is "blank" @@ -184,11 +191,9 @@ dependencies { // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html tasks.named('processResources', ProcessResources).configure { var replaceProperties = [ - minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, - forge_version: forge_version, forge_version_range: forge_version_range, - loader_version_range: loader_version_range, - mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, - mod_authors: mod_authors, mod_description: mod_description, + mc_version: mc_version, + mod_id: mod_id, + mod_version: mod_version ] inputs.properties replaceProperties @@ -202,11 +207,11 @@ tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, - 'Specification-Vendor' : mod_authors, + 'Specification-Vendor' : 'Lothrazar', 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, - 'Implementation-Vendor' : mod_authors, + 'Implementation-Vendor' : 'Lothrazar', 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } @@ -215,10 +220,6 @@ tasks.named('jar', Jar).configure { finalizedBy 'reobfJar' } -// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing: -// tasks.named('publish').configure { -// dependsOn 'reobfJar' -// } // Example configuration to allow publishing using the maven-publish plugin publishing { @@ -233,6 +234,7 @@ publishing { } } } + task signJar(type: SignJar, dependsOn: jar) { // findProperty allows us to reference the property without it existing. @@ -245,11 +247,11 @@ task signJar(type: SignJar, dependsOn: jar) { inputFile = jar.archivePath outputFile = jar.archivePath } + task cleanJar { delete 'build/libs' } - tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } diff --git a/gradle.properties b/gradle.properties index aba442b9..bb3e3aec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,31 +15,23 @@ mod_id=storagenetwork curse_id=268495 mod_version=1.11.3 - - mc_version=1.20.1 -forge_version=47.1.1 + +# NEO +forge_version=47.1.104 mod_name=storagenetwork mod_group_id=com.lothrazar.storagenetwork -mod_license=SeeGithub -mod_authors=Lothrazar -mod_description=mod -minecraft_version_range=[1.20.1,) -forge_version_range=[47,) -loader_version_range=[47,) mapping_channel=official -minecraft_version=1.20.1 mapping_version=1.20.1 -mc_version=1.20.1 -flib_file=4647711 -flib_version=0.0.7 -patchouli_version=81 -jei_version=15.0.0.12 +flib_version=0.0.14 +flib_file=5495793 +patchouli_version=84 +jei_version=15.3.0.4 emi_version=1.0.21 -curios_version=5.2.0-beta.3+1.20.1 +curios_version=5.7.2 diff --git a/settings.gradle b/settings.gradle index 291d399d..24584e97 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,8 +2,8 @@ pluginManagement { repositories { gradlePluginPortal() maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' + name = 'NeoForged' + url = 'https://maven.neoforged.net/releases' } } } diff --git a/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java b/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java index ec524f0d..4e8db9f1 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/AbstractNetworkScreen.java @@ -99,11 +99,18 @@ public boolean mouseScrolled(double x, double y, double mouseButton) { public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { super.mouseClicked(mouseX, mouseY, mouseButton); getNetwork().mouseClicked(mouseX, mouseY, mouseButton); - if (getNetwork().getSize() == NetworkScreenSize.NORMAL) { + var size = getNetwork().getSize(); + if (size.isCrafting()) { //TODO: this is part of crafting grid, to clear it out. should be its own button class int rectX = 63; int rectY = 110; + if (size == NetworkScreenSize.EXPANDED) { + rectX = 63; + rectY = 110 + 200; + } + System.out.println(mouseX + "," + mouseY); if (isHovering(rectX, rectY, 7, 7, mouseX, mouseY)) { + System.out.println("clear!"); PacketRegistry.INSTANCE.sendToServer(new ClearRecipeMessage()); PacketRegistry.INSTANCE.sendToServer(new RequestMessage(0, ItemStack.EMPTY, false, false)); return true; diff --git a/src/main/java/com/lothrazar/storagenetwork/block/expand/ScreenNetworkInventoryExpanded.java b/src/main/java/com/lothrazar/storagenetwork/block/expand/ScreenNetworkInventoryExpanded.java index 48d6a821..4cc9d02e 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/expand/ScreenNetworkInventoryExpanded.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/expand/ScreenNetworkInventoryExpanded.java @@ -17,12 +17,14 @@ public class ScreenNetworkInventoryExpanded extends AbstractNetworkScreen { - public static final int ROWS = 4 * 5 + 1; protected int W = 256; //i know they could all be in the same png file and i pull out sprites from it, but split images is easier to work with private TileableTexture head = new TileableTexture(new ResourceLocation(StorageNetworkMod.MODID, "textures/gui/expandable_head.png"), W, 10); + private TileableTexture head_right = new TileableTexture(new ResourceLocation(StorageNetworkMod.MODID, "textures/gui/expandable_head_right.png"), W, 10); private TileableTexture row = new TileableTexture(new ResourceLocation(StorageNetworkMod.MODID, "textures/gui/expandable_row.png"), W, SsnConsts.SQ); + private TileableTexture row_right = new TileableTexture(new ResourceLocation(StorageNetworkMod.MODID, "textures/gui/expandable_row_right.png"), W, SsnConsts.SQ); private TileableTexture crafting = new TileableTexture(new ResourceLocation(StorageNetworkMod.MODID, "textures/gui/expandable_crafting.png"), W, 66); + private TileableTexture crafting_right = new TileableTexture(new ResourceLocation(StorageNetworkMod.MODID, "textures/gui/expandable_crafting_right.png"), W, 66); private TileableTexture player = new TileableTexture(new ResourceLocation(StorageNetworkMod.MODID, "textures/gui/expandable_player.png"), 176, 84); protected final NetworkWidget network; private TileInventoryExpanded tile; @@ -31,8 +33,10 @@ public ScreenNetworkInventoryExpanded(ContainerNetworkInventoryExpanded containe super(container, inv, name); tile = container.tile; network = new NetworkWidget(this, NetworkScreenSize.EXPANDED); - imageHeight = player.height() + crafting.height() + row.height() * ROWS + head.height(); - imageWidth = W; + imageHeight = player.height() + crafting.height() + + row.height() * NetworkScreenSize.EXPANDED.lines() + + head.height(); + imageWidth = W + 12 * 18;//scrollWidth } @Override @@ -59,16 +63,18 @@ public void renderBg(GuiGraphics ms, float partialTicks, int mouseX, int mouseY) int xpos = xCenter; int ypos = yCenter; blitSegment(ms, head, xpos, ypos); + blitSegment(ms, head_right, xpos + W, ypos); ypos += head.height(); //render the rows for (int line = 0; line < network.getLines(); line++) { blitSegment(ms, row, xpos, ypos); + blitSegment(ms, row_right, xpos + W, ypos); ypos += row.height(); } blitSegment(ms, crafting, xpos, ypos); + blitSegment(ms, crafting_right, xpos + W, ypos); ypos += crafting.height() - 4; blitSegment(ms, player, xpos, ypos); - // ms.blit(player.texture(), xpos, ypos, 0, imageHeight, imageWidth, imageHeight); //update network network.applySearchTextToSlots(); network.renderItemSlots(ms, mouseX, mouseY, font); diff --git a/src/main/java/com/lothrazar/storagenetwork/gui/NetworkScreenSize.java b/src/main/java/com/lothrazar/storagenetwork/gui/NetworkScreenSize.java index d045d960..e04058d1 100644 --- a/src/main/java/com/lothrazar/storagenetwork/gui/NetworkScreenSize.java +++ b/src/main/java/com/lothrazar/storagenetwork/gui/NetworkScreenSize.java @@ -3,4 +3,31 @@ public enum NetworkScreenSize { //normal has the crafting table //large is the original inventory and remote with no crafting table NORMAL, LARGE, EXPANDED; + + public int lines() { + switch (this) { + case NORMAL: + return 4; + case LARGE: + return 4 * 2; + case EXPANDED: + return 4 * 5 + 1; + } + return 0; + } + + public int columns() { + switch (this) { + case NORMAL: + case LARGE: + return 9; + case EXPANDED: + return 25; + } + return 0; + } + + public boolean isCrafting() { + return this != LARGE; + } } \ No newline at end of file diff --git a/src/main/java/com/lothrazar/storagenetwork/gui/NetworkWidget.java b/src/main/java/com/lothrazar/storagenetwork/gui/NetworkWidget.java index 8419945c..1ddec49c 100644 --- a/src/main/java/com/lothrazar/storagenetwork/gui/NetworkWidget.java +++ b/src/main/java/com/lothrazar/storagenetwork/gui/NetworkWidget.java @@ -11,7 +11,6 @@ import com.lothrazar.storagenetwork.StorageNetworkMod; import com.lothrazar.storagenetwork.api.EnumSearchPrefix; import com.lothrazar.storagenetwork.api.IGuiNetwork; -import com.lothrazar.storagenetwork.block.expand.ScreenNetworkInventoryExpanded; import com.lothrazar.storagenetwork.gui.components.ButtonRequest; import com.lothrazar.storagenetwork.gui.components.ButtonRequest.TextureEnum; import com.lothrazar.storagenetwork.gui.slot.ItemSlotNetwork; @@ -60,37 +59,35 @@ public class NetworkWidget { // public int xNetwork = 8; public int yNetwork = 10; - private NetworkScreenSize size; + private final NetworkScreenSize size; public NetworkWidget(IGuiNetwork gui, NetworkScreenSize size) { this.gui = gui; stacks = Lists.newArrayList(); slots = Lists.newArrayList(); - setScreenSize(size); + this.size = size; + setScreenSize(); PacketRegistry.INSTANCE.sendToServer(new RequestMessage()); lastClick = System.currentTimeMillis(); } - private void setScreenSize(NetworkScreenSize size) { + private void setScreenSize() { int buffer = 0; + setLines(size.lines()); + setColumns(size.columns()); switch (size) { case NORMAL: buffer = 59; - setLines(4); break; case LARGE: - setLines(4 * 2); break; case EXPANDED: buffer = -10; this.xNetwork = 10; // head.height(); - this.scrollWidth = 256; - setLines(ScreenNetworkInventoryExpanded.ROWS); // the number of rows that can fit - setColumns(9 + 4); + this.scrollWidth = 256 + 12 * 18; //imageWidth break; } scrollHeight = (SsnConsts.SQ + 1) * this.getLines() + buffer; - this.size = size; } public void init(Font font) { @@ -393,25 +390,23 @@ public void mouseClicked(double mouseX, double mouseY, int mouseButton) { } } LocalPlayer player = Minecraft.getInstance().player; - if (player == null) { + if (player == null || !this.canClick()) { return; } ItemStack stackCarriedByMouse = player.containerMenu.getCarried(); if (!stackUnderMouse.isEmpty() && (mouseButton == UtilTileEntity.MOUSE_BTN_LEFT || mouseButton == UtilTileEntity.MOUSE_BTN_RIGHT) - && stackCarriedByMouse.isEmpty() && - this.canClick()) { + && stackCarriedByMouse.isEmpty()) { // Request an item (from the network) if we are in the upper section of the GUI PacketRegistry.INSTANCE.sendToServer(new RequestMessage(mouseButton, this.stackUnderMouse.copy(), Screen.hasShiftDown(), Screen.hasAltDown() || Screen.hasControlDown())); this.lastClick = System.currentTimeMillis(); } - else if (!stackCarriedByMouse.isEmpty() && inField((int) mouseX, (int) mouseY) && - this.canClick()) { - // Insert the item held by the mouse into the network - PacketRegistry.INSTANCE.sendToServer(new InsertMessage(0, mouseButton)); - this.lastClick = System.currentTimeMillis(); - } + else if (!stackCarriedByMouse.isEmpty() && inField((int) mouseX, (int) mouseY)) { + // Insert the item held by the mouse into the network + PacketRegistry.INSTANCE.sendToServer(new InsertMessage(0, mouseButton)); + this.lastClick = System.currentTimeMillis(); + } } private boolean inField(int mouseX, int mouseY) { diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index d6c97aff..65bddd70 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -16,7 +16,7 @@ issueTrackerURL="https://github.com/Lothrazar/Storage-Network/issues" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod -modId="storagenetwork" #mandatory +modId="${mod_id}" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it version="${mod_version}" #mandatory @@ -52,18 +52,12 @@ Storage Network to connect inventories to search and craft [[dependencies.storagenetwork]] modId="minecraft" mandatory=true - versionRange="[1.20.1,)" - ordering="NONE" - side="BOTH" -[[dependencies.storagenetwork]] - modId="jei" - mandatory=false - versionRange="[13.1,)" + versionRange="[${mc_version},)" ordering="NONE" side="BOTH" [[dependencies.storagenetwork]] modId="flib" mandatory=true - versionRange="[0.0.7,)" + versionRange="[0.0.14,)" ordering="NONE" side="BOTH" \ No newline at end of file diff --git a/src/main/resources/assets/storagenetwork/textures/gui/expandable_crafting.png b/src/main/resources/assets/storagenetwork/textures/gui/expandable_crafting.png index 5b99560f..35a74a03 100644 Binary files a/src/main/resources/assets/storagenetwork/textures/gui/expandable_crafting.png and b/src/main/resources/assets/storagenetwork/textures/gui/expandable_crafting.png differ diff --git a/src/main/resources/assets/storagenetwork/textures/gui/expandable_crafting_right.png b/src/main/resources/assets/storagenetwork/textures/gui/expandable_crafting_right.png new file mode 100644 index 00000000..102bd49e Binary files /dev/null and b/src/main/resources/assets/storagenetwork/textures/gui/expandable_crafting_right.png differ diff --git a/src/main/resources/assets/storagenetwork/textures/gui/expandable_head.png b/src/main/resources/assets/storagenetwork/textures/gui/expandable_head.png index 660eb880..a008cf75 100644 Binary files a/src/main/resources/assets/storagenetwork/textures/gui/expandable_head.png and b/src/main/resources/assets/storagenetwork/textures/gui/expandable_head.png differ diff --git a/src/main/resources/assets/storagenetwork/textures/gui/expandable_head_right.png b/src/main/resources/assets/storagenetwork/textures/gui/expandable_head_right.png new file mode 100644 index 00000000..f9913bdc Binary files /dev/null and b/src/main/resources/assets/storagenetwork/textures/gui/expandable_head_right.png differ diff --git a/src/main/resources/assets/storagenetwork/textures/gui/expandable_row.png b/src/main/resources/assets/storagenetwork/textures/gui/expandable_row.png index 3f3381a2..9429778e 100644 Binary files a/src/main/resources/assets/storagenetwork/textures/gui/expandable_row.png and b/src/main/resources/assets/storagenetwork/textures/gui/expandable_row.png differ diff --git a/src/main/resources/assets/storagenetwork/textures/gui/expandable_row_right.png b/src/main/resources/assets/storagenetwork/textures/gui/expandable_row_right.png new file mode 100644 index 00000000..147528c4 Binary files /dev/null and b/src/main/resources/assets/storagenetwork/textures/gui/expandable_row_right.png differ