From 1333bae8d967a4de5e52011626583698ea36f440 Mon Sep 17 00:00:00 2001 From: Chris Massie Date: Thu, 17 Mar 2022 14:23:49 +0000 Subject: [PATCH] Updated docs, fixed some warnings Updated the readme to reflect recent changes. Bumped the version number from 1.0 to 1.1 Fixed or suppressed some minor warnings. --- build.gradle | 2 +- readme.md | 12 +++++++++++- .../java/scot/massie/mc/itemcopy/CommandHandler.java | 3 ++- src/main/java/scot/massie/mc/itemcopy/CopyPath.java | 5 ++--- src/main/java/scot/massie/mc/itemcopy/Paster.java | 3 --- src/main/resources/META-INF/mods.toml | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index bf9a342..6920901 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.0' +version = '1.1' group = 'scot.massie.mc.itemcopy' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'itemcopy' diff --git a/readme.md b/readme.md index c3ee1b9..ca02153 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,21 @@ # Itemcopy -This mod adds two commands: `/copyitem` and `/pasteitem`. +This mod adds the ability to copy, paste, and share items with NBT data. The intent of this mod is to give players the ability to copy items they may have created in a way that doesn't give them the ability to create new items. It was inspired by the desire to easily store, recall, and share Chisels & Bits patterns. +## Commands + `/copyitem ` lets you copy the current item in your hand, with a given name, to a file. (see below) This name may be multiple words long. You can use the same name for copies of different items. (e.g. for a book and for a banner) `/pasteitem ` lets you paste a previously copied item onto the item in your hand, as long as it's an item of the same type. As you type, possible copies will be suggested. This allows you to copy and paste items between worlds and even onto servers. +`/shareitem ` shares the item in your hand with another player. If they accept, they will have access to it as though they had copied it themselves. + +`/shareitem ` shares an already made copy of an item with another player, where "copy name" is the name an item was copied as. (e.g. with `/copyitem`) + +`/acceptshareditem ` accepts an offer to share a copy of an item from another player. "Copy name" is the name the copy will be saved as. If no "copy name" is provided, it will be saved with the name the person sharing the item gave it, unless they're sharing the item in their hand and not a saved copy, in which case it will be saved as "shareditem". + ## Whitelist On first run, a whitelist file is created in the config folder (`config/itemcopy-whitelist.txt`) where each line is an item ID that's whitelisted for this mod. You can add or remove whitelisted items by adding them to, or removing them from, this file. @@ -35,3 +43,5 @@ Some items that seem conceptually variants of the same item may be entirely sepa ## Technical Built against Forge 39.1.0 for Minecraft 1.18.1. + +This mod is required on both the server and client sides. diff --git a/src/main/java/scot/massie/mc/itemcopy/CommandHandler.java b/src/main/java/scot/massie/mc/itemcopy/CommandHandler.java index ef5532c..5286eef 100644 --- a/src/main/java/scot/massie/mc/itemcopy/CommandHandler.java +++ b/src/main/java/scot/massie/mc/itemcopy/CommandHandler.java @@ -291,7 +291,8 @@ public static int cmdShare(CommandContext context) return 1; } - public static int cmdShare_itemInHand(CommandContext context) + public static int cmdShare_itemInHand( + @SuppressWarnings("BoundedWildcard") CommandContext context) { CommandSourceStack src = context.getSource(); diff --git a/src/main/java/scot/massie/mc/itemcopy/CopyPath.java b/src/main/java/scot/massie/mc/itemcopy/CopyPath.java index 33d1777..becd79f 100644 --- a/src/main/java/scot/massie/mc/itemcopy/CopyPath.java +++ b/src/main/java/scot/massie/mc/itemcopy/CopyPath.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -15,8 +14,8 @@ public final class CopyPath implements Iterable private final List steps; - public CopyPath(List steps) - { this.steps = Collections.unmodifiableList(new ArrayList<>(steps)); } + public CopyPath(@SuppressWarnings("TypeMayBeWeakened") List steps) + { this.steps = List.copyOf(steps); } public CopyPath(String... steps) { this(Arrays.asList(steps)); } diff --git a/src/main/java/scot/massie/mc/itemcopy/Paster.java b/src/main/java/scot/massie/mc/itemcopy/Paster.java index 02f3faf..e0df129 100644 --- a/src/main/java/scot/massie/mc/itemcopy/Paster.java +++ b/src/main/java/scot/massie/mc/itemcopy/Paster.java @@ -19,9 +19,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import java.util.Optional; import java.util.function.Supplier; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 2a7c0f9..2781ec4 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="itemcopy" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.0 for Minecraft 1.18" #mandatory +version="1.1 for Minecraft 1.18" #mandatory # A display name for the mod displayName="ItemCopy" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/