All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.EntityCaveSpider Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package net.minecraft.server;

import org.bukkit.entity.CaveSpider;
import org.jetbrains.annotations.NotNull;

public class EntityCaveSpider extends EntitySpider {

  public EntityCaveSpider(World world) {
    super(world);
    this.setSize(0.7F, 0.5F);
  }

  protected void initAttributes() {
    super.initAttributes();
    this.getAttributeInstance(GenericAttributes.maxHealth).setValue(12.0D);
  }

  public boolean r(Entity entity) {
    if (super.r(entity)) {
      if (entity instanceof EntityLiving) {
        byte b0 = 0;

        if (this.world.getDifficulty() == EnumDifficulty.NORMAL) {
          b0 = 7;
        } else if (this.world.getDifficulty() == EnumDifficulty.HARD) {
          b0 = 15;
        }

        if (b0 > 0) {
          ((EntityLiving) entity).addEffect(new MobEffect(MobEffectList.POISON.id, b0 * 20, 0));
        }
      }

      return true;
    } else {
      return false;
    }
  }

  public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, GroupDataEntity groupdataentity) {
    return groupdataentity;
  }

  public float getHeadHeight() {
    return 0.45F;
  }

  @NotNull
  @Override
  public CaveSpider getEntity() {
    return (CaveSpider) super.getEntity();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy