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

Add support for bows #24

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private void migrateFromOne(ConfigurationVersionUpdateEvent event) {
int pickaxe = defaultPercentage;
int axe = defaultPercentage;
int shovel = defaultPercentage;
int bow = defaultPercentage;
int crossbow = defaultPercentage;
int lighter = defaultPercentage;
int shears = defaultPercentage;
Expand All @@ -55,6 +56,7 @@ private void migrateFromOne(ConfigurationVersionUpdateEvent event) {
pickaxe = config.get("pickaxePercentage").getAsInt();
axe = config.get("axePercentage").getAsInt();
shovel = config.get("shovelPercentage").getAsInt();
bow = config.get("bowPercentage").getAsInt();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be removed as it would throw an exception resulting in every other value not being migrated

Suggested change
bow = config.get("bowPercentage").getAsInt();

crossbow = config.get("crossbowPercentage").getAsInt();
lighter = config.get("lighterPercentage").getAsInt();
shears = config.get("shearsPercentage").getAsInt();
Expand All @@ -68,6 +70,7 @@ private void migrateFromOne(ConfigurationVersionUpdateEvent event) {
tools.add(gson.toJsonTree(new WarnTool(Type.PICKAXE, warnSound, lastHitSound, pickaxe, openChat, lastHitWarn)));
tools.add(gson.toJsonTree(new WarnTool(Type.AXE, warnSound, lastHitSound, axe, openChat, lastHitWarn)));
tools.add(gson.toJsonTree(new WarnTool(Type.SHOVEL, warnSound, lastHitSound, shovel, openChat, lastHitWarn)));
tools.add(gson.toJsonTree(new WarnTool(Type.BOW, warnSound, lastHitSound, bow, openChat, lastHitWarn)));
tools.add(gson.toJsonTree(new WarnTool(Type.CROSSBOW, warnSound, lastHitSound, crossbow, openChat, lastHitWarn)));
tools.add(gson.toJsonTree(new WarnTool(Type.LIGHTER, warnSound, lastHitSound, lighter, openChat, lastHitWarn)));
tools.add(gson.toJsonTree(new WarnTool(Type.SHEARS, warnSound, lastHitSound, shears, openChat, lastHitWarn)));
Expand Down
11 changes: 7 additions & 4 deletions core/src/main/java/com/rappytv/toolwarn/util/WarnTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ public enum Type {
AXE(2, 0),
SHOVEL(3, 0),
HOE(0, 1),
CROSSBOW(1, 1),
LIGHTER(2, 1),
SHEARS(3, 1),
TRIDENT(0, 2);
BOW(1, 1),
CROSSBOW(2, 1),
LIGHTER(3, 1),
SHEARS(0, 2),
TRIDENT(1, 2);

private final ResourceLocation sprite = ResourceLocation.create("toolwarn", "textures/tools.png");
private final int x;
Expand Down Expand Up @@ -102,6 +103,8 @@ public static Type getByItem(ItemStack itemStack) {
return SHOVEL;
} else if (path.endsWith("_hoe")) {
return HOE;
} else if (path.equalsIgnoreCase("bow")) {
return BOW;
} else if (path.equalsIgnoreCase("crossbow")) {
return CROSSBOW;
} else if (path.equalsIgnoreCase("flint_and_steel")) {
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/assets/toolwarn/i18n/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"axe": "Axt",
"shovel": "Schaufel",
"hoe": "Hacke",
"bow": "Bogen",
"crossbow": "Armbrust",
"lighter": "Feuerzeug",
"shears": "Schere",
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/assets/toolwarn/i18n/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"axe": "Axe",
"shovel": "Shovel",
"hoe": "Hoe",
"bow": "Bow",
"crossbow": "Crossbow",
"lighter": "Flint and steel",
"shears": "Shears",
Expand Down
Binary file modified core/src/main/resources/assets/toolwarn/textures/tools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.