Remove the race selection from the world creation screen (no longer needed since you are asked to select a race upon joining the world)

This commit is contained in:
Sollace 2022-09-30 16:42:56 +02:00
parent ab97a7b6ef
commit 02eaf365c8
2 changed files with 0 additions and 25 deletions

View file

@ -22,7 +22,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.OpenToLanScreen; import net.minecraft.client.gui.screen.OpenToLanScreen;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreens; import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -77,9 +76,6 @@ public class UnicopiaClient implements ClientModInitializer {
} }
private void onScreenInit(Screen screen, ButtonList buttons) { private void onScreenInit(Screen screen, ButtonList buttons) {
if (screen instanceof CreateWorldScreen) {
buttons.addButton(LanSettingsScreen.createRaceSelector(screen));
}
if (screen instanceof OpenToLanScreen) { if (screen instanceof OpenToLanScreen) {
buttons.addButton(new Button(screen.width / 2 - 155, 130, 150, 20)) buttons.addButton(new Button(screen.width / 2 - 155, 130, 150, 20))
.onClick(b -> MinecraftClient.getInstance().setScreen(new LanSettingsScreen(screen))) .onClick(b -> MinecraftClient.getInstance().setScreen(new LanSettingsScreen(screen)))

View file

@ -6,7 +6,6 @@ import com.minelittlepony.common.client.gui.GameGui;
import com.minelittlepony.common.client.gui.ScrollContainer; import com.minelittlepony.common.client.gui.ScrollContainer;
import com.minelittlepony.common.client.gui.dimension.Bounds; import com.minelittlepony.common.client.gui.dimension.Bounds;
import com.minelittlepony.common.client.gui.element.Button; import com.minelittlepony.common.client.gui.element.Button;
import com.minelittlepony.common.client.gui.element.Cycler;
import com.minelittlepony.common.client.gui.element.Label; import com.minelittlepony.common.client.gui.element.Label;
import com.minelittlepony.common.client.gui.element.Toggle; import com.minelittlepony.common.client.gui.element.Toggle;
import com.minelittlepony.common.client.gui.packing.GridPacker; import com.minelittlepony.common.client.gui.packing.GridPacker;
@ -15,9 +14,7 @@ import com.minelittlepony.common.client.gui.style.Style;
import com.minelittlepony.unicopia.Config; import com.minelittlepony.unicopia.Config;
import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.util.RegistryIndexer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.server.integrated.IntegratedServer; import net.minecraft.server.integrated.IntegratedServer;
@ -149,22 +146,4 @@ public class LanSettingsScreen extends GameGui {
return new Style().setIcon(TribeButton.createSprite(race, 2, 2, 15)) return new Style().setIcon(TribeButton.createSprite(race, 2, 2, 15))
.setTooltip(race.getTranslationKey(), 0, 10); .setTooltip(race.getTranslationKey(), 0, 10);
} }
public static Cycler createRaceSelector(Screen screen) {
RegistryIndexer<Race> races = RegistryIndexer.of(Race.REGISTRY);
return new Cycler(screen.width / 2 + 110, 60, 20, 20) {
@Override
protected void renderForground(MatrixStack matrices, MinecraftClient mc, int mouseX, int mouseY, int foreColor) {
super.renderForground(matrices, mc, mouseX, mouseY, foreColor);
if (isMouseOver(mouseX, mouseY)) {
renderToolTip(matrices, screen, mouseX, mouseY);
}
}
}.setStyles(Race.REGISTRY.stream().map(LanSettingsScreen::createStyle).toArray(Style[]::new)).onChange(i -> {
Unicopia.getConfig().preferredRace.set(races.valueOf(i));
Unicopia.getConfig().save();
return i;
}).setValue(races.indexOf(Unicopia.getConfig().preferredRace.get()));
}
} }