Fixed invalid connections being possible, see BluSunrize/ImmersiveEngineering#1975

This commit is contained in:
malte0811 2017-03-21 18:16:21 +01:00
parent b36e5c2623
commit 4a4360c98b

View file

@ -1,6 +1,6 @@
/*******************************************************************************
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016 malte0811
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
*/
package malte0811.industrialWires.items;
import java.util.HashSet;
@ -129,7 +129,7 @@ public class ItemIC2Coil extends Item implements IWireCoil{
player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"sameConnection"));
} else if( distanceSq > (type.getMaxLength()*type.getMaxLength())) {
player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"tooFar"));
} else if(!(tileEntityLinkingPos instanceof IImmersiveConnectable)) {
} else if(!(tileEntityLinkingPos instanceof IImmersiveConnectable)||!((IImmersiveConnectable) tileEntityLinkingPos).canConnectCable(type, TargetingInfo.readFromNBT(stack.getTagCompound()))) {
player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"invalidPoint"));
} else {
IImmersiveConnectable nodeHere = (IImmersiveConnectable)tileEntity;