blob: 1c1ed5d9fbf595bc4c174aeccad250ce7de6ad98 [file] [log] [blame] [raw]
package net.glowstone.io.entity;
import java.util.function.Function;
import net.glowstone.entity.projectile.GlowArrow;
import net.glowstone.util.nbt.CompoundTag;
import org.bukkit.Location;
import org.jetbrains.annotations.NonNls;
public class ArrowStore<T extends GlowArrow> extends ProjectileStore<T> {
public ArrowStore(Class<T> clazz, @NonNls String id, Function<Location, T> constructor) {
super(clazz, id, constructor);
}
@Override
public void save(T entity, CompoundTag tag) {
super.save(entity, tag);
tag.putShort("life", entity.getLife());
}
@Override
public void load(T entity, CompoundTag tag) {
super.load(entity, tag);
tag.readShort("life", entity::setLife);
}
}