use of net.minecraft.client.gui.components.AbstractWidget in project SpongeCommon by SpongePowered.
the class TitleScreenMixin_Vanilla method vanilla$addPluginsButton.
@Inject(method = "init", at = @At("TAIL"))
private void vanilla$addPluginsButton(final CallbackInfo ci) {
final Optional<AbstractWidget> realmsButton = this.buttons.stream().filter(b -> b.getMessage().equals(new TranslatableComponent("menu.online"))).findFirst();
realmsButton.ifPresent(b -> {
b.setWidth(98);
b.x = this.width / 2 + 2;
});
// Plugins Button
this.addButton(new Button(this.width / 2 - 100, realmsButton.map(b -> b.y).orElse(0), 98, 20, new TextComponent("Plugins"), b -> this.minecraft.setScreen(new PluginScreen(this))));
}
Aggregations