Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/utils/math/constraints/vect/VectCache.java

37 lines
547 B

package mightypork.utils.math.constraints.vect;
public class VectCache extends VectAdapter {
private final VectVar cache = Vect.makeVar();
private final Vect source;
private boolean inited = false;
public VectCache(Vect source) {
this.source = source;
}
@Override
protected Vect getSource()
{
if (!inited) poll();
return cache;
}
/**
* Update cached value and cached digest (if digest caching is enabled)
*/
@Override
public void poll()
{
inited = true;
cache.setTo(source);
super.poll();
}
}