mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 07:59:28 +00:00
Updated PR to use ChargedCreeperBossType
This commit is contained in:
@@ -42,7 +42,7 @@ public class BossEntityUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (id.equalsIgnoreCase("charged_creeper")) {
|
if (id.equalsIgnoreCase("charged_creeper")) {
|
||||||
return new VanillaBossType(Creeper.class, true);
|
return new ChargedCreeperBossType();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.willfp.ecobosses.bosses.util.bosstype;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Creeper;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
class ChargedCreeperBossType extends VanillaBossType {
|
||||||
|
/**
|
||||||
|
* Create new Charged Creeper boss type.
|
||||||
|
*/
|
||||||
|
ChargedCreeperBossType() {
|
||||||
|
super(Creeper.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a charged creeper.
|
||||||
|
*
|
||||||
|
* @param location The location.
|
||||||
|
* @return The entity.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LivingEntity spawnBossEntity(@NotNull final Location location) {
|
||||||
|
Creeper creeper = Objects.requireNonNull(location.getWorld()).spawn(location, Creeper.class);
|
||||||
|
creeper.setPowered(true);
|
||||||
|
return creeper;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,11 +13,6 @@ class VanillaBossType extends BossType {
|
|||||||
*/
|
*/
|
||||||
private final Class<? extends LivingEntity> entityClass;
|
private final Class<? extends LivingEntity> entityClass;
|
||||||
|
|
||||||
/**
|
|
||||||
* If the entity is Creeper and should or should not be charged.
|
|
||||||
*/
|
|
||||||
private final boolean creeperCharged;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new vanilla boss type.
|
* Create new vanilla boss type.
|
||||||
*
|
*
|
||||||
@@ -25,24 +20,11 @@ class VanillaBossType extends BossType {
|
|||||||
*/
|
*/
|
||||||
VanillaBossType(@NotNull final Class<? extends LivingEntity> entityClass) {
|
VanillaBossType(@NotNull final Class<? extends LivingEntity> entityClass) {
|
||||||
this.entityClass = entityClass;
|
this.entityClass = entityClass;
|
||||||
this.creeperCharged = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create new vanilla boss type.
|
|
||||||
*
|
|
||||||
* @param entityClass The entity class.
|
|
||||||
* @param creeperCharged The creeper power state.
|
|
||||||
*/
|
|
||||||
VanillaBossType(@NotNull final Class<? extends LivingEntity> entityClass, boolean creeperCharged) {
|
|
||||||
this.entityClass = entityClass;
|
|
||||||
this.creeperCharged = creeperCharged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LivingEntity spawnBossEntity(@NotNull final Location location) {
|
public LivingEntity spawnBossEntity(@NotNull final Location location) {
|
||||||
LivingEntity result = Objects.requireNonNull(location.getWorld()).spawn(location, entityClass);
|
LivingEntity result = Objects.requireNonNull(location.getWorld()).spawn(location, entityClass);
|
||||||
if (result instanceof Creeper creeper && creeperCharged) creeper.setPowered(true);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user