use of org.spongepowered.common.accessor.world.entity.monster.EndermiteAccessor in project SpongeCommon by SpongePowered.
the class EndermiteData method register.
// @formatter:off
public static void register(final DataProviderRegistrator registrator) {
registrator.asMutable(Endermite.class).create(Keys.DESPAWN_DELAY).get(h -> {
if (h.isPersistenceRequired()) {
return null;
}
return new SpongeTicks(((EndermiteAccessor) h).accessor$life());
}).setAnd((h, v) -> {
if (h.isPersistenceRequired()) {
return false;
}
final int ticks = (int) v.ticks();
if (ticks < 0 || ticks > EndermiteData.DESPAWN_DELAY_MAX) {
return false;
}
((EndermiteAccessor) h).accessor$life(ticks);
return true;
});
}
Aggregations