Jump to content

Zer0HD2

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by Zer0HD2

  1. @TheGreyGhost I already have another custom model working fine, but it does seem to be the addChild part which is breaking things. What you can't see in the image is that it's actually cloned some parts of the model 2-3 times under the ground. @jabelar I already took a look at that, not entirely sure which part you're referring to.
  2. I don't really feel like this needs much of an explanation... Model as it appears in Techne (sorry, dropbox images broke, have to post links): https://www.dropbox.com/s/xcpuvz0stihu4s2/meh.PNG Model as it appears in-game: https://www.dropbox.com/s/rxk5klq65lvtvtd/javaw%202014-06-13%2000-35-48-151.png And my code: Model public class ModelGoblinModel extends ModelBase { //fields ModelRenderer Head; ModelRenderer RightEar; ModelRenderer LeftEar; ModelRenderer Nose; ModelRenderer NosePart2; ModelRenderer UpperArm2; ModelRenderer UpperArm1; ModelRenderer LowerArm2; ModelRenderer LowerArm1; ModelRenderer UpperBody; ModelRenderer LowerBody; ModelRenderer Leg2; ModelRenderer Leg1; ModelRenderer Foot2; ModelRenderer Foot1; ModelRenderer UpperLeg1; ModelRenderer UpperLeg2; ModelRenderer hilt; ModelRenderer CrossGuard; ModelRenderer CrossGuardLeft; ModelRenderer CrossGuardRight; ModelRenderer Blade; ModelRenderer BladePart3; ModelRenderer BladePart2; public ModelGoblinModel() { textureWidth = 64; textureHeight = 32; Head = new ModelRenderer(this, 42, 0); Head.addBox(-3F, -5F, -2.5F, 6, 5, 5); Head.setRotationPoint(0F, 5F, 0F); Head.setTextureSize(64, 32); setRotation(Head, 0F, 0F, 0F); Nose = new ModelRenderer(this, 50, 26); Nose.addBox(-0.5F, -0.5F, -1F, 1, 1, 1); Nose.setRotationPoint(0F, 3F, -2F); Nose.setTextureSize(64, 32); setRotation(Nose, 0.1745329F, 0F, 0F); Head.addChild(Nose); NosePart2 = new ModelRenderer(this, 50, 29); NosePart2.addBox(-0.5F, -0.5F, -1F, 1, 2, 1); NosePart2.setRotationPoint(0F, 3.7F, -2.5F); NosePart2.setTextureSize(64, 32); setRotation(NosePart2, -0.5948578F, 0F, 0F); Nose.addChild(NosePart2); RightEar = new ModelRenderer(this, 54, 29); RightEar.addBox(-4F, -1F, -0.5F, 4, 2, 1); RightEar.setRotationPoint(-2.5F, 2F, 0F); RightEar.setTextureSize(64, 32); setRotation(RightEar, 0.3490659F, 0.7853982F, 0.3490659F); Head.addChild(RightEar); LeftEar = new ModelRenderer(this, 54, 26); LeftEar.addBox(0F, -1F, -0.5F, 4, 2, 1); LeftEar.setRotationPoint(2.5F, 2F, 0F); LeftEar.setTextureSize(64, 32); setRotation(LeftEar, 0.3490659F, -0.7853982F, -0.3490659F); Head.addChild(LeftEar); UpperArm2 = new ModelRenderer(this, 28, 24); UpperArm2.addBox(-1F, 0F, -1.5F, 2, 5, 3); UpperArm2.setRotationPoint(3F, 5F, 0.5F); UpperArm2.setTextureSize(64, 32); setRotation(UpperArm2, 0.4014257F, 0.1483529F, -0.3665191F); UpperArm1 = new ModelRenderer(this, 38, 24); UpperArm1.addBox(-1F, 0F, -1.5F, 2, 5, 3); UpperArm1.setRotationPoint(-3F, 5F, 0.5F); UpperArm1.setTextureSize(64, 32); setRotation(UpperArm1, 0.4014257F, -0.1483529F, 03665191F); LowerArm2 = new ModelRenderer(this, 26, 6); LowerArm2.addBox(-1F, 0F, -1F, 2, 6, 2); LowerArm2.setRotationPoint(3F, 10F, 0.5F); LowerArm2.setTextureSize(64, 32); setRotation(LowerArm2, -0.7853981F, 0F, 0F); UpperArm2.addChild(LowerArm2); LowerArm1 = new ModelRenderer(this, 34, 6); LowerArm1.addBox(-1F, 0F, -1F, 2, 6, 2); LowerArm1.setRotationPoint(-3F, 10F, 0.5F); LowerArm1.setTextureSize(64, 32); setRotation(LowerArm1, -0.7853981F, 0F, 0F); UpperArm1.addChild(LowerArm1); UpperLeg1 = new ModelRenderer(this, 26, 0); UpperLeg1.addBox(-1F, 0F, -1F, 2, 4, 2); UpperLeg1.setRotationPoint(-2F, 15F, 0.5F); UpperLeg1.setTextureSize(64, 32); setRotation(UpperLeg1, -0.5235988F, 0F, 0F); Leg1 = new ModelRenderer(this, 30, 14); Leg1.addBox(-1F, 0F, -1F, 2, 6, 2); Leg1.setRotationPoint(-2F, 18F, -1.5F); Leg1.setTextureSize(64, 32); setRotation(Leg1, 0.4014257F, 0F, 0F); UpperLeg1.addChild(Leg1); Foot1 = new ModelRenderer(this, 20, 29); Foot1.addBox(-1F, 0F, -1F, 2, 1, 2); Foot1.setRotationPoint(-2F, 23F, -0.5F); Foot1.setTextureSize(64, 32); setRotation(Foot1, 0F, 0F, 0F); UpperLeg2 = new ModelRenderer(this, 34, 0); UpperLeg2.addBox(-1F, 0F, -1F, 2, 4, 2); UpperLeg2.setRotationPoint(2F, 15F, 0.5F); UpperLeg2.setTextureSize(64, 32); setRotation(UpperLeg2, -0.5235988F, 0F, 0F); Leg2 = new ModelRenderer(this, 38, 14); Leg2.addBox(-1F, 0F, -1F, 2, 6, 2); Leg2.setRotationPoint(2F, 18F, -1.5F); Leg2.setTextureSize(64, 32); setRotation(Leg2, 0.4014257F, 0F, 0F); UpperLeg2.addChild(Leg2); Foot2 = new ModelRenderer(this, 20, 26); Foot2.addBox(-1F, 0F, -1F, 2, 1, 2); Foot2.setRotationPoint(2F, 23F, -0.5F); Foot2.setTextureSize(64, 32); setRotation(Foot2, 0F, 0F, 0F); Leg2.addChild(Foot2); UpperBody = new ModelRenderer(this, 46, 10); UpperBody.addBox(-3F, -5F, -1F, 6, 5, 3); UpperBody.setRotationPoint(0F, 10F, 0F); UpperBody.setTextureSize(64, 32); setRotation(UpperBody, 0F, 0F, 0F); LowerBody = new ModelRenderer(this, 48, 18); LowerBody.addBox(-2.5F, -2F, -1F, 5, 5, 3); LowerBody.setRotationPoint(0F, 12F, 0F); LowerBody.setTextureSize(64, 32); setRotation(LowerBody, 0F, 0F, 0F); hilt = new ModelRenderer(this, 0, 28); hilt.addBox(0F, 0F, 0F, 1, 1, 3); hilt.setRotationPoint(-4F, 14F, -1F); hilt.setTextureSize(64, 32); setRotation(hilt, 0F, 0F, 0F); LowerArm1.addChild(hilt); CrossGuard = new ModelRenderer(this, 0, 0); CrossGuard.addBox(0F, 0F, 0F, 1, 3, 1); CrossGuard.setRotationPoint(-4F, 13F, -2F); CrossGuard.setTextureSize(64, 32); setRotation(CrossGuard, 0F, 0F, 0F); hilt.addChild(CrossGuard); CrossGuardLeft = new ModelRenderer(this, 8, 26); CrossGuardLeft.addBox(0F, 0F, 0F, 1, 2, 1); CrossGuardLeft.setRotationPoint(-4F, 15.4F, -1.7F); CrossGuardLeft.setTextureSize(64, 32); setRotation(CrossGuardLeft, -0.5948578F, 0F, 0F); CrossGuard.addChild(CrossGuardLeft); Blade = new ModelRenderer(this, 0, 11); Blade.addBox(0F, 0F, 0F, 1, 3, 12); Blade.setRotationPoint(-4F, 13F, -14F); Blade.setTextureSize(64, 32); setRotation(Blade, 0F, 0F, 0F); CrossGuard.addChild(Blade); CrossGuardRight = new ModelRenderer(this, 8, 29); CrossGuardRight.addBox(0F, 0F, 0F, 1, 2, 1); CrossGuardRight.setRotationPoint(-4F, 13.1F, -0.9F); CrossGuardRight.setTextureSize(64, 32); setRotation(CrossGuardRight, 3.735005F, 0F, 0F); CrossGuard.addChild(CrossGuardRight); BladePart3 = new ModelRenderer(this, 15, 4); BladePart3.addBox(0F, 0F, 0F, 1, 1, 1); BladePart3.setRotationPoint(-4F, 12F, -13F); BladePart3.setTextureSize(64, 32); setRotation(BladePart3, 0F, 0F, 0F); Blade.addChild(BladePart3); BladePart2 = new ModelRenderer(this, 4, 0); BladePart2.addBox(0F, 0F, 0F, 1, 2, 1); BladePart2.setRotationPoint(-4F, 11F, -14F); BladePart2.setTextureSize(64, 32); setRotation(BladePart2, 0F, 0F, 0F); Blade.addChild(BladePart2); } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Head.render(f5); Nose.render(f5); UpperArm2.render(f5); UpperArm1.render(f5); LowerArm2.render(f5); LowerArm1.render(f5); Leg2.render(f5); Leg1.render(f5); LowerBody.render(f5); Foot2.render(f5); UpperLeg1.render(f5); UpperLeg2.render(f5); UpperBody.render(f5); hilt.render(f5); CrossGuard.render(f5); CrossGuardLeft.render(f5); RightEar.render(f5); LeftEar.render(f5); Blade.render(f5); CrossGuardRight.render(f5); NosePart2.render(f5); Foot1.render(f5); BladePart3.render(f5); BladePart2.render(f5); } protected void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } @Override public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.Head.rotateAngleY = f3 / (180F / (float)Math.PI); this.Head.rotateAngleX = f3 / (180F / (float)Math.PI); this.UpperArm1.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 2.0F * f1 * 0.5F; this.UpperArm2.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F; this.UpperArm1.rotateAngleZ = 0.0F; this.UpperArm2.rotateAngleZ = 0.0F; this.UpperLeg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; this.UpperLeg2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1; this.UpperLeg1.rotateAngleY = 0.0F; this.UpperLeg2.rotateAngleY = 0.0F; float f6; float f7; } } Renderer: public class GoblinRenderer extends RenderLiving { private static final ResourceLocation texLoc = new ResourceLocation(Reference.MODID + ":" + "textures/models/goblin.png"); public GoblinRenderer(ModelGoblinModel model, float shadowSize) { super(model, shadowSize); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return texLoc; } }
  3. That works perfectly, thanks!
  4. The issue I have is that the NameFormat event only normally fires when a player logs in, but I need to update their username while they are still logged in.
  5. You can indeed, thanks for that. One other question, regarding the EntityPlayer and String used when creating a new NameFormat event to post to the bus: should I use the player's display name or CommandSenderName for the string argument? The event is being fired, but the player's name is not changing. Could this be because the display name already has something appended to it?
  6. So I'm creating a mod which stores information about a player. This information is displayed both in a custom GUI element on their screen, and in their display name. I can change the display name using the NameFormat event when the player logs in, but it sometimes needs to change without the player relogging. Is there any way to either change the player's display name or manually trigger the NameFormat event?
  7. There's also a pretty nifty search bar on these forums... you could, I don't know, find the 10 or so people who have asked this exact question before you and read the answers given to them. Which, by the way, are almost always the answer diesieben07 gave above.
  8. Changing a vanilla harvest level depends on whether you want to change the level of a tool or a block. A block is easier, as you just have to override the Forge methods that set the harvest level after mods have loaded using Reflection.initialize(ForgeHooks.class);, (Thanks to diesieben07 for that tip ) then just use setHarvestLevel on the block you want to change. Changing a tool's harvest level is harder, it involves removing the recipe for said tool and creating your own with a different EnumToolMaterial.
  9. As diesieben7 said, every item will have a NBTTagCompound assigned to it. You can read and write values using a sort of name/value pair system (bad explaination on my part, I haven't really used them much). So you could set the kill count using tagComp.getInt("killCount") to get the current one, incrementing it, then using tagComp.setInt("killCount", newValue) to add the new count. You will need more than those two functions, but that's pretty much the basics of reading and writing to a tag compound.
  10. Can you post your main class?
  11. I would use NBT tags to store the kill count, then use the addInformation method to display how many kills the weapon has on the tooltip. Additionally, you could store who crafted it in the NBT compound and only apply the kill count bonus for that player.
  12. However, createExplosion is not.
  13. After some excessive googling, it appears I have to write a custom item rendering method for the weapon. Does anyone have any pointers about this and/or a better way of getting the mob to hold the weapon?
  14. I'm just focusing on getting the weapon to render right now. Tried using the renderEquippedItems() method from RenderBiped with no luck.
  15. So I've created a mob which uses a custom model, but the model is similar enough to the default ModelBiped that the default armour models should fit on it. However, when I use this.setCurrentItemOrArmor(3, new ItemStack(Items.iron_chestplate)); to try and add an iron chestplate to the mob (as I have done with my other custom mob which uses the biped model), it does nothing. I'm also trying to add a weapon to the mob (this seems like it should be easier), yet I can't get that to display either. However, the mob does sometimes drop the weapon when it dies. Is there some method I need to create to add armour or weapons to a custom model?
  16. If you're starting the game through Eclipse, you will have a different player name, but the mob will still belong to the name you had when you tamed it.
  17. Ah, thanks. That works
  18. That's what I tried, all of it works except for the final step. Can't get the armorType variable.
  19. Is there any way of getting which armorType a player's held item is? As in, helmet, body, legs, boots.
  20. You, my good sir, are awesome. Thanks for that, works perfectly
  21. The issue with changing the harvest level in preInit is that Forge then goes and changes it back to default afterwards.
  22. Because I was writing it in a hurry and that was the only event I could think of on the spot. Any suggestions to improve it are welcome I'm fairly new to Forge modding, so some of the stuff I do may not be the best solution.
  23. There are multiple ways of doing this, depending on what exactly you want to do. For example, setting the harvest level of a vanilla block (I've just got this working in my mod) is quite tricky, as Forge sets this after the mod loads. This means that you have to use an event listener, in my case, a player join even listener. This is done by creating a new class file to tell the mod what to run on that event, and using the EVENT_BUS on your main mod file to listen for the event: Main file: FMLCommonHandler.instance().bus().register(new PlayerJoinEvent()); PlayerJoinEvent.class: public class PlayerJoinEvent{ @SubscribeEvent public void playerJoin(PlayerEvent.PlayerLoggedInEvent event) { //Modify iron ore to require a harvest level of 3 (diamond): Blocks.iron_ore.setHarvestLevel("pickaxe", 3); } } Drops are done using the same method, but using a different event: HarvestDropsEvent. The following code would make iron ore drop 64 diamond pickaxes. Because why not? public class BlockHarvestEvent { @SubscribeEvent public void onBlockHarvest(HarvestDropsEvent event) { if(event.block == Blocks.iron_ore) { event.drops.clear(); event.drops.add(new ItemStack(Items.diamond_pickaxe, 64)); } } } Again, this has to be called in your main file, but using a different event bus: MinecraftForge.EVENT_BUS.register(new BlockHarvestEvent()); Most other things can be changed without needing to listen for an event, such as hardness (I know for a fact that this one works, I use it in my mods).
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.