use of com.minecolonies.api.colony.buildings.modules.settings.ISettingKey in project minecolonies by ldtteam.
the class GuardTaskSetting method render.
@Override
public void render(final ISettingKey<?> key, final Pane pane, final ISettingsModuleView settingsModuleView, final IBuildingView building, final Window window) {
final String setting = getSettings().get(getCurrentIndex());
final ButtonImage targetButton = pane.findPaneOfTypeByID("setTarget", ButtonImage.class);
final Text mineLabel = pane.findPaneOfTypeByID("minePos", Text.class);
if (setting.equals(PATROL_MINE) && building instanceof AbstractBuildingGuards.View) {
mineLabel.setVisible(true);
if (((AbstractBuildingGuards.View) building).getMinePos() != null) {
mineLabel.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.worherhuts.patrollingmine", ((AbstractBuildingGuards.View) building).getMinePos().toShortString()));
} else {
mineLabel.setText(new TranslationTextComponent("com.minecolonies.coremod.job.guard.assignmine"));
}
targetButton.setVisible(false);
} else if (!setting.equals(FOLLOW)) {
mineLabel.setVisible(false);
targetButton.setVisible(true);
if (setting.equals(PATROL)) {
if (!settingsModuleView.getSetting(AbstractBuildingGuards.PATROL_MODE).getValue().equals(PatrolModeSetting.MANUAL)) {
targetButton.setVisible(false);
} else {
targetButton.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.workerhuts.targetpatrol"));
}
} else {
targetButton.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.workerhuts.targetguard"));
}
targetButton.setHandler(button -> building.getModuleView(ToolModuleView.class).getWindow().open());
} else {
mineLabel.setVisible(false);
targetButton.setVisible(false);
}
pane.findPaneOfTypeByID("trigger", ButtonImage.class).setText(new TranslationTextComponent(setting));
}
Aggregations