Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default tablet keybind #32

Open
wants to merge 1 commit into
base: 1.21
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Requires <a href="https://modrinth.com/mod/connector">Connector</a> and <a href=

**Scattered Shards** adds a system of collectible "shards" that can be created via a UI and placed in-world.

Type `/shards` or use a *Shard Tablet* any time to view which shards you've collected, and which ones are left!
Type `/shards` or use a *Shard Tablet* any time to view which shards you've collected, and which ones are left! There is also a keybind to open the tablet;
it is not bound by default, so you may want to create a default setting for your modpack!

**Features:**
- Shards can have titles, descriptions, and face art in the form of item stacks or arbitrary textures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class ScatteredShardsClient implements ClientModInitializer {
public static final KeyBinding VIEW_COLLECTION = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.scattered_shards.collection",
InputUtil.GLFW_KEY_J,
InputUtil.UNKNOWN_KEY.getCode(),
"key.categories.scattered_shards"
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
public class ShardCollectedToast implements Toast {
public static final int TITLE_COLOR = 0xFF_FFFF00;
public static final Text TITLE = Text.translatable("toast.scattered_shards.collected");
public static final Text HINT = Text.translatable("toast.scattered_shards.collected.prompt", Text.keybind(ScatteredShardsClient.VIEW_COLLECTION.getTranslationKey()).formatted(Formatting.GOLD).formatted(Formatting.BOLD));
private static final Identifier TEXTURE = Identifier.ofVanilla("toast/advancement");
public static final int DURATION = 5000;

Expand All @@ -33,9 +32,24 @@ public class ShardCollectedToast implements Toast {
private final int height;

public ShardCollectedToast(Shard shard) {

Text hint;

if (ScatteredShardsClient.VIEW_COLLECTION.isUnbound()) {
hint = Text.translatable(
"toast.scattered_shards.collected.prompt_without_key",
Text.literal("/shards").formatted(Formatting.AQUA).formatted(Formatting.BOLD)
);
} else {
hint = Text.translatable(
"toast.scattered_shards.collected.prompt",
Text.keybind(ScatteredShardsClient.VIEW_COLLECTION.getTranslationKey()).formatted(Formatting.GOLD).formatted(Formatting.BOLD)
);
}

this.icon = shard.icon();
this.descLines = wrap(List.of(shard.name().copy().withColor(ScatteredShardsAPI.getClientLibrary().shardTypes().get(shard.shardTypeId()).orElse(ShardType.MISSING).textColor())));
this.hintLines = wrap(List.of(HINT));
this.hintLines = wrap(List.of(hint));
this.height = 32 + Math.max(0, Math.max(this.descLines.size(), this.hintLines.size()) - 1) * 11;
icon.ifRight(ModMetaUtil::touchIconTexture);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/scattered_shards/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

"toast.scattered_shards.collected": "Shard Collected!",
"toast.scattered_shards.collected.prompt": "Press [%s] to view",
"toast.scattered_shards.collected.prompt_without_key": "Use %s to view",
"toast.scattered_shards.shard_mod.title": "Shard Modification",
"toast.scattered_shards.shard_mod.success": "Successfully modified '%s'",
"toast.scattered_shards.shard_mod.fail": "Failed to modify '%s'",
Expand Down
Loading