Posted November 4, 20169 yr I'm not sure where to start with this. Let's say I have an item that has been named on an anvil with X player name. How would I go around to get that X player skin to use it to render with my model? I have done some tests with GameProfile and creating one with null UUID and the name of X player, and then trying to get the skin from the profile, but it doesn't seam to do the job.
November 4, 20169 yr What are you trying to do with the Skin render it as the item? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
November 4, 20169 yr Author I'm trying to render them as a player itself, in a model. On my Entity I have a "private static GameProfile owner;" Then I have public MyEntityMe(World worldIn) { super(worldIn); this.owner = new GameProfile(null, "namegoeshere"); // TODO Auto-generated constructor stub } Then I have a method to get the resource location that gets called on the renderer. public static ResourceLocation getResourceLocation() { Minecraft minecraft = Minecraft.getMinecraft(); Map<?, ?> map = minecraft.getSkinManager().loadSkinFromCache(owner); if (map.containsKey(Type.SKIN)) { final MinecraftProfileTexture skin = (MinecraftProfileTexture)map.get(Type.SKIN); return minecraft.getSkinManager().loadSkin(skin, Type.SKIN); } return null; }
November 4, 20169 yr What actually happens, does it render with the missing texture? Or Steve skin? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
November 4, 20169 yr Author What actually happens, does it render with the missing texture? Or Steve skin? Well, first to make sure everything else was working ok I had something like this on my Renderer: public static final ResourceLocation TEXTURE = new ResourceLocation(ModInfo.MODID + ":textures/entities/steve.png"); And I have Steve Texture on my assets. But now with the code I have above is renders the missing texture Purple and Black. I believe the problem is the way I'm creating the GameProfile, not sure.
November 4, 20169 yr Author Don't store the name, when the user enters the name, immediately convert it to UUID and then use that from then on. If you need to display the name again, convert back. Otherwise your system will break when the user changes name. So I should get the UUID from the given name, and then get a new GameProfile with the UUID I got and try from there? Gonna try it, thanks you.
November 4, 20169 yr Author So I should get the UUID from the given name, and then get a new GameProfile with the UUID I got and try from there?Yes. You should never store usernames anywhere (except in a UUID->name cache). I'm confuse on how would I get the UUID from a given name. Any tips? Thanks a lot.
November 4, 20169 yr Author How would I go around to get that X player skin to use it to render with my model? I was just offering a different way to get the player skin. He can get it off the players client from the using getLocationSkin. Send it to the server via packet. If rendering an entity or tileEntity pass that resourceLocation to the renderer on the client by utilizing IEntityAdditionalSpawnData. At least that is how I do it. Also for my case, I need to have access to any Skin with the only starting information been the Minecraft Name of the player, so it's not just players connected to a server, or players ingame, but any given name.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.