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 c082934 commit 256a5db
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void addEditButton() {
TileEntityModelSwitcher.ModeInfo info = this.infoList.get(selectedIndex);
maid.setModelId(info.getModelId().toString());

this.addRenderableWidget(new Button(leftPos + 55, topPos + 15, 76, 20,new TranslatableComponent("gui.touhou_little_maid.button.skin"), b -> CacheIconManager.openModelSwitcherModelGui(maid, info, this)));
this.addRenderableWidget(new Button(leftPos + 55, topPos + 15, 76, 20, new TranslatableComponent("gui.touhou_little_maid.button.skin"), b -> CacheIconManager.openModelSwitcherModelGui(maid, info, this)));
this.addRenderableWidget(new DirectButton(leftPos + 55, topPos + 38, 76, 20, info.getDirection(),
b -> info.setDirection(((DirectButton) b).getDirection())));
this.addRenderableWidget(new Button(leftPos + 12, topPos + 135, 121, 20, new TranslatableComponent("selectWorld.edit.save"),
Expand Down Expand Up @@ -147,7 +147,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 @@ -169,7 +169,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 @@ -54,20 +54,12 @@ protected void drawRightEntity(PoseStack poseStack, int posX, int posY, MaidMode
int textureSize = 24;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, cacheIconId);
RenderSystem.disableDepthTest();
blit(poseStack, posX - textureSize / 2, posY - textureSize, textureSize, textureSize, 0, 0, textureSize, textureSize, textureSize, textureSize);
} else {
drawEntity(poseStack, 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 addModelCustomTips(MaidModelInfo modelItem, List<Component> tooltips) {
String useSoundPackId = modelItem.getUseSoundPackId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import com.github.tartaricacid.touhoulittlemaid.network.NetworkHandler;
import com.github.tartaricacid.touhoulittlemaid.network.message.ChairModelMessage;
import com.github.tartaricacid.touhoulittlemaid.util.EntityCacheUtil;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -40,6 +42,8 @@ protected void drawRightEntity(PoseStack poseStack, int posX, int posY, ChairMod
var allTextures = Minecraft.getInstance().textureManager.byPath;
if (allTextures.containsKey(cacheIconId)) {
int textureSize = 24;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, cacheIconId);
blit(poseStack, posX - textureSize / 2, posY - textureSize, textureSize, textureSize, 0, 0, textureSize, textureSize, textureSize, textureSize);
} else {
drawEntity(poseStack, posX, posY, modelItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ protected void drawRightEntity(PoseStack poseStack, int posX, int posY, MaidMode
int textureSize = 24;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, cacheIconId);
RenderSystem.disableDepthTest();
blit(poseStack, posX - textureSize / 2, posY - textureSize, textureSize, textureSize, 0, 0, textureSize, textureSize, textureSize, textureSize);
} else {
drawEntity(poseStack, posX, posY, modelItem);
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 @@ -12,7 +12,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 @@ -24,7 +24,6 @@ public MaidGroup(String label, RegistryObject<Item> iconItem) {
super(String.format("touhou_little_maid.%s", label));
this.displayName = new TranslatableComponent(String.format("item_group.%s.%s", TouhouLittleMaid.MOD_ID, label));
this.iconItem = iconItem;
this.setEnchantmentCategories(InitEnchantments.GOHEI);
}

@Override
Expand Down

0 comments on commit 256a5db

Please sign in to comment.