Skip to content

Commit ad6d6e6

Browse files
committed
allow rebinding break keybind
1 parent dbd860f commit ad6d6e6

File tree

14 files changed

+138
-14
lines changed

14 files changed

+138
-14
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Numismatics 1.0.7
33
------------------------------------------------------
44
Fixes
55
- Fix coins stacked above 127 visually disappearing on the client in Brass Depositors
6+
7+
Changes
8+
- Allow rebinding the break keybind using the crouch keybind (was previously shift + break key)
69
------------------------------------------------------
710
Numismatics 1.0.6
811
------------------------------------------------------

common/src/generated/resources/.cache/630af4bded938901e0e1fd57c58a2ac245292828

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.20.1 2024-04-19T18:54:51.68026008 Create: Numismatics/Numismatics' Advancements
1+
// 1.20.1 2024-05-30T17:23:26.208852962 Create: Numismatics/Numismatics' Advancements
22
8f32fb49ef81058e2e660fac983dbef2f554db38 data/numismatics/advancements/root.json
33
645c92e6e449889ed4cf617432fd6fa87ffe355b data/numismatics/advancements/questionable_investment.json
44
894790d980b33b5cc24a21937c7db72bf0af1c5a data/numismatics/advancements/money_laundering.json

common/src/generated/resources/.cache/6ba62358bf8e130d42215f5f9edbedd611809677

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.20.1 2024-04-19T18:54:51.679233321 Create: Numismatics/Numismatics Standard Recipes
1+
// 1.20.1 2024-05-30T17:23:26.207789631 Create: Numismatics/Numismatics Standard Recipes
22
e16d9a5134c226db94bb389c44e55a8b393ca6c4 data/numismatics/recipes/crafting/brass_depositor.json
33
151c31385fcbf7283f380e25ee2c8fdacd6d5103 data/numismatics/recipes/crafting/orange_id_card.json
44
858305a3537cdcb5bb19b883e688ddb876f0473c data/numismatics/recipes/crafting/brown_id_card.json
@@ -16,8 +16,8 @@ b359f00206e8522f61fa06cc6bda43142f180e30 data/numismatics/recipes/crafting/lime_
1616
29ba720cf8ae338eec2edbd997fcb3f6a8de7cd1 data/numismatics/advancements/recipes/misc/crafting/vendor.json
1717
11be645cfbf1ee8721ffceb2b47d30e2923e9323 data/numismatics/advancements/recipes/misc/crafting/andesite_depositor.json
1818
ba04c62863e2c847ad7ac240e282c3f6ecd85d62 data/numismatics/recipes/crafting/banking_guide.json
19-
0000b8a2cd58843eb7cf2c0b4b7b71a07baf3652 data/numismatics/advancements/recipes/misc/crafting/magenta_card.json
2019
a2966bf8eb0aa54b64e4c77d1522bd6163e03a1d data/numismatics/advancements/recipes/misc/crafting/orange_id_card.json
20+
0000b8a2cd58843eb7cf2c0b4b7b71a07baf3652 data/numismatics/advancements/recipes/misc/crafting/magenta_card.json
2121
0e1680b878cfa51c04809504b3542cb6312027a1 data/numismatics/recipes/crafting/gray_id_card.json
2222
af8adf907389ccfa18bfa035d40108f9c5755ddd data/numismatics/recipes/crafting/white_id_card.json
2323
5c882ba48afb491eac809ad5fef36c5d419afd1f data/numismatics/recipes/crafting/purple_card.json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// 1.20.1 2024-04-19T18:54:51.680063444 Create: Numismatics/Numismatics' Sequenced Assembly Recipes
1+
// 1.20.1 2024-05-30T17:23:26.208697274 Create: Numismatics/Numismatics' Sequenced Assembly Recipes

common/src/generated/resources/.cache/d6a1ec2d08c6d6d7facbde77dda6f0158c00bbd6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.20.1 2024-04-19T18:54:51.676973276 Create: Numismatics/Registrate Provider for numismatics [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
1+
// 1.20.1 2024-05-30T17:23:26.206118089 Create: Numismatics/Registrate Provider for numismatics [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
22
70c481f36a9718ac48632e6939ac6ba785be4c9e assets/numismatics/models/item/black_id_card.json
33
95ef415a564eba1d212053195d25b199427b94e3 assets/numismatics/blockstates/creative_vendor.json
44
4458283178334ae169a7cbbd1aa09067cbb99ee7 data/numismatics/tags/items/internal/dyes/green_dyes.json
@@ -38,11 +38,11 @@ a8cb82f19034a0e724e12df45c883e9cd469c210 assets/numismatics/models/item/green_ca
3838
cca7e7be961c6ed6272f19211bb17707b7934155 assets/numismatics/models/item/creative_vendor.json
3939
9fdcd12c871f136e66973a8c02be94a675a4b727 data/numismatics/tags/items/internal/dyes/yellow_dyes.json
4040
dc5c60bbbaf3a5d7bc1f9bc0c9377757dbd8de49 data/numismatics/loot_tables/blocks/bank_terminal.json
41-
bb6968537ab305ee37b6268f9037a689b8c8a9c9 assets/numismatics/lang/en_us.json
41+
1cd26e33d78f7b7f93e9d7466eae50f027b34075 assets/numismatics/lang/en_us.json
4242
edd6109002439af0f15959debe4cb9cca254add8 data/minecraft/tags/blocks/mineable/pickaxe.json
4343
facbd710d107ebc9b2c6ddfa3b59a16d5f85c992 assets/numismatics/models/item/spur.json
4444
d6f017479b3cc538f73d7fb0a1e65d1742bab266 assets/numismatics/models/item/light_blue_id_card.json
45-
6dd2c5d0c4c607aa601fb66217f4f60a5c008489 assets/numismatics/lang/en_ud.json
45+
9f38b4224f4986b2e40be7e68c40a0c67a866561 assets/numismatics/lang/en_ud.json
4646
e62db1a880d468865769307ad19f16d9b7dac7c1 data/numismatics/tags/items/internal/dyes/light_gray_dyes.json
4747
c5958ebbc2782c2611690c642713cadc59656814 assets/numismatics/models/item/light_blue_card.json
4848
9e6e50d40e3688ae681107e60ac5ff5fc22585f9 data/numismatics/loot_tables/blocks/andesite_depositor.json

common/src/generated/resources/assets/numismatics/lang/en_ud.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"block.numismatics.creative_vendor": "ɹopuǝΛ ǝʌıʇɐǝɹƆ",
2525
"block.numismatics.creative_vendor.tooltip": "ᴚOᗡNƎΛ ƎΛI⟘ⱯƎᴚƆ",
2626
"block.numismatics.creative_vendor.tooltip.summary": "˙ʞɔoʇs ɟo ʇno unɹ ɹo dn ןןıɟ ɹǝʌǝu ןןıʍ pǝɹnbıɟuoɔ ǝɔuo 'ɹopuǝʌ ǝɥʇ ɟo uoısɹǝʌ ‾ǝʌıʇɐǝɹƆ‾",
27-
"block.numismatics.trusted_block.attempt_break": "ʞɔoןq sıɥʇ ʞɐǝɹq oʇ ʇɟıɥs pןoH",
27+
"block.numismatics.trusted_block.attempt_break": "ʞɔoןq sıɥʇ ʞɐǝɹq oʇ >ʇuǝıןɔ uo ǝɔɐןdǝɹ sɔıʇɐɯsıɯnu< pןoH",
2828
"block.numismatics.vendor": "ɹopuǝΛ",
2929
"block.numismatics.vendor.tooltip": "ᴚOᗡNƎΛ",
3030
"block.numismatics.vendor.tooltip.mode": "ǝpoW",

common/src/generated/resources/assets/numismatics/lang/en_us.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"block.numismatics.creative_vendor": "Creative Vendor",
2525
"block.numismatics.creative_vendor.tooltip": "CREATIVE VENDOR",
2626
"block.numismatics.creative_vendor.tooltip.summary": "_Creative_ version of the vendor, once configured will never fill up or run out of stock.",
27-
"block.numismatics.trusted_block.attempt_break": "Hold shift to break this block",
27+
"block.numismatics.trusted_block.attempt_break": "Hold <numismatics replace on client> to break this block",
2828
"block.numismatics.vendor": "Vendor",
2929
"block.numismatics.vendor.tooltip": "VENDOR",
3030
"block.numismatics.vendor.tooltip.mode": "Mode",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Numismatics
3+
* Copyright (c) 2024 The Railways Team
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package dev.ithundxr.createnumismatics.events;
20+
21+
import dev.ithundxr.createnumismatics.annotation.event.MultiLoaderEvent;
22+
import net.minecraft.client.Minecraft;
23+
import net.minecraft.network.chat.Component;
24+
25+
public class ClientEvents {
26+
@MultiLoaderEvent
27+
public static Component clientReceiveMessage(Component message, boolean overlay) {
28+
String messageString = message.getString();
29+
String replaceString = "<numismatics replace on client>";
30+
31+
if (messageString.equals("Hold " + replaceString + " to break this block") && overlay) {
32+
String keyName = Minecraft.getInstance().options.keyShift.getTranslatedKeyMessage().getString();
33+
34+
return Component.literal(messageString.replace(replaceString, keyName)).setStyle(message.getStyle());
35+
}
36+
37+
return message;
38+
}
39+
}

common/src/main/java/dev/ithundxr/createnumismatics/events/CommonEvents.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import dev.ithundxr.createnumismatics.registry.NumismaticsPackets;
3131
import dev.ithundxr.createnumismatics.registry.packets.BankAccountLabelPacket;
3232
import net.minecraft.ChatFormatting;
33+
import net.minecraft.client.Minecraft;
34+
import net.minecraft.client.Options;
3335
import net.minecraft.core.BlockPos;
3436
import net.minecraft.server.level.ServerPlayer;
3537
import net.minecraft.world.InteractionHand;
@@ -60,7 +62,7 @@ public static boolean onBlockBreak(LevelAccessor level, BlockPos pos, BlockState
6062
mayBreak = conditionalBreak.mayBreak(level, pos, state, player);
6163
}
6264

63-
if (state.getBlock() instanceof TrustedBlock trustedBlock && !player.isShiftKeyDown() && trustedBlock.isTrusted(player, level, pos)) {
65+
if (state.getBlock() instanceof TrustedBlock trustedBlock && !player.isCrouching() && trustedBlock.isTrusted(player, level, pos)) {
6466
player.displayClientMessage(Components.translatable("block.numismatics.trusted_block.attempt_break")
6567
.withStyle(ChatFormatting.DARK_RED), true);
6668
}

common/src/main/resources/assets/numismatics/lang/default/interface.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
"gui.numismatics.vendor.full.named": "Vendor is full, contact %s to empty it",
2929
"gui.numismatics.vendor.no_item_in_hand": "Hold the stack of items you want to sell",
3030

31-
"block.numismatics.trusted_block.attempt_break": "Hold shift to break this block"
31+
"block.numismatics.trusted_block.attempt_break": "Hold <numismatics replace on client> to break this block"
3232
}

fabric/build.gradle.kts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Numismatics
3+
* Copyright (c) 2024 The Railways Team
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
119
import dev.ithundxr.silk.ChangelogText
220

321
architectury.fabric()
@@ -13,10 +31,8 @@ loom {
1331
name = "Minecraft Data"
1432
vmArg("-Dfabric-api.datagen")
1533
vmArg("-Dfabric-api.datagen.output-dir=${common.file("src/generated/resources")}")
16-
vmArg("-Dfabric-api.datagen.modid=railways")
34+
vmArg("-Dfabric-api.datagen.modid=numismatics")
1735
vmArg("-Dporting_lib.datagen.existing_resources=${common.file("src/main/resources")}")
18-
19-
environmentVariable("DATAGEN", "TRUE")
2036
}
2137

2238
getByName("client") {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Numismatics
3+
* Copyright (c) 2024 The Railways Team
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package dev.ithundxr.createnumismatics.events.fabric;
20+
21+
import dev.ithundxr.createnumismatics.events.ClientEvents;
22+
import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
23+
24+
public class ClientEventsFabric {
25+
public static void init() {
26+
ClientReceiveMessageEvents.MODIFY_GAME.register(ClientEvents::clientReceiveMessage);
27+
}
28+
}

fabric/src/main/java/dev/ithundxr/createnumismatics/fabric/NumismaticsClientImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
package dev.ithundxr.createnumismatics.fabric;
2020

2121
import dev.ithundxr.createnumismatics.NumismaticsClient;
22+
import dev.ithundxr.createnumismatics.events.ClientEvents;
23+
import dev.ithundxr.createnumismatics.events.fabric.ClientEventsFabric;
2224
import net.fabricmc.api.ClientModInitializer;
2325

2426
public class NumismaticsClientImpl implements ClientModInitializer {
2527
@Override
2628
public void onInitializeClient() {
2729
NumismaticsClient.init();
30+
ClientEventsFabric.init();
2831
}
2932
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Numismatics
3+
* Copyright (c) 2024 The Railways Team
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package dev.ithundxr.createnumismatics.events.forge;
20+
21+
import dev.ithundxr.createnumismatics.events.ClientEvents;
22+
import net.minecraftforge.api.distmarker.Dist;
23+
import net.minecraftforge.client.event.ClientChatReceivedEvent;
24+
import net.minecraftforge.eventbus.api.SubscribeEvent;
25+
import net.minecraftforge.fml.common.Mod;
26+
27+
@Mod.EventBusSubscriber(Dist.CLIENT)
28+
public class ClientEventsForge {
29+
@SubscribeEvent
30+
public static void onClientSystemChat(ClientChatReceivedEvent.System event) {
31+
event.setMessage(ClientEvents.clientReceiveMessage(event.getMessage(), event.isOverlay()));
32+
}
33+
}

0 commit comments

Comments
 (0)