Revise the vault menu
Adds a keybind to open the vaults Fixes flight being disabled by the server on a relog Adds a flight enchantment to boots and leggings (Tier 1 max) DB Profile has additional column for flight as a boolean. Network packet added for client to server to request the vault to open. Added translation entries to en_us.json
This commit is contained in:
parent
da5d53fb88
commit
91fdf78a57
21 changed files with 396 additions and 38 deletions
|
@ -103,7 +103,7 @@ public class CommandRegistry {
|
|||
HomeCommand.register(ev.getDispatcher());
|
||||
DelHomeCommand.register(ev.getDispatcher());
|
||||
|
||||
FlyCommand.register(ev.getDispatcher());
|
||||
//FlyCommand.register(ev.getDispatcher());
|
||||
|
||||
ChatColorCommand.register(ev.getDispatcher());
|
||||
NameColorCommand.register(ev.getDispatcher());
|
||||
|
|
|
@ -3,11 +3,16 @@ package dev.zontreck.otemod.commands.vaults;
|
|||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.implementation.vault.VaultContainer;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.SimpleMenuProvider;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
|
||||
public class VaultCommand {
|
||||
|
@ -26,15 +31,25 @@ public class VaultCommand {
|
|||
private static int vault(CommandSourceStack source, int i) {
|
||||
//VaultContainer cont = new VaultContainer(i, source.getPlayer().getUUID());
|
||||
//cont.startOpen(source.getPlayer());
|
||||
if(i <0)
|
||||
{
|
||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You can only specify a vault number in the positive range")), source.getServer());
|
||||
return 0;
|
||||
}
|
||||
doOpen(source.getPlayer(), i);
|
||||
|
||||
VaultContainer container = new VaultContainer(source.getPlayer(), i);
|
||||
|
||||
NetworkHooks.openScreen(source.getPlayer(), new SimpleMenuProvider(container.serverMenu, Component.literal("Vault "+i)));
|
||||
|
||||
// Add to the master vault registry
|
||||
if(VaultContainer.VAULT_REGISTRY.containsKey(source.getPlayer().getUUID()))VaultContainer.VAULT_REGISTRY.remove(source.getPlayer().getUUID());
|
||||
VaultContainer.VAULT_REGISTRY.put(source.getPlayer().getUUID(), container);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void doOpen(ServerPlayer p, int i){
|
||||
|
||||
VaultContainer container = new VaultContainer(p, i);
|
||||
|
||||
NetworkHooks.openScreen(p, new SimpleMenuProvider(container.serverMenu, Component.literal("Vault "+i)));
|
||||
|
||||
// Add to the master vault registry
|
||||
if(VaultContainer.VAULT_REGISTRY.containsKey(p.getUUID()))VaultContainer.VAULT_REGISTRY.remove(p.getUUID());
|
||||
VaultContainer.VAULT_REGISTRY.put(p.getUUID(), container);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue