spawnCreature spawnEntity not workin'

Discussion in 'Plugin Development' started by TheGamesHawk2001, May 25, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    I Al Istannen

    @TheGamesHawk2001 What exactly didn't work? Any errors? Why do you spawn a zombie? And you could use "Location loc = p.getLocation()". In your event handler: You named it hitPet. You are checking if the damaged Entity is a player and the Entity that damaged is a cow. I don't think the cow is going to kill sb.
     
  2. Why not.

    It doesn't spawn any animals.

    Thought it was the other way around :p
     
  3. Offline

    I Al Istannen

    @TheGamesHawk2001 Does it send the message? This
    Code:
    Cow cow = (Cow) player.getWorld().spawnEntity(player.getLocation(), EntityType.COW); 
    worked perfectly fine for me.
     
  4. Yes, it sent the message saying it spawned a cow but no cow was spawned nor a zombie.
     
  5. Offline

    I Al Istannen

    @TheGamesHawk2001 Have you tried the one line I sent you?

    EDIT: And you are using "cow.setTarget(p)". I would be surprised if that works in the way you think.
     
  6. na

    https://imgur.com/GfQl3R7
     
  7. Offline

    I Al Istannen

    @TheGamesHawk2001 I copy and pasted your code. It worked. Have you somehow turned mob spawning off?
     
  8. Offline

    Zombie_Striker

  9. Offline

    I Al Istannen

    @Zombie_Striker Afaik that doesn't solve the problem he mentioned though.
     
  10. Offline

    Zombie_Striker

    @TheGamesHawk2001
    Maybe the problem is you are making a new Location the hard way. Your getting the World,XYZ instead of using Player#getLocation() (You are constantly using .getLocation, which returns a Location, and you chose the hard way!)

    The next step after that is that you need to do debugging. Is the cow == null? Are you setting a value something you shouldn't? If you relog, does it appear? Are there plugins that limit spawnRates? Do you do anything externally with cows?
     
    Last edited: May 26, 2015
  11. Offline

    I Al Istannen

    @Zombie_Striker Just to clarify it, I'm not op xD. I tried to help him. His/Her code worked for me, I even copy pasted it. Result? Working. I have no idea what's going on there.
     
  12. Offline

    caderape

  13. had mob spawning turned off, thanks <3
     
  14. Offline

    Zombie_Striker

    If this problem has be solved, mark as solved.
     
Thread Status:
Not open for further replies.

Share This Page