fix lens-filter diodes

This commit is contained in:
Adrian 2015-07-20 12:37:29 +02:00
parent a20dc994fb
commit 30cbb152a7

View file

@ -22,12 +22,17 @@ public class LensFilterHandler {
for (ForgeDirection dir: event.destinations) {
int sideColor = -1;
int sideLensColor = -1;
// Get the side's color
// (1/2) From this pipe's outpost
PipePluggable pluggable = container.getPipePluggable(dir);
if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) {
sideColor = ((LensPluggable) pluggable).color;
if (pluggable != null && pluggable instanceof LensPluggable) {
if (((LensPluggable) pluggable).isFilter) {
sideColor = ((LensPluggable) pluggable).color;
} else {
sideLensColor = ((LensPluggable) pluggable).color;
}
}
// (2/2) From the other pipe's outpost
@ -37,8 +42,11 @@ public class LensFilterHandler {
pluggable = otherContainer.getPipePluggable(dir.getOpposite());
if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) {
int otherColor = ((LensPluggable) pluggable).color;
// Check if colors conflict - if so, the side is unpassable
if (sideColor >= 0 && otherColor != sideColor) {
// Filter colors conflict - the side is unpassable
continue;
} else if (sideLensColor != -1 && sideColor != otherColor) {
// The closer lens color differs from the further away filter color - the side is unpassable
continue;
} else {
sideColor = otherColor;