mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
aaaaaaaaaaaaaaaaaa
This commit is contained in:
parent
9c4c081e3e
commit
f9959e9a4a
@ -60,17 +60,24 @@ public class ItemWiring extends Item {
|
|||||||
|
|
||||||
TileEntityPylonBase first = (TileEntityPylonBase) world.getTileEntity(x1, y1, z1);
|
TileEntityPylonBase first = (TileEntityPylonBase) world.getTileEntity(x1, y1, z1);
|
||||||
TileEntityPylonBase second = ((TileEntityPylonBase) te);
|
TileEntityPylonBase second = ((TileEntityPylonBase) te);
|
||||||
|
|
||||||
if(TileEntityPylonBase.canConnect(first, second)) {
|
switch (TileEntityPylonBase.canConnect(first, second)) {
|
||||||
|
case 0:
|
||||||
first.addConnection(x, y, z);
|
first.addConnection(x, y, z);
|
||||||
second.addConnection(x1, y1, z1);
|
second.addConnection(x1, y1, z1);
|
||||||
player.addChatMessage(new ChatComponentText("Wire end"));
|
player.addChatMessage(new ChatComponentText("Wire end"));
|
||||||
|
break;
|
||||||
} else {
|
case 1:
|
||||||
player.addChatMessage(new ChatComponentText("Wire error - " + TileEntityPylonBase.errorMessage));
|
player.addChatMessage(new ChatComponentText("Wire error - Pylons are not the same type"));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
player.addChatMessage(new ChatComponentText("Wire error - Cannot connect to the same pylon"));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
player.addChatMessage(new ChatComponentText("Wire error - Pylon is too far away"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.stackTagCompound = null;
|
stack.stackTagCompound = null;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -18,18 +18,15 @@ import net.minecraft.world.WorldServer;
|
|||||||
public abstract class TileEntityPylonBase extends TileEntityCableBaseNT {
|
public abstract class TileEntityPylonBase extends TileEntityCableBaseNT {
|
||||||
|
|
||||||
public List<int[]> connected = new ArrayList<int[]>();
|
public List<int[]> connected = new ArrayList<int[]>();
|
||||||
public static String errorMessage = "";
|
|
||||||
|
|
||||||
public static boolean canConnect(TileEntityPylonBase first, TileEntityPylonBase second) {
|
public static int canConnect(TileEntityPylonBase first, TileEntityPylonBase second) {
|
||||||
|
|
||||||
if(first.getConnectionType() != second.getConnectionType()) {
|
if(first.getConnectionType() != second.getConnectionType()) {
|
||||||
errorMessage = "pylons are not the same type";
|
return 1;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(first == second) {
|
if(first == second) {
|
||||||
errorMessage = "cannot connect to the same pylon";
|
return 2;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double len = Math.min(first.getMaxWireLength(), second.getMaxWireLength());
|
double len = Math.min(first.getMaxWireLength(), second.getMaxWireLength());
|
||||||
@ -43,8 +40,7 @@ public abstract class TileEntityPylonBase extends TileEntityCableBaseNT {
|
|||||||
(secondPos.zCoord) - (firstPos.zCoord)
|
(secondPos.zCoord) - (firstPos.zCoord)
|
||||||
);
|
);
|
||||||
|
|
||||||
errorMessage = "pylon too far away";
|
return len >= delta.lengthVector() ? 0 : 3;
|
||||||
return len >= delta.lengthVector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConnection(int x, int y, int z) {
|
public void addConnection(int x, int y, int z) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user