crwdns138211:0crwdne138211:0
crwdns138215:0crwdne138215:0
crwdns138217:0:javadoc:crwdne138217:0
crwdns138219:0crwdne138219:0
import org.spongepowered.api.data.DataHolder;
import org.spongepowered.api.data.key.Keys;
public void heal(DataHolder target) {
if (target.supports(Keys.HEALTH)) {
double maxHealth = target.get(Keys.MAX_HEALTH).get();
target.offer(Keys.HEALTH, maxHealth);
}
}
crwdns138221:0crwdne138221:0
crwdns138223:0crwdne138223:0
crwdns138225:0crwdne138225:0
crwdns138227:0:javadoc:crwdne138227:0
crwdns138229:0:javadoc:crwdne138229:0
public void removeName(DataHolder target) {
target.remove(Keys.DISPLAY_NAME);
}
crwdns138231:0crwdne138231:0
crwdns138233:0crwdne138233:0
crwdns138235:0crwdne138235:0
import java.util.function.Function;
public void buff(DataHolder target) {
target.transform(Keys.MAX_HEALTH, new Function<Double,Double>() {
@Override
public Double apply(Double input) {
return (input == null) ? 0 : input * 2;
}
});
}
crwdns138237:0crwdne138237:0
public void buff(DataHolder target) {
target.transform(Keys.MAX_HEALTH, d -> (d == null) ? 0 : 2*d);
}
crwdns138239:0:javadoc:crwdne138239:0
crwdns138241:0crwdne138241:0
crwdns157075:0:javadoc:crwdnd157075:0:javadoc:crwdne157075:0
crwdns138245:0crwdne138245:0
public void scare(DataHolder target) {
if (target.supports(Keys.NEXT_ENTITY_TO_SPAWN)) {
WeightedCollectionValue value = target.getValue(Keys.NEXT_ENTITY_TO_SPAWN).get();
List<Entity> entities = value.get(new Random());
}
}