-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- builtin docs now mention data components instead of NBT - added a `/ftbguides setguide` command to set up guide book items
- Loading branch information
Showing
6 changed files
with
59 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [2100.0.0] | ||
|
||
### Changed | ||
* Ported to Minecraft 1.21. Support for Fabric and NeoForge. | ||
* Forge support may be re-added if/when Architectury adds support for Forge |
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
33 changes: 33 additions & 0 deletions
33
common/src/main/java/dev/ftb/mods/ftbguides/commands/SetGuideCommand.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,33 @@ | ||
package dev.ftb.mods.ftbguides.commands; | ||
|
||
import com.mojang.brigadier.arguments.StringArgumentType; | ||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
import dev.ftb.mods.ftbguides.registry.GuideBookData; | ||
import dev.ftb.mods.ftbguides.registry.ModItems; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import static net.minecraft.commands.Commands.argument; | ||
import static net.minecraft.commands.Commands.literal; | ||
|
||
public class SetGuideCommand { | ||
public static LiteralArgumentBuilder<CommandSourceStack> register() { | ||
return literal("setguide") | ||
.requires(source -> source.hasPermission(2)) | ||
.then(argument("id", StringArgumentType.greedyString()) | ||
.executes(ctx -> setGuide(ctx.getSource(), StringArgumentType.getString(ctx, "id"))) | ||
); | ||
} | ||
|
||
private static int setGuide(CommandSourceStack source, String id) throws CommandSyntaxException { | ||
ItemStack stack = source.getPlayerOrException().getMainHandItem(); | ||
if (!stack.isEmpty()) { | ||
stack.set(ModItems.GUIDE_DATA.get(), new GuideBookData(id)); | ||
source.sendSuccess(() -> Component.translatable("ftbguides.message.set_data", stack.getDisplayName(), id), false); | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
} |
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