コード例 #1
0
 /**
  * API method to add custom default hitboxes.
  *
  * @param entityClass The entity class to add the custom default for (also applies to classes
  *     extending this one)
  * @return The added default hitbox object
  */
 public static HeadHitboxDefault add(
     Class entityClass,
     float scale,
     float childScale,
     float[] size,
     float[] offset,
     float headDamage,
     float bodyDamage,
     float headMultiplier,
     float bodyMultiplier) {
   HeadHitboxDefault hitbox =
       new HeadHitboxDefault(
           scale,
           childScale,
           size,
           offset,
           headDamage,
           bodyDamage,
           headMultiplier,
           bodyMultiplier);
   hitbox.entityClass = entityClass;
   HeadHitboxDefault.DEFAULT_HEAD_HITBOXES.add(hitbox);
   return hitbox;
 }
コード例 #2
0
 public static HeadHitboxDefault add(Class entityClass, HeadHitboxDefault hitbox) {
   hitbox.entityClass = entityClass;
   HeadHitboxDefault.DEFAULT_HEAD_HITBOXES.add(hitbox);
   return hitbox;
 }
コード例 #3
0
  static {
    // Populate the defaults map
    HeadHitboxDefault hitbox;

    HeadHitboxDefault.add(EntityCreeper.class, new HeadHitboxDefault(0.35F));
    HeadHitboxDefault.add(EntitySkeleton.class);
    HeadHitboxDefault.add(
        EntitySpider.class, new HeadHitboxDefault(0.4F, 0.5F, 0.4F, 0.0F, -0.1F, 0.75F));
    HeadHitboxDefault.add(EntityGiantZombie.class);
    HeadHitboxDefault.add(EntityZombie.class);
    HeadHitboxDefault.add(
        EntitySlime.class,
        new HeadHitboxDefault(0.35F, 0.35F, 0.35F, 0.0F, 0.3F, 1.0F, 1.0F, 0.0F, 1.0F, 0.3F));
    HeadHitboxDefault.add(
        EntityGhast.class, new HeadHitboxDefault(0.35F, 0.35F, 0.35F, 0.0F, 0.3F, 1.0F));
    hitbox = HeadHitboxDefault.add(EntityEnderman.class);
    hitbox.offset[1] = -0.02F;
    HeadHitboxDefault.add(
        EntitySilverfish.class, new HeadHitboxDefault(1.0F, Float.NaN, 1.0F, 0.0F, 0.0F, 1.0F));
    HeadHitboxDefault.add(EntityBlaze.class, new HeadHitboxDefault(0.35F));
    HeadHitboxDefault.add(
        EntityDragon.class,
        new HeadHitboxDefault(0.4F, Float.NaN, 0.4F, 0.0F, 0.0F, -1.0F, 1.0F, 0.0F, 1.0F, 1.0F));
    hitbox = HeadHitboxDefault.add(EntityWither.class, new HeadHitboxDefault(0.4F, 1.0F, 1.5F));
    hitbox.offset[1] = -0.02F;
    HeadHitboxDefault.add(EntityBat.class, new HeadHitboxDefault(0.5F));
    HeadHitboxDefault.add(EntityWitch.class, new HeadHitboxDefault(0.25F));
    HeadHitboxDefault.add(
        EntityPig.class, new HeadHitboxDefault(0.5F, 0.5F, 0.5F, 0.0F, -0.1F, 1.0F));
    HeadHitboxDefault.add(
        EntitySheep.class, new HeadHitboxDefault(0.5F, 0.3F, 0.5F, 0.0F, -0.1F, 1.0F));
    HeadHitboxDefault.add(
        EntityCow.class, new HeadHitboxDefault(0.5F, 0.3F, 0.4F, 0.0F, -0.1F, 1.0F));
    HeadHitboxDefault.add(
        EntityChicken.class, new HeadHitboxDefault(1.0F, 0.8F, 1.0F, 0.0F, -0.4F, 1.6F));
    HeadHitboxDefault.add(
        EntitySquid.class, new HeadHitboxDefault(0.5F, Float.NaN, 0.3F, 0.0F, 0.0F, -1.0F));
    HeadHitboxDefault.add(
        EntityWolf.class, new HeadHitboxDefault(0.5F, 0.5F, 0.3F, 0.0F, -0.1F, 1.0F));
    HeadHitboxDefault.add(EntitySnowman.class, new HeadHitboxDefault(0.35F, -1.0F, 0.3F));
    HeadHitboxDefault.add(
        EntityOcelot.class, new HeadHitboxDefault(0.4F, 0.5F, 0.4F, 0.0F, -0.1F, 1.2F));
    HeadHitboxDefault.add(EntityIronGolem.class, new HeadHitboxDefault(0.35F, 1.0F, 1.5F));
    HeadHitboxDefault.add(
        EntityHorse.class, new HeadHitboxDefault(0.4F, 0.5F, 0.4F, 0.0F, -0.3F, 0.75F));
    HeadHitboxDefault.add(EntityVillager.class, HeadHitboxDefault.get(EntityWitch.class).copy());
  }