aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--README.md2
-rw-r--r--src/main/java/de/cowtipper/cowlection/command/MooCommand.java35
3 files changed, 37 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd261d6..210ed5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- hover over one of the area/location-items in a *sub*-category of the Bestiary to see an overview of the tiers upgrades you are closest to
- can be ordered by fewest kills or lowest % to next tier by clicking on the area/location item
- `/moo whatAmILookingAt` (or: `/m waila`)
- - copy info of "the thing" you're looking at (NPC or mob + nearby "text-only" armor stands; armor stand, placed skull, dropped item, item in item frame, map on wall)
+ - copy info of "the thing" you're looking at (NPC or mob + nearby "text-only" armor stands; armor stand, placed skull, banner, sign, dropped item, item in item frame, map on wall)
- automatically decodes base64 data (e.g. skin details) and unix timestamps
- Auction house: Mark sold/ended/expired auctions
- either one letter (S, E, E) or the full word
diff --git a/README.md b/README.md
index 3a480a3..5e3c7fa 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ It is a collection of different features mainly focused on Hypixel SkyBlock. ðŸ
| Toggle join/leave notifications for friends, guild members or best friends separately | `/moo config` → Notifications |
| Copy chat component | <kbd>ALT</kbd> + <kbd>right click</kbd><br>Hold <kbd>shift</kbd> to copy full component |
| Copy inventories to clipboard as JSON | <kbd>CTRL</kbd> + <kbd>C</kbd> |
-| Copy info of "the thing" you're looking at (NPC or mob + nearby "text-only" armor stands; armor stand, placed skull, dropped item, item in item frame, map on wall) | `/moo whatAmILookingAt` |
+| Copy info of "the thing" you're looking at (NPC or mob + nearby "text-only" armor stands; armor stand, placed skull, banner, sign, dropped item, item in item frame, map on wall) | `/moo whatAmILookingAt` |
| Tab-completable usernames for several commands (e.g. `/party`, `/invite`, ...) | `/moo config` &rarr; `Commands with Tab-completable usernames` for full list of commands |
| Auto-replace `/r` with `/w <latest username>` | `/r `, use `/rr` to avoid auto-replacement |
| Change guiScale to any value | `/moo guiscale [newValue]` |
diff --git a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java
index b7edc46..26ef279 100644
--- a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java
+++ b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java
@@ -29,11 +29,14 @@ import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.HoverEvent;
import net.minecraft.init.Items;
+import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemSkull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityBanner;
+import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.*;
import net.minecraft.world.storage.MapData;
@@ -782,6 +785,38 @@ public class MooCommand extends CommandBase {
main.getChatHelper().sendMessage(EnumChatFormatting.GREEN, "Copied skull data to clipboard.");
return;
}
+ } else if (te instanceof TileEntitySign) {
+ TileEntitySign sign = (TileEntitySign) te;
+ NBTTagCompound nbt = new NBTTagCompound();
+ for (int lineNr = 0; lineNr < sign.signText.length; lineNr++) {
+ nbt.setString("Text" + (lineNr + 1), sign.signText[lineNr].getFormattedText());
+ nbt.setString("TextUnformatted" + (lineNr + 1), sign.signText[lineNr].getUnformattedText());
+ }
+ GuiScreen.setClipboardString(GsonUtils.toJson(nbt, true));
+ main.getChatHelper().sendMessage(EnumChatFormatting.GREEN, "Copied sign data to clipboard.");
+ return;
+ } else if (te instanceof TileEntityBanner) {
+ List<String> possiblePatterns = Arrays.asList("b", "bl", "bo", "br", "bri", "bs", "bt", "bts", "cbo", "cr", "cre", "cs", "dls", "drs", "flo", "gra", "hh", "ld", "ls", "mc", "moj", "mr", "ms", "rd", "rs", "sc", "sku", "ss", "tl", "tr", "ts", "tt", "tts", "vh", "lud", "rud", "gru", "hhb", "vhr");
+ String base64Alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/";
+
+ TileEntityBanner banner = (TileEntityBanner) te;
+ Iterator<TileEntityBanner.EnumBannerPattern> bannerPatterns = banner.getPatternList().iterator();
+ Iterator<EnumDyeColor> bannerColors = banner.getColorList().iterator();
+ try {
+ // hash used by needcoolshoes.com
+ StringBuilder bannerHash = new StringBuilder();
+ while (bannerPatterns.hasNext() && bannerColors.hasNext()) {
+ int patternId = possiblePatterns.indexOf(bannerPatterns.next().getPatternID());
+ int color = bannerColors.next().getDyeDamage();
+ int first = ((patternId >> 6) << 4) | (color & 0xF);
+ int second = patternId & 0x3F;
+ bannerHash.append(base64Alphabet.charAt(first)).append(base64Alphabet.charAt(second));
+ }
+ main.getChatHelper().sendMessage(new MooChatComponent("âž¡ View banner on needcoolshoes.com").green().setUrl("https://www.needcoolshoes.com/banner?=" + bannerHash));
+ } catch (IndexOutOfBoundsException e) {
+ main.getChatHelper().sendMessage(EnumChatFormatting.RED, "Failed to parse banner data (unknown banner pattern).");
+ }
+ return;
}
break;
}