1
0

Bump to 1.19

This commit is contained in:
Ryan Fox 2022-06-11 20:58:16 -07:00
parent 94b26089a8
commit de8df562de
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
11 changed files with 40 additions and 38 deletions

View File

@ -1,8 +1,8 @@
org.gradle.jvmargs=-Xmx1G
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3
minecraft_version=1.19
yarn_mappings=1.19+build.2
loader_version=0.14.7
mod_version=1.2.0
maven_group=party._2a03.mc
archives_base_name=minecraft-tweaks-2a03
fabric_version=0.47.10+1.18.2
fabric_version=0.55.3+1.19

View File

@ -1,8 +1,8 @@
package party._2a03.mc;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.registry.CommandRegistry;
import net.fabricmc.loader.api.FabricLoader;
import java.io.File;
import java.nio.file.Files;
@ -49,13 +49,15 @@ public class MinecraftTweaks2a03 implements ModInitializer {
Database.close();
});
LOGGER.info("Registering 2a03.party commands");
CommandRegistry.INSTANCE.register(false, dispatcher -> {
ConfigCommand.register(dispatcher);
FlyCommand.register(dispatcher);
HatCommand.register(dispatcher);
HeadCommand.register(dispatcher);
HomeCommand.register(dispatcher);
SpawnCommand.register(dispatcher);
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
if (environment.dedicated) {
ConfigCommand.register(dispatcher);
FlyCommand.register(dispatcher);
HatCommand.register(dispatcher);
HeadCommand.register(dispatcher);
HomeCommand.register(dispatcher);
SpawnCommand.register(dispatcher);
}
});
}
}

View File

@ -4,7 +4,7 @@ import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import party._2a03.mc.util.Config;
public class ConfigCommand {
@ -17,9 +17,9 @@ public class ConfigCommand {
ServerCommandSource source = ctx.getSource();
try {
Config.loadConfig();
source.sendFeedback(new LiteralText("Reloaded the configuration"), true);
source.sendFeedback(Text.of("Reloaded the configuration"), true);
} catch(Exception e) {
source.sendFeedback(new LiteralText("Failed to reload the configuration"), true);
source.sendFeedback(Text.of("Failed to reload the configuration"), true);
}
return 1;
}));

View File

@ -5,7 +5,7 @@ import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import party._2a03.mc.util.Config;
public class FlyCommand {
@ -13,7 +13,7 @@ public class FlyCommand {
dispatcher.register(CommandManager.literal("fly").executes(ctx -> {
ServerCommandSource source = ctx.getSource();
if (Config.getBool("disableFlyCommand")) {
source.sendFeedback(new LiteralText("The /fly command is disabled"), true);
source.sendFeedback(Text.of("The /fly command is disabled"), true);
return 0;
}
ServerPlayerEntity sender = source.getPlayer();
@ -21,9 +21,9 @@ public class FlyCommand {
boolean flight = abilities.allowFlying;
abilities.allowFlying = !flight;
if (!flight)
source.sendFeedback(new LiteralText("I wanna fly like an eagle... to the sea!"), true);
source.sendFeedback(Text.of("I wanna fly like an eagle... to the sea!"), true);
else {
source.sendFeedback(new LiteralText("Flight disabled"), true);
source.sendFeedback(Text.of("Flight disabled"), true);
abilities.flying = false;
}
sender.sendAbilitiesUpdate();

View File

@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
public class HatCommand {
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
@ -17,7 +17,7 @@ public class HatCommand {
ItemStack head = sender.getEquippedStack(EquipmentSlot.HEAD);
sender.equipStack(EquipmentSlot.MAINHAND, head);
sender.equipStack(EquipmentSlot.HEAD, mainhand);
source.sendFeedback(new LiteralText("Swapped items between main hand and head"), false);
source.sendFeedback(Text.of("Swapped items between main hand and head"), false);
return 1;
}));
}

View File

@ -10,7 +10,7 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
public class HeadCommand {
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
@ -29,7 +29,7 @@ public class HeadCommand {
ItemEntity itementity = sender.dropItem(itemstack, false);
itementity.resetPickupDelay();
itementity.setOwner(sender.getUuid());
source.sendFeedback(new LiteralText("Player head has been given"), false);
source.sendFeedback(Text.of("Player head has been given"), false);
return 1;
}
}

View File

@ -6,7 +6,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.registry.RegistryKey;
import party._2a03.mc.util.Database;
import party._2a03.mc.util.PlayerData;
@ -19,11 +19,11 @@ public class HomeCommand {
ServerPlayerEntity sender = source.getPlayer();
PlayerPosition position = Database.getPlayer(sender.getUuid().toString()).getHome();
if (position.registrykey == null) {
source.sendFeedback(new LiteralText("Home not found, do /home set"), false);
source.sendFeedback(Text.of("Home not found, do /home set"), false);
return -1;
}
sender.teleport(sender.getServer().getWorld(position.registrykey), position.x, position.y, position.z, position.yaw, position.pitch);
source.sendFeedback(new LiteralText("Teleported to home"), true);
source.sendFeedback(Text.of("Teleported to home"), true);
return 1;
});
@ -39,7 +39,7 @@ public class HomeCommand {
RegistryKey registrykey = sender.getWorld().getRegistryKey();
PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey);
playerdata.setHome(location);
source.sendFeedback(new LiteralText("Your home has been updated"), true);
source.sendFeedback(Text.of("Your home has been updated"), true);
return 1;
}));
@ -57,7 +57,7 @@ public class HomeCommand {
RegistryKey registrykey = sender.getWorld().getRegistryKey();
PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey);
playerdata.setHome(location);
source.sendFeedback(new LiteralText("User's home has been updated (" + StringArgumentType.getString(ctx, "UUID") + ")"), true);
source.sendFeedback(Text.of("User's home has been updated (" + StringArgumentType.getString(ctx, "UUID") + ")"), true);
return 1;
})));

View File

@ -5,7 +5,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.registry.RegistryKey;
import party._2a03.mc.util.Config;
import party._2a03.mc.util.PlayerPosition;
@ -18,14 +18,14 @@ public class SpawnCommand {
PlayerPosition position = new PlayerPosition(Config.getData("spawn"));
if (position.registrykey == null) {
if (source.hasPermissionLevel(2)) {
source.sendFeedback(new LiteralText("Spawn not found, do /spawn set"), false);
source.sendFeedback(Text.of("Spawn not found, do /spawn set"), false);
} else {
source.sendFeedback(new LiteralText("Spawn not found, ask an admin to set it"), false);
source.sendFeedback(Text.of("Spawn not found, ask an admin to set it"), false);
}
return -1;
}
sender.teleport(sender.getServer().getWorld(position.registrykey), position.x, position.y, position.z, position.yaw, position.pitch);
source.sendFeedback(new LiteralText("Teleported to the spawn point"), true);
source.sendFeedback(Text.of("Teleported to the spawn point"), true);
return 1;
});
@ -42,7 +42,7 @@ public class SpawnCommand {
RegistryKey registrykey = sender.getWorld().getRegistryKey();
PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey);
Config.setData("spawn", location.getJSON());
source.sendFeedback(new LiteralText("Spawn has been set"), true);
source.sendFeedback(Text.of("Spawn has been set"), true);
return 1;
}));

View File

@ -5,7 +5,7 @@ import com.mojang.brigadier.context.CommandContext;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.command.GameModeCommand;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.world.GameMode;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -17,7 +17,7 @@ public class MixinGameModeCommand {
@Inject(method = "execute", at = @At("HEAD"))
private static void OnExecute(CommandContext<ServerCommandSource> context, Collection<ServerPlayerEntity> targets, GameMode gameMode, CallbackInfoReturnable cir) {
if (gameMode == GameMode.CREATIVE) {
context.getSource().sendFeedback(new LiteralText("<Server> Creative mode? What are you, a cheater?"), false);
context.getSource().sendFeedback(Text.of("<Server> Creative mode? What are you, a cheater?"), false);
}
return;
}

View File

@ -18,7 +18,7 @@ public abstract class MixinServerPlayerEntity extends PlayerEntity {
private RegistryKey<World> spawnPointDimension;
public MixinServerPlayerEntity() {
super(null, null, 0, null);
super(null, null, 0, null, null);
}
@Inject(method = "moveToSpawn", at = @At("HEAD"), cancellable = true)

View File

@ -23,8 +23,8 @@
"minecraft-tweaks-2a03.mixins.json"
],
"depends": {
"fabricloader": ">=0.12.12",
"fabricloader": ">=0.14.7",
"fabric": "*",
"minecraft": "1.18.2"
"minecraft": "1.19"
}
}