1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-09-01 10:07:56 +00:00

Use vanilla's nine-slice sprites for border rendering

- Move remaining sprites to the vanilla GUI atlas.

 - Convert our computer border/sidebar sprites to use vanilla's
   nine-sliced mcmeta files. I thought I'd have to do something custom
   here for the sidebar, as that has no right border, but vanilla
   supports that natively!

 - Use the normal GuiGraphics.blitSprite for rendering computer
   border/sidebar.

 - Obey nine-slice scaling within the pocket computer renderer.
This commit is contained in:
Jonathan Coates
2025-06-15 16:24:29 +01:00
parent 418c9be7ac
commit 9272e2efcd
24 changed files with 398 additions and 266 deletions

View File

@@ -5,25 +5,16 @@
package dan200.computercraft.mixin.client;
import dan200.computercraft.client.ClientHooks;
import dan200.computercraft.client.ClientRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.main.GameConfig;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
class MinecraftMixin {
@Shadow
@Final
private ReloadableResourceManager resourceManager;
@Inject(method = "updateLevelInEngines", at = @At("HEAD"))
@SuppressWarnings("unused")
private void updateLevelInEngines(ClientLevel screen, CallbackInfo ci) {
@@ -35,17 +26,4 @@ class MinecraftMixin {
private void disconnect(Screen screen, boolean keepResourcePacks, CallbackInfo ci) {
ClientHooks.onDisconnect();
}
@Inject(
method = "<init>(Lnet/minecraft/client/main/GameConfig;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/ResourceLoadStateTracker;startReload(Lnet/minecraft/client/ResourceLoadStateTracker$ReloadReason;Ljava/util/List;)V",
ordinal = 0
)
)
@SuppressWarnings("unused")
private void beforeInitialResourceReload(GameConfig gameConfig, CallbackInfo ci) {
ClientRegistry.registerReloadListeners(resourceManager::registerReloadListener, (Minecraft) (Object) this);
}
}