Monster spawn in day

Discussion in 'Plugin Development' started by Someone_Like_You, Apr 22, 2014.

Thread Status:
Not open for further replies.
  1. Im trying to make zombies spawn at daytime too, I tried override the canSpawn() method in my zombie class... it didnt worked :S, anyone have any ideas?
     
  2. Offline

    Rocoty

    Help us help you. Show us your code so far.
     
    BlazingBroGamer likes this.
  3. Offline

    RawCode

    code or it didn't happen
     
    Rocoty likes this.
  4. Offline

    Rocoty

    I believe you can override the j_() method to return true. But without your code it's hard to say.
     
  5. Rocoty RawCode I tried override that method, didnt worked, and what do you guys want to see in my code? its just extended entity... here it is though
    Code:java
    1. public class Zombie extends EntityZombie {
    2. Double speed = 0.3D;
    3. Double damage = 0.15D;
    4. String type = "normal";
    5.  
    6. public Zombie(World world) {
    7. super(world);
    8. this.clearEquipments();
    9. this.getAttributeInstance(GenericAttributes.e).setValue(damage); // Original 3.0D
    10. this.getAttributeInstance(GenericAttributes.d).setValue(speed);
    11. try {
    12. Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
    13. bField.setAccessible(true);
    14. Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
    15. cField.setAccessible(true);
    16. bField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
    17. bField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
    18. cField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
    19. cField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
    20. } catch (Exception exc) {
    21. exc.printStackTrace();
    22. // This means that the name of one of the fields changed names or declaration and will have to be re-examined.
    23. }
    24. this.goalSelector.a(0, new PathfinderGoalFloat(this));
    25. this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1D, false));
    26. this.goalSelector.a(3, new PathfinderGoalMoveTowardsRestriction(this, 0.5D));
    27. this.goalSelector.a(4, new PathfinderGoalRandomStroll(this, 0.5D));
    28. this.goalSelector.a(5, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
    29. this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
    30. this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
    31. this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
    32. }
    33.  
    34. @Override
    35. protected void aC() {
    36. super.aC();
    37. this.getAttributeInstance(GenericAttributes.e).setValue(1D); // Original 3.0D
    38. this.getAttributeInstance(GenericAttributes.d).setValue(0.3D);
    39. }
    40.  
    41. public void clearEquipments(){
    42. EntityEquipment ee = ((LivingEntity) this.getBukkitEntity()).getEquipment();
    43. ee.setHelmet(null);
    44. ee.setChestplate(null);
    45. ee.setLeggings(null);
    46. ee.setBoots(null);
    47. ee.setItemInHand(null);
    48. }
    49.  
    50. public String getType(){
    51. return this.type;
    52. }
    53. }

    note : the canSpawn() method isnt here because I deleted it.. it didnt worked
     
  6. Offline

    Deleted user

Thread Status:
Not open for further replies.

Share This Page