Meldexun Posted April 17, 2019 Share Posted April 17, 2019 So i have made a armor with a custom model. The model is tight on the player skin and is working properly with a normal Skin (the 4x12x4 arms from steve). But with a skin with small arms the arms aren't rotating the same way as my armor. This results in the arms coming out of the armor from the swing animation. That's the model class: ModelRenderer diveRightArm; public Model() { super(0.0F); this.textureWidth = 64; this.textureHeight = 64; diveRightArm = new ModelRenderer(this, 0, 80); diveRightArm.addBox(-2.0F, -2.0F, -2.0F, 4, 12, 4, 0.001F); diveRightArm.setRotationPoint(0.0F, 0.5F, 0.0F); diveRightArm.setTextureSize(textureWidthIn, textureHeightIn); diveRightArm.mirror = true; setRotation(diveRightArm, 0.0F, 0.0F, 0.0F); } @Override public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } The arms should be covered: Quote Link to comment Share on other sites More sharing options...
Meldexun Posted April 17, 2019 Author Share Posted April 17, 2019 So i found out that when i extend my model class ModelPlayer instead of ModelBiped my model is rotating correctly with the arms. But that results in other problems. For example in multiplayer the armor is just rendered for yourself and others don't see it. Has anyone experience with that? Quote Link to comment Share on other sites More sharing options...
Xumuk Posted April 17, 2019 Share Posted April 17, 2019 (edited) I also made a armor with custom model, but the texture is very incorrectly displayed. In order not to create new threads, I'll ask my question here. Edited April 17, 2019 by Xumuk Quote Link to comment Share on other sites More sharing options...
Xumuk Posted April 17, 2019 Share Posted April 17, 2019 And I can advise the author of the topic to see what methods the IDE offers from ModelBiped and ModelRenderer. Perhaps there are methods that will add support for changing the movement of the hand. Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted April 18, 2019 Share Posted April 18, 2019 11 hours ago, Xumuk said: In order not to create new threads, I'll ask my question here. Make a new thread, having two people with different problems (even if the symptoms are the same) on the same thread never works out so as a general rule make your own thread. Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
Cadiboo Posted April 18, 2019 Share Posted April 18, 2019 15 hours ago, Meldexun said: For example in multiplayer the armor is just rendered for yourself and others don't see it. Has anyone experience with that? This usually means that you are using Minecraft#player when you shouldn’t be. Post your new code (all of it) Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
Meldexun Posted April 18, 2019 Author Share Posted April 18, 2019 (edited) 3 hours ago, Cadiboo said: This usually means that you are using Minecraft#player when you shouldn’t be. I'm never using for this part of my mod. So thats my new model class: @SideOnly(Side.CLIENT) public class ModelDivingGear extends ModelPlayer { ModelRenderer diveRightArm; ModelRenderer diveLeftArm; public ModelDivingGear(float scale, boolean smallArmsIn) { super(scale, smallArmsIn); this.textureHeight = 128; this.textureWidth = 64; //arms if (smallArmsIn) { diveRightArm = this.createCube(0, 48 + 32, -2.0F, -2.0F, -2.0F, 3, 12, 4, 0.251F); setRotation(diveRightArm, 0.0F, 0.0F, 0.0F); diveLeftArm = this.createCube(0, 48 + 32, -2.0F, -2.0F, -2.0F, 3, 12, 4, 0.251F); setRotation(diveLeftArm, 0.0F, (float) Math.PI, 0.0F); } else { diveRightArm = this.createCube(0, 48 + 32, -3.0F, -2.0F, -2.0F, 4, 12, 4, 0.251F); setRotation(diveRightArm, 0.0F, 0.0F, 0.0F); diveLeftArm = this.createCube(0, 48 + 32, -3.0F, -2.0F, -2.0F, 4, 12, 4, 0.251F); setRotation(diveLeftArm, 0.0F, (float) Math.PI, 0.0F); } bipedRightArm.addChild(diveRightArm); bipedLeftArm.addChild(diveLeftArm); } @Override public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } private ModelRenderer createCube(int texOffX, int texOffY, float offX, float offY, float offZ, int width, int height, int depth, float scale) { ModelRenderer m = new ModelRenderer(this, texOffX, texOffY); m.addBox(offX, offY, offZ, width, height, depth, scale); m.setRotationPoint(0.0F, 0.0F, 0.0F); m.setTextureSize(textureWidth, textureHeight); m.mirror = true; return m; } } Here i create the model: @EventBusSubscriber(Side.CLIENT) public class ArmorModels { public static ModelDivingGear divingGearModel; public static ModelDivingGear divingGearModelSlim; public static ModelDivingGearLegs divingGearModelLegs; @SubscribeEvent public static void registerRenders(ModelRegistryEvent event) { divingGearModel = new ModelDivingGear(0.0F, false); divingGearModelSlim = new ModelDivingGear(0.0F, true); divingGearModelLegs = new ModelDivingGearLegs(0.0F); } } And i override the getArmorModel method: @SideOnly(Side.CLIENT) @Override public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { return armorSlot == EntityEquipmentSlot.LEGS ? ArmorModels.divingGearModelLegs : entityLiving instanceof EntityPlayer && ((EntityPlayerSP) entityLiving).getSkinType().equals("slim") ? ArmorModels.divingGearModelSlim : ArmorModels.divingGearModel; } I thought the getArmorModel method always passes you an EntityPlayerSP when a player is wearing the armor. But it may pass an EntityPlayerMP on servers? Is that right? That the only point that i don't really know about. Edited April 18, 2019 by Meldexun Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted April 19, 2019 Share Posted April 19, 2019 12 hours ago, Meldexun said: I thought the getArmorModel method always passes you an EntityPlayerSP when a player is wearing the armor. But it may pass an EntityPlayerMP on servers? Is that right? That the only point that i don't really know about. Armor models are client side only so it will never pass an EntityPlayerMP. It may pass you an EntityOtherPlayerMP though. Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
Meldexun Posted April 19, 2019 Author Share Posted April 19, 2019 8 hours ago, Cadiboo said: Armor models are client side only so it will never pass an EntityPlayerMP. It may pass you an EntityOtherPlayerMP though. Yeah, i also found this out already after some testing. So i'm now checking for AbstractClientPlayer (it may be named different). Also i changed my model again and all seems to work fine now. Thank you for the help. 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.