Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions blighted-smp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
Comment thread
Trixmas marked this conversation as resolved.
</dependencies>

<build>
Expand All @@ -55,6 +65,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import fr.moussax.blightedSMP.commands.AdminCommand;
import fr.moussax.blightedSMP.engine.entities.BlightedEntity;
import fr.moussax.blightedSMP.engine.entities.listeners.BlightedEntitiesListener;
import fr.moussax.blightedSMP.engine.entities.EntityManager;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.entity.LivingEntity;
Expand Down Expand Up @@ -75,7 +75,7 @@ private int butcher(Player player, double radius) {
}

private void removeEntity(LivingEntity entity) {
BlightedEntity blighted = BlightedEntitiesListener.getBlightedEntity(entity);
BlightedEntity blighted = EntityManager.getBlightedEntity(entity);
if (blighted != null) {
blighted.cleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ protected boolean executeAdmin(Player player, Command command, String label, Str
return false;
}

BlightedEntity prototype = EntitiesRegistry.get(args[0].toUpperCase());
BlightedEntity entity = EntitiesRegistry.create(args[0].toUpperCase());

if (prototype == null) {
if (entity == null) {
warn(player, "Unable to find §4" + args[0].toUpperCase() + " §cinto the registry.");
return false;
}

BlightedEntity entity = prototype.clone();

if (entity instanceof AncientCreature ancientCreature) {
ancientCreature.setSummoner(player);
ancientCreature.summoner(player);
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,24 @@ public class CorruptedChampion extends BlightedEntity {
private int currentPhase = 1;

public CorruptedChampion() {
super("Corrupted Champion", 350, MELEE_DAMAGE, EntityType.ZOMBIE);
addAttribute(Attribute.SCALE, 4.0);
addAttribute(Attribute.SPAWN_REINFORCEMENTS, 0.0);
addAttribute(Attribute.KNOCKBACK_RESISTANCE, 0.40);
setBoss(true);

armor = new ItemStack[]{
new ItemStack(Material.GOLDEN_BOOTS),
new ItemStack(Material.IRON_LEGGINGS),
new ItemBuilder(Material.GOLDEN_CHESTPLATE).setArmorTrim(TrimMaterial.GOLD, TrimPattern.SNOUT).toItemStack(),
new ItemBuilder(Material.PLAYER_HEAD)
super("CORRUPTED_CHAMPION", "Corrupted Champion", EntityType.ZOMBIE);
attributes(attributes -> attributes
.maxHealth(350)
.attackDamage(MELEE_DAMAGE)
.scale(4.0)
.knockbackResistance(0.40)
.set(Attribute.SPAWN_REINFORCEMENTS, 0.0)
);
boss();
equipment(equipment -> equipment
.helmet(new ItemBuilder(Material.PLAYER_HEAD)
.setCustomSkullTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWFiNTRjMWNlOTQyYzIzMjFkNmRiYjgzMjQ1ZWJmM2ZmZDY5NmJmOWQxZjAyNDY3MzY0NzFmNjdmNzJiYTI1MCJ9fX0=")
.toItemStack()
};

itemInMainHand = new ItemBuilder(Material.NETHERITE_SWORD).glow().toItemStack();
.toItemStack())
.chestplate(new ItemBuilder(Material.GOLDEN_CHESTPLATE).setArmorTrim(TrimMaterial.GOLD, TrimPattern.SNOUT).toItemStack())
.leggings(Material.IRON_LEGGINGS)
.boots(Material.GOLDEN_BOOTS)
.mainHand(new ItemBuilder(Material.NETHERITE_SWORD).glow().toItemStack())
);
}

private static ItemStack createRocketBoots() {
Expand Down Expand Up @@ -137,7 +139,7 @@ protected long onPhaseTransition(double healthThreshold) {
return 0L;
}

setBootsEquipped(armor != null && armor.length > 0 ? armor[0] : new ItemStack(Material.GOLDEN_BOOTS));
setBoots(new ItemStack(Material.GOLDEN_BOOTS));

if (healthThreshold == 0.66) {
currentPhase = 2;
Expand Down Expand Up @@ -277,7 +279,7 @@ private void executeStomp() {
}

setPerformingAbility(true);
setBootsEquipped(RED_BOOTS);
setBoots(RED_BOOTS);

if (entity instanceof Mob mob) {
mob.setAI(false);
Expand Down Expand Up @@ -330,7 +332,7 @@ public void run() {

private void cleanup() {
cancel();
setBootsEquipped(armor != null && armor.length > 0 ? armor[0] : new ItemStack(Material.GOLDEN_BOOTS));
setBoots(new ItemStack(Material.GOLDEN_BOOTS));
if (entity instanceof Mob mob) {
mob.setAI(true);
}
Expand Down Expand Up @@ -724,9 +726,9 @@ public Giant spawnInvertedSword(Location spawnLocation, double scale) {
Location targetLocation = spawnLocation.clone();
targetLocation.setPitch(0);
targetLocation.setYaw(spawnLocation.getYaw());
Giant giant = Objects.requireNonNull(spawnLocation.getWorld()).spawn(targetLocation, Giant.class, g -> {
configureSwordGiant(g, scale);
g.setCustomName("Dinnerbone");
Giant giant = Objects.requireNonNull(spawnLocation.getWorld()).spawn(targetLocation, Giant.class, giantEntity -> {
configureSwordGiant(giantEntity, scale);
giantEntity.setCustomName("Dinnerbone");
}
);
return giant;
Expand All @@ -751,13 +753,6 @@ private void configureSwordGiant(Giant giant, double scale) {
Objects.requireNonNull(giant.getEquipment()).setItemInMainHand(new ItemBuilder(Material.NETHERITE_SWORD).glow().toItemStack());
}

private void setBootsEquipped(ItemStack bootsItem) {
if (entity == null || entity.getEquipment() == null) {
return;
}
entity.getEquipment().setBoots(bootsItem);
}

private boolean tryStartAbility() {
if (isPerformingAbility()) {
return false;
Expand All @@ -770,18 +765,6 @@ private void endAbility() {
setPerformingAbility(false);
}

@Override
public String getEntityId() {
return "CORRUPTED_CHAMPION";
}

@Override
public CorruptedChampion clone() {
CorruptedChampion clone = (CorruptedChampion) super.clone();
clone.activeStabs = new CopyOnWriteArrayList<>();
return clone;
}

@Override
public LivingEntity spawn(Location location) {
super.spawn(location);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,29 +165,21 @@ private boolean isSafeEvasionDirection(Vector direction) {

@Override
protected void equipEnragedArmor(EntityEquipment equipment) {
if (equipment == null) return;

equipment.setHelmet(new ItemBuilder(Material.LEATHER_HELMET)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.SENTRY)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack()
);
equipment.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.SENTRY)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack()
setArmor(
new ItemBuilder(Material.LEATHER_HELMET)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.SENTRY)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack(),
new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.SENTRY)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack(),
new ItemBuilder(Material.IRON_LEGGINGS).unbreakable().toItemStack(),
new ItemBuilder(Material.IRON_BOOTS).unbreakable().toItemStack()
);
equipment.setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).unbreakable().toItemStack());
equipment.setBoots(new ItemBuilder(Material.IRON_BOOTS).unbreakable().toItemStack());
}

@Override
public BlightswornArcherArchetype clone() {
BlightswornArcherArchetype clone = (BlightswornArcherArchetype) super.clone();
clone.isAiming = false;
clone.nextScatterTick = 0;
return clone;
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package fr.moussax.blightedSMP.content.entities.factions.blightsworn;

import fr.moussax.blightedSMP.engine.entities.EntityLootTableBuilder;
import fr.moussax.blightedSMP.engine.entities.spawnable.condition.SpawnRules;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
Expand All @@ -10,7 +8,6 @@
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
Expand All @@ -24,20 +21,26 @@ public BlightswornBogged() {
super("BLIGHTSWORN_BOGGED", "Blightsworn Bogged", EntityType.BOGGED);
setDamage(6);
setDroppedExp(12);
itemInMainHand = new ItemStack(Material.BOW);
setLootTable(new EntityLootTableBuilder()
.addLoot(Material.BONE, 2, 4, 1.0)
.addLoot(Material.ARROW, 2, 5, 1.0)
.addLoot(Material.TIPPED_ARROW,
equipment(eq -> eq.mainHand(Material.BOW));

spawning(spawn -> spawn
.biomes(Biome.SWAMP, Biome.MANGROVE_SWAMP)
.overworldHostile()
);

loot(loot -> loot
.drop(Material.BONE, 2, 4, 1.0)
.drop(Material.ARROW, 2, 5, 1.0)
.drop(Material.TIPPED_ARROW,
builder -> builder.setItemMeta(
meta -> ((PotionMeta) meta).setBasePotionType(PotionType.POISON)),
1,
3,
0.4
)
.addDamagedItem(Material.BOW, 0.10, 0.75, 0.15, RARE)
.addGems(5, 0.04, VERY_RARE)
.build());
.damagedItem(Material.BOW, 0.10, 0.75, 0.15, RARE)
.gems(5, 0.04, VERY_RARE)
);
}

@Override
Expand All @@ -54,9 +57,4 @@ protected void onEnrage(LivingEntity entity) {
entity.getWorld().spawnParticle(Particle.SNEEZE, location, 50, 0.5, 1.0, 0.5, 0.05);
entity.getWorld().spawnParticle(Particle.DUST, location, 30, 0.5, 1.0, 0.5, 0.0, BLIGHT_DUST);
}

@Override
protected void defineSpawnConditions() {
addCondition(SpawnRules.biome(Biome.SWAMP, Biome.MANGROVE_SWAMP).and(SpawnRules.overworldHostile()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,31 +156,19 @@ private void spawnBlightResidue() {

@Override
protected void equipEnragedArmor(EntityEquipment equipment) {
if (equipment == null) return;

equipment.setHelmet(new ItemBuilder(Material.LEATHER_HELMET)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.FLOW)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack()
);
equipment.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.SNOUT)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack()
setArmor(
new ItemBuilder(Material.LEATHER_HELMET)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.FLOW)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack(),
new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setArmorTrim(TrimMaterial.AMETHYST, TrimPattern.SNOUT)
.setLeatherColor(PHASE_TWO_COLOR)
.unbreakable()
.toItemStack(),
new ItemBuilder(Material.IRON_LEGGINGS).unbreakable().toItemStack(),
new ItemBuilder(Material.IRON_BOOTS).unbreakable().toItemStack()
);
equipment.setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).unbreakable().toItemStack());
equipment.setBoots(new ItemBuilder(Material.IRON_BOOTS).unbreakable().toItemStack());
}

@Override
public BlightswornBruteArchetype clone() {
BlightswornBruteArchetype clone = (BlightswornBruteArchetype) super.clone();
clone.blightStacks = 0;
clone.isSurging = false;
clone.isRecovering = false;
clone.isPhaseTwo = false;
return clone;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package fr.moussax.blightedSMP.content.entities.factions.blightsworn;

import fr.moussax.blightedSMP.engine.entities.listeners.BlightedEntitiesListener;
import fr.moussax.blightedSMP.engine.entities.EntityManager;
import fr.moussax.blightedSMP.engine.entities.spawnable.SpawnableEntity;
import fr.moussax.bedrock.utils.ItemBuilder;
import lombok.Getter;
Expand Down Expand Up @@ -40,7 +40,9 @@ protected BlightswornCreature(String entityId, String name, EntityType entityTyp
}

protected BlightswornCreature(String entityId, String name, EntityType entityType, int maxHealth, double spawnProbability) {
super(entityId, name, maxHealth, entityType, spawnProbability);
super(entityId, name, entityType);
setMaxHealth(maxHealth);
spawning(spawn -> spawn.probability(spawnProbability));
setupDefaultArmor();
}

Expand Down Expand Up @@ -83,18 +85,18 @@ protected void onRehydrate(LivingEntity existing) {
protected abstract void equipEnragedArmor(EntityEquipment equipment);

private void setupDefaultArmor() {
armor = new ItemStack[]{
new ItemStack(Material.AIR),
new ItemStack(Material.AIR),
new ItemBuilder(Material.LEATHER_CHESTPLATE)
setArmor(
new ItemBuilder(Material.LEATHER_HELMET)
.setLeatherColor(PHASE_ONE_COLOR)
.unbreakable()
.toItemStack(),
new ItemBuilder(Material.LEATHER_HELMET)
new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setLeatherColor(PHASE_ONE_COLOR)
.unbreakable()
.toItemStack()
};
.toItemStack(),
null,
null
);
}

private void evaluateResonance() {
Expand All @@ -103,7 +105,7 @@ private void evaluateResonance() {
boolean hasNearbyAlly = false;

for (Entity nearby : entity.getNearbyEntities(12, 12, 12)) {
var blighted = BlightedEntitiesListener.getBlightedEntity(nearby);
var blighted = EntityManager.getBlightedEntity(nearby);
if (!(blighted instanceof BlightswornCreature ally) || !ally.isAlive()) continue;

hasNearbyAlly = true;
Expand Down Expand Up @@ -145,12 +147,4 @@ public void setResonating(boolean resonating) {
baseSpeedBeforeResonance = -1;
}
}

@Override
public BlightswornCreature clone() {
BlightswornCreature clone = (BlightswornCreature) super.clone();
clone.isResonating = false;
clone.baseSpeedBeforeResonance = -1;
return clone;
}
}
Loading
Loading