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);
}
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);
}));
}
Aggregations