Don't break the API!

This commit is contained in:
Ellpeck 2016-09-01 18:08:15 +02:00
parent 0e4967ea70
commit a4ac7ccb81
4 changed files with 22 additions and 2 deletions

View file

@ -78,7 +78,9 @@ public class ConnectionPair{
compound.setInteger("y"+i, relay.getY()); compound.setInteger("y"+i, relay.getY());
compound.setInteger("z"+i, relay.getZ()); compound.setInteger("z"+i, relay.getZ());
} }
if(this.type != null){
compound.setString("Type", this.type.name()); compound.setString("Type", this.type.name());
}
compound.setBoolean("SuppressRender", this.suppressConnectionRender); compound.setBoolean("SuppressRender", this.suppressConnectionRender);
return compound; return compound;
} }

View file

@ -30,6 +30,12 @@ public interface ILaserRelayConnectionHandler{
Network getNetworkFor(BlockPos relay, World world); Network getNetworkFor(BlockPos relay, World world);
@Deprecated
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world);
@Deprecated
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world, boolean suppressConnectionRender);
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world); boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world);
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender); boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender);

View file

@ -164,8 +164,10 @@ public class CommonEvents{
if(!fixed){ if(!fixed){
for(int i = 0; i < pair.positions.length; i++){ for(int i = 0; i < pair.positions.length; i++){
if(ActuallyAdditionsAPI.connectionHandler.getNetworkFor(pair.positions[i], event.getWorld()) != null){
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pair.positions[i], event.getWorld()); ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pair.positions[i], event.getWorld());
} }
}
ModUtil.LOGGER.error("Had to remove a Laser Relay connection between "+pair.positions[0]+" and "+pair.positions[1]+" because it couldn't be adapted to the new system!"); ModUtil.LOGGER.error("Had to remove a Laser Relay connection between "+pair.positions[0]+" and "+pair.positions[1]+" because it couldn't be adapted to the new system!");
} }
} }

View file

@ -91,6 +91,16 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH
return null; return null;
} }
@Override
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world){
return this.addConnection(firstRelay, secondRelay, null, world);
}
@Override
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world, boolean suppressConnectionRender){
return this.addConnection(firstRelay, secondRelay, null, world, suppressConnectionRender);
}
@Override @Override
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world){ public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world){
return this.addConnection(firstRelay, secondRelay, type, world, false); return this.addConnection(firstRelay, secondRelay, type, world, false);