Shimizu Izumi Posted January 6, 2022 Share Posted January 6, 2022 (edited) I'm making a mod that is based on the anime Sword Art online and there is a Item called the <<Hand Mirror>> and when u use this item in the anime it changes you character design to how you look in real life I want to implement this in my mod but so that you start with a random skin and when you use the item it restores your own skin permanently. is this even possible? and how can I do that? Edited February 6, 2022 by Leon Henning Quote Link to comment Share on other sites More sharing options...
ElTotisPro50 Posted July 22, 2023 Share Posted July 22, 2023 On 1/6/2022 at 5:19 PM, Shimizu Izumi said: I'm making a mod that is based on the anime Sword Art online and there is a Item called the <<Hand Mirror>> and when u use this item in the anime it changes you character design to how you look in real life I want to implement this in my mod but so that you start with a random skin and when you use the item it restores your own skin permanently. is this even possible? and how can I do that? https://github.com/Totis22/Change-players-skin-1.18.2/tree/main Remember that in the main method for changing skin, it requires any boolean condition/s. If all conditions are true the skin changes, but if one condition is false, it changes you back to your original skin. If "start with random skin" means, change player's skin when they enter the world, just use the same ".renderSkin()" method in the RenderHandEvent, selecting a downloaded random skin from your mod, or interacting with a skins web page, then, when you hold the item, stop the .renderSkin something like this: @SubscribeEvent public static void randomSkinManagment(EntityJoinWorldEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); skin = skins.get(rand.nextInt(skins.size())); } } @SubscribeEvent public static void playerHoldSword(TickEvent.PlayerTickEvent event) { if(event.player == null) return; Player player = event.player; if(player.getMainHandItem().is(Items.DIAMOND_SWORD)) { //save NBT Data to player: player.somewhereinNBTDATA.heldSword = true; } } @SubscribeEvent public static void renderSkinEvent(RenderLivingEvent event) { TotisCustomSkinRenderer.renderSkin( new ResourceLocation(Constants.MOD_ID, "textures/skins/" + skin + ".png"), event, event.getEntity(), false, player.somewhereinNBTDATA.heldSword == true); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.