9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-21 16:09:24 +00:00

Removed NMS, replaced illusioner with Dark Guardian

This commit is contained in:
Auxilor
2021-08-13 15:38:12 +01:00
parent 1918a46678
commit 7804cebd53
22 changed files with 13 additions and 335 deletions

View File

@@ -7,9 +7,6 @@ plugins {
dependencies { dependencies {
implementation project(":eco-core:core-plugin") implementation project(":eco-core:core-plugin")
implementation project(":eco-core:core-proxy")
implementation project(":eco-core:core-nms:v1_16_R3")
implementation project(path: ":eco-core:core-nms:v1_17_R1", configuration: 'mapped')
} }
allprojects { allprojects {

View File

@@ -1,9 +0,0 @@
group 'com.willfp'
version rootProject.version
subprojects {
dependencies {
compileOnly project(':eco-core:core-proxy')
compileOnly project(':eco-core:core-plugin')
}
}

View File

@@ -1,6 +0,0 @@
group 'com.willfp'
version rootProject.version
dependencies {
compileOnly 'org.spigotmc:spigot:1.16.4-R0.1-SNAPSHOT'
}

View File

@@ -1,22 +0,0 @@
package com.willfp.ecobosses.proxy.v1_16_R3;
import com.willfp.ecobosses.proxy.proxies.CustomEntitySpawnerProxy;
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
import com.willfp.ecobosses.proxy.util.CustomEntity;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@SuppressWarnings("unchecked")
public class CustomEntitySpawner implements CustomEntitySpawnerProxy {
@Override
public <T extends LivingEntity> @Nullable T spawnCustomEntity(final Class<? extends CustomEntity<? extends LivingEntity>> entityClass,
@NotNull final Location location) {
if (entityClass.equals(CustomIllusionerProxy.class)) {
return (T) CustomIllusioner.spawn(location);
}
return null;
}
}

View File

@@ -1,62 +0,0 @@
package com.willfp.ecobosses.proxy.v1_16_R3;
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
import net.minecraft.server.v1_16_R3.EntityHuman;
import net.minecraft.server.v1_16_R3.EntityIllagerIllusioner;
import net.minecraft.server.v1_16_R3.EntityIllagerWizard;
import net.minecraft.server.v1_16_R3.EntityInsentient;
import net.minecraft.server.v1_16_R3.EntityIronGolem;
import net.minecraft.server.v1_16_R3.EntityRaider;
import net.minecraft.server.v1_16_R3.EntityTypes;
import net.minecraft.server.v1_16_R3.EntityVillagerAbstract;
import net.minecraft.server.v1_16_R3.PathfinderGoalBowShoot;
import net.minecraft.server.v1_16_R3.PathfinderGoalFloat;
import net.minecraft.server.v1_16_R3.PathfinderGoalHurtByTarget;
import net.minecraft.server.v1_16_R3.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_16_R3.PathfinderGoalMeleeAttack;
import net.minecraft.server.v1_16_R3.PathfinderGoalNearestAttackableTarget;
import net.minecraft.server.v1_16_R3.PathfinderGoalRandomStroll;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.entity.Illusioner;
import org.jetbrains.annotations.NotNull;
public class CustomIllusioner extends EntityIllagerIllusioner implements CustomIllusionerProxy {
/**
* Instantiate a new custom illusioner entity.
*
* @param location The location to spawn it at.
*/
public CustomIllusioner(@NotNull final Location location) {
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
this.setPosition(location.getX(), location.getY(), location.getZ());
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new EntityIllagerWizard.b());
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
this.goalSelector.a(2, new PathfinderGoalBowShoot<>(this, 1.0D, 20, 15.0F));
this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D));
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(6, new PathfinderGoalBowShoot<>(this, 0.5D, 20, 15.0F));
this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D));
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F));
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0]));
this.targetSelector.a(2, (new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)).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));
}
/**
* Spawn illusioner.
*
* @param location The location.
* @return The illusioner.
*/
public static Illusioner spawn(@NotNull final Location location) {
CustomIllusioner illusioner = new CustomIllusioner(location);
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
return (Illusioner) illusioner.getBukkitEntity();
}
}

View File

@@ -1,28 +0,0 @@
plugins {
id 'xyz.jpenilla.special-gradle' version '1.0.0-SNAPSHOT'
}
group 'com.willfp'
version rootProject.version
dependencies {
compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:remapped-mojang'
}
specialGradle {
minecraftVersion.set("1.17")
specialSourceVersion.set("1.10.0")
}
buildTools {
quiet.set(true);
}
configurations.create('mapped')
artifacts {
mapped jar.outputs.files.files.toArray()[0]
}
productionMappedJar.mustRunAfter(clean)
build.dependsOn productionMappedJar

View File

@@ -1,22 +0,0 @@
package com.willfp.ecobosses.proxy.v1_17_R1;
import com.willfp.ecobosses.proxy.proxies.CustomEntitySpawnerProxy;
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
import com.willfp.ecobosses.proxy.util.CustomEntity;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@SuppressWarnings("unchecked")
public class CustomEntitySpawner implements CustomEntitySpawnerProxy {
@Override
public <T extends LivingEntity> @Nullable T spawnCustomEntity(final Class<? extends CustomEntity<? extends LivingEntity>> entityClass,
@NotNull final Location location) {
if (entityClass.equals(CustomIllusionerProxy.class)) {
return (T) CustomIllusioner.spawn(location);
}
return null;
}
}

View File

@@ -1,59 +0,0 @@
package com.willfp.ecobosses.proxy.v1_17_R1;
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
import net.minecraft.world.entity.ai.goal.RangedBowAttackGoal;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.animal.IronGolem;
import net.minecraft.world.entity.npc.AbstractVillager;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.raid.Raider;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
import org.bukkit.entity.Illusioner;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.jetbrains.annotations.NotNull;
public class CustomIllusioner extends net.minecraft.world.entity.monster.Illusioner implements CustomIllusionerProxy {
/**
* Instantiate a new custom illusioner entity.
*
* @param location The location to spawn it at.
*/
public CustomIllusioner(@NotNull final Location location) {
super(EntityType.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
this.setPos(location.getX(), location.getY(), location.getZ());
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new Raider.HoldGroundAttackGoal(this, 25));
this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(2, new RangedBowAttackGoal<>(this, 1.0D, 20, 15.0F));
this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D));
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(6, new RangedBowAttackGoal<>(this, 0.5D, 20, 15.0F));
this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D));
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F));
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, Raider.class)).setAlertOthers());
this.targetSelector.addGoal(2, (new NearestAttackableTargetGoal<>(this, Player.class, true)).setUnseenMemoryTicks(300));
this.targetSelector.addGoal(3, (new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)).setUnseenMemoryTicks(300));
this.targetSelector.addGoal(3, (new NearestAttackableTargetGoal<>(this, IronGolem.class, false)).setUnseenMemoryTicks(300));
}
/**
* Spawn illusioner.
*
* @param location The location.
* @return The illusioner.
*/
public static Illusioner spawn(@NotNull final Location location) {
CustomIllusioner illusioner = new CustomIllusioner(location);
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner, CreatureSpawnEvent.SpawnReason.CUSTOM);
return (Illusioner) illusioner.getBukkitEntity();
}
}

View File

@@ -2,7 +2,6 @@ group 'com.willfp'
version rootProject.version version rootProject.version
dependencies { dependencies {
compileOnly project(":eco-core:core-proxy")
compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT' compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT'
compileOnly 'commons-io:commons-io:2.8.0' compileOnly 'commons-io:commons-io:2.8.0'
compileOnly 'com.destroystokyo.paper:paper-api:1.16.3-R0.1-SNAPSHOT' compileOnly 'com.destroystokyo.paper:paper-api:1.16.3-R0.1-SNAPSHOT'

View File

@@ -29,7 +29,7 @@ public class EcoBosses {
* Sets that exist by default. * Sets that exist by default.
*/ */
private static final List<String> DEFAULT_BOSSES = Arrays.asList( private static final List<String> DEFAULT_BOSSES = Arrays.asList(
"illusioner", "dark_guardian",
"tarantula", "tarantula",
"steel_golem", "steel_golem",
"alpha_wolf" "alpha_wolf"

View File

@@ -1,7 +1,5 @@
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.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.bukkit.entity.LivingEntity;
@@ -21,11 +19,7 @@ public class BossEntityUtils {
Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass(); Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass();
assert type != null; assert type != null;
return new VanillaBossType(type); return new VanillaBossType(type);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
Class<? extends CustomEntity<? extends LivingEntity>> proxy = CustomEntities.getEntityClass(id.toLowerCase());
if (proxy != null) {
return new CustomBossType(proxy);
}
} }
return null; return null;

View File

@@ -1,29 +0,0 @@
package com.willfp.ecobosses.bosses.util.bosstype;
import com.willfp.ecobosses.EcoBossesPlugin;
import com.willfp.ecobosses.proxy.proxies.CustomEntitySpawnerProxy;
import com.willfp.ecobosses.proxy.util.CustomEntity;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;
class CustomBossType extends BossType {
/**
* The entity type.
*/
private final Class<? extends CustomEntity<? extends LivingEntity>> entityClass;
/**
* Create new vanilla boss type.
*
* @param entityClass The entity class.
*/
CustomBossType(@NotNull final Class<? extends CustomEntity<? extends LivingEntity>> entityClass) {
this.entityClass = entityClass;
}
@Override
public LivingEntity spawnBossEntity(@NotNull final Location location) {
return EcoBossesPlugin.getInstance().getProxy(CustomEntitySpawnerProxy.class).spawnCustomEntity(entityClass, location);
}
}

View File

@@ -1,7 +1,7 @@
enabled: true enabled: true
name: "&fAlpha Wolf &7| &c%health%♥ &7| &e%time%" # Display name name: "&fAlpha Wolf &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: wolf # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin) base-mob: wolf
bossbar: bossbar:
enabled: true enabled: true

View File

@@ -1,7 +1,7 @@
enabled: true enabled: true
name: "&9Illusioner &7| &c%health%♥ &7| &e%time%" # Display name name: "&9Dark Guardian &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: custom_illusioner # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin) base-mob: enderman
bossbar: bossbar:
enabled: true enabled: true
@@ -46,12 +46,12 @@ rewards:
broadcast: broadcast:
spawn: spawn:
- "" - ""
- "&fAn &9&lIllusioner&r&f has been spawned!" - "&fA &9&lDark Guardian&r&f has been spawned!"
- "&fCome fight it at &9%x%&f, &9%y%&f, &9%z%&f!" - "&fCome fight it at &9%x%&f, &9%y%&f, &9%z%&f!"
- "" - ""
death: death:
- "" - ""
- "&fThe &9&lIllusioner&r&f has been killed!" - "&fThe &9&lDark Guardian&r&f has been killed!"
- "&fMost Damage:" - "&fMost Damage:"
- "&f - &9%top%&f (%top_damage% Damage)" - "&f - &9%top%&f (%top_damage% Damage)"
- "&f - &9%second%&f (%second_damage% Damage)" - "&f - &9%second%&f (%second_damage% Damage)"
@@ -59,13 +59,13 @@ broadcast:
- "" - ""
despawn: despawn:
- "" - ""
- "&fYou ran out of time to kill the &9&lIllusioner&r&f!" - "&fYou ran out of time to kill the &9&lDark Guardian&r&f!"
- "" - ""
# Effects can be found on the wiki! https://ecobosses.willfp.com/ # Effects can be found on the wiki! https://ecobosses.willfp.com/
effects: effects:
- "summon:evoker:10" - "summon:evoker:10"
- "summon:vindicator:10" - "summon:enderman:10"
- "shuffle-hotbar:10" - "shuffle-hotbar:10"
- "give-potion-effect:confusion:10:200:10" - "give-potion-effect:confusion:10:200:10"
- "give-potion-effect:blindness:1:40:20" - "give-potion-effect:blindness:1:40:20"
@@ -107,11 +107,13 @@ sounds:
spawn: # On spawn spawn: # On spawn
- "entity_illusioner_mirror_move:100:0.5" - "entity_illusioner_mirror_move:100:0.5"
- "entity_wither_spawn:100:2" - "entity_wither_spawn:100:2"
- "entity_enderman_death:50:2"
death: # On death death: # On death
- "entity_evoker_prepare_wololo:50:0.8" - "entity_evoker_prepare_wololo:50:0.8"
- "entity_illusioner_prepare_blindness:50:1" - "entity_illusioner_prepare_blindness:50:1"
- "entity_wither_death:50:2" - "entity_wither_death:50:2"
- "entity_enderman_death:50:0.5"
despawn: despawn:
- "entity_ender_dragon_ambient:50:0.5" - "entity_ender_dragon_ambient:50:0.5"

View File

@@ -1,7 +1,7 @@
enabled: true enabled: true
name: "&8Steel Golem &7| &c%health%♥ &7| &e%time%" # Display name name: "&8Steel Golem &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: iron_golem # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin) base-mob: iron_golem
bossbar: bossbar:
enabled: true enabled: true

View File

@@ -1,7 +1,7 @@
enabled: true enabled: true
name: "&4Tarantula &7| &c%health%♥ &7| &e%time%" # Display name name: "&4Tarantula &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: cave_spider # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin) base-mob: cave_spider
bossbar: bossbar:
enabled: true enabled: true

View File

@@ -1,6 +0,0 @@
group 'com.willfp'
version rootProject.version
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT'
}

View File

@@ -1,21 +0,0 @@
package com.willfp.ecobosses.proxy.proxies;
import com.willfp.eco.core.proxy.AbstractProxy;
import com.willfp.ecobosses.proxy.util.CustomEntity;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface CustomEntitySpawnerProxy extends AbstractProxy {
/**
* Spawn custom entity.
*
* @param <T> The class.
* @param entityClass The custom entity proxy class.
* @param location The location.
* @return The bukkit entity, or null if invalid class.
*/
@Nullable <T extends LivingEntity> T spawnCustomEntity(Class<? extends CustomEntity<? extends LivingEntity>> entityClass,
@NotNull Location location);
}

View File

@@ -1,9 +0,0 @@
package com.willfp.ecobosses.proxy.proxies;
import com.willfp.eco.core.proxy.AbstractProxy;
import com.willfp.ecobosses.proxy.util.CustomEntity;
import org.bukkit.entity.Illusioner;
public interface CustomIllusionerProxy extends AbstractProxy, CustomEntity<Illusioner> {
}

View File

@@ -1,30 +0,0 @@
package com.willfp.ecobosses.proxy.util;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
import lombok.experimental.UtilityClass;
import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@UtilityClass
public class CustomEntities {
/**
* Registered custom entities.
*/
private static final BiMap<String, Class<? extends CustomEntity<? extends LivingEntity>>> REGISTRY = new ImmutableBiMap.Builder<String, Class<? extends CustomEntity<? extends LivingEntity>>>()
.put("custom_illusioner", CustomIllusionerProxy.class)
.build();
/**
* Get entity class.
*
* @param id The entity id.
* @return The class.
*/
@Nullable
public Class<? extends CustomEntity<? extends LivingEntity>> getEntityClass(@NotNull final String id) {
return REGISTRY.get(id);
}
}

View File

@@ -1,7 +0,0 @@
package com.willfp.ecobosses.proxy.util;
import org.bukkit.entity.LivingEntity;
public interface CustomEntity<T extends LivingEntity> {
}

View File

@@ -9,8 +9,4 @@ rootProject.name = 'EcoBosses'
// Core // Core
include ':eco-core' include ':eco-core'
include ':eco-core:core-nms'
include ':eco-core:core-nms:v1_16_R3'
include ':eco-core:core-nms:v1_17_R1'
include ':eco-core:core-proxy'
include ':eco-core:core-plugin' include ':eco-core:core-plugin'