Skip to content

Commit

Permalink
Move slime/magmacube into a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Ineusia committed Sep 27, 2024
1 parent 68388c0 commit af5fb91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/gmail/nossr50/listeners/EntityListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.bukkit.projectiles.ProjectileSource;

import java.util.Arrays;
import java.util.List;

import static com.gmail.nossr50.util.MobMetadataUtils.*;

Expand All @@ -57,6 +58,7 @@ public class EntityListener implements Listener {
* check if a {@link Player} has a {@link Trident} enchanted with "Piercing".
*/
private final NamespacedKey piercingEnchantment = NamespacedKey.minecraft("piercing");
private final List<EntityType> transformableEntities = Arrays.asList(EntityType.SLIME, EntityType.MAGMA_CUBE);

public EntityListener(final mcMMO pluginRef) {
this.pluginRef = pluginRef;
Expand All @@ -76,7 +78,7 @@ public void onEntityTransform(EntityTransformEvent event) {
}

// Clear the original slime/magma cubes metadata - it's dead.
if (Arrays.asList(EntityType.SLIME, EntityType.MAGMA_CUBE).contains(livingEntity.getType())) {
if (transformableEntities.contains(livingEntity.getType())) {
mcMMO.getTransientMetadataTools().cleanLivingEntityMetadata(livingEntity);
}
}
Expand Down Expand Up @@ -662,7 +664,7 @@ public void onEntityDeathLowest(EntityDeathEvent event) {
LivingEntity entity = event.getEntity();

// Clear metadata for Slimes/Magma Cubes after transformation events take place, otherwise small spawned slimes will not have any tags
if (Arrays.asList(EntityType.SLIME, EntityType.MAGMA_CUBE).contains(entity.getType())) {
if (transformableEntities.contains(entity.getType())) {
return;
}

Expand Down

0 comments on commit af5fb91

Please sign in to comment.