Skip to content

Commit

Permalink
修正部分内容
Browse files Browse the repository at this point in the history
- 修正坐垫界面图标错误
- 修正重载材质导致的崩溃问题
- 修正模型切换器界面的显示问题
- 修正附魔书的位置不正确
  • Loading branch information
TartaricAcid committed Sep 5, 2024
1 parent 00bb90f commit 7ab193e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void resize(Minecraft pMinecraft, int pWidth, int pHeight) {
if (this.description != null) {
value = this.description.getValue();
}
super.resize(pMinecraft, width, height);
super.resize(pMinecraft, pWidth, pHeight);
if (this.description != null) {
this.description.setValue(value);
}
Expand All @@ -170,7 +170,7 @@ public void render(PoseStack pPoseStack, int pMouseX, int pMouseY, float pPartia
}
drawCenteredString(pPoseStack, font, String.format("%d/%d", page + 1, (infoList.size() - 1) / maxRow + 1), leftPos + 193, topPos + 12, 0xffffff);
if (this.description != null) {
InventoryScreen.renderEntityInInventory(leftPos + 30, topPos + 60, 25, leftPos - 150, topPos - 50, maid);
InventoryScreen.renderEntityInInventory(leftPos + 30, topPos + 60, 25, -25, -20, maid);
this.description.render(pPoseStack, pMouseX, pMouseY, pPartialTick);
}
super.render(pPoseStack, pMouseX, pMouseY, pPartialTick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,12 @@ protected void drawRightEntity(PoseStack pPoseStack, int posX, int posY, MaidMod
int textureSize = 24;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, cacheIconId);
RenderSystem.disableDepthTest();
blit(pPoseStack, posX - textureSize / 2, posY - textureSize, textureSize, textureSize, 0, 0, textureSize, textureSize, textureSize, textureSize);
} else {
drawEntity(pPoseStack, posX, posY, modelItem);
}
}

private float[] getRgbFromHash(int hashCode) {
float r = (float) (hashCode >> 16 & 255) / 255.0F;
float g = (float) (hashCode >> 8 & 255) / 255.0F;
float b = (float) (hashCode & 255) / 255.0F;
return new float[]{r, g, b};
}

@Override
protected void openDetailsGui(EntityMaid maid, MaidModelInfo modelInfo) {
if (minecraft != null && modelInfo.getEasterEgg() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ protected void drawRightEntity(PoseStack pPoseStack, int posX, int posY, ChairMo
int textureSize = 24;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, cacheIconId);
RenderSystem.disableDepthTest();
blit(pPoseStack, posX - textureSize / 2, posY - textureSize, textureSize, textureSize, 0, 0, textureSize, textureSize, textureSize, textureSize);
} else {
drawEntity(pPoseStack, posX, posY, modelItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ protected void drawRightEntity(PoseStack pPoseStack, int posX, int posY, MaidMod
int textureSize = 24;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, cacheIconId);
RenderSystem.disableDepthTest();
blit(pPoseStack, posX - textureSize / 2, posY - textureSize, textureSize, textureSize, 0, 0, textureSize, textureSize, textureSize, textureSize);
} else {
drawEntity(pPoseStack, posX, posY, modelItem);
Expand Down Expand Up @@ -124,7 +123,7 @@ protected void setRowIndex(int rowIndex) {
ROW_INDEX = rowIndex;
}

private void drawEntity(PoseStack pPoseStack, int posX, int posY, MaidModelInfo modelItem) {
private void drawEntity(PoseStack pPoseStack, int posX, int posY, MaidModelInfo modelItem) {
Level world = getMinecraft().level;
if (world == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public void load(ResourceManager manager) {
}

private void doLoad() {
if (imageIn == null) {
return;
}
int width = imageIn.getWidth();
int height = imageIn.getHeight();
TextureUtil.prepareImage(this.getId(), 0, width, height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import static com.github.tartaricacid.touhoulittlemaid.init.InitItems.*;

public class MaidGroup extends CreativeModeTab {
public static CreativeModeTab MAIN_TAB = new MaidGroup("main", HAKUREI_GOHEI);
public static CreativeModeTab MAIN_TAB = new MaidGroup("main", HAKUREI_GOHEI).setEnchantmentCategories(InitEnchantments.GOHEI);
public static CreativeModeTab GARAGE_KIT_TAB = new MaidGroup("garage_kit", GARAGE_KIT);
public static CreativeModeTab CHAIR_TAB = new MaidGroup("chair", CHAIR);

Expand All @@ -23,7 +23,6 @@ public MaidGroup(String label, RegistryObject<Item> iconItem) {
super(String.format("touhou_little_maid.%s", label));
this.displayName = Component.translatable(String.format("item_group.%s.%s", TouhouLittleMaid.MOD_ID, label));
this.iconItem = iconItem;
this.setEnchantmentCategories(InitEnchantments.GOHEI);
}

@Override
Expand Down

0 comments on commit 7ab193e

Please sign in to comment.