Skip to content

Commit

Permalink
fix #97
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Oct 21, 2024
1 parent d338f76 commit 73465f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package dev.yurisuika.raised.client.gui.screens;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import dev.yurisuika.raised.client.RaisedOptions;
Expand All @@ -17,19 +15,15 @@
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.TooltipAccessor;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.player.PlayerModelPart;
import net.minecraft.world.item.Items;

import java.util.ArrayList;
import java.util.UUID;

public class RaisedScreen extends Screen {

Expand Down Expand Up @@ -254,27 +248,16 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
}
case PLAYERS -> {
GameProfile profilePlayer = minecraft.getMinecraftSessionService().fillProfileProperties(minecraft.player.getGameProfile(), false);
GameProfile profileNotch = minecraft.getMinecraftSessionService().fillProfileProperties(new GameProfile(UUID.fromString("069a79f4-44e9-4726-a5be-fca90e38aaf5"), "Notch"), false);
Player entityPlayer = minecraft.level.getPlayerByUUID(profilePlayer.getId());
Player entityNotch = minecraft.level.getPlayerByUUID(profileNotch.getId());
boolean shouldFlip = entityPlayer != null && LivingEntityRenderer.isEntityUpsideDown(entityPlayer);

fill(poseStack, -91 + 1, offset - 1 - 10 - 9, -91 + 1 + 144, offset - 1, Integer.MIN_VALUE);
fill(poseStack, -91 + 1 + 1, offset - 1 - 9 - 9, -91 + 1 + 144, offset - 1 - 1 - 9, minecraft.options.getBackgroundColor(553648127));
fill(poseStack, -91 + 1 + 1, offset - 1 - 9, -91 + 1 + 144, offset - 1 - 1, minecraft.options.getBackgroundColor(553648127));

RenderSystem.setShaderTexture(0, minecraft.getSkinManager().registerTexture(minecraft.getSkinManager().getInsecureSkinInformation(profilePlayer).values().stream().findFirst().get(), MinecraftProfileTexture.Type.SKIN));
GuiComponent.blit(poseStack, -91 + 1 + 1, offset - 1 - 9 - 9, 8, 8, 8.0F, 8 + (shouldFlip ? 8 : 0), 8, 8 * (shouldFlip ? -1 : 1), 64, 64);
if (entityPlayer != null && entityPlayer.isModelPartShown(PlayerModelPart.HAT)) {
GuiComponent.blit(poseStack, -91 + 1 + 1, offset - 1 - 9 - 9, 8, 8, 40.0F, 8 + (shouldFlip ? 8 : 0), 8, 8 * (shouldFlip ? -1 : 1), 64, 64);
}

RenderSystem.setShaderTexture(0, minecraft.getSkinManager().registerTexture(minecraft.getSkinManager().getInsecureSkinInformation(profileNotch).values().stream().findFirst().get(), MinecraftProfileTexture.Type.SKIN));
RenderSystem.setShaderTexture(0, ResourceLocation.tryParse("textures/entity/steve.png"));
GuiComponent.blit(poseStack, -91 + 1 + 1, offset - 1 - 9 - 9, 8, 8, 8.0F, 8.0F, 8, 8, 64, 64);
GuiComponent.blit(poseStack, -91 + 1 + 1, offset - 1 - 9 - 9, 8, 8, 40.0F, 8.0F, 8, 8, 64, 64);
RenderSystem.setShaderTexture(0, ResourceLocation.tryParse("textures/entity/alex.png"));
GuiComponent.blit(poseStack, -91 + 1 + 1, offset - 1 - 9, 8, 8, 8.0F, 8.0F, 8, 8, 64, 64);
if (entityNotch != null && entityNotch.isModelPartShown(PlayerModelPart.HAT)) {
GuiComponent.blit(poseStack, -91 + 1 + 1, offset - 1 - 9, 8, 8, 40.0F, 8.0F, 8, 8, 64, 64);
}
GuiComponent.blit(poseStack, -91 + 1 + 1, offset - 1 - 9, 8, 8, 40.0F, 8.0F, 8, 8, 64, 64);

font.drawShadow(poseStack, translatableX, -91 + 1 + 10, offset - 1 - 9 - 9, -1);
font.drawShadow(poseStack, translatableY, -91 + 1 + 10, offset - 1 - 9, -1);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/dev/yurisuika/raised/util/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.File;
import java.io.FileWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;

public class Config {
Expand All @@ -25,7 +26,7 @@ public static void setOptions(Options options) {

public static void saveConfig() {
try {
FileWriter fileWriter = new FileWriter(file);
FileWriter fileWriter = new FileWriter(file, StandardCharsets.UTF_8);
fileWriter.write(gson.toJson(getOptions()));
fileWriter.close();
} catch (Exception e) {
Expand Down

0 comments on commit 73465f5

Please sign in to comment.