generated from JamCoreModding/multi-loader-template-mod
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a72b35e
commit eba4f94
Showing
31 changed files
with
251 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
common/src/client/java/io/github/jamalam360/utility_belt/client/UtilityBeltCommands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package io.github.jamalam360.utility_belt.client; | ||
|
||
import com.mojang.brigadier.CommandDispatcher; | ||
import dev.architectury.event.events.client.ClientCommandRegistrationEvent; | ||
import io.github.jamalam360.utility_belt.UtilityBelt; | ||
import io.github.jamalam360.utility_belt.UtilityBeltItem; | ||
import io.github.jamalam360.utility_belt.client.network.ClientNetworking; | ||
import io.github.jamalam360.utility_belt.state.StateManager; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.commands.CommandBuildContext; | ||
import net.minecraft.network.chat.ClickEvent; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
import static dev.architectury.event.events.client.ClientCommandRegistrationEvent.literal; | ||
|
||
public class UtilityBeltCommands { | ||
public static void registerCommands(CommandDispatcher<ClientCommandRegistrationEvent.ClientCommandSourceStack> dispatcher, CommandBuildContext _ctx) { | ||
literal("utilitybelt") | ||
.then( | ||
literal("help") | ||
.executes(ctx -> { | ||
ctx.getSource().arch$sendSuccess(UtilityBeltCommands::getHelpMessage, false); | ||
return 0; | ||
}) | ||
) | ||
.then( | ||
literal("fixme") | ||
.executes(ctx -> { | ||
Player player = Minecraft.getInstance().player; | ||
|
||
StateManager stateManager = StateManager.getStateManager(player); | ||
stateManager.setInBelt(player, false); | ||
stateManager.setSelectedBeltSlot(player, 0); | ||
ClientNetworking.sendNewStateToServer(false, 0, false); | ||
ctx.getSource().arch$sendSuccess(() -> Component.literal("Reset state"), false); | ||
return 0; | ||
}) | ||
); | ||
} | ||
|
||
public static void registerDevelopmentCommands(CommandDispatcher<ClientCommandRegistrationEvent.ClientCommandSourceStack> dispatcher, CommandBuildContext _ctx) { | ||
dispatcher.register( | ||
literal("dumpstatec") | ||
.executes(ctx -> { | ||
var player = Minecraft.getInstance().player; | ||
|
||
StateManager stateManager = StateManager.getStateManager(player); | ||
|
||
System.out.println("In belt: " + stateManager.isInBelt(player)); | ||
System.out.println("Selected slot: " + stateManager.getSelectedBeltSlot(player)); | ||
System.out.println("Belt NBT: " + UtilityBeltItem.getBelt(player).get(UtilityBelt.UTILITY_BELT_INVENTORY_COMPONENT_TYPE.get())); | ||
|
||
StateManager stateManagerS = StateManager.getStateManager(false); | ||
System.out.println("In belt (client but server): " + stateManagerS.isInBelt(player)); | ||
System.out.println("Selected slot (client but server): " + stateManagerS.getSelectedBeltSlot(player)); | ||
System.out.println("Belt NBT (client but server): " + UtilityBeltItem.getBelt(player).get(UtilityBelt.UTILITY_BELT_INVENTORY_COMPONENT_TYPE.get())); | ||
return 0; | ||
}) | ||
); | ||
} | ||
|
||
private static Component getHelpMessage() { | ||
return Component.literal("/utilitybelt help").withStyle(ChatFormatting.YELLOW) | ||
.append(Component.literal(" - Shows this help message").withStyle(ChatFormatting.GRAY)) | ||
.append(Component.literal("\n")) | ||
.append(Component.literal("/utilitybelt fixme").withStyle(ChatFormatting.YELLOW)) | ||
.append(Component.literal(" - Fixes your state. Useful if you manage to get stuck in the belt. If you use this command please report the circumstances to ").withStyle(ChatFormatting.GRAY)) | ||
.append(Component.literal("https://github.com/JamCoreModding/utility-belt").withStyle(s -> s.withUnderlined(true).withColor(ChatFormatting.BLUE).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/JamCoreModding/utility-belt")))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...0/utility_belt/mixin/client/GuiMixin.java → ...0/utility_belt/client/mixin/GuiMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 9 additions & 8 deletions
17
...utility_belt/client/ClientNetworking.java → ...belt/client/network/ClientNetworking.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ility_belt/client/BeltHotbarRenderer.java → ...elt/client/render/BeltHotbarRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lam360/utility_belt/client/BeltModel.java → ...utility_belt/client/render/BeltModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...360/utility_belt/client/BeltRenderer.java → ...lity_belt/client/render/BeltRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...tility_belt/screen/UtilityBeltScreen.java → ...belt/client/screen/UtilityBeltScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ility_belt/client/ClientStateManager.java → ...belt/client/state/ClientStateManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
common/src/client/resources/utility_belt.client.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "io.github.jamalam360.utility_belt.client.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"mixins": [ | ||
], | ||
"client": [ | ||
"ClientPacketListenerMixin", | ||
"GuiMixin", | ||
"MinecraftMixin" | ||
], | ||
"server": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} | ||
|
Oops, something went wrong.