Push 1.2.3
This commit is contained in:
parent
3275bd4e8c
commit
883d41ecc9
5 changed files with 75 additions and 7 deletions
|
@ -40,6 +40,7 @@ import org.slf4j.Logger;
|
|||
|
||||
import dev.zontreck.otemod.blocks.ModBlocks;
|
||||
import dev.zontreck.otemod.commands.DelHomeCommand;
|
||||
import dev.zontreck.otemod.commands.FlyCommand;
|
||||
import dev.zontreck.otemod.commands.HomeCommand;
|
||||
import dev.zontreck.otemod.commands.HomesCommand;
|
||||
import dev.zontreck.otemod.commands.SetHomeCommand;
|
||||
|
@ -146,6 +147,8 @@ public class OTEMod
|
|||
SetHomeCommand.register(ev.getDispatcher());
|
||||
HomeCommand.register(ev.getDispatcher());
|
||||
DelHomeCommand.register(ev.getDispatcher());
|
||||
|
||||
FlyCommand.register(ev.getDispatcher());
|
||||
}
|
||||
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
|
|
65
src/main/java/dev/zontreck/otemod/commands/FlyCommand.java
Normal file
65
src/main/java/dev/zontreck/otemod/commands/FlyCommand.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package dev.zontreck.otemod.commands;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.math.Vector3d;
|
||||
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatColor;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.server.command.TextComponentHelper;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
public class FlyCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("fly").executes(FlyCommand::Fly));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int Fly(CommandContext<CommandSourceStack> ctx2)
|
||||
{
|
||||
// Request homes
|
||||
// String homeName = "";
|
||||
// CommandSourceStack ctx = ctx2.getSource();
|
||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||
// if(homeName==null)return 0;
|
||||
CommandSourceStack ctx = ctx2.getSource();
|
||||
if(! ctx.isPlayer())
|
||||
{
|
||||
|
||||
ctx.sendFailure(MutableComponent.create( new TranslatableContents("dev.zontreck.otemod.msgs.homes.only_player")));
|
||||
return 1;
|
||||
}
|
||||
ServerPlayer p = ctx.getPlayer();
|
||||
|
||||
if(p.getAbilities().mayfly){
|
||||
p.getAbilities().mayfly=false;
|
||||
p.getAbilities().flying=false;
|
||||
p.onUpdateAbilities();
|
||||
|
||||
ctx.sendSuccess(Component.literal(ChatColor.BOLD + "[" + ChatColor.DARK_GREEN + "OTEMOD" + ChatColor.WHITE + "] "+ChatColor.resetChat() + ChatColor.DARK_PURPLE + "Your ability to fly has been disabled"), false);
|
||||
}else {
|
||||
p.getAbilities().mayfly=true;
|
||||
p.onUpdateAbilities();
|
||||
|
||||
ctx.sendSuccess(Component.literal(ChatColor.BOLD + "[" + ChatColor.DARK_GREEN + "OTEMOD" + ChatColor.WHITE + "] "+ChatColor.resetChat() + ChatColor.DARK_PURPLE + "You can now fly"), false);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[41,]" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[43,]" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="GPL 2.0"
|
||||
|
@ -19,7 +19,7 @@ modId="otemod" #mandatory
|
|||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
||||
# see the associated build.gradle script for how to populate this completely automatically during a build
|
||||
version="${file.jarVersion}" #mandatory
|
||||
version="1.2.3" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="OTEMod Resources" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||
|
|
Reference in a new issue