Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • MOB HOLDING ITEMS AND MOB SPAWNING WITH ITEMS.
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
DARKHAWX

MOB HOLDING ITEMS AND MOB SPAWNING WITH ITEMS.

By DARKHAWX, February 4, 2013 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 4, 2013

Hey guys just wondering what the code is for making my mob pick up items off the ground and what the code would be for my mob to spawn holding an item (I want it to spawn holding a sword). Any help will be appreciated.

 

P.S. I was also wondering if someone would explain what each section of the setRotationAngles does (what angle does it change):

 

 

 super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
          float var8 = MathHelper.sin(this.onGround * (float)Math.PI);
          float var9 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float)Math.PI);
          this.bipedRightArm.rotateAngleZ = 0.0F;
          this.bipedLeftArm.rotateAngleZ = 0.0F;
          this.bipedRightArm.rotateAngleY = -(0.1F - var8 * 0.6F);
          this.bipedLeftArm.rotateAngleY = 0.1F - var8 * 0.6F;
          this.bipedRightArm.rotateAngleX = -((float)Math.PI / 4F);
          this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
          this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
          this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
          this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
          this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
          this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;

 

-DARKHAWX

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted February 4, 2013

Take a look on the code for zombies, they pickup and use items they find on the ground!

  • Quote

Share this post


Link to post
Share on other sites

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 5, 2013

I have been but I can't find the code, I've also looked at the code for the Zombie Pigmen and I can't find the code for them either. Any other suggestions?

 

  • Quote

Share this post


Link to post
Share on other sites

RegalBlaze    1

RegalBlaze

RegalBlaze    1

  • Tree Puncher
  • RegalBlaze
  • Members
  • 1
  • 21 posts
Posted February 5, 2013

The zombies pick up stuff from the ground with 1 very short boolean line: canPickUpLoot

 

I wanted to make my mob pick up specific stuff from the ground but couldn't figure out how using that code, so i think you would have to write something of your own.

  • Quote

Share this post


Link to post
Share on other sites

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 5, 2013

Yeah i've tried that. Here is the code that I copied from the zombie but it still doesn't work. Can someone figure out what's wrong?

 

 public void initCreature()
{
 this.canPickUpLoot = true;
 this.setCurrentItemOrArmor(2, new ItemStack(Item.swordSteel));
}

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted February 5, 2013

are you calling the initCreature() method from your entity's class constructor?

  • Quote

Share this post


Link to post
Share on other sites

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 5, 2013

No. I've placed it where it was placed in EntityZombie. But it still doesn't work. And I have no idea why.

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted February 6, 2013

Could you post you entity's java file into www.pastebin.com with java as syntax highlightning?

This will make it a lot easier to see what's going on :)

  • Quote

Share this post


Link to post
Share on other sites

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 6, 2013

Okay. Here: http://pastebin.com/ytN7wQ6f

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted February 6, 2013

No not the model file, the entity file, the place where you call initCreature, the file which contains the class which extends the entity?

Where you have your special methods setup and all that?

  • Quote

Share this post


Link to post
Share on other sites

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 6, 2013

Okay sorry, here is the new link: http://pastebin.com/dbyCJD3d

  • Quote

Share this post


Link to post
Share on other sites

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 6, 2013

*Bump

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted February 7, 2013

I'm working a lot of overtime this week so I doubt I can do it tonight but if you havent solved the pickup issue or someone else has found an good answer for ya, I will try to make a mob pickup items to test how it works.

Have you tried extending the zombie class? then you're mob should be able to do all that a zombie does including picking up items.

Movespeed and all such variables is possible to change for your mob, so it could work...

 

 

PS: About the rotation, go into techne and adjust rotation on the 3 sliders below the texture offset.

There you should be able to see the effect of adjusting the X, Y and Z angle's. :)

 

  • Quote

Share this post


Link to post
Share on other sites

DARKHAWX    1

DARKHAWX

DARKHAWX    1

  • Creeper Killer
  • DARKHAWX
  • Members
  • 1
  • 107 posts
Posted February 8, 2013

Okay I tried that, still didn't fix it. It added more issues. My mobs act like zombies (on fire in sun, converting villagers). Then I decided to override those in my Entity file. But that just screwed everything up and still didn't fix it. So... You might have to look at the code, because I can't figure it out.

  • Quote

Share this post


Link to post
Share on other sites

Dannyflame98    0

Dannyflame98

Dannyflame98    0

  • Tree Puncher
  • Dannyflame98
  • Members
  • 0
  • 9 posts
Posted March 6, 2013

I also want to know how to do this (Spawn holding an item not picking up)

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • DaemonUmbra
      Forge 1.14.4 not working

      By DaemonUmbra · Posted 11 minutes ago

      I see you're using Java 13, this isn't going to work for running Forge, though I don't think it's the issue here. Apparently your Minecraft jar is somehow incomplete, delete versions/1.14.4/1.14.4.jar and try again.
    • DaemonUmbra
      re:server tick loop

      By DaemonUmbra · Posted 14 minutes ago

      How did you install the modpack?
    • geekles
      [Forge 1.14.4] Loading saved world

      By geekles · Posted 36 minutes ago

      I'm working on a mod (for a personal project of mine) that allows for the game to be controlled wirelessly through commands. It's a challenge for the game where the output from the game will be streamed to connected viewers. The audience may control the game's instance through commands. I currently have it so that the ingame character's movement may be controlled via commands as well as specifying which multiplayer server to join etc. however loading up a singleplayer world is ironically seemingly more tedious and I haven't been able to get far with that part. I would like to give the audience the opportunity to either choose to join a server and try controlling the game through commands only or choose to create or join a pre-existing singleplayer world. Naturally, checks will be made to ensure no one abuses this system and tries spamming servers with connection requests. 
    • BeardlessBrady
      [1.12.2] NBT inconsistencies

      By BeardlessBrady · Posted 57 minutes ago

      Yes it seems the tile entity method #writeToNBT is acting the same way
    • diesieben07
      [1.12.2] NBT inconsistencies

      By diesieben07 · Posted 1 hour ago

      Did you verify your tile entity was being saved? Or just the custom item?
  • Topics

    • izaakbobo1
      10
      Forge 1.14.4 not working

      By izaakbobo1
      Started October 13

    • daylite
      7
      re:server tick loop

      By daylite
      Started 18 hours ago

    • geekles
      4
      [Forge 1.14.4] Loading saved world

      By geekles
      Started Thursday at 09:37 PM

    • BeardlessBrady
      8
      [1.12.2] NBT inconsistencies

      By BeardlessBrady
      Started Friday at 11:12 PM

    • Baconator
      4
      pw.mods.fml.common.LoaderException: java.lang.NoSuchFieldError: rock

      By Baconator
      Started 5 hours ago

  • Who's Online (See full list)

    • Royy212
    • DaemonUmbra
    • Rick57
    • LexManos
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • MOB HOLDING ITEMS AND MOB SPAWNING WITH ITEMS.
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community