1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-03 23:22:59 +00:00

Split some textures into sprite sheets

- Split buttons.png into individual textures.
 - Split corners_xyz.png into the following:

   - borders_xyz.png: A nine-sliced texture of the computer borders.
   - pocket_bottom_xyz.png: A horizontally 3-sliced texture of the
     bottom part of a pocket computer.
   - sidebar_xyz.png: A vertically 3-sliced texture of the computer
     sidebar.

While not splitting the sliced textures into smaller ones may seem a
little odd, it's consistent with what vanilla does in 1.20.2, and I
think will make editing them easier than juggling 9 textures.

I do want to make this more data-driven in the future, but that will
have to wait until the changes in 1.20.2.

This also adds a tools/update-resources.py program, which performs this
transformation on a given resource pack.
This commit is contained in:
Jonathan Coates
2023-08-27 18:02:51 +01:00
parent 6dfdeb9321
commit 53546b9f57
37 changed files with 556 additions and 161 deletions

View File

@@ -5,16 +5,25 @@
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 = "clearLevel(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD"))
@SuppressWarnings("UnusedMethod")
private void clearLevel(Screen screen, CallbackInfo ci) {
@@ -26,4 +35,16 @@ class MinecraftMixin {
private void setLevel(ClientLevel screen, CallbackInfo ci) {
ClientHooks.onWorldUnload();
}
@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
)
)
public void beforeInitialResourceReload(GameConfig gameConfig, CallbackInfo ci) {
ClientRegistry.registerReloadListeners(resourceManager::registerReloadListener, (Minecraft) (Object) this);
}
}

View File

@@ -0,0 +1,20 @@
{
"sources": [
{"type": "minecraft:single", "resource": "computercraft:gui/buttons/turned_off"},
{"type": "minecraft:single", "resource": "computercraft:gui/buttons/turned_off_hover"},
{"type": "minecraft:single", "resource": "computercraft:gui/buttons/turned_on"},
{"type": "minecraft:single", "resource": "computercraft:gui/buttons/turned_on_hover"},
{"type": "minecraft:single", "resource": "computercraft:gui/buttons/terminate"},
{"type": "minecraft:single", "resource": "computercraft:gui/buttons/terminate_hover"},
{"type": "minecraft:single", "resource": "computercraft:gui/border_normal"},
{"type": "minecraft:single", "resource": "computercraft:gui/pocket_bottom_normal"},
{"type": "minecraft:single", "resource": "computercraft:gui/sidebar_normal"},
{"type": "minecraft:single", "resource": "computercraft:gui/border_advanced"},
{"type": "minecraft:single", "resource": "computercraft:gui/pocket_bottom_advanced"},
{"type": "minecraft:single", "resource": "computercraft:gui/sidebar_advanced"},
{"type": "minecraft:single", "resource": "computercraft:gui/border_command"},
{"type": "minecraft:single", "resource": "computercraft:gui/sidebar_command"},
{"type": "minecraft:single", "resource": "computercraft:gui/border_colour"},
{"type": "minecraft:single", "resource": "computercraft:gui/pocket_bottom_colour"}
]
}