mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 07:59:28 +00:00
Cleaned up bosstype
This commit is contained in:
@@ -19,7 +19,6 @@ import net.minecraft.server.v1_16_R3.PathfinderGoalRandomStroll;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey;
|
||||||
import org.bukkit.entity.Illusioner;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -51,11 +50,4 @@ public class CustomIllusioner extends EntityIllagerIllusioner implements CustomI
|
|||||||
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300));
|
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300));
|
||||||
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, false)).a(300));
|
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, false)).a(300));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Illusioner spawn(@NotNull final Location location) {
|
|
||||||
CustomIllusioner illusioner = new CustomIllusioner(location);
|
|
||||||
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
|
||||||
return (Illusioner) illusioner.getBukkitEntity();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package com.willfp.ecobosses.bosses.util.bosstype;
|
package com.willfp.ecobosses.bosses.util.bosstype;
|
||||||
|
|
||||||
import com.willfp.ecobosses.proxy.util.CustomEntities;
|
import com.willfp.ecobosses.proxy.util.CustomEntities;
|
||||||
|
import com.willfp.ecobosses.proxy.util.CustomEntity;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@UtilityClass
|
@UtilityClass
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public class BossEntityUtils {
|
public class BossEntityUtils {
|
||||||
/**
|
/**
|
||||||
* Get boss type.
|
* Get boss type.
|
||||||
@@ -15,11 +17,17 @@ public class BossEntityUtils {
|
|||||||
* @param id The name.
|
* @param id The name.
|
||||||
* @return The boss type.
|
* @return The boss type.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public static BossType getBossType(@NotNull final String id) {
|
public static BossType getBossType(@NotNull final String id) {
|
||||||
if (CustomEntities.getEntityClass(id) != null) {
|
Class<? extends CustomEntity<? extends LivingEntity>> proxy = CustomEntities.getEntityClass(id.toLowerCase());
|
||||||
return new CustomBossType(Objects.requireNonNull(CustomEntities.getEntityClass(id)));
|
Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass();
|
||||||
} else {
|
if (proxy != null) {
|
||||||
return new VanillaBossType(Objects.requireNonNull(EntityType.valueOf(id.toUpperCase()).getEntityClass()));
|
return new CustomBossType(proxy);
|
||||||
}
|
}
|
||||||
|
if (type != null) {
|
||||||
|
return new VanillaBossType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.willfp.ecobosses.bosses.util.bosstype;
|
package com.willfp.ecobosses.bosses.util.bosstype;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -11,14 +10,14 @@ class VanillaBossType extends BossType {
|
|||||||
/**
|
/**
|
||||||
* The entity type.
|
* The entity type.
|
||||||
*/
|
*/
|
||||||
private final Class<? extends Entity> entityClass;
|
private final Class<? extends LivingEntity> entityClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new vanilla boss type.
|
* Create new vanilla boss type.
|
||||||
*
|
*
|
||||||
* @param entityClass The entity class.
|
* @param entityClass The entity class.
|
||||||
*/
|
*/
|
||||||
VanillaBossType(@NotNull final Class<? extends Entity> entityClass) {
|
VanillaBossType(@NotNull final Class<? extends LivingEntity> entityClass) {
|
||||||
this.entityClass = entityClass;
|
this.entityClass = entityClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user