Skip to content

Commit

Permalink
同步 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Nov 12, 2023
1 parent 201038a commit 6e6bc11
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.components.Widget;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.network.chat.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
Expand All @@ -32,6 +34,8 @@ public abstract class AbstractModelGui<T extends LivingEntity, E extends IModelI
};
private static final ResourceLocation BG = new ResourceLocation(TouhouLittleMaid.MOD_ID, "textures/gui/skin_select.png");
private static final ResourceLocation SIDE = new ResourceLocation(TouhouLittleMaid.MOD_ID, "textures/gui/skin_select_side.png");
private static final ResourceLocation EMPTY_ICON = new ResourceLocation(TouhouLittleMaid.MOD_ID, "textures/gui/empty_model_pack_icon.png");
private static final SimpleTexture EMPTY_ICON_TEXTURE = new SimpleTexture(EMPTY_ICON);
protected final T entity;
private final SkinGuiNumber<E> guiNumber;
private final List<CustomModelPack<E>> modelPackList;
Expand Down Expand Up @@ -285,6 +289,10 @@ private void drawTabIcon(PoseStack poseStack, int middleX, int middleY) {
CustomModelPack<E> pack = modelPackList.get(guiNumber.tabToPackIndex(index, getPageIndex()));
ResourceLocation icon = pack.getIcon();
if (icon != null) {
AbstractTexture iconTexture = Minecraft.getInstance().textureManager.getTexture(icon, EMPTY_ICON_TEXTURE);
if (EMPTY_ICON_TEXTURE.equals(iconTexture)) {
icon = EMPTY_ICON;
}
if (pack.getIconAnimation() == CustomModelPack.AnimationState.UNCHECK) {
checkIconAnimation(pack, icon);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private static void loadGeckoMaidModelElement(Path rootPath, MaidModelInfo maidM
registerFilePackTexture(rootPath, maidModelItem.getTexture());
// 加载动画
List<ResourceLocation> animation = maidModelItem.getAnimation();
if (animation == null || animation.size() == 0) {
if (animation == null || animation.isEmpty()) {
return;
}
AnimationFile animationData = new AnimationFile();
Expand Down Expand Up @@ -283,7 +283,7 @@ private static void loadGeckoChairModelElement(Path rootPath, ChairModelInfo cha
registerFilePackTexture(rootPath, chairModelItem.getTexture());
// 加载动画
List<ResourceLocation> animation = chairModelItem.getAnimation();
if (animation == null || animation.size() == 0) {
if (animation == null || animation.isEmpty()) {
return;
}
AnimationFile animationData = new AnimationFile();
Expand Down Expand Up @@ -388,7 +388,7 @@ private static void loadGeckoMaidModelElement(ZipFile zipFile, MaidModelInfo mai
registerZipPackTexture(zipFile.getName(), maidModelItem.getTexture());
// 加载动画
List<ResourceLocation> animation = maidModelItem.getAnimation();
if (animation == null || animation.size() == 0) {
if (animation == null || animation.isEmpty()) {
return;
}
AnimationFile animationData = new AnimationFile();
Expand Down Expand Up @@ -430,7 +430,7 @@ private static void loadGeckoChairModelElement(ZipFile zipFile, ChairModelInfo c
registerZipPackTexture(zipFile.getName(), chairModelItem.getTexture());
// 加载动画
List<ResourceLocation> animation = chairModelItem.getAnimation();
if (animation == null || animation.size() == 0) {
if (animation == null || animation.isEmpty()) {
return;
}
AnimationFile animationData = new AnimationFile();
Expand Down Expand Up @@ -468,7 +468,7 @@ private static void putMaidModelData(MaidModelInfo maidModelItem, BedrockModel<E
// 如果加载的模型不为空
MAID_MODELS.putModel(id, modelJson);
MAID_MODELS.putInfo(id, maidModelItem);
if (animations != null && animations.size() > 0) {
if (animations != null && !animations.isEmpty()) {
MAID_MODELS.putAnimation(id, animations);
}
}
Expand Down Expand Up @@ -519,7 +519,7 @@ private static void loadChairModelElement(Path rootPath, ChairModelInfo chairMod
// 如果加载的模型不为空
CHAIR_MODELS.putModel(id, modelJson);
CHAIR_MODELS.putInfo(id, chairModelItem);
if (animations != null && animations.size() > 0) {
if (animations != null && !animations.isEmpty()) {
CHAIR_MODELS.putAnimation(id, animations);
}
// 打印日志
Expand Down Expand Up @@ -573,7 +573,7 @@ private static void loadChairModelElement(ZipFile zipFile, ChairModelInfo chairM
// 如果加载的模型不为空
CHAIR_MODELS.putModel(id, modelJson);
CHAIR_MODELS.putInfo(id, chairModelItem);
if (animations != null && animations.size() > 0) {
if (animations != null && !animations.isEmpty()) {
CHAIR_MODELS.putAnimation(id, animations);
}
// 打印日志
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.tartaricacid.touhoulittlemaid.client.resource.pojo;

import com.github.tartaricacid.touhoulittlemaid.TouhouLittleMaid;
import com.google.gson.JsonSyntaxException;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down Expand Up @@ -103,6 +104,9 @@ public CustomModelPack<T> decorate() {
if (author == null) {
author = Collections.EMPTY_LIST;
}
if (icon == null) {
icon = new ResourceLocation(TouhouLittleMaid.MOD_ID, "textures/gui/empty_model_pack_icon.png");
}
if (iconDelay <= 0) {
iconDelay = 1;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 6e6bc11

Please sign in to comment.