Skip to content

Conversation

@Novampr
Copy link

@Novampr Novampr commented Oct 20, 2025

Add GUI screens to Rainbow in order to make it much more user-friendly (imo anyway).

This PR also shuffles round translations and changes them to word them better for the user, adds a dummy CustomItemProvider for null safety (uses a null value in the backend anyway).

Copy link
Member

@eclipseisoffline eclipseisoffline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial batch - will probably be more reviews once these are taken care of. I'll also be sure to play around with the screens to test the user interaction.

context.getSource().sendFeedback(Component.translatable("commands.rainbow.pack_created", name));

PackManagerUtils.startPack(name, packManager, context.getSource().getClient());

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary whitespace.

}

public CustomItemProvider getItemProvider() {
if (this.itemProvider == null) return NoItemProvider.INSTANCE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a (relatively) new project there's still a chance to have a consistent codestyle without having to reformat everything.
Until there is an organisation wide standard for code style, please fully expand if statements and the likes, as this is most consistent with other code.


public void tick(Minecraft minecraft) {
// Don't tick when this screen is open, the user might be toggling settings
if (minecraft.screen instanceof ManagePackScreen) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this check if the game is paused (Minecraft#isPaused) as well as if the open screen should pause the game (Screen#isPauseScreen), then the instanceof check here should no longer be necessary.


import java.util.concurrent.atomic.AtomicReference;

@Mixin(AbstractContainerScreen.class)
Copy link
Member

@eclipseisoffline eclipseisoffline Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to remove the mixin and use Fabric's screen API instead? (see net.fabricmc.fabric.api.client.screen.v1)

private final PackMapper mapper;

@Nullable
private EditBox PACK_NAME_EDIT_BOX;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be packNameEditBox.

import org.slf4j.Logger;

public class RainbowClient implements ClientModInitializer {
public static final Logger LOGGER = LogUtils.getLogger();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can replace this with Rainbow.LOGGER.

"SplashRendererAccessor"
],
"injectors": {
"defaultRequire": 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indents need fixing here.

private final PackManager packManager = new PackManager();
private final PackMapper packMapper = new PackMapper(packManager);
private static final PackManager packManager = new PackManager();
private static final PackMapper packMapper = new PackMapper(packManager);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are constants, so PACK_MANAGER and PACK_MAPPER.

public static PackManager getPackManager() {
return packManager;
}
public static PackMapper getPackMapper() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a newline before this method.

Comment on lines +67 to +78
List<ItemStack> items;

if (minecraft.screen instanceof AbstractContainerScreen<?> abstractContainerScreen) {
items = abstractContainerScreen.getMenu().getItems();
} else {
items = new ArrayList<>(minecraft.player.getInventory().getNonEquipmentItems());
items.add(minecraft.player.getInventory().getItem(36)); // Boots
items.add(minecraft.player.getInventory().getItem(37)); // Leggings
items.add(minecraft.player.getInventory().getItem(38)); // Chestplate
items.add(minecraft.player.getInventory().getItem(39)); // Helmet
items.add(minecraft.player.getInventory().getItem(40)); // Offhand
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List<ItemStack> items;
if (minecraft.screen instanceof AbstractContainerScreen<?> abstractContainerScreen) {
items = abstractContainerScreen.getMenu().getItems();
} else {
items = new ArrayList<>(minecraft.player.getInventory().getNonEquipmentItems());
items.add(minecraft.player.getInventory().getItem(36)); // Boots
items.add(minecraft.player.getInventory().getItem(37)); // Leggings
items.add(minecraft.player.getInventory().getItem(38)); // Chestplate
items.add(minecraft.player.getInventory().getItem(39)); // Helmet
items.add(minecraft.player.getInventory().getItem(40)); // Offhand
}
List<ItemStack> items = new ArrayList<>(minecraft.player.inventoryMenu.getItems());
if (minecraft.player.hasContainerOpen()) {
items.addAll(minecraft.player.containerMenu.getItems())
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants