Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAbsolutionism committed Nov 23, 2024
1 parent 4aab20b commit deaa645
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

@Name("Entity Snapshot")
@Description({
"Returns an entity snapshot of the provided entities, which is a snapshot of all the data of the provided entities. "
+ "This data includes the values of all the entities' attributes at the time of this expression being called.",
"Returns an entity snapshot of the provided entities, which is a snapshot of all the data of the provided entities.",
"This data includes the values of all the entities' attributes at the time of this expression being called.",
"This expression can only be used to copy the full attributes of an entity. Individual attributes cannot be modified or retrieved."
})
@Examples({
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/ch/njol/skript/expressions/ExprSpawnEggEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ public class ExprSpawnEggEntity extends SimplePropertyExpression<Object, EntityS
@Override
public void change(Event event, Object @Nullable [] delta, ChangeMode mode) {
EntitySnapshot snapshot = (EntitySnapshot) (delta != null ? delta[0] : null);
if (snapshot != null) {
for (Object object : getExpr().getArray(event)) {
ItemStack item = ItemUtils.asItemStack(object);
if (item == null || !(item.getItemMeta() instanceof SpawnEggMeta eggMeta))
continue;
eggMeta.setSpawnedEntity(snapshot);
if (object instanceof Slot slot) {
item.setItemMeta(eggMeta);
slot.setItem(item);
} else if (object instanceof ItemType itemType) {
itemType.setItemMeta(eggMeta);
} else if (object instanceof ItemStack itemStack) {
itemStack.setItemMeta(eggMeta);
}
if (snapshot == null)
return;
for (Object object : getExpr().getArray(event)) {
ItemStack item = ItemUtils.asItemStack(object);
if (item == null || !(item.getItemMeta() instanceof SpawnEggMeta eggMeta))
continue;
eggMeta.setSpawnedEntity(snapshot);
if (object instanceof Slot slot) {
item.setItemMeta(eggMeta);
slot.setItem(item);
} else if (object instanceof ItemType itemType) {
itemType.setItemMeta(eggMeta);
} else if (object instanceof ItemStack itemStack) {
itemStack.setItemMeta(eggMeta);
}
}
}
Expand Down

0 comments on commit deaa645

Please sign in to comment.