Search in sources :

Example 1 with PacketSpeciesSelected

use of com.lying.variousoddities.network.PacketSpeciesSelected in project VariousOddities by Lyinginbedmon.

the class ScreenSelectTemplates method finalise.

private void finalise() {
    List<ResourceLocation> templateNames = Lists.newArrayList();
    this.listApplied.getTemplates().forEach((template) -> {
        templateNames.add(template.getRegistryName());
    });
    PacketHandler.sendToServer(new PacketSpeciesSelected(player.getUniqueID(), this.baseSpecies.getRegistryName(), this.customTypes != null, templateNames.toArray(new ResourceLocation[0])));
    Minecraft.getInstance().displayGuiScreen(null);
}
Also used : PacketSpeciesSelected(com.lying.variousoddities.network.PacketSpeciesSelected) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 2 with PacketSpeciesSelected

use of com.lying.variousoddities.network.PacketSpeciesSelected in project VariousOddities by Lyinginbedmon.

the class ScreenSelectSpecies method init.

public void init(Minecraft minecraft, int width, int height) {
    super.init(minecraft, width, height);
    this.buttons.clear();
    int midX = width / 2;
    if (this.selectableSpecies.isEmpty())
        initSpecies();
    this.speciesList = new SpeciesList(minecraft, this, 200, this.height, this.selectableSpecies);
    this.speciesList.setLeftPos((this.width - 170) / 2 - 11 - this.speciesList.getRowWidth());
    this.children.add(this.speciesList);
    int listWidth = 165;
    this.abilityList = new AbilityList(minecraft, (this.width - listWidth) / 2, listWidth, this.height, 20);
    this.children.add(this.abilityList);
    this.addButton(selectButton = new Button(midX - 50, 35, 100, 20, new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".species_select.select"), (button) -> {
        Minecraft.getInstance().displayGuiScreen(new ScreenSelectTemplates(player, getCurrentSpecies(), keepTypes ? EnumCreatureType.getCustomTypes(player).asSet() : EnumSet.noneOf(EnumCreatureType.class), this.targetPower));
    }, (button, matrix, x, y) -> {
        renderTooltip(matrix, new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".species_select.select"), x, y);
    }));
    this.addButton(typesButton = new Button(midX - 60, height - 25, 120, 20, new TranslationTextComponent("gui.varodd.species_select.lose_types"), (button) -> {
        keepTypes = !keepTypes;
        typesButton.setMessage(new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".species_select." + (keepTypes ? "keep_types" : "lose_types")));
    }, (button, matrix, x, y) -> {
        renderTooltip(matrix, new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".species_select.keep_types.info"), x, y);
    }));
    this.addButton(new Button(midX + 100, 35, 20, 20, new StringTextComponent("X"), (button) -> {
        PacketHandler.sendToServer(new PacketSpeciesSelected(player.getUniqueID()));
        Minecraft.getInstance().displayGuiScreen(null);
    }, (button, matrix, x, y) -> {
        renderTooltip(matrix, new TranslationTextComponent("gui.varodd.species_select.exit"), x, y);
    }));
    this.addButton(new Button(this.width - 23, 3, 20, 20, new StringTextComponent(">"), (button) -> {
        Minecraft.getInstance().displayGuiScreen(new ScreenSelectTemplates(player, Species.HUMAN, keepTypes ? EnumCreatureType.getCustomTypes(player).asSet() : EnumSet.noneOf(EnumCreatureType.class), this.targetPower));
    }, (button, matrix, x, y) -> {
        renderTooltip(matrix, new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".templates_select"), x, y);
    }));
}
Also used : WorldVertexBufferUploader(net.minecraft.client.renderer.WorldVertexBufferUploader) Arrays(java.util.Arrays) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) VORegistries(com.lying.variousoddities.init.VORegistries) LivingData(com.lying.variousoddities.capabilities.LivingData) ITextComponent(net.minecraft.util.text.ITextComponent) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) DefaultVertexFormats(net.minecraft.client.renderer.vertex.DefaultVertexFormats) Lists(com.google.common.collect.Lists) PacketSpeciesSelected(com.lying.variousoddities.network.PacketSpeciesSelected) Minecraft(net.minecraft.client.Minecraft) Button(net.minecraft.client.gui.widget.button.Button) StringTextComponent(net.minecraft.util.text.StringTextComponent) Type(com.lying.variousoddities.species.abilities.Ability.Type) EnumSet(java.util.EnumSet) Nullable(javax.annotation.Nullable) Species(com.lying.variousoddities.species.Species) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) Ability(com.lying.variousoddities.species.abilities.Ability) GlStateManager(com.mojang.blaze3d.platform.GlStateManager) PlayerEntity(net.minecraft.entity.player.PlayerEntity) AbilityModifier(com.lying.variousoddities.species.abilities.AbilityModifier) AbilityModifierCon(com.lying.variousoddities.species.abilities.AbilityModifierCon) ExtendedList(net.minecraft.client.gui.widget.list.ExtendedList) Reference(com.lying.variousoddities.reference.Reference) AbilityNaturalArmour(com.lying.variousoddities.species.abilities.AbilityNaturalArmour) AbstractGui(net.minecraft.client.gui.AbstractGui) PacketHandler(com.lying.variousoddities.network.PacketHandler) List(java.util.List) Screen(net.minecraft.client.gui.screen.Screen) Matrix4f(net.minecraft.util.math.vector.Matrix4f) FontRenderer(net.minecraft.client.gui.FontRenderer) Tessellator(net.minecraft.client.renderer.Tessellator) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) ResourceLocation(net.minecraft.util.ResourceLocation) EnumCreatureType(com.lying.variousoddities.species.types.EnumCreatureType) Comparator(java.util.Comparator) Collections(java.util.Collections) PacketSpeciesSelected(com.lying.variousoddities.network.PacketSpeciesSelected) EnumCreatureType(com.lying.variousoddities.species.types.EnumCreatureType) Button(net.minecraft.client.gui.widget.button.Button) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) StringTextComponent(net.minecraft.util.text.StringTextComponent)

Aggregations

PacketSpeciesSelected (com.lying.variousoddities.network.PacketSpeciesSelected)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 Lists (com.google.common.collect.Lists)1 LivingData (com.lying.variousoddities.capabilities.LivingData)1 VORegistries (com.lying.variousoddities.init.VORegistries)1 PacketHandler (com.lying.variousoddities.network.PacketHandler)1 Reference (com.lying.variousoddities.reference.Reference)1 Species (com.lying.variousoddities.species.Species)1 Ability (com.lying.variousoddities.species.abilities.Ability)1 Type (com.lying.variousoddities.species.abilities.Ability.Type)1 AbilityModifier (com.lying.variousoddities.species.abilities.AbilityModifier)1 AbilityModifierCon (com.lying.variousoddities.species.abilities.AbilityModifierCon)1 AbilityNaturalArmour (com.lying.variousoddities.species.abilities.AbilityNaturalArmour)1 EnumCreatureType (com.lying.variousoddities.species.types.EnumCreatureType)1 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 GlStateManager (com.mojang.blaze3d.platform.GlStateManager)1 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1