Skip to content

Commit

Permalink
apply 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
umjammer committed Dec 5, 2024
1 parent ae0d4e8 commit f660758
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'fabric-loom' version '1.9-SNAPSHOT'
id 'maven-publish'
id 'eclipse'
id 'idea'
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version = 1.21.3
yarn_mappings = 1.21.3+build.2
minecraft_version = 1.21.4
yarn_mappings = 1.21.4+build.1
loader_version = 0.16.9

mod_version = 1.0.0
Expand All @@ -14,6 +14,6 @@ archives_base_name = justmap

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
fabric_version = 0.107.0+1.21.3
fabric_version = 0.110.5+1.21.4
cloth_version = 16.0.141
modmenu_version = 12.0.0-beta.1
modmenu_version = 13.0.0-beta.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ private void bindOutline() {
if (outlineId == null) {
NativeImage outline = ImageUtil.generateOutline(image, width, height, color);
NativeImageBackedTexture outTexture = new NativeImageBackedTexture(outline);
this.outlineId = textureManager.registerDynamicTexture(String.format("%s_%s_outline", this.id.getNamespace(), this.id.getPath()), outTexture);
this.outlineId = Identifier.of(this.id.getNamespace(), "%s_outline".formatted(this.id.getPath()));
textureManager.registerTexture(outlineId, outTexture);
}
RenderUtil.bindTexture(outlineId);
}
Expand Down Expand Up @@ -112,8 +113,8 @@ private static EntityHeadIconImage registerIcon(Entity entity, Identifier entity

private static EntityHeadIconImage registerIcon(Entity entity, Identifier entityId, File image) {
NativeImage iconImage = ImageUtil.loadImage(image, 32, 32);
String prefix = String.format("icon_%s_%s", entityId.getNamespace(), entityId.getPath());
Identifier textureId = textureManager.registerDynamicTexture(prefix, new NativeImageBackedTexture(iconImage));
Identifier textureId = Identifier.of("icon_%s".formatted(entityId.getNamespace()), entityId.getPath());
textureManager.registerTexture(textureId, new NativeImageBackedTexture(iconImage));
EntityHeadIconImage icon = new EntityHeadIconImage(entityId, textureId, iconImage);
return registerIcon(entity, entityId, icon);
}
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/ru/bulldog/justmap/map/icon/PlayerHeadIconImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.texture.AbstractTexture;
import net.minecraft.client.texture.PlayerSkinTexture;
import net.minecraft.client.texture.PlayerSkinTextureDownloader;
import net.minecraft.client.texture.ResourceTexture;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.DefaultSkinHelper;
Expand Down Expand Up @@ -74,7 +76,7 @@ public void getPlayerSkin(MapPlayer player) {
this.skinId = player.getSkinTextures().texture();

try {
this.playerSkin.load(MinecraftClient.getInstance().getResourceManager());
this.playerSkin.loadContents(MinecraftClient.getInstance().getResourceManager());
} catch (IOException ex) {
JustMap.LOGGER.warning(ex.getLocalizedMessage());
}
Expand All @@ -86,7 +88,7 @@ public void getPlayerSkin(MapPlayer player) {
this.success = false;

try {
this.playerSkin.load(MinecraftClient.getInstance().getResourceManager());
this.playerSkin.loadContents(MinecraftClient.getInstance().getResourceManager());
} catch (IOException ex) {
JustMap.LOGGER.warning(ex.getLocalizedMessage());
}
Expand All @@ -97,8 +99,12 @@ private ResourceTexture loadSkinTexture(Identifier id, String playerName, UUID p
TextureManager textureManager = MinecraftClient.getInstance().getTextureManager();
AbstractTexture abstractTexture = textureManager.getTexture(id);
if (abstractTexture == null) {
abstractTexture = new PlayerSkinTexture(null, String.format("http://skins.minecraft.net/MinecraftSkins/%s.png", StringHelper.stripTextFormat(playerName)), DefaultSkinHelper.getSkinTextures(playerUUID).texture(), true, null);
textureManager.registerTexture(id, abstractTexture);
CompletableFuture<Identifier> downloader = PlayerSkinTextureDownloader.downloadAndRegisterTexture(DefaultSkinHelper.getSkinTextures(playerUUID).texture(), null , String.format("https://skins.minecraft.net/MinecraftSkins/%s.png", StringHelper.stripTextFormat(playerName)), true); // TODO 1.21.4
try {
id = downloader.get();
abstractTexture = textureManager.getTexture(id);
} catch (ExecutionException | InterruptedException e) {
}
}
return (ResourceTexture) abstractTexture;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ private static void loadSkin(File folder, File skinFile) {
String imageName = JsonHelper.getString(skinData, "image");
File imageFile = new File(folder, imageName);
NativeImage skinImage = ImageUtil.loadImage(imageFile, width, height);
String prefix = String.format("%s_%s", JustMap.MODID, imageName);
Identifier textureId = textureManager.registerDynamicTexture(prefix, new NativeImageBackedTexture(skinImage));
Identifier textureId = Identifier.of(JustMap.MODID, imageName);
textureManager.registerTexture(textureId, new NativeImageBackedTexture(skinImage));
switch (shape) {
case ROUND:
MapSkin.addRoundSkin(name, textureId, skinImage, width, height, border);
Expand Down
4 changes: 2 additions & 2 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Mon Nov 04 17:02:49 JST 2024
VERSION_BUILD=436
#Thu Dec 05 22:17:55 JST 2024
VERSION_BUILD=450
VERSION_MAJOR=1
VERSION_MINOR=2

0 comments on commit f660758

Please sign in to comment.