This repository has been archived by the owner on Jul 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
15 changed files
with
266 additions
and
188 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# CatTeleportMod-Fabric | ||
Little mod to help you count seconds on cat-powered teleport | ||
A little mod to help you count seconds on cat-powered teleports |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package net.just_s.ctpmod.commands; | ||
|
||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.arguments.IntegerArgumentType; | ||
import com.mojang.brigadier.arguments.StringArgumentType; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; | ||
import net.just_s.ctpmod.CTPMod; | ||
import net.just_s.ctpmod.config.Point; | ||
import net.minecraft.command.CommandRegistryAccess; | ||
import net.minecraft.text.Text; | ||
|
||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; | ||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; | ||
|
||
public class AddCommand { | ||
public static void register(CommandDispatcher<FabricClientCommandSource> fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { | ||
fabricClientCommandSourceCommandDispatcher.register( | ||
literal(CTPMod.MOD_CMD).then( | ||
literal("add").then( | ||
argument("name", StringArgumentType.word()).then( | ||
argument("startPeriod", IntegerArgumentType.integer(0)).then( | ||
argument("endPeriod", IntegerArgumentType.integer(1)). | ||
executes(AddCommand::run) | ||
) | ||
) | ||
) | ||
) | ||
); | ||
} | ||
|
||
private static int run(CommandContext<FabricClientCommandSource> ctx) { | ||
String waypointName = ctx.getArgument("name", String.class); | ||
int startPeriod = ctx.getArgument("startPeriod", int.class); | ||
int endPeriod = ctx.getArgument("endPeriod", int.class); | ||
CTPMod.config.addPoint(new Point(waypointName, startPeriod, endPeriod)); | ||
ctx.getSource().sendFeedback(CTPMod.generateFeedback( | ||
"Point §f{0} §aadded§2 with period: §f{1}-{2}§2.", | ||
waypointName, startPeriod, endPeriod | ||
)); | ||
return 1; | ||
} | ||
} |
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,40 @@ | ||
package net.just_s.ctpmod.commands; | ||
|
||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.arguments.StringArgumentType; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; | ||
import net.just_s.ctpmod.CTPMod; | ||
import net.minecraft.command.CommandRegistryAccess; | ||
|
||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; | ||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; | ||
|
||
public class DelCommand { | ||
public static void register(CommandDispatcher<FabricClientCommandSource> fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { | ||
fabricClientCommandSourceCommandDispatcher.register( | ||
literal(CTPMod.MOD_CMD).then( | ||
literal("delete").then( | ||
argument("name", StringArgumentType.word()). | ||
executes(DelCommand::run) | ||
) | ||
) | ||
); | ||
} | ||
|
||
private static int run(CommandContext<FabricClientCommandSource> ctx) { | ||
String waypointName = ctx.getArgument("name", String.class); | ||
if (CTPMod.config.deletePoint(waypointName)) { | ||
ctx.getSource().sendFeedback(CTPMod.generateFeedback( | ||
"Point §f{0} §cdeleted§2.", | ||
waypointName | ||
)); | ||
} else { | ||
ctx.getSource().sendFeedback(CTPMod.generateFeedback( | ||
"Point §f{0} §cwas not deleted due to some issues§2.", | ||
waypointName | ||
)); | ||
} | ||
return 1; | ||
} | ||
} |
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,28 @@ | ||
package net.just_s.ctpmod.commands; | ||
|
||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; | ||
import net.just_s.ctpmod.CTPMod; | ||
import net.minecraft.command.CommandRegistryAccess; | ||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; | ||
|
||
public class ListCommand { | ||
public static void register(CommandDispatcher<FabricClientCommandSource> fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { | ||
fabricClientCommandSourceCommandDispatcher.register( | ||
literal(CTPMod.MOD_CMD).then( | ||
literal("list").executes(ListCommand::run) | ||
) | ||
); | ||
} | ||
|
||
private static int run(CommandContext<FabricClientCommandSource> ctx) { | ||
String[] pointRepr = new String[CTPMod.points.length]; | ||
for (int i = 0; i < CTPMod.points.length; i++) {pointRepr[i] = CTPMod.points[i].toString();} | ||
String message = "list of loaded Points:\n" + String.join("\n", pointRepr); | ||
ctx.getSource().sendFeedback(CTPMod.generateFeedback( | ||
message | ||
)); | ||
return 1; | ||
} | ||
} |
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,38 @@ | ||
package net.just_s.ctpmod.commands; | ||
|
||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.arguments.IntegerArgumentType; | ||
import com.mojang.brigadier.arguments.StringArgumentType; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; | ||
import net.just_s.ctpmod.CTPMod; | ||
import net.just_s.ctpmod.config.Point; | ||
import net.minecraft.command.CommandRegistryAccess; | ||
|
||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; | ||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; | ||
|
||
public class RcCommand { | ||
public static void register(CommandDispatcher<FabricClientCommandSource> fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { | ||
fabricClientCommandSourceCommandDispatcher.register( | ||
literal(CTPMod.MOD_CMD).then( | ||
literal("rc").then( | ||
argument("seconds", IntegerArgumentType.integer(1)). | ||
executes(RcCommand::run) | ||
) | ||
) | ||
); | ||
} | ||
|
||
private static int run(CommandContext<FabricClientCommandSource> ctx) { | ||
int seconds = ctx.getArgument("seconds", int.class); | ||
if (CTPMod.MC.isInSingleplayer()) { | ||
ctx.getSource().sendFeedback(CTPMod.generateFeedback( | ||
"§cCTPMod doesn't work in §4SinglePlayer§c. You can use §dNether Portals§c instead of rejoining." | ||
)); | ||
return 1; | ||
} | ||
CTPMod.startReconnect(new Point(null, seconds, seconds)); | ||
return 1; | ||
} | ||
} |
Oops, something went wrong.