Fixes bug which let phase conveyor operate with any non-zero power; now requires full power to work (#672)

* Fixes bug which let phase conveyor operate with any non-zero power; now requires full power to work

* Fixed normal bridge, deprecated method
This commit is contained in:
David Held 2019-09-16 16:00:06 -07:00 committed by Anuken
parent 4b824f7a4c
commit 4dc55e5594
2 changed files with 3 additions and 10 deletions

View File

@ -67,7 +67,7 @@ public class Plugins{
URLClassLoader classLoader = new URLClassLoader(new URL[]{jar.file().toURI().toURL()}, ClassLoader.getSystemClassLoader()); URLClassLoader classLoader = new URLClassLoader(new URL[]{jar.file().toURI().toURL()}, ClassLoader.getSystemClassLoader());
Class<?> main = classLoader.loadClass(meta.main); Class<?> main = classLoader.loadClass(meta.main);
metas.put(main, meta); metas.put(main, meta);
return new LoadedPlugin(jar, zip, (Plugin)main.newInstance(), meta); return new LoadedPlugin(jar, zip, (Plugin)main.getDeclaredConstructor().newInstance(), meta);
} }
/** Represents a plugin that has been loaded from a jar file.*/ /** Represents a plugin that has been loaded from a jar file.*/

View File

@ -24,7 +24,6 @@ public class ItemBridge extends Block{
protected int timerTransport = timers++; protected int timerTransport = timers++;
protected int range; protected int range;
protected float transportTime = 2f; protected float transportTime = 2f;
protected IntArray removals = new IntArray();
protected TextureRegion endRegion, bridgeRegion, arrowRegion; protected TextureRegion endRegion, bridgeRegion, arrowRegion;
private static int lastPlaced = Pos.invalid; private static int lastPlaced = Pos.invalid;
@ -162,21 +161,15 @@ public class ItemBridge extends Block{
entity.time += entity.cycleSpeed * entity.delta(); entity.time += entity.cycleSpeed * entity.delta();
entity.time2 += (entity.cycleSpeed - 1f) * entity.delta(); entity.time2 += (entity.cycleSpeed - 1f) * entity.delta();
removals.clear();
IntSetIterator it = entity.incoming.iterator(); IntSetIterator it = entity.incoming.iterator();
while(it.hasNext){ while(it.hasNext){
int i = it.next(); int i = it.next();
Tile other = world.tile(i); Tile other = world.tile(i);
if(!linkValid(tile, other, false)){ if(!linkValid(tile, other, false)){
removals.add(i); it.remove();
} }
} }
for(int j = 0; j < removals.size; j++)
entity.incoming.remove(removals.get(j));
Tile other = world.tile(entity.link); Tile other = world.tile(entity.link);
if(!linkValid(tile, other)){ if(!linkValid(tile, other)){
entity.link = Pos.invalid; entity.link = Pos.invalid;
@ -184,7 +177,7 @@ public class ItemBridge extends Block{
entity.uptime = 0f; entity.uptime = 0f;
}else{ }else{
if(entity.cons.valid()){ if(entity.cons.valid() && (!hasPower || Mathf.isZero(1f - entity.power.satisfaction))){
entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, 0.04f); entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, 0.04f);
}else{ }else{
entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f); entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f);