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
|
@ -6,25 +6,39 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.commands.vaults.VaultCommand;
|
||||
import dev.zontreck.otemod.networking.ModMessages;
|
||||
import dev.zontreck.otemod.networking.packets.OpenVaultPacket;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.Button.OnPress;
|
||||
import net.minecraft.client.gui.font.TextFieldHelper;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
|
||||
public class VaultScreen extends AbstractContainerScreen <VaultMenu>
|
||||
{
|
||||
// 176x224
|
||||
public final UUID VaultMenuID;
|
||||
public final Player thePlayer;
|
||||
public final VaultMenu THE_CONTAINER;
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation(OTEMod.MOD_ID, "textures/gui/vault.png");
|
||||
|
||||
public VaultScreen(VaultMenu container, Inventory playerInv, Component comp){
|
||||
super(container, playerInv, comp);
|
||||
thePlayer=playerInv.player;
|
||||
|
||||
this.VaultMenuID = container.VaultMenuID;
|
||||
this.leftPos = 0;
|
||||
this.topPos = 0;
|
||||
this.THE_CONTAINER=container;
|
||||
|
||||
this.imageWidth = 207;
|
||||
this.imageHeight = 238;
|
||||
|
@ -54,6 +68,17 @@ public class VaultScreen extends AbstractContainerScreen <VaultMenu>
|
|||
{
|
||||
super.init();
|
||||
// This is where custom controls would be added!
|
||||
|
||||
this.addWidget(new Button(this.leftPos+7,this.topPos+84,16,16,Component.literal(""), (button)->{
|
||||
thePlayer.closeContainer();
|
||||
|
||||
ModMessages.sendToServer(new OpenVaultPacket(0,true,-1));
|
||||
} ));
|
||||
|
||||
this.addWidget(new Button(this.leftPos+187,this.topPos+84,16,16,Component.literal(""), (button)->{
|
||||
thePlayer.closeContainer();
|
||||
ModMessages.sendToServer(new OpenVaultPacket(0, true, 1));
|
||||
} ));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Reference in a new issue