use of com.bluepowermod.api.gate.IGateConnection in project BluePower by Qmunity.
the class GateBase method onActivated.
// Interaction
@Override
public boolean onActivated(EntityPlayer player, QMovingObjectPosition mop, ItemStack item) {
if (getLayout() == null && !getWorld().isRemote)
loadLayout();
if (item != null && item.getItem() instanceof IScrewdriver) {
if (player.isSneaking()) {
if (logic().changeMode()) {
if (!getWorld().isRemote) {
((IScrewdriver) item.getItem()).damage(item, 1, player, false);
getRedstoneConnectionCache().recalculateConnections();
getBundledConnectionCache().recalculateConnections();
for (IGateConnection c : getConnections()) if (c != null)
c.notifyUpdate();
sendUpdateIfNeeded();
}
return true;
}
return false;
} else {
setRotation((getRotation() + 1) % 4);
((IScrewdriver) item.getItem()).damage(item, 1, player, false);
getRedstoneConnectionCache().recalculateConnections();
getBundledConnectionCache().recalculateConnections();
for (GateConnectionBase c : getConnections()) if (c != null)
c.notifyUpdate();
sendUpdateIfNeeded();
}
return true;
} else if (hasGUI()) {
if (getWorld().isRemote) {
FMLCommonHandler.instance().showGuiScreen(getGui(player));
} else {
handleGUIServer(player);
}
return true;
}
return false;
}
Aggregations